use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class PathTreeNode method getUrl.
@Override
public URL getUrl() {
final Path path = getPath();
final BaseTreeNode parent = getParent();
return getUrl(parent, path);
}
use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class PathTreeNode method addPathNode.
public static void addPathNode(final List<BaseTreeNode> children, final Path path, final boolean showHidden) {
if (showHidden || !Paths.isHidden(path) && Files.exists(path)) {
final BaseTreeNode child = newTreeNode(path);
children.add(child);
}
}
use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class PathTreeNode method newFileSystemsTreeNode.
public static BaseTreeNode newFileSystemsTreeNode() {
final BaseTreeNode fileSystems = new FunctionChildrenTreeNode(FileSystems.getDefault(), "File Systems", getIconFolder("drive"), (fileSystem) -> {
final Iterable<Path> roots = ((FileSystem) fileSystem).getRootDirectories();
return getPathNodes(roots, true);
});
fileSystems.setOpen(true);
return fileSystems;
}
use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class LayerGroupTreeNode method propertyChangeDo.
@Override
public void propertyChangeDo(final PropertyChangeEvent e) {
super.propertyChangeDo(e);
final Object source = e.getSource();
final LayerGroup layerGroup = getGroup();
if (source == layerGroup) {
final String propertyName = e.getPropertyName();
if ("layers".equals(propertyName)) {
if (e instanceof IndexedPropertyChangeEvent) {
final IndexedPropertyChangeEvent indexedEvent = (IndexedPropertyChangeEvent) e;
final int index = indexedEvent.getIndex();
final Layer oldLayer = (Layer) e.getOldValue();
final Layer newLayer = (Layer) e.getNewValue();
final List<BaseTreeNode> children = new ArrayList<>(getChildren());
if (newLayer == null) {
if (oldLayer != null) {
children.remove(index);
}
} else if (oldLayer == null) {
final BaseTreeNode newTreeNode = newTreeNode(newLayer);
children.add(index, newTreeNode);
}
setChildren(children);
}
} else if ("visible".equals(propertyName)) {
if (isChildrenInitialized()) {
for (final BaseTreeNode childNode : getChildren()) {
if (childNode instanceof LayerTreeNode) {
final LayerTreeNode childLayerNode = (LayerTreeNode) childNode;
childLayerNode.refreshIcon();
}
}
}
}
}
}
use of com.revolsys.swing.tree.BaseTreeNode in project com.revolsys.open by revolsys.
the class LayerGroupTreeNode method newTreeNode.
protected BaseTreeNode newTreeNode(final Layer layer) {
BaseTreeNode childNode;
if (layer instanceof LayerGroup) {
final LayerGroup childGroup = (LayerGroup) layer;
childNode = new LayerGroupTreeNode(childGroup);
} else {
childNode = new LayerTreeNode(layer);
}
return childNode;
}
Aggregations