public void onChildAdded(Component child) { super.onChildAdded(child); if (_treechildren == child) addVisibleItemCount(_treechildren.getVisibleItemCount()); }
public void onChildRemoved(Component child) { if (child instanceof Treerow) { _treerow = null; } else if (child instanceof Treechildren) { if (isOpen()) addVisibleItemCount(-_treechildren.getVisibleItemCount()); _treechildren = null; } super.onChildRemoved(child); }
/*package*/ void addVisibleItemCount(int count) { if (count == 0) return; Component parent = getParent(); if (parent instanceof Treeitem) { if (((Treeitem) parent).isOpen()) ((Treeitem) parent).addVisibleItemCount(count); } else if (parent instanceof Tree) ((Tree) parent).addVisibleItemCount(count); _visibleItemCount += count; }
public boolean setVisible(boolean visible) { if (isVisible() != visible) { smartUpdate("visible", visible); int count = isOpen() && _treechildren != null ? _treechildren.getVisibleItemCount() + 1 : 1; if (visible) { boolean result = super.setVisible(visible); addVisibleItemCount(count); return result; } else { addVisibleItemCount(-count); return super.setVisible(visible); } } return visible; }
/** Sets whether this container is open. */ public void setOpen(boolean open) { if (_open != open) { _open = open; //Note: _treerow might not be ready yet because it might be //initialized before creating child components (for ZK pages) smartUpdate("open", _open); //If the item is open, its tree has model and not rendered, render the item if (_treechildren != null) addVisibleItemCount((_open ? 1 : -1) * _treechildren.getVisibleItemCount()); Tree tree = getTree(); if (tree != null && tree.getModel() != null) { if (_open && !isLoaded()) tree.renderItem(this); } } }
addVisibleItemCount(_treechildren.getVisibleItemCount()); else { addVisibleItemCount(-_treechildren.getVisibleItemCount());