/** called when all nodes are expanded. */ @Override public final void allNodesExpanded() { invalidateAll(); }
/** called when all nodes are collapsed. */ @Override public final void allNodesCollapsed() { invalidateAll(); }
/** * Sets whether the root of the tree should be visible. * * @param rootLess * whether the root should be visible */ public void setRootLess(boolean rootLess) { if (this.rootLess != rootLess) { this.rootLess = rootLess; invalidateAll(); // if the tree is in rootless mode, make sure the root node is // expanded if (rootLess == true && getModelObject() != null) { getTreeState().expandNode(getModelObject().getRoot()); } } }
/** * Checks whether the model has been changed, and if so unregister and register listeners. */ private void checkModel() { // find out whether the model object (the TreeModel) has been changed TreeModel model = getModelObject(); if (model != previousModel) { if (previousModel != null) { previousModel.removeTreeModelListener(this); } previousModel = model; if (model != null) { model.addTreeModelListener(this); } // model has been changed, redraw whole tree invalidateAll(); } }
/** * @see TreeModelListener#treeStructureChanged(TreeModelEvent) */ @Override public final void treeStructureChanged(TreeModelEvent e) { if (dirtyAll) { return; } // get the parent node of changed nodes Object node = e.getTreePath() != null ? e.getTreePath().getLastPathComponent() : null; // has the tree root changed? if (node == null || e.getTreePath().getPathCount() == 1) { invalidateAll(); } else { invalidateNodeWithChildren(node); } }