Search in sources :

Example 1 with LayerRendererTreeNode

use of com.revolsys.swing.tree.node.layer.LayerRendererTreeNode in project com.revolsys.open by revolsys.

the class LayerStylePanel method propertyChange.

@SuppressWarnings("unchecked")
@Override
public void propertyChange(final PropertyChangeEvent event) {
    final String propertyName = event.getPropertyName();
    if ("replaceRenderer".equals(propertyName)) {
        saveStylePanel();
        final LayerRenderer<? extends Layer> oldRenderer = (LayerRenderer<? extends Layer>) event.getOldValue();
        final LayerRenderer<? extends Layer> newRenderer = (LayerRenderer<? extends Layer>) event.getNewValue();
        if (oldRenderer == this.rootRenderer && newRenderer != null && newRenderer != oldRenderer) {
            Property.removeListener(oldRenderer, this);
            this.rootNode.removeNode(0);
            Property.addListener(newRenderer, this);
            final LayerRendererTreeNode newNode = new LayerRendererTreeNode(newRenderer);
            this.rootNode.addNode(newNode);
            this.tree.expandAllNodes();
            this.rootRenderer = newRenderer;
            // setVisible(newRenderer,true);
            setSelectedRenderer(newRenderer);
        }
    } else if ("renderers".equals(propertyName)) {
        this.tree.expandAllNodes();
    }
}
Also used : LayerRendererTreeNode(com.revolsys.swing.tree.node.layer.LayerRendererTreeNode) LayerRenderer(com.revolsys.swing.map.layer.LayerRenderer) Layer(com.revolsys.swing.map.layer.Layer) AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer)

Aggregations

AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)1 Layer (com.revolsys.swing.map.layer.Layer)1 LayerRenderer (com.revolsys.swing.map.layer.LayerRenderer)1 LayerRendererTreeNode (com.revolsys.swing.tree.node.layer.LayerRendererTreeNode)1