Vector buttonTreeItems = WadlTreeRoot.removeChildrenXKeepButtons(parentTreeItem, WadlXml.faultNode);
Iterator allfaultsIterator = allFaults.iterator();
while (allfaultsIterator.hasNext()) {
FaultNode fault = (FaultNode) allfaultsIterator.next();
TreeItem faultTreeItem = new TreeItem(new FaultItem(fault, parentNode, parentTreeItem));
faultTreeItem.setUserObject(WadlXml.faultNode);
parentTreeItem.addItem(faultTreeItem);
}
if (!WadlTreeRoot.containsButton(buttonTreeItems, ApplicationItem.button + WadlXml.faultNode)) {
// add fault button
HorizontalPanel addFaultPanel = new HorizontalPanel();
Button addFaultButton = new Button(GuiFactory.strings.addFault());
addFaultButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
if (parentNode instanceof ApplicationNode) {
FaultNode fault = new FaultNode(GuiFactory.strings.newFault(), (GenericNode) parentNode, (ApplicationNode) parentNode);
fault.setId(GuiFactory.strings.newId());
((ApplicationNode) parentNode).addFault(fault);
}
else if (parentNode instanceof ResponseNode) {
((ResponseNode) parentNode).addFault(new FaultNode(GuiFactory.strings.newFault(), (GenericNode) parentNode, ((ResponseNode) parentNode).getApplication()));
}
listFaults(parentNode, parentTreeItem);
}
});
addFaultPanel.add(addFaultButton);