new InsertDialog(this, className, info, anchorElement);
}
}
public void doInsert(String className, String preset, Element anchorNode) throws GUIException {
TreeItem items[] = (TreeItem[]) dataModel.getValue("tree.selected");
TreeItem item = items[0];
WidgetUserObject parentObject = (WidgetUserObject) item.getUserObject();
Document document = parentObject.element.getOwnerDocument();
Element childWidget = document.createElement("widget");
childWidget.setAttribute("class", className);
if (preset != null)
childWidget.setAttribute("preset", preset);
TreeItem newNode = new TreeItem(item, null);
Widget parentWidget = ((WidgetUserObject) item.getUserObject()).widget;
Widget widget = constructWidget(parentWidget, className, null, preset);
Object anchor = null;
if (parentWidget != null) {
anchor = createAnchor(widget, anchorNode);
parentWidget.addChild(widget, anchor);
}
widget.finalizeConstruction();
parentObject.element.appendChild(childWidget);
if (widget instanceof Dialog) {
Dialog dialog = (Dialog) widget;
dialog.initDialog(null);
dialog.show();
}
if (parentWidget != null)
revalidate(parentWidget);
WidgetUserObject userObject = new WidgetUserObject(childWidget, widget, newNode);
userObject.tableModel.addRow(new NameTableRow(userObject));
if (anchorNode != null) {
childWidget.appendChild(anchorNode);
PropertyTableRow row = new PropertyTableRow(userObject, anchor, anchorNode);
userObject.tableModel.addRow(row);
}
newNode.setUserObject(userObject);
newNode.setText(className);
item.addChild(newNode, null);
widgetTree.structureChanged(item);
dataModel.setValue("tree.selected", new TreeItem[] { newNode });
Builder.markModified();
}