01: package org.openwfe.gpe.parts;
02:
03: import java.util.List;
04: import java.util.Map;
05:
06: import org.eclipse.draw2d.IFigure;
07: import org.eclipse.draw2d.graph.CompoundDirectedGraph;
08: import org.eclipse.draw2d.graph.Edge;
09: import org.eclipse.draw2d.graph.Node;
10:
11: import org.eclipse.gef.EditPart;
12:
13: /**
14: * @author helena
15: */
16: public class OtherPart extends CompositeOrOneChildPart {
17:
18: IFigure figure;
19:
20: public OtherPart(IFigure figure) {
21: super ();
22: this .figure = figure;
23: }
24:
25: /**
26: * @see org.openwfe.gpe.parts.CompositeOrOneChildPart#createFigure()
27: */
28: protected IFigure createFigure() {
29: return figure;
30: }
31:
32: /**
33: * @see FlowElementPart#contributeEdgesToGraph(org.eclipse.graph.CompoundDirectedGraph,
34: * java.util.Map)
35: */
36: public void contributeEdgesToGraph(CompoundDirectedGraph graph,
37: Map map) {
38: super .contributeEdgesToGraph(graph, map);
39: Node node, prev = null;
40: EditPart a;
41: List members = getChildren();
42: for (int n = 0; n < members.size(); n++) {
43: a = (EditPart) members.get(n);
44: node = (Node) map.get(a);
45: if (prev != null) {
46: Edge e = new Edge(prev, node);
47: e.weight = 50;
48: graph.edges.add(e);
49: }
50: prev = node;
51: }
52: }
53:
54: /**
55: * @see org.openwfe.gpe.parts.CompositeOrOneChildPart#getAnchorOffset()
56: */
57: int getAnchorOffset() {
58: return 15;
59: }
60:
61: }
|