Interface SwingFilterTreeModel<T>
- Type Parameters:
T- the item type
- All Superinterfaces:
FilterTreeModel<T>,TreeModel
- All Known Subinterfaces:
SwingEntityTableTreeModel,SwingEntityTreeModel
A Swing TreeModel based on the UI-agnostic FilterTreeModel, adding the TreeModel
interface, with selection() narrowed to a FilterTreeSelection, a
TreeSelectionModel.
The tree nodes are the current NodePaths of the model, the root being NodePath.nodePath(), so the
components of a TreePath are NodePaths, and TreePaths are equal when they identify the same
node, whichever item instances they hold.
TreeModelListeners are notified in the order they were added.
Expansion is model state, see FilterTreeModel.expansion(), a JTree over this model must be kept in step with it,
as is.codion.swing.common.ui.component.tree.FilterTree does.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilds aSwingFilterTreeModel, theFilterTreeModel.Builderoptions with the selection based on aTreeSelectionModel.Nested classes/interfaces inherited from interface is.codion.common.model.component.tree.FilterTreeModel
FilterTreeModel.Expansion<T>, FilterTreeModel.Loader<T>, FilterTreeModel.Nodes<T>, FilterTreeModel.NodesListener<T>, FilterTreeModel.VisibleNodes<T> -
Method Summary
Modifier and TypeMethodDescriptionbuilder()voidfireNodesChanged(Collection<NodePath<T>> paths) Notifies all listeners that the given nodes have changed, for when external state changes how they are rendered.getRoot()The selection, over theFilterTreeModel.visible()nodes, by item, withTreeSelection.paths()addressing particular nodes, the same item appearing in several places.Methods inherited from interface is.codion.common.model.component.tree.FilterTreeModel
expansion, nodes, sort, visibleMethods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getChildCount, getIndexOfChild, isLeaf, removeTreeModelListener, valueForPathChanged
-
Method Details
-
selection
FilterTreeSelection<T> selection()Description copied from interface:FilterTreeModelThe selection, over the
FilterTreeModel.visible()nodes, by item, withTreeSelection.paths()addressing particular nodes, the same item appearing in several places. Selecting a node hidden below a collapsed ancestor expands its ancestors, and a node not yet loaded is selected viaTreeSelection.Pending.set(NodePath).The selection is kept by path, through refreshes, filtering, sorting and expansion. A selected node hidden by collapsing one of its ancestors is replaced by its nearest visible ancestor, and one removed or excluded is dropped from the selection.
- Specified by:
selectionin interfaceFilterTreeModel<T>- Returns:
- the
FilterTreeSelectioninstance used by this tree model
-
getRoot
- Specified by:
getRootin interfaceTreeModel- Returns:
- the root,
NodePath.nodePath()
-
fireNodesChanged
Notifies all listeners that the given nodes have changed, for when external state changes how they are rendered. Paths not included in the model are ignored.- Parameters:
paths- the paths of the changed nodes
-
treePath
- Parameters:
path- the path- Returns:
- a
TreePathidentifying the node identified by the given path, its components the paths from the root down to it
-
builder
- Returns:
- a
SwingFilterTreeModel.Builder.RootsStepinstance
-