@Override
protected void contributeNodesToGraph(CompoundDirectedGraph graph, Subgraph s,
Map<AbstractGraphicalEditPart, Object> map) {
GraphAnimation.recordInitialState(getContentPane());
Subgraph me = new Subgraph(this, s);
// me.setRowConstraint(getActivity().getSortIndex());
me.outgoingOffset = 5;
me.incomingOffset = 5;
IFigure fig = getFigure();
if (fig instanceof SubgraphFigure) {
if (graph.getDirection() == PositionConstants.EAST) {
if (fig instanceof ParallelActivityFigure) {
me.width = fig.getPreferredSize(me.width, me.height).width;
int tagHeight = ((SubgraphFigure) fig).getHeader().getPreferredSize().height;
int tagWidth = ((SubgraphFigure) fig).getHeader().getPreferredSize().width;
me.insets.left = tagHeight;
me.insets.top = tagWidth;
me.insets.right = tagHeight;
}
else if (fig instanceof SequentialActivityFigure) {
me.height = fig.getPreferredSize(me.width, me.height).height;
int tagWidth = ((SubgraphFigure) fig).getHeader().getPreferredSize().width;
me.insets.top = tagWidth;
me.insets.left = 0;
me.insets.bottom = tagWidth;
}
}
else {
me.width = fig.getPreferredSize(me.width, me.height).width;
int tagHeight = ((SubgraphFigure) fig).getHeader().getPreferredSize().height;
me.insets.top = tagHeight;
me.insets.left = 0;
me.insets.bottom = tagHeight;
}
}
me.innerPadding = new Insets(0);
if (graph.getDirection() == PositionConstants.EAST) {
me.setPadding(new Insets(6, 8, 6, 8));
}
else {
me.setPadding(new Insets(8, 6, 8, 6));
}
map.put(this, me);
graph.nodes.add(me);
for (int i = 0; i < getChildren().size(); i++) {
ActivityPart activity = (ActivityPart) getChildren().get(i);
activity.contributeNodesToGraph(graph, me, map);
}
for (int i = 0; i < getSourceConnections().size(); i++) {
TransitionPart trans = (TransitionPart) getSourceConnections().get(i);
Subgraph sub = (Subgraph) map.get(getViewer().getContents());
trans.contributeNodesToGraph(graph, s, map);
}
}