01: /**
02: *
03: */package org.drools.reteoo;
04:
05: import org.drools.spi.ObjectType;
06: import org.eclipse.draw2d.ColorConstants;
07: import org.eclipse.swt.graphics.Color;
08:
09: /**
10: * Wraps {@link ObjectTypeNode} and adds visual extras like color information
11: *
12: */
13: public class ObjectTypeNodeVertex extends BaseVertex {
14:
15: private static final String NODE_NAME = "ObjectTypeNode";
16:
17: private final ObjectTypeNode node;
18:
19: /**
20: * Constructor
21: *
22: * @param node node to be wrapped
23: */
24: public ObjectTypeNodeVertex(final ObjectTypeNode 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 + " : " + this .node.getObjectType();
34: }
35:
36: /* (non-Javadoc)
37: * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
38: */
39: public String toString() {
40: return NODE_NAME;
41: }
42:
43: /* (non-Javadoc)
44: * @see org.drools.reteoo.BaseNodeVertex#getFillColor()
45: */
46: public Color getFillColor() {
47: return ColorConstants.red;
48: }
49:
50: /**
51: * {@link ObjectType} as {@link String}
52: *
53: * @return object type as string
54: */
55: public String getObjectType() {
56: return node.getObjectType().toString();
57: }
58: }
|