01: package visualdebugger.draw2d;
02:
03: import org.eclipse.draw2d.*;
04:
05: import de.uka.ilkd.key.visualdebugger.SourceElementId;
06: import de.uka.ilkd.key.visualdebugger.executiontree.ETLeafNode;
07:
08: public class LeafNode extends Ellipse {
09:
10: static final Border BORDER = new LineBorder(ColorConstants.black, 1);
11: final ETLeafNode etNode;
12: // final ICompilationUnit unit;
13:
14: private Label label = new Label();
15:
16: private SourceElementId id = null;
17: private boolean selected;
18:
19: public LeafNode(ETLeafNode node) {
20: super ();
21: etNode = node;
22: setPreferredSize(15, 15);
23: setSize(15, 15);
24: if (node.getState() == ETLeafNode.INFEASIBLE)
25: setBackgroundColor(ColorConstants.yellow);
26: else if (node.getExceptionName() != null) {
27: setBackgroundColor(ColorConstants.red);
28: setToolTip(new Label(node.getExceptionName()));
29: } else
30: setBackgroundColor(ColorConstants.green);
31: }
32:
33: public void setSelected(boolean value) {
34: selected = value;
35: if (selected)
36: setBorder(BORDER);
37: else
38: setBorder(null);
39: repaint();
40: }
41:
42: /**
43: * @see java.lang.Object#toString()
44: */
45: public String toString() {
46: return this .etNode.toString();
47: }
48:
49: public void validate() {
50: this .setSize(15, 15);
51: repaint();
52: super .validate();
53: }
54:
55: public ETLeafNode getETLeafNode() {
56: return etNode;
57: }
58:
59: }
|