/** * Override to set the visibility of wrapped components. Invoked when visibility or activation * states change. * * @param visible The current visibility state. * @param activated The current activation state. */ protected void updateVisibility(boolean visible, boolean activated) { if (!getDefinition().isInternal()) { getOuterComponent().setVisible(visible && activated); } }
/** * Called before the parent has been changed. * * @param newParent The value of the parent property prior to the change. */ @Override protected void beforeParentChanged(ElementBase newParent) { if (getParent() != null && !getDefinition().isInternal()) { unbind(); } }
/** * Removes the specified element as a child of this parent. * * @param child Child element to remove. * @param destroy If true the child is explicitly destroyed. */ public void removeChild(ElementBase child, boolean destroy) { if (!children.contains(child)) { return; } boolean isLocked = child.isLocked() || child.getDefinition().isInternal(); if (destroy) { child.removeChildren(); if (!isLocked) { child.destroy(); } } if (!isLocked) { beforeRemoveChild(child); children.remove(child); child.updateParent(null); afterRemoveChild(child); } }
/** * Called after the parent has been changed. * * @param oldParent The value of the parent property prior to the change. */ @Override protected void afterParentChanged(ElementBase oldParent) { if (getParent() != null) { if (!getDefinition().isInternal()) { bind(); } setDesignMode(getParent().isDesignMode()); } }
/** * 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; }
Class<? extends ElementBase> clazz = getClazz(); if (isInternal()) { element = parent.getChild(clazz, null); } else {
/** * Materializes the layout, under the specified parent. * * @param parent Parent UI element at this level of the hierarchy. May be null. * @param node The current layout element. * @param ignoreInternal Ignore internal elements. */ private void materializeChildren(ElementBase parent, LayoutElement node, boolean ignoreInternal) { for (LayoutNode child : node.getChildren()) { PluginDefinition def = child.getDefinition(); ElementBase element = ignoreInternal && def.isInternal() ? null : createElement(parent, child); if (element != null) { materializeChildren(element, (LayoutElement) child, false); } } for (LayoutTrigger trigger : node.getTriggers()) { ElementTrigger trg = new ElementTrigger(); trg.addTarget((ElementUI) parent); createElement(trg, trigger.getChild(LayoutTriggerCondition.class)); createElement(trg, trigger.getChild(LayoutTriggerAction.class)); ((ElementUI) parent).addTrigger(trg); } }
boolean isNull = ele == null; boolean isLocked = isNull || ele.isLocked(); boolean noDelete = isLocked || ele.getDefinition().isInternal(); boolean noAdd = isLocked || !ele.canAcceptChild(); boolean noEdit = isLocked || !ele.getDefinition().hasEditableProperties();
if (def.isInternal()) { continue;