public class StructureTreeModel<Structure extends AbstractTreeStructure> extends AbstractTreeModel implements Disposable, InvokerSupplier, ChildrenProvider<javax.swing.tree.TreeNode>
Disposable.Parent
disposed, listeners
Constructor and Description |
---|
StructureTreeModel(Structure structure,
java.util.Comparator<? super NodeDescriptor<?>> comparator,
Disposable parent) |
StructureTreeModel(Structure structure,
java.util.Comparator<? super NodeDescriptor<?>> comparator,
Invoker invoker,
Disposable parent) |
StructureTreeModel(Structure structure,
Disposable parent) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Usually not invoked directly, see class javadoc.
|
void |
expand(java.lang.Object element,
javax.swing.JTree tree,
java.util.function.Consumer<? super javax.swing.tree.TreePath> consumer)
Expands a node in the specified tree.
|
javax.swing.tree.TreeNode |
getChild(java.lang.Object object,
int index) |
int |
getChildCount(java.lang.Object object) |
java.util.List<javax.swing.tree.TreeNode> |
getChildren(java.lang.Object object) |
int |
getIndexOfChild(java.lang.Object object,
java.lang.Object child) |
Invoker |
getInvoker() |
javax.swing.tree.TreeNode |
getRoot() |
javax.swing.tree.TreeNode |
getRootImmediately()
Deprecated.
do not use
|
Promise<?> |
invalidate()
Invalidates all nodes and notifies Swing model that a whole tree hierarchy is changed.
|
Promise<javax.swing.tree.TreePath> |
invalidate(java.lang.Object element,
boolean structure)
Invalidates specified nodes and notifies Swing model that these nodes are changed.
|
Promise<javax.swing.tree.TreePath> |
invalidate(javax.swing.tree.TreePath path,
boolean structure)
Invalidates specified nodes and notifies Swing model that these nodes are changed.
|
boolean |
isLeaf(java.lang.Object object) |
void |
makeVisible(java.lang.Object element,
javax.swing.JTree tree,
java.util.function.Consumer<? super javax.swing.tree.TreePath> consumer)
Makes visible a node in the specified tree.
|
Promise<TreeVisitor> |
promiseVisitor(java.lang.Object element)
Promises to create default visitor to find the specified element.
|
void |
select(java.lang.Object element,
javax.swing.JTree tree,
java.util.function.Consumer<? super javax.swing.tree.TreePath> consumer)
Selects a node in the specified tree.
|
void |
setComparator(java.util.Comparator<? super NodeDescriptor<?>> comparator) |
java.lang.String |
toString() |
addTreeModelListener, removeTreeModelListener, treeNodesChanged, treeNodesInserted, treeNodesRemoved, treeStructureChanged, valueForPathChanged
public StructureTreeModel(Structure structure, Disposable parent)
public StructureTreeModel(Structure structure, java.util.Comparator<? super NodeDescriptor<?>> comparator, Disposable parent)
public StructureTreeModel(Structure structure, java.util.Comparator<? super NodeDescriptor<?>> comparator, Invoker invoker, Disposable parent)
public final void setComparator(java.util.Comparator<? super NodeDescriptor<?>> comparator)
comparator
- a comparator to sort tree nodes or null
to disable sortingpublic void dispose()
Disposable
dispose
in interface Disposable
dispose
in class AbstractTreeModel
public final Invoker getInvoker()
getInvoker
in interface InvokerSupplier
public final Promise<?> invalidate()
public final Promise<javax.swing.tree.TreePath> invalidate(javax.swing.tree.TreePath path, boolean structure)
path
- a path to the node to invalidatestructure
- true
means that all child nodes must be invalidated;
false
means that only the node specified by path
must be updatedinvalidate(Object, boolean)
public final Promise<javax.swing.tree.TreePath> invalidate(java.lang.Object element, boolean structure)
element
- an element of the internal tree structurestructure
- true
means that all child nodes must be invalidated;
false
means that only the node specified by path
must be updatedinvalidate(TreePath, boolean)
public final void expand(java.lang.Object element, javax.swing.JTree tree, java.util.function.Consumer<? super javax.swing.tree.TreePath> consumer)
element
- an element of the internal tree structuretree
- a tree, which nodes should be expandedconsumer
- a path consumer called on EDT if path is found and expandedpublic final void makeVisible(java.lang.Object element, javax.swing.JTree tree, java.util.function.Consumer<? super javax.swing.tree.TreePath> consumer)
element
- an element of the internal tree structuretree
- a tree, which nodes should be made visibleconsumer
- a path consumer called on EDT if path is found and made visiblepublic final void select(java.lang.Object element, javax.swing.JTree tree, java.util.function.Consumer<? super javax.swing.tree.TreePath> consumer)
element
- an element of the internal tree structuretree
- a tree, which nodes should be selectedconsumer
- a path consumer called on EDT if path is found and selectedpublic final Promise<TreeVisitor> promiseVisitor(java.lang.Object element)
element
- an element of the internal tree structureTreeUtil.promiseExpand(JTree, TreeVisitor)
,
TreeUtil.promiseSelect(JTree, TreeVisitor)
public final javax.swing.tree.TreeNode getRoot()
getRoot
in interface javax.swing.tree.TreeModel
public final java.util.List<javax.swing.tree.TreeNode> getChildren(java.lang.Object object)
getChildren
in interface ChildrenProvider<javax.swing.tree.TreeNode>
object
- a tree nodenull
if they are not ready yetpublic final int getChildCount(java.lang.Object object)
getChildCount
in interface javax.swing.tree.TreeModel
public final javax.swing.tree.TreeNode getChild(java.lang.Object object, int index)
getChild
in interface javax.swing.tree.TreeModel
public final boolean isLeaf(java.lang.Object object)
isLeaf
in interface javax.swing.tree.TreeModel
public final int getIndexOfChild(java.lang.Object object, java.lang.Object child)
getIndexOfChild
in interface javax.swing.tree.TreeModel
@Deprecated public final javax.swing.tree.TreeNode getRootImmediately()
public java.lang.String toString()
toString
in class java.lang.Object
Invoker(String, Disposable, com.intellij.util.ThreeState)