public class ExpansionState extends AbstractSet<TreePath> implements Serializable
Modifier and Type | Class and Description |
---|---|
private class |
ExpansionState.Listener |
Modifier and Type | Field and Description |
---|---|
private ExpansionState.Listener |
listener |
private Set<TreePath> |
paths |
private static long |
serialVersionUID |
private JTree |
tree |
Constructor and Description |
---|
ExpansionState(JTree t)
For the given JTree.
|
ExpansionState(JTree tree,
Collection<TreePath> state)
For the given JTree, with the given set of expanded paths.
|
ExpansionState(JTree tree,
Collection<TreePath> state,
boolean assumeCollapsed)
For the given JTree, with the given set of expanded paths.
|
Modifier and Type | Method and Description |
---|---|
protected Object |
clone() |
static void |
collapseAll(JTree tree)
Will re-expand the root if it was expanded and the tree has
an invisible root (otherwise the tree will appear empty, and there
is no easy way for the user to change that.
|
static void |
collapseAll(JTree tree,
TreePath root)
requires: root is not a leaf.
|
private static void |
collapseAllImpl(JTree tree,
TreeModel data,
TreePath path) |
boolean |
contains(TreePath item) |
boolean |
containsAll(Collection<?> c) |
boolean |
containsAllAncestors(Collection<TreePath> c)
Are all the ancestors (including the paths) expanded?
|
boolean |
containsAncestors(TreePath path)
Are all the ancestors (including the path) expanded?
|
private ExpansionState.Listener |
createListener() |
void |
disconnect(JTree t) |
static void |
expandAll(JTree tree) |
static void |
expandAll(JTree tree,
TreePath path)
requires: path is not a leaf.
|
private static Collection<TreePath> |
extremalPaths(TreeModel data,
TreePath path,
Collection<TreePath> result)
The "extremal paths" of the tree model's subtree starting at
path.
|
private static void |
extremalPathsImpl(TreeModel data,
TreePath path,
Collection<TreePath> result) |
boolean |
isEmpty() |
Iterator<TreePath> |
iterator() |
static Collection<TreePath> |
paths(JTree tree,
Collection<TreePath> result)
All paths in the JTree that are expanded, including those
under hidden parents.
|
private static void |
pathsImpl(JTree tree,
TreeModel data,
TreePath path,
Collection<TreePath> result) |
private void |
readFromTree() |
private void |
readObject(ObjectInputStream in) |
static void |
setPaths(JTree tree,
Collection<TreePath> paths)
Try to expand exactly the paths given in paths.
|
static void |
setPaths(JTree tree,
Collection<TreePath> paths,
boolean assumeCollapsed)
assumedCollapsed: if true, assume that (if at all) only the root
is expanded.
|
private static void |
setPathsImpl(JTree tree,
TreeModel data,
TreePath path,
int maxLevel,
Collection<TreePath> paths) |
int |
size() |
Collection<TreePath> |
state(Collection<TreePath> result) |
equals, hashCode, removeAll
add, addAll, clear, contains, remove, retainAll, toArray, toArray, toString
private static final long serialVersionUID
private JTree tree
private transient ExpansionState.Listener listener
public ExpansionState(JTree t)
public ExpansionState(JTree tree, Collection<TreePath> state)
public ExpansionState(JTree tree, Collection<TreePath> state, boolean assumeCollapsed)
public void disconnect(JTree t)
private void readFromTree()
public int size()
size
in interface Collection<TreePath>
size
in interface Set<TreePath>
size
in class AbstractCollection<TreePath>
public boolean isEmpty()
isEmpty
in interface Collection<TreePath>
isEmpty
in interface Set<TreePath>
isEmpty
in class AbstractCollection<TreePath>
public boolean contains(TreePath item)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<TreePath>
containsAll
in interface Set<TreePath>
containsAll
in class AbstractCollection<TreePath>
public boolean containsAncestors(TreePath path)
public boolean containsAllAncestors(Collection<TreePath> c)
protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public Collection<TreePath> state(Collection<TreePath> result)
public static void collapseAll(JTree tree)
public static void collapseAll(JTree tree, TreePath root)
public static void expandAll(JTree tree)
public static void expandAll(JTree tree, TreePath path)
private static Collection<TreePath> extremalPaths(TreeModel data, TreePath path, Collection<TreePath> result)
private static void extremalPathsImpl(TreeModel data, TreePath path, Collection<TreePath> result)
public static Collection<TreePath> paths(JTree tree, Collection<TreePath> result)
private static void pathsImpl(JTree tree, TreeModel data, TreePath path, Collection<TreePath> result)
public static void setPaths(JTree tree, Collection<TreePath> paths)
public static void setPaths(JTree tree, Collection<TreePath> paths, boolean assumeCollapsed)
private static void setPathsImpl(JTree tree, TreeModel data, TreePath path, int maxLevel, Collection<TreePath> paths)
private ExpansionState.Listener createListener()