private static boolean isDescendant(Component c1, Component c2) { if (c1 == c2) return true; // first c1 can be IdSpace while ((c1 = c1.getParent()) != null) { if (c1 == c2) return true; if (c1 instanceof IdSpace) return c1 == c2; } return false; }
/** Returns the {@link Tree} instance containing this element. */ public Tree getTree() { for (Component p = this; (p = p.getParent()) != null;) if (p instanceof Tree) return (Tree) p; return null; }
private static boolean isDescendant(Component c1, Component c2) { if (c1 == c2) return true; // first c1 can be IdSpace while ((c1 = c1.getParent()) != null) { if (c1 == c2) return true; if (c1 instanceof IdSpace) return c1 == c2; } return false; }
/** Returns the tree owning this item. */ public Tree getTree() { for (Component p = this; (p = p.getParent()) != null;) if (p instanceof Tree) return (Tree) p; return null; }
/** Return the tree that owns this cell. */ public Tree getTree() { for (Component n = this; (n = n.getParent()) != null;) if (n instanceof Tree) return (Tree) n; return null; }
private boolean isRedudant(Radio radio) { for (Component p = radio; (p = p.getParent()) != null;) if (p instanceof Radiogroup) return p == this; return false; }
/** Returns the grid that contains this row. */ public Grid getGrid() { final Component parent = getParent(); return parent != null ? (Grid) parent.getParent() : null; }
/** Returns the grid that contains this column. */ public Grid getGrid() { final Component parent = getParent(); return parent != null ? (Grid) parent.getParent() : null; }
/** * Return the child index of the component. If the component is one of the * page roots, return -1. */ public int getComponentChildIndex() { if (_compChildIndex > -1) return _compChildIndex; Component parent = _comp.getParent(); return parent == null ? -1 : parent.getChildren().indexOf(_comp); }
/** Returns the listbox that this belongs to. */ public Listbox getListbox() { final Component comp = getParent(); return comp != null ? (Listbox) comp.getParent() : null; }
public boolean accept(ComponentMatchCtx ctx, String... parameters) { if (parameters.length > 0) return false; return ctx.getComponent().getParent() == null; } });
/** Returns the parent IdSpace (scope), or null if no parent. */ private static Scope getParentIdSpace(Scope scope) { if (scope == null || !(scope instanceof Component)) return null; final Component p = ((Component) scope).getParent(); return p != null ? p.getSpaceOwner() : null; }
/** Returns the list box that it belongs to. */ public Listbox getListbox() { final Component comp = getParent(); return comp != null ? (Listbox) comp.getParent() : null; }
/** Returns the listbox that this belongs to. */ public Listbox getListbox() { final Component comp = getParent(); return comp != null ? (Listbox) comp.getParent() : null; }
/** Returns the grid that this belongs to. */ public Grid getGrid() { final Component comp = getParent(); return comp != null ? (Grid) comp.getParent() : null; }
private Template lookupTemplate(Component comp, String name) { if (comp == null) return null; Template template = comp.getTemplate(name); return template == null ? lookupTemplate(comp.getParent(), name) : template; }
/** Returns the parent of the ID space, or null if not found. * @since 5.0.0 */ public static IdSpace getParentIdSpace(IdSpace idspace) { if (idspace instanceof Component) { final Component c = (Component) idspace; final Component p = c.getParent(); return p != null ? p.getSpaceOwner() : c.getPage(); } return null; }
/** * Return the count of total siblings of the component, including itself. */ public int getComponentSiblingSize() { Component parent = _comp.getParent(); return parent == null ? _comp.getPage().getRoots().size() : parent.getChildren().size(); }
/** Post event to the non-stub ancestor. */ /*package*/ void postToNonStubAncestor(StubEvent event) { Component target = event.getTarget(); for (; target != null && (target instanceof Native || target instanceof StubComponent); target = target.getParent()) ; if (target != null) Events.postEvent(new StubEvent(event, target)); } }
public boolean insertBefore(Component newChild, Component refChild) { final Tree tree = getTree(); if (newChild.getParent() == this && tree != null && tree.inPagingMold() && !tree.isInvalidated()) { //might change page, have to invalidate tree.invalidate(); } return super.insertBefore(newChild, refChild); }