public boolean addOpenObject(E child) { final int[] path = getPath(child); if (path != null && path.length > 0) return addOpenPath(path); return false; }
@SuppressWarnings("unchecked") public boolean isObjectOpened(Object child) { final int[] path = getPath((E) child); if (path != null && path.length > 0) return isPathOpened(path); return false; }
/** @deprecated As of release 6.0.0, replaced with {@link #fireEvent(int, int[], int, int)}. */ public void fireEvent(E node, int indexFrom, int indexTo, int evtType) { fireEvent(evtType, getPath(node), indexFrom, indexTo); }
@SuppressWarnings("unchecked") public boolean removeFromSelection(Object child) { final int[] path = getPath((E) child); if (path != null && path.length > 0) return removeSelectionPath(path); return false; }
@SuppressWarnings("unchecked") public boolean removeOpenObject(Object child) { final int[] path = getPath((E) child); if (path != null && path.length > 0) return removeOpenPath(path); return false; }
@SuppressWarnings("unchecked") public boolean isSelected(Object child) { final int[] path = getPath((E) child); if (path != null && path.length > 0) return isPathSelected(path); return false; }
public boolean addToSelection(E child) { final int[] path = getPath(child); if (path != null && path.length > 0) return addSelectionPath(path); return false; }
/** A utility that the deriving class can call to restore the states * saved by {@link #beforeSort} * @since 6.0.0 */ protected void afterSort(Object ctx) { if (ctx instanceof States) { @SuppressWarnings("unchecked") final States<E> states = (States) ctx; _selection.clear(); for (final E node : states.selection) _selection.add(new Path(getPath(node))); _opens.clear(); for (final E node : states.opens) _opens.add(new Path(getPath(node))); } }
private int getChildNodeCount(E node) { int c = getChildCount(node); int count = c; for (int i = 0; i < c; i++) { E child = getChild(node, i); if (isPathOpened(getPath(child))) { count += getChildNodeCount(child); } } return count; }