public class TreePathUtil
extends java.lang.Object
Constructor and Description |
---|
TreePathUtil() |
Modifier and Type | Method and Description |
---|---|
static <T> javax.swing.tree.TreePath |
convertArrayToTreePath(T... array) |
static <T> javax.swing.tree.TreePath |
convertArrayToTreePath(T [] array,
java.util.function.Function<? super T,java.lang.Object> converter) |
static <T> javax.swing.tree.TreePath |
convertCollectionToTreePath(java.lang.Iterable<? extends T> collection) |
static <T> javax.swing.tree.TreePath |
convertCollectionToTreePath(java.lang.Iterable<? extends T> collection,
java.util.function.Function<? super T,java.lang.Object> converter) |
static java.lang.Object[] |
convertTreePathToArray(javax.swing.tree.TreePath path) |
static java.lang.Object[] |
convertTreePathToArray(javax.swing.tree.TreePath path,
java.util.function.Function<java.lang.Object,java.lang.Object> converter) |
static java.lang.String[] |
convertTreePathToStrings(javax.swing.tree.TreePath path) |
static javax.swing.tree.TreePath |
createTreePath(javax.swing.tree.TreePath parent,
java.lang.Object component) |
static javax.swing.tree.TreePath |
findAncestor(javax.swing.tree.TreePath path,
java.util.function.Predicate<javax.swing.tree.TreePath> predicate) |
static javax.swing.tree.TreePath |
findCommonAncestor(java.lang.Iterable<? extends javax.swing.tree.TreePath> paths) |
static javax.swing.tree.TreePath |
findCommonAncestor(javax.swing.tree.TreePath... paths) |
static <T> javax.swing.tree.TreePath |
pathToCustomNode(T node,
java.util.function.Function<? super T,? extends T> getParent) |
static <T> javax.swing.tree.TreePath |
pathToCustomNode(T node,
java.util.function.Function<? super T,? extends T> getParent,
java.util.function.Function<? super T,java.lang.Object> converter) |
static javax.swing.tree.TreePath |
pathToTreeNode(javax.swing.tree.TreeNode node) |
static javax.swing.tree.TreePath |
pathToTreeNode(javax.swing.tree.TreeNode node,
java.util.function.Function<? super javax.swing.tree.TreeNode,java.lang.Object> converter) |
static javax.swing.tree.TreeNode |
toTreeNode(javax.swing.tree.TreePath path) |
static javax.swing.tree.TreeNode[] |
toTreeNodes(javax.swing.tree.TreePath... paths) |
static javax.swing.tree.TreePath |
toTreePath(javax.swing.tree.TreeNode node) |
static javax.swing.tree.TreePath [] |
toTreePathArray(java.util.Collection<javax.swing.tree.TreePath> collection) |
static javax.swing.tree.TreePath[] |
toTreePaths(javax.swing.tree.TreeNode... nodes) |
public static javax.swing.tree.TreePath createTreePath(javax.swing.tree.TreePath parent, java.lang.Object component)
parent
- the parent path or null
to indicate the rootcomponent
- the last path componentpublic static java.lang.String[] convertTreePathToStrings(javax.swing.tree.TreePath path)
path
- a tree path to convertnull
if the specified path is wrong
or a path component is null
or its string representation is null
public static java.lang.Object[] convertTreePathToArray(javax.swing.tree.TreePath path)
path
- a tree path to convertnull
if the specified path is wrong
or a path component is null
public static java.lang.Object[] convertTreePathToArray(javax.swing.tree.TreePath path, java.util.function.Function<java.lang.Object,java.lang.Object> converter)
path
- a tree path to convertconverter
- a function to convert path componentsnull
if the specified path is wrong
or a path component is null
or a path component is converted to null
@SafeVarargs public static <T> javax.swing.tree.TreePath convertArrayToTreePath(T... array)
array
- an array of path components to convertnull
if the specified array is empty
or a path component is null
or a path component is converted to null
public static <T> javax.swing.tree.TreePath convertArrayToTreePath(T [] array, java.util.function.Function<? super T,java.lang.Object> converter)
array
- an array of path components to convertconverter
- a function to convert path componentsnull
if the specified array is empty
or a path component is null
or a path component is converted to null
public static <T> javax.swing.tree.TreePath convertCollectionToTreePath(java.lang.Iterable<? extends T> collection)
collection
- a collection of path components to convertnull
if the specified collection is empty
or a path component is null
or a path component is converted to null
public static <T> javax.swing.tree.TreePath convertCollectionToTreePath(java.lang.Iterable<? extends T> collection, java.util.function.Function<? super T,java.lang.Object> converter)
collection
- a collection of path components to convertconverter
- a function to convert path componentsnull
if the specified collection is empty
or a path component is null
or a path component is converted to null
public static javax.swing.tree.TreePath pathToTreeNode(javax.swing.tree.TreeNode node)
node
- the tree node to get the path fornull
if a path component is null
or a path component is converted to null
public static javax.swing.tree.TreePath pathToTreeNode(javax.swing.tree.TreeNode node, java.util.function.Function<? super javax.swing.tree.TreeNode,java.lang.Object> converter)
node
- the tree node to get the path forconverter
- a function to convert path componentsnull
if a path component is null
or a path component is converted to null
public static <T> javax.swing.tree.TreePath pathToCustomNode(T node, java.util.function.Function<? super T,? extends T> getParent)
node
- the node to get the path forgetParent
- a function to get a parent node for the given onenull
if a path component is null
or a path component is converted to null
public static <T> javax.swing.tree.TreePath pathToCustomNode(T node, java.util.function.Function<? super T,? extends T> getParent, java.util.function.Function<? super T,java.lang.Object> converter)
node
- the node to get the path forgetParent
- a function to get a parent node for the given oneconverter
- a function to convert path componentsnull
if a path component is null
or a path component is converted to null
public static javax.swing.tree.TreePath [] toTreePathArray(java.util.Collection<javax.swing.tree.TreePath> collection)
public static javax.swing.tree.TreeNode toTreeNode(javax.swing.tree.TreePath path)
public static javax.swing.tree.TreeNode[] toTreeNodes(javax.swing.tree.TreePath... paths)
public static javax.swing.tree.TreePath toTreePath(javax.swing.tree.TreeNode node)
public static javax.swing.tree.TreePath[] toTreePaths(javax.swing.tree.TreeNode... nodes)
public static javax.swing.tree.TreePath findAncestor(javax.swing.tree.TreePath path, java.util.function.Predicate<javax.swing.tree.TreePath> predicate)
path
- a tree path to iterate through ancestorspredicate
- a predicate that tests every ancestor of the given pathnull
if the path does not have any applicable ancestorpublic static javax.swing.tree.TreePath findCommonAncestor(javax.swing.tree.TreePath... paths)
paths
- an array of tree paths to iterate throughnull
if these paths do not have onepublic static javax.swing.tree.TreePath findCommonAncestor(java.lang.Iterable<? extends javax.swing.tree.TreePath> paths)
paths
- a collection of tree paths to iterate throughnull
if these paths do not have one