Search in sources :

Example 1 with AbstractMultipleRenderer

use of com.revolsys.swing.map.layer.record.renderer.AbstractMultipleRenderer in project com.revolsys.open by revolsys.

the class AbstractRecordLayer method addRenderer.

@Override
public int addRenderer(final LayerRenderer<?> child, final int index) {
    final AbstractRecordLayerRenderer oldRenderer = getRenderer();
    AbstractMultipleRenderer rendererGroup;
    if (oldRenderer instanceof AbstractMultipleRenderer) {
        rendererGroup = (AbstractMultipleRenderer) oldRenderer;
    } else {
        final AbstractRecordLayer layer = oldRenderer.getLayer();
        rendererGroup = new MultipleRecordRenderer(layer);
        rendererGroup.addRenderer(oldRenderer);
        setRenderer(rendererGroup);
    }
    if (index == 0) {
        rendererGroup.addRenderer(0, (AbstractRecordLayerRenderer) child);
        return 0;
    } else {
        rendererGroup.addRenderer((AbstractRecordLayerRenderer) child);
        return rendererGroup.getRenderers().size() - 1;
    }
}
Also used : AbstractRecordLayerRenderer(com.revolsys.swing.map.layer.record.renderer.AbstractRecordLayerRenderer) AbstractMultipleRenderer(com.revolsys.swing.map.layer.record.renderer.AbstractMultipleRenderer) MultipleRecordRenderer(com.revolsys.swing.map.layer.record.renderer.MultipleRecordRenderer)

Aggregations

AbstractMultipleRenderer (com.revolsys.swing.map.layer.record.renderer.AbstractMultipleRenderer)1 AbstractRecordLayerRenderer (com.revolsys.swing.map.layer.record.renderer.AbstractRecordLayerRenderer)1 MultipleRecordRenderer (com.revolsys.swing.map.layer.record.renderer.MultipleRecordRenderer)1