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