/** * return the index of this item * @return the index of this item * @since 5.0.9 */ public int getIndex() { List list = this.getParent().getChildren(); return list.indexOf(this); }
/** Returns the parent tree item, * or null if this item is already the top level of the tree. * The parent tree item is actually the grandparent if any. * * @since 3.0.0 */ public Treeitem getParentItem() { final Component p = getParent(); final Component gp = p != null ? p.getParent() : null; return gp instanceof Treeitem ? (Treeitem) gp : null; }
/** * adds the number of the visible item to the count of its parent. * @param count * @param force if true, ignores {@link #isVisible()} * @since 3.0.7 */ void addVisibleItemCount(int count) { Treechildren tc = (Treechildren) getParent(); if (tc != null && super.isVisible()) tc.addVisibleItemCount(count); }
/*package*/ boolean isRealVisible() { if (!isVisible()) return false; Component comp = getParent(); return comp == null || ((comp instanceof Treechildren) ? ((Treechildren) comp).isRealVisible() : comp.isVisible()); }
inclusive = true; } else { // go up a level when there's no more prev sibling Component cmp = item.getParent().getParent(); if (cmp instanceof Treeitem) { Treeitem parent = (Treeitem) cmp;
public void setParent(Component parent) { final Component oldp = getParent(); if (oldp == parent) return; //nothing changed final Tree oldtree = oldp != null ? getTree() : null; super.setParent(parent); //maintain the selected status if (oldtree != null) oldtree.onTreeitemRemoved(this); if (parent != null) { final Tree tree = getTree(); if (tree != null) tree.onTreeitemAdded(this); } }
Treechildren parent = (Treechildren) ti.getParent(); Object childNode = Tree.this.getAssociatedNode(ti, Tree.this); renderChildren0(renderer, parent, ti, childNode, i);
public Set<? extends Component> getAvailableAtClient() { if (!isCropper()) return null; final Tree tree = getTree(); final Component parent = getParent(); final Execution exe = Executions.getCurrent(); final String attrnm = VISIBLE_ITEM + tree.getUuid(); Map<Treeitem, Boolean> map = cast((Map) exe.getAttribute(attrnm)); if (map == null) { //Test very simple case first since getVisibleItems costly if (parent instanceof Treeitem) { for (Treeitem ti = (Treeitem) parent;;) { if (!ti.isOpen()) return Collections.emptySet(); Component gp = ti.getParent().getParent(); if (!(gp instanceof Treeitem)) break; ti = (Treeitem) gp; } } map = tree.getVisibleItems(); Executions.getCurrent().setAttribute(attrnm, map); } return map.keySet(); //yes, we return all visible items, not just direct children //in other words, we consider the whole tree as a single scope //See also bug 2814504 } }
|| !model.isPathOpened(getPath0((Treechildren) newItem.getParent(), index)))); if (!item.isLoaded() && newItem.isOpen()) Tree.this.renderChildren(this, tc, node);
Treechildren parent = (Treechildren) ti.getParent(); Object childNode = getAssociatedNode(ti, this); renderChildren0(renderer, parent, ti, childNode, i); Treechildren parent = (Treechildren) maxItem.getParent(); Object childNode = getAssociatedNode(maxItem, this); renderChildren0(renderer, parent, maxItem, childNode, maxItem.getIndex());
} else { final Component[] items = ShadowElementsCtrl .filterOutShadows(tm.create(ti.getParent(), ti, new VariableResolver() { public Object resolveVariable(String name) { if ("each".equals(name)) {
public void render(final Treeitem item, final Object data, final int index) throws Exception { final Tree tree = item.getTree(); final Component parent = item.getParent(); final Template tm = resolveTemplate(tree, parent, data, index, -1, "model");