- All Superinterfaces:
FilterTreeModel<Entity>
- All Known Subinterfaces:
SwingEntityTableTreeModel
- All Known Implementing Classes:
AbstractEntityTableTreeModel
The included items of an EntityTableModel as a FilterTreeModel, arranged by a foreign key
referencing the parent, from the table model entity type to itself.
The tree follows the included items, reloaded synchronously after each change, so it shows the rows the table model shows, siblings in the order of the rows. Sorting or filtering the table model does the same to the tree.
The selection is kept in sync with the table model selection both ways, an entity selected in the table model, or by item in the tree, having its ancestors expanded in the tree. The single selection mode of the tree follows the one of the table model, so change the latter.
An entity whose parent is not among the included items is an orphan, hidden along with everything below it, unless
shown as a root, see orphansAsRoots(). An entity on a cycle of parents is reachable from no root, so neither
it nor anything below it is in the tree. The included items reachable from no root are available via
unreachable().
Edit the table model rather than the tree, since a change made via FilterTreeModel.nodes() lasts only until the next
change to the included items.
The table model holds the listeners of the tree model weakly, so it does not keep a tree model no longer in use, one built for a dialog for example.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilds aEntityTableTreeModel.static interfaceThe included items reachable from no root, so not in the tree: the orphans not shown as roots, along with everything below them, and the entities on, or below, a cycle of parents.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()Controls whether entities whose parent is not among the included items are shown as roots, otherwise they are hidden, along with everything below them, false by default.Controls whether siblings with children come before those without, in the order of the rows within each group, otherwise the siblings are in the order of the rows, false by default.
-
Method Details
-
orphansAsRoots
State orphansAsRoots()Controls whether entities whose parent is not among the included items are shown as roots, otherwise they are hidden, along with everything below them, false by default.- Returns:
- the
Statecontrolling whether orphans are shown as roots
-
parentsFirst
State parentsFirst()Controls whether siblings with children come before those without, in the order of the rows within each group, otherwise the siblings are in the order of the rows, false by default.- Returns:
- the
Statecontrolling whether parents come first
-
unreachable
EntityTableTreeModel.UnreachableItems unreachable()- Returns:
- the
EntityTableTreeModel.UnreachableItems, the included items reachable from no root, so not in the tree
-
builder
- Returns:
- a
EntityTableTreeModel.Builder.TableModelStepinstance
-