Search in sources :

Example 1 with SLDTreeItemInterface

use of com.sldeditor.ui.tree.item.SLDTreeItemInterface in project sldeditor by robward-scisys.

the class SLDTree method leafSelected.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.tree.SLDTreeUpdatedInterface#leafSelected()
     */
@Override
public void leafSelected() {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) symbolTree.getLastSelectedPathComponent();
    DefaultMutableTreeNode parent = null;
    if (node != null) {
        Object nodeInfo = node.getUserObject();
        if (nodeInfo != null) {
            Class<?> classSelected = nodeInfo.getClass();
            SLDTreeItemInterface treeItem = TreeItemMap.getInstance().getValue(classSelected);
            if (treeItem != null) {
                treeItem.itemSelected(node, nodeInfo);
            }
            if (displayPanel != null) {
                Controller.getInstance().setPopulating(true);
                Class<?> parentClass = null;
                if (node.getParent() != null) {
                    parent = (DefaultMutableTreeNode) node.getParent();
                    parentClass = parent.getUserObject().getClass();
                    // Check to see if node represents a fill
                    if (classSelected == FillImpl.class) {
                        // Check to see if fill has been selected
                        Symbolizer symbolizer = (Symbolizer) parent.getUserObject();
                        if (!SLDTreeLeafFactory.getInstance().hasFill(symbolizer)) {
                            parentClass = null;
                            classSelected = null;
                        }
                    } else if (classSelected == StrokeImpl.class) {
                        // Check to see if stroke has been selected
                        Symbolizer symbolizer = (Symbolizer) parent.getUserObject();
                        if (!SLDTreeLeafFactory.getInstance().hasStroke(symbolizer)) {
                            parentClass = null;
                            classSelected = null;
                        }
                    }
                }
                displayPanel.show(parentClass, classSelected);
                Controller.getInstance().setPopulating(false);
            }
            if (renderList != null) {
                for (RenderSymbolInterface render : renderList) {
                    render.renderSymbol();
                }
            }
        }
    }
    if (treeTools != null) {
        treeTools.setButtonState(parent, node, this.currentGeometryType);
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) RenderSymbolInterface(com.sldeditor.datasource.RenderSymbolInterface) StrokeImpl(org.geotools.styling.StrokeImpl) SLDTreeItemInterface(com.sldeditor.ui.tree.item.SLDTreeItemInterface) PolygonSymbolizer(org.geotools.styling.PolygonSymbolizer) Symbolizer(org.geotools.styling.Symbolizer) LineSymbolizer(org.geotools.styling.LineSymbolizer) PointSymbolizer(org.geotools.styling.PointSymbolizer) RasterSymbolizer(org.geotools.styling.RasterSymbolizer)

Aggregations

RenderSymbolInterface (com.sldeditor.datasource.RenderSymbolInterface)1 SLDTreeItemInterface (com.sldeditor.ui.tree.item.SLDTreeItemInterface)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 LineSymbolizer (org.geotools.styling.LineSymbolizer)1 PointSymbolizer (org.geotools.styling.PointSymbolizer)1 PolygonSymbolizer (org.geotools.styling.PolygonSymbolizer)1 RasterSymbolizer (org.geotools.styling.RasterSymbolizer)1 StrokeImpl (org.geotools.styling.StrokeImpl)1 Symbolizer (org.geotools.styling.Symbolizer)1