|
Lines 21-42
Link Here
|
| 21 |
import org.eclipse.draw2d.geometry.Point; |
21 |
import org.eclipse.draw2d.geometry.Point; |
| 22 |
import org.eclipse.draw2d.geometry.PrecisionPoint; |
22 |
import org.eclipse.draw2d.geometry.PrecisionPoint; |
| 23 |
import org.eclipse.draw2d.geometry.Rectangle; |
23 |
import org.eclipse.draw2d.geometry.Rectangle; |
| 24 |
import org.eclipse.zest.core.widgets.internal.GraphLabel; |
|
|
| 25 |
import org.eclipse.zest.layouts.LayoutEntity; |
| 26 |
import org.eclipse.zest.layouts.constraints.LayoutConstraint; |
| 27 |
import org.eclipse.swt.SWT; |
24 |
import org.eclipse.swt.SWT; |
| 28 |
import org.eclipse.swt.graphics.Color; |
25 |
import org.eclipse.swt.graphics.Color; |
| 29 |
import org.eclipse.swt.graphics.Font; |
26 |
import org.eclipse.swt.graphics.Font; |
| 30 |
import org.eclipse.swt.graphics.FontData; |
27 |
import org.eclipse.swt.graphics.FontData; |
| 31 |
import org.eclipse.swt.graphics.Image; |
28 |
import org.eclipse.swt.graphics.Image; |
| 32 |
import org.eclipse.swt.widgets.Display; |
29 |
import org.eclipse.swt.widgets.Display; |
|
|
30 |
import org.eclipse.zest.core.widgets.internal.GraphLabel; |
| 31 |
import org.eclipse.zest.layouts.LayoutEntity; |
| 32 |
import org.eclipse.zest.layouts.constraints.LayoutConstraint; |
| 33 |
|
33 |
|
| 34 |
/** |
34 |
/* |
| 35 |
* Simple node class which has the following properties: color, size, location, |
35 |
* Simple node class which has the following properties: color, size, location, |
| 36 |
* and a label. It also has a list of connections and anchors. |
36 |
* and a label. It also has a list of connections and anchors. |
| 37 |
* |
37 |
* |
| 38 |
* @author Chris Callendar |
38 |
* @author Chris Callendar |
|
|
39 |
* |
| 39 |
* @author Del Myers |
40 |
* @author Del Myers |
|
|
41 |
* |
| 40 |
* @author Ian Bull |
42 |
* @author Ian Bull |
| 41 |
*/ |
43 |
*/ |
| 42 |
public class GraphNode extends GraphItem { |
44 |
public class GraphNode extends GraphItem { |
|
Lines 82-100
Link Here
|
| 82 |
} |
84 |
} |
| 83 |
|
85 |
|
| 84 |
public GraphNode(IContainer graphModel, int style, Object data) { |
86 |
public GraphNode(IContainer graphModel, int style, Object data) { |
| 85 |
super(graphModel.getGraph(), style, data); |
87 |
this(graphModel.getGraph(), style, "" /*text*/, null /*image*/, data); |
| 86 |
initModel(graphModel, " ", null); |
|
|
| 87 |
nodeFigure = initFigure(); |
| 88 |
|
| 89 |
// This is a hack because JAVA sucks! |
| 90 |
// I don't want to expose addNode so I can't put it in the |
| 91 |
// IContainer interface. |
| 92 |
if (this.parent.getItemType() == GRAPH) { |
| 93 |
((Graph) this.parent).addNode(this); |
| 94 |
} else if (this.parent.getItemType() == CONTAINER) { |
| 95 |
((GraphContainer) this.parent).addNode(this); |
| 96 |
} |
| 97 |
this.parent.getGraph().registerItem(this); |
| 98 |
} |
88 |
} |
| 99 |
|
89 |
|
| 100 |
public GraphNode(IContainer graphModel, int style, String text) { |
90 |
public GraphNode(IContainer graphModel, int style, String text) { |
|
Lines 102-121
Link Here
|
| 102 |
} |
92 |
} |
| 103 |
|
93 |
|
| 104 |
public GraphNode(IContainer graphModel, int style, String text, Object data) { |
94 |
public GraphNode(IContainer graphModel, int style, String text, Object data) { |
| 105 |
super(graphModel.getGraph(), style); |
95 |
this(graphModel.getGraph(), style, text, null /*image*/, data); |
| 106 |
initModel(graphModel, text, null); |
|
|
| 107 |
nodeFigure = initFigure(); |
| 108 |
|
| 109 |
// This is a hack because JAVA sucks! |
| 110 |
// I don't want to expose addNode so I can't put it in the |
| 111 |
// IContainer interface. |
| 112 |
if (this.parent.getItemType() == GRAPH) { |
| 113 |
((Graph) this.parent).addNode(this); |
| 114 |
} else if (this.parent.getItemType() == CONTAINER) { |
| 115 |
((GraphContainer) this.parent).addNode(this); |
| 116 |
} |
| 117 |
this.parent.getGraph().registerItem(this); |
| 118 |
|
| 119 |
} |
96 |
} |
| 120 |
|
97 |
|
| 121 |
public GraphNode(IContainer graphModel, int style, String text, Image image) { |
98 |
public GraphNode(IContainer graphModel, int style, String text, Image image) { |
|
Lines 123-129
Link Here
|
| 123 |
} |
100 |
} |
| 124 |
|
101 |
|
| 125 |
public GraphNode(IContainer graphModel, int style, String text, Image image, Object data) { |
102 |
public GraphNode(IContainer graphModel, int style, String text, Image image, Object data) { |
| 126 |
super(graphModel.getGraph(), style); |
103 |
super(graphModel.getGraph(), style, data); |
| 127 |
initModel(graphModel, text, image); |
104 |
initModel(graphModel, text, image); |
| 128 |
nodeFigure = initFigure(); |
105 |
nodeFigure = initFigure(); |
| 129 |
|
106 |
|