/** * Creates a tree node associated with the specified UI element. * * @param ele UI element * @return Newly created tree node. */ private Treenode createNode(ElementBase ele) { String label = ele.getDisplayName(); String instanceName = ele.getInstanceName(); PluginDefinition def = ele.getDefinition(); if (!label.equalsIgnoreCase(instanceName)) { label += " - " + instanceName; } Treenode node = new Treenode(); node.setLabel(label); node.setData(ele); node.setHint(StringUtils.defaultString(def.getDescription(), noDescriptionHint)); node.addEventForward(DropEvent.class, window, null); node.addEventForward(DblclickEvent.class, btnProperties, ClickEvent.TYPE); if (!ele.isLocked() && !def.isInternal()) { node.setDragid("d" + dragId++); } return node; }
node.setDisabled(true); } else { node.addEventForward(DblclickEvent.TYPE, btnOK, ClickEvent.TYPE);
/** * Adds a tree node under the specified parent. * * @param proxy The proxy associated with the tree node. * @param parent The tree parent to receive the new tree node. * @param insertAfter Tree node after which new node will be added (may be null). * @return The newly created tree node. */ protected Treenode addTreenode(Proxy proxy, BaseComponent parent, Treenode insertAfter) { Treenode node = null; if (proxy != null) { node = new Treenode(); parent = parent == null ? (insertAfter == null ? tree : insertAfter.getParent()) : parent; BaseComponent refChild = insertAfter == null ? null : insertAfter.getNextSibling(); parent.addChild(node, refChild); proxy.setItem(node); initProxy(proxy); if (hasLabelProperty(proxy.getDefinition().getClazz())) { node.addEventForward(DblclickEvent.TYPE, tree, null); } } return node; }