fbench.graph.ServiceSequence ss = new fbench.graph.ServiceSequence(getElement());
ans.addElement(ss);
int w = ss.getComponent(1).getPreferredSize().width;
int x1 = w;
NodeList trans = getElement().getChildNodes();
InputPrimitive pred = null, succ = null;
for (int i = 0; i < trans.getLength(); i++) {
NodeList prims = trans.item(i).getChildNodes();
for (int j = 0; j < prims.getLength(); j++) {
succ = (InputPrimitive) GraphElement.forElement((Element) prims
.item(j));
ans.add(succ);
x1 = Math.max(x1, succ.getPreferredSize().width);
if (j > 0)
ans.add(new ServiceLink(pred, succ));
pred = succ;
}
}
ss.setPreferredLocation(x1 - w, 0);
int x2 = x1 + ss.getComponent(2).getPreferredSize().width;
int y = ss.getPreferredSize().height;
for (int i = 1; i < ans.size(); i++) {
Object el = ans.elementAt(i);
if (!(el instanceof InputPrimitive))
continue;
InputPrimitive prim = (InputPrimitive) el;
int x = prim.isLeftInterface() ? x1 - prim.getPreferredSize().width
: x2;
prim.setPreferredLocation(x, y);
y += prim.getPreferredSize().height;
}
ans.add(new ServiceBounds(ss,succ));
return ans;
}