Example usage for com.google.gwt.maps.client.controls ControlPosition RIGHT_BOTTOM

List of usage examples for com.google.gwt.maps.client.controls ControlPosition RIGHT_BOTTOM

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.controls ControlPosition RIGHT_BOTTOM.

Prototype

ControlPosition RIGHT_BOTTOM

To view the source code for com.google.gwt.maps.client.controls ControlPosition RIGHT_BOTTOM.

Click Source Link

Document

Elements are positioned on the right, above bottom-right elements, and flow upwards.

Usage

From source file:org.rebioma.client.maps.TileLayerSelector.java

License:Apache License

public LayerInfo selectLayer(final String layerSelected, final TileLayerCallback callback) {
    if (layerSelected == null) {
        return null;
    }/*from  w w  w. j av a 2  s.c om*/
    if (layerSelected.equals(LOADING)) {
        Timer t = new Timer() {
            @Override
            public void run() {
                if (!getItemText(0).equals(LOADING)) {
                    cancel();
                    selectLayer(layerSelected, callback);
                }
            }
        };
        t.scheduleRepeating(500);
        return null;
    }
    LayerInfo layerInfo = null;
    if (selectedLayer != null) {
        map.getOverlayMapTypes().removeAt(selectedLayer.getMapIndex());
    }
    if (layerLegend != null) {
        layerLegend.removeFromParent();
    }
    if (layerSelected.equals(SELECT) || layerSelected.equals(CLEAR)) {
        setSelectedIndex(selectionNames.get(SELECT));
        selectedLayer = null;
        layerLegend = null;
        callback.onLayerCleared(layerInfos.get(selectedLayer));
    } else {
        setSelectedIndex(selectionNames.get(layerSelected));
        layerInfo = layerInfos.get(layerSelected);
        selectedLayer = layerInfo.getInstance();
        ImageMapType overlay = selectedLayer.asOverlay();
        map.getOverlayMapTypes().push(overlay);
        selectedLayer.setMapIndex(map.getOverlayMapTypes().getLength() - 1);
        layerLegend = layerInfos.get(layerSelected).getInstance().getLegend();
        if (layerLegend != null) {
            map.setControls(ControlPosition.RIGHT_BOTTOM, layerLegend);
        }
        callback.onLayerSelected(layerInfo);
    }
    return layerInfo;
}