use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class LayerGroupTreeNode method addChild.
@Override
public int addChild(final int index, final Object object) {
if (object instanceof Layer) {
final Layer layer = (Layer) object;
final LayerGroup group = getGroup();
group.addLayer(index, layer);
return index;
} else {
return -1;
}
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class LayerGroupTreeNode method loadChildrenDo.
@Override
protected List<BaseTreeNode> loadChildrenDo() {
final List<BaseTreeNode> children = new ArrayList<>();
final LayerGroup group = getGroup();
for (final Layer child : group) {
final BaseTreeNode childNode = newTreeNode(child);
children.add(childNode);
}
return children;
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class LayerGroupTreeNode method removeChild.
@Override
public boolean removeChild(final Object child) {
if (child instanceof Layer) {
final Layer layer = (Layer) child;
final LayerGroup group = getGroup();
return group.removeLayer(layer);
} else {
return false;
}
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class LayerGroupTreeNode method mouseClicked.
@Override
public void mouseClicked(final MouseEvent e) {
final Object source = e.getSource();
final JTree tree = getTree();
if (source == tree) {
final int clickCount = e.getClickCount();
if (clickCount == 2 && SwingUtilities.isLeftMouseButton(e)) {
final int x = e.getX();
final int y = e.getY();
final TreePath path = tree.getPathForLocation(x, y);
final Layer layer = getLayer();
final TreeUI ui = tree.getUI();
final Rectangle bounds = ui.getPathBounds(tree, path);
final int cX = x - bounds.x;
final int index = cX / 21;
int offset = 0;
if (index == offset) {
layer.setVisible(!layer.isVisible());
}
offset++;
}
e.consume();
}
}
use of com.revolsys.swing.map.layer.Layer in project com.revolsys.open by revolsys.
the class ProjectFrame method getTreeNode.
public BaseTreeNode getTreeNode(final Layer layer) {
final List<Layer> layerPath = layer.getPathList();
final TreePath treePath = this.tocTree.getTreePath(layerPath);
if (treePath == null) {
return null;
} else {
return (BaseTreeNode) treePath.getLastPathComponent();
}
}
Aggregations