protected void addInterfaceElements(Element intfcs, String tag,
Vector graph, boolean isInputs, boolean isEvents, int x0) {
NodeList lst = intfcs.getElementsByTagName(tag);
if (lst.getLength() < 1)
return;
Event evt = null;
NodeList evts = lst.item(0).getChildNodes();
int n = evts.getLength();
if (isEvents)
gap = 10 * n + 10;
if (!isInputs)
x0 += gap;
for (int i = 0; i < n; i++) {
evt = (Event) GraphElement.forElement((Element) evts.item(i));
evt.setPreferredLocation(x0, y);
graph.add(evt);
y += dy;
if (isInputs)
fbx = Math.max(fbx, evt.getPreferredSize().width + gap);
IOLink lnk = isInputs ? new IOLink(evt, fbt, isEvents)
: new IOLink(fbt, evt, isEvents);
lnk.setElement(evt.getElement());
graph.add(lnk);
if (isEvents)
graph.add(new WithLink(lnk, fbt));
}
}