1 | package onetomany.etc;
|
---|
2 | //package negotiator.onetomany.etc;
|
---|
3 | //
|
---|
4 | //import java.awt.Canvas;
|
---|
5 | //import java.awt.Graphics;
|
---|
6 | //import java.util.HashMap;
|
---|
7 | //
|
---|
8 | //import negotiator.onetomany.DemandPlan;
|
---|
9 | //import negotiator.onetomany.Portfolio;
|
---|
10 | //import negotiator.onetomany.Product;
|
---|
11 | //
|
---|
12 | //
|
---|
13 | ///**
|
---|
14 | // * @author Faria Nassiri-Mofakham
|
---|
15 | // *
|
---|
16 | // */
|
---|
17 | //public class DemandPlanDrawing extends Canvas
|
---|
18 | //{
|
---|
19 | //
|
---|
20 | // private static final long serialVersionUID = 1L;
|
---|
21 | // DemandPlan p;
|
---|
22 | //
|
---|
23 | // public DemandPlanDrawing(DemandPlan p2)
|
---|
24 | // {
|
---|
25 | // p = p2;
|
---|
26 | // }
|
---|
27 | //
|
---|
28 | //
|
---|
29 | // public void paint(Graphics g)
|
---|
30 | // {
|
---|
31 | // int z = p.getDemandPlan().size();
|
---|
32 | // int yOffset=50;
|
---|
33 | // int r=30/z;
|
---|
34 | // int d=(g.getClipBounds().width-z*2*r)/(z+4); // it is enough to be divided by z+1, but for making the distance smaller, larger numbers are better
|
---|
35 | // int x = g.getClipBounds().x;//+ d;
|
---|
36 | // final int xx =x;
|
---|
37 | // int offset=d/2;
|
---|
38 | //
|
---|
39 | //
|
---|
40 | // for (Product product : p.getDemandPlan().keySet())
|
---|
41 | // {
|
---|
42 | // Integer q = p.getQuantity(product);
|
---|
43 | //
|
---|
44 | // System.out.println("For product " + product + ", the quantity I want to draw is: " + q);
|
---|
45 | //
|
---|
46 | // g.setColor(product.getColor());
|
---|
47 | // for (int i=0; i<q; i++)
|
---|
48 | // {
|
---|
49 | // if (x+2*r+d < g.getClipBounds().width)
|
---|
50 | // x += d/2;
|
---|
51 | // else
|
---|
52 | // {
|
---|
53 | // x=xx+d;
|
---|
54 | // yOffset+=offset;
|
---|
55 | // }
|
---|
56 | // g.fillOval(x, g.getClipBounds().y+yOffset, 2*r, 2*r); // it also need to became dynamic
|
---|
57 | //
|
---|
58 | // }
|
---|
59 | //
|
---|
60 | // x=xx;
|
---|
61 | // yOffset+=offset; // no condition for the height ?!
|
---|
62 | // }
|
---|
63 | //
|
---|
64 | // }
|
---|
65 | //
|
---|
66 | //
|
---|
67 | //}
|
---|
68 | //
|
---|