Search in sources :

Example 1 with LayerRenderer

use of com.revolsys.swing.map.layer.LayerRenderer in project com.revolsys.open by revolsys.

the class BaseStylePanel method addField.

protected Field addField(final JPanel container, final Object object, final String fieldName) {
    final Class<?> fieldClass = Property.getClass(object, fieldName);
    if (fieldClass == null) {
        return null;
    } else {
        final Object value = Property.get(object, fieldName);
        SwingUtil.addLabel(container, fieldName);
        final Field field = newField(fieldName, fieldClass, value);
        setField(field);
        if (this.readOnlyFieldNames.contains(fieldName)) {
            field.setEditable(false);
        }
        if (field instanceof JTextArea) {
            container.add(new JScrollPane((Component) field));
        } else {
            container.add((Component) field);
        }
        Property.addListener(field, "fieldValue", this);
        Property.addListener(field, fieldName, this);
        if (object instanceof LayerRenderer) {
            this.rendererFieldNames.add(fieldName);
        }
        return field;
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) LengthMeasureTextField(com.revolsys.swing.field.LengthMeasureTextField) FontChooserField(com.revolsys.swing.field.FontChooserField) MarkerField(com.revolsys.swing.map.component.MarkerField) JTextField(javax.swing.JTextField) Field(com.revolsys.swing.field.Field) TextField(com.revolsys.swing.field.TextField) ColorChooserField(com.revolsys.swing.field.ColorChooserField) JTextArea(javax.swing.JTextArea) LayerRenderer(com.revolsys.swing.map.layer.LayerRenderer) Component(java.awt.Component)

Example 2 with LayerRenderer

use of com.revolsys.swing.map.layer.LayerRenderer in project com.revolsys.open by revolsys.

the class LayerTreeNode method addChild.

@Override
public int addChild(final int index, final Object child) {
    if (child instanceof LayerRenderer<?>) {
        final LayerRenderer<?> childRenderer = (LayerRenderer<?>) child;
        final AbstractLayer layer = getLayer();
        return layer.addRenderer(childRenderer, index);
    } else {
        return -1;
    }
}
Also used : AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer) LayerRenderer(com.revolsys.swing.map.layer.LayerRenderer)

Example 3 with LayerRenderer

use of com.revolsys.swing.map.layer.LayerRenderer in project com.revolsys.open by revolsys.

the class LayerTreeNode method addChild.

@Override
public int addChild(final Object child) {
    if (child instanceof LayerRenderer<?>) {
        final LayerRenderer<?> childRenderer = (LayerRenderer<?>) child;
        final AbstractLayer layer = getLayer();
        return layer.addRenderer(childRenderer);
    } else {
        return -1;
    }
}
Also used : AbstractLayer(com.revolsys.swing.map.layer.AbstractLayer) LayerRenderer(com.revolsys.swing.map.layer.LayerRenderer)

Example 4 with LayerRenderer

use of com.revolsys.swing.map.layer.LayerRenderer 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

LayerRenderer (com.revolsys.swing.map.layer.LayerRenderer)4 AbstractLayer (com.revolsys.swing.map.layer.AbstractLayer)3 ColorChooserField (com.revolsys.swing.field.ColorChooserField)1 Field (com.revolsys.swing.field.Field)1 FontChooserField (com.revolsys.swing.field.FontChooserField)1 LengthMeasureTextField (com.revolsys.swing.field.LengthMeasureTextField)1 TextField (com.revolsys.swing.field.TextField)1 MarkerField (com.revolsys.swing.map.component.MarkerField)1 Layer (com.revolsys.swing.map.layer.Layer)1 LayerRendererTreeNode (com.revolsys.swing.tree.node.layer.LayerRendererTreeNode)1 Component (java.awt.Component)1 JScrollPane (javax.swing.JScrollPane)1 JTextArea (javax.swing.JTextArea)1 JTextField (javax.swing.JTextField)1