01: package org.openwfe.gpe.figures;
02:
03: import org.eclipse.draw2d.ColorConstants;
04: import org.eclipse.draw2d.Graphics;
05: import org.eclipse.draw2d.Label;
06: import org.eclipse.draw2d.MarginBorder;
07: import org.eclipse.draw2d.geometry.Rectangle;
08:
09: public class ConcurrenceFigure extends SubgraphFigure {
10:
11: boolean selected;
12:
13: /**
14: * @param header
15: * @param footer
16: */
17: public ConcurrenceFigure() {
18: super (new Label(""), new Label(""));
19: setBorder(new MarginBorder(3, 5, 3, 0));
20: setOpaque(true);
21: }
22:
23: protected void paintFigure(Graphics g) {
24: super .paintFigure(g);
25: Rectangle r = getBounds();
26: g.setBackgroundColor(ColorConstants.button);
27: if (selected) {
28: g.setBackgroundColor(ColorConstants.menuBackgroundSelected);
29: g.setForegroundColor(ColorConstants.menuForegroundSelected);
30: }
31:
32: g.fillRectangle(r.x, r.y, 3, r.height);
33: g.fillRectangle(r.right() - 3, r.y, 3, r.height);
34: g.fillRectangle(r.x, r.bottom() - 18, r.width, 18);
35: g.fillRectangle(r.x, r.y, r.width, 18);
36: }
37:
38: public void setSelected(boolean selected) {
39: if (this.selected == selected)
40: return;
41: this.selected = selected;
42: if (!selected) {
43: getHeader().setForegroundColor(null);
44: getFooter().setForegroundColor(null);
45: } else {
46: getHeader().setForegroundColor(
47: ColorConstants.menuForegroundSelected);
48: getFooter().setForegroundColor(
49: ColorConstants.menuForegroundSelected);
50: }
51:
52: repaint();
53: }
54:
55: }
|