|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.flextree.FlexTreeUtils
public class FlexTreeUtils
Method Summary | ||
---|---|---|
static boolean |
allLeafsMatch(TreePath[] paths,
Class<?> type)
Return whether all leafs (last path components) of the given paths match the given type. |
|
static
|
getMatchingLeafs(TreePath[] paths,
Class<T> type)
Return the matching leaf objects (last path components) of the given paths matching the given type. |
|
static List<TreePath> |
getMatchingPaths(TreePath[] paths,
Class<?> type)
Return those paths whose leaf objects (last path components) of the given paths match the given type. |
|
static
|
locateCommonParent(TreePath[] paths,
Class<T> type)
Locate a common element of the given type within the given paths. |
|
static
|
locateLast(TreePath path,
Class<T> type)
find that object of the given class, which is nearest to a leaf (and farthest from the root). |
|
static boolean |
someLeafsMatch(TreePath[] paths,
Class<?> type)
Return whether at least one leaf (last path component) of the given paths matches the given type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T locateLast(TreePath path, Class<T> type)
null
is returned.
public static boolean someLeafsMatch(TreePath[] paths, Class<?> type)
paths
- the paths to testtype
- the type to match
true
if at least one leaf matches the given typepublic static boolean allLeafsMatch(TreePath[] paths, Class<?> type)
paths
- the paths to testtype
- the type to match
true
if all leafs match the given typepublic static <T> List<T> getMatchingLeafs(TreePath[] paths, Class<T> type)
paths
- the paths to testtype
- the type to match
public static List<TreePath> getMatchingPaths(TreePath[] paths, Class<?> type)
paths
- the paths to testtype
- the type to match
public static <T> T locateCommonParent(TreePath[] paths, Class<T> type)
null
if not all of the paths
contain an element of the given type or the instances are not the same.
To illustrate the behavior let us assume that there are three item types A
,
B
and C
with instances A1
, A2
and so on.
The following table illustrates the result querying for the type B
given some
example input paths:
Paths | Result |
---|---|
A1,B1,C1 A1,B1,C2 A1,B1,C3 |
B1 |
A1,A2,B1,C1 A2,B1,C2 B1,C3 |
B1 |
B1,B1,C1 B2,B1,C2 B3,B1,C3 |
B1 |
A1,B1,C1 A1,B1,C2 A1,B1,C1 |
B1 |
A1,B1,C1 A1,B1,C2 A1,B1,B4 |
null |
A1,B1,C1 A1,B1,C2 A1,B2,C3 |
null |
A1,B1,C1 A1,B1,C2 A1,C3 |
null |
paths
- type
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |