@Override public void addChild(BaseComponent child, int index) { root.addChild(child, index); } }
/** * Moves a child to before another component. * * @param child Child to move * @param before Move child to this component. */ protected void moveChild(BaseUIComponent child, BaseUIComponent before) { child.getParent().addChild(child, before); }
public Image createImage(BaseComponent parent, String src) { Image img = new Image(src); parent.addChild(img); return img; }
/** * Moves this child to the specified index within its parent. * * @param index New index for this child. */ public void setIndex(int index) { getParent().addChild(this, index); }
/** * Sets the component's parent. * * @param parent The new parent. * @exception ComponentException Thrown if the new parent is not a valid parent for this * component. */ public void setParent(BaseComponent parent) { if (parent != this.parent) { if (parent == null) { this.parent.removeChild(this); } else { parent.addChild(this); } } }
/** * Add the UI components of the child pane to their respective parent components in the view. * * @see org.carewebframework.shell.elements.ElementUI#bind */ @Override protected void bind() { super.bind(); BaseComponent root = ((ElementStepView) getParent()).getToolbarRoot(); root.addChild(step); }
/** * Adds a text entry to the dialog panel. * * @param text Text to add. * @param sclass SClass of the added text. */ private void newLabel(String text, String sclass) { Label lbl = new Label(text); lbl.addClass(sclass); //lbl.setMultiline(true); //lbl.setPre(true); pnlDialog.addChild(lbl); lbl.scrollIntoView(); }
/** * Registers an external style sheet. If the style sheet has not already been registered, * creates a style component and adds it to the current page. * * @param url URL of style sheet. */ public void registerStyleSheet(String url) { if (findStyleSheet(url) == null) { Style ss = new Style(); ss.setSrc(url); registeredStyles.addChild(ss); } }
/** * Adds an element (menu or menu item) to the main menu. * * @param path Determines the position of the element in the menu tree. * @param ele The element to be added. If null, a new element of the specified type is created. * @param parent The parent to receive the new element. * @param insertBefore The sibling before which the new element is to be inserted. If null, or * the specified component is not at the same level as the element to be added, the * new element will be added after any existing siblings. * @return The element that was added. */ public static BaseMenuComponent addMenuOrMenuItem(String path, BaseMenuComponent ele, BaseComponent parent, BaseComponent insertBefore) { String pcs[] = path == null ? NULL_PATH : path.split("\\\\"); int last = pcs.length - 1; for (int i = 0; i < last; i++) { parent = findMenu(parent, pcs[i], insertBefore); } ele = ele == null ? createMenuOrMenuitem(parent) : ele; ele.setLabel(pcs[last]); parent.addChild(ele, insertBefore); return ele; }
/** * Creates a label for a string value. * * @param parent BaseComponent that will be the parent of the label. * @param value Value to be used as label text. * @param prefix Value to be used as a prefix for the label text. * @param style Style to be applied to the label. * @param asFirst If true, the label is prepended to the parent. If false, it is appended. * @return The newly created label. */ public Label createLabel(BaseComponent parent, Object value, String prefix, String style, boolean asFirst) { Label label = new Label(createLabelText(value, prefix)); label.setStyles(style); parent.addChild(label, asFirst ? 0 : -1); return label; }
/** * Add a link for drilldown of objects. * * @param dataObject Object for drilldown. * @param title Title for dialog. */ private void addLink(Object dataObject, String title) { if (debugObject(dataObject, true)) { BaseComponent cell = getLastRow().getFirstChild(); cell.addChild(new DebugLink(dataObject, title)); } }
/** * Returns the menu with the specified label, or creates one if it does not exist. * * @param parent The parent component under which to search. May be a Toolbar or a Menupopup * component. * @param label Label of menu to search. * @param insertBefore If not null, the new menu is inserted before this one. If null, the menu * is appended. * @return Menu or menu item with the specified label. */ public static BaseMenuComponent findMenu(BaseComponent parent, String label, BaseComponent insertBefore) { for (BaseMenuComponent child : parent.getChildren(BaseMenuComponent.class)) { if (label.equalsIgnoreCase(child.getLabel())) { return child; } } BaseMenuComponent cmp = createMenuOrMenuitem(parent); cmp.setLabel(label); parent.addChild(cmp, insertBefore); return cmp; }
@Override public void bind() { setTreeView(getAncestor(ElementTreeView.class)); treeView.getInnerComponent().addChild(pane); getNodeParent().addChild(node); }
parent.addChild(component);
/** * Promote the selected tree node. */ @EventHandler(value = "click", target = "@btnLeft") private void onClick$btnLeft() { Treenode node = tree.getSelectedNode(); Treenode parent = (Treenode) node.getParent(); parent.getParent().addChild(node, parent.getNextSibling()); doChanged(true); }
/** * Renders a child. * * @param modelIndex The index of the model object to be rendered. * @return The rendered child component, or null if no renderer has been registered or * pagination is active and the child falls outside the current page. */ protected T renderChild(int modelIndex) { if (renderer != null && paginator.inRange(modelIndex)) { M mdl = model.get(modelIndex); T child = renderer.render(mdl); parent.addChild(child, getChildIndex(modelIndex)); if (model instanceof INestedModel) { getLinkedViews().put(child, new ModelAndView<>(child, ((INestedModel<M>) model).getChildren(mdl), renderer)); } return child; } return null; }
/** * Recursively create tree items that correspond to the topic tree from the help view. * * @param tc The root node to receive newly created tree nodes. * @param node A topic tree node. * @return Newly created tree node. */ private Treenode addNode(BaseComponent tc, HelpTopicNode node) { HelpTopic topic = node.getTopic(); Treenode parent = new Treenode(); parent.setLabel(topic.getLabel()); parent.setData(topic); topics.put(topic, parent); tc.addChild(parent); for (HelpTopicNode child : node.getChildren()) { addNode(parent, child); } parent.setCollapsed(false); return parent; }
/** * 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; }
private void doDrop(Treenode dragged, Treenode target, boolean allowExchange) { ElementBase eleTarget = getElement(target); ElementBase eleDragged = getElement(dragged); switch (movementType(dragged, target, allowExchange)) { case INVALID: return; case EXCHANGE: eleDragged.setIndex(eleTarget.getIndex()); target.getParent().addChild(dragged, target); break; case FIRST: eleDragged.setIndex(0); target.addChild(dragged, 0); break; case RELOCATE: eleDragged.setParent(eleTarget); getTreenode(target).addChild(dragged); break; } updateDroppable(); updateControls(); }