01: /**
02: *
03: */package org.drools.reteoo;
04:
05: import org.drools.spi.Constraint;
06: import org.eclipse.draw2d.ColorConstants;
07: import org.eclipse.swt.graphics.Color;
08:
09: /**
10: * Wraps {@link JoinNode} and adds visual extras like color information
11: *
12: */
13: public class JoinNodeVertex extends BaseVertex {
14:
15: private static final String NODE_NAME = "JoinNode";
16:
17: private final JoinNode node;
18:
19: /**
20: * Constructor
21: *
22: * @param node node to be wrapped
23: */
24: public JoinNodeVertex(final JoinNode node) {
25: super ();
26: this .node = node;
27: }
28:
29: /* (non-Javadoc)
30: * @see org.drools.reteoo.BaseNodeVertex#getHtml()
31: */
32: public String getHtml() {
33: return NODE_NAME + "<BR/>"
34: + dumpConstraints(this .node.getConstraints());
35: }
36:
37: /* (non-Javadoc)
38: * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
39: */
40: public String toString() {
41: return NODE_NAME;
42: }
43:
44: /* (non-Javadoc)
45: * @see org.drools.reteoo.BaseNodeVertex#getFillColor()
46: */
47: public Color getFillColor() {
48: return ColorConstants.green;
49: }
50:
51: /**
52: * Node constraints
53: *
54: * @return array of constraints
55: */
56: public Constraint[] getConstraints() {
57: return node.getConstraints();
58: }
59:
60: /**
61: * Node ID
62: *
63: * @return node id
64: */
65: public int getId() {
66: return node.getId();
67: }
68:
69: }
|