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