BoxJTreepublic class BoxJTree extends JTree implements org.jdesktop.application.session.PropertySupport
Constructors Summary |
---|
public BoxJTree()
setRootVisible(false);
setLargeModel(true);
setName("boxTree");
|
Methods Summary |
---|
public java.lang.String | convertValueToText(java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
if (value instanceof Box) {
return ((Box) value).getType();
} else {
return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus); //To change body of overridden methods use File | Settings | File Templates.
}
| public java.lang.Object | getSessionState(java.awt.Component c)
Enumeration<TreePath> treePathEnumeration = this.getExpandedDescendants(new TreePath(this.getModel().getRoot()));
java.util.List<String> openPath = new LinkedList<String>();
Path oldMp4Path = null;
if (treePathEnumeration != null) {
while (treePathEnumeration.hasMoreElements()) {
TreePath treePath = treePathEnumeration.nextElement();
openPath.add(Path.createPath((Box) treePath.getLastPathComponent()));
}
}
return openPath;
| public void | setSessionState(java.awt.Component c, java.lang.Object state)
LinkedList<String> openPath = (LinkedList<String>) state;
if (!openPath.isEmpty()) {
for (String s : openPath) {
Box expanded = Path.getPath((Box) this.getModel().getRoot(), s);
List path = new LinkedList();
while (expanded != null) {
path.add(expanded);
expanded = expanded.getParent();
}
if (path.size() > 0) {
Collections.reverse(path);
TreePath tp = new TreePath(path.toArray());
this.expandPath(tp);
}
}
}
|
|