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;
}
}
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;
}
}
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;
}
}
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();
}
}
Aggregations