Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java @ 4329:c9dcce9448f2
Added a new control 'show legend' to the map's toolbar. This control opens a window that displays the legends of all activated layers.
Currently, the row in that window has a fixed size of 400x150. The size is fixed, because there are problems with SmartGWT to build
panels with auto height/width :-/
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 30 Oct 2012 12:16:26 +0100 |
parents | 0be65bc65cee |
children | 6e01499bfbdf |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Tue Oct 30 13:05:26 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Tue Oct 30 12:16:26 2012 +0100 @@ -1,7 +1,17 @@ package de.intevation.flys.client.client.ui.map; +import org.gwtopenmaps.openlayers.client.Bounds; +import org.gwtopenmaps.openlayers.client.Map; +import org.gwtopenmaps.openlayers.client.control.DragPan; +import org.gwtopenmaps.openlayers.client.control.SelectFeature; +import org.gwtopenmaps.openlayers.client.control.SelectFeatureOptions; +import org.gwtopenmaps.openlayers.client.control.ZoomBox; +import org.gwtopenmaps.openlayers.client.event.MapZoomListener; +import org.gwtopenmaps.openlayers.client.feature.VectorFeature; +import org.gwtopenmaps.openlayers.client.layer.Vector; +import org.gwtopenmaps.openlayers.client.util.Attributes; + import com.google.gwt.core.client.GWT; - import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.SelectionType; import com.smartgwt.client.util.SC; @@ -18,17 +28,7 @@ import de.intevation.flys.client.client.ui.Toolbar; import de.intevation.flys.client.client.utils.EnableDisableCmd; import de.intevation.flys.client.shared.model.Collection; - -import org.gwtopenmaps.openlayers.client.Bounds; -import org.gwtopenmaps.openlayers.client.Map; -import org.gwtopenmaps.openlayers.client.control.DragPan; -import org.gwtopenmaps.openlayers.client.control.SelectFeature; -import org.gwtopenmaps.openlayers.client.control.SelectFeatureOptions; -import org.gwtopenmaps.openlayers.client.control.ZoomBox; -import org.gwtopenmaps.openlayers.client.event.MapZoomListener; -import org.gwtopenmaps.openlayers.client.feature.VectorFeature; -import org.gwtopenmaps.openlayers.client.layer.Vector; -import org.gwtopenmaps.openlayers.client.util.Attributes; +import de.intevation.flys.client.shared.model.ThemeList; /** @@ -48,6 +48,7 @@ protected Button manageThemesButton; protected Button datacageButton; + protected Button legendButton; protected ImgButton addWMSButton; protected ImgButton zoomToMaxButton; @@ -65,6 +66,8 @@ protected DrawControl drawControl; protected MeasureControl measureControl; + protected LegendWindow legendWindow; + protected Canvas position; @@ -112,6 +115,9 @@ datacageButton = createDatacageControl(); addMember(datacageButton); + legendButton = createLegendControl(); + addMember(legendButton); + addWMSButton = createWMSControl(); addMember(addWMSButton); @@ -562,6 +568,29 @@ } + protected Button createLegendControl() { + Button btn = new Button(MSG.legend()); + btn.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + openLegendWindow(); + } + }); + + return btn; + } + + + protected void openLegendWindow() { + if (legendWindow == null) { + MapOutputTab tab = (MapOutputTab) getOutputTab(); + legendWindow = new LegendWindow(tab.getThemePanel().getThemeList()); + } + + legendWindow.show(); + } + + protected ImgButton createGetFeatureInfo() { MapOutputTab ot = (MapOutputTab) getOutputTab(); if (ot == null) { @@ -678,5 +707,12 @@ return url; } + + + public void updateThemes(ThemeList themeList) { + if (legendWindow != null) { + legendWindow.update(themeList); + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :