Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java @ 2983:725470fc57d2
Add "Manage themes" button to ChartToolbar and MapToolbar.
flys-client/trunk@4991 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 13 Jul 2012 11:31:25 +0000 |
parents | 51ed89b754ae |
children | 0be65bc65cee |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Fri Jul 13 10:09:20 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Fri Jul 13 11:31:25 2012 +0000 @@ -1,7 +1,6 @@ package de.intevation.flys.client.client.ui.map; 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; @@ -11,9 +10,15 @@ import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; -import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.events.ResizedEvent; import com.smartgwt.client.widgets.events.ResizedHandler; +import com.smartgwt.client.widgets.layout.HLayout; + +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.ui.ImgLink; +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; @@ -21,19 +26,11 @@ 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 org.gwtopenmaps.openlayers.client.event.MapZoomListener; - -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.ui.Toolbar; -import de.intevation.flys.client.client.ui.ImgLink; -import de.intevation.flys.client.client.utils.EnableDisableCmd; -import de.intevation.flys.client.shared.model.ThemeList; -import de.intevation.flys.client.shared.model.Collection; - /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> @@ -50,6 +47,7 @@ protected SelectFeature selectFeature; protected GetFeatureInfo getFeatureInfo; + protected Button manageThemesButton; protected Button datacageButton; protected ImgButton addWMSButton; @@ -109,6 +107,9 @@ epsgLabel = createEPSGLabel(); if (mapTab != null) { + manageThemesButton = createManageThemesControl(); + addMember(manageThemesButton); + datacageButton = createDatacageControl(); addMember(datacageButton); @@ -139,6 +140,7 @@ addMember(createRightPanel()); addResizedHandler(new ResizedHandler() { + @Override public void onResized(ResizedEvent e) { if (getVisibleWidth() < 656) { setHeight(55); @@ -267,6 +269,7 @@ btn.setShowRollOverIcon(false); btn.setSelected(false); btn.addClickHandler(new ClickHandler() { + @Override public void onClick(ClickEvent e) { if (btn.isSelected()) { cmd.enable(); @@ -295,6 +298,7 @@ protected ImgButton createMaxExtentControl() { ImgButton zoomToMax = createButton(MSG.zoom_all(), new ClickHandler() { + @Override public void onClick(ClickEvent event) { floodMap.getMap().zoomToMaxExtent(); } @@ -310,6 +314,7 @@ zoomBox = new ZoomBox(); EnableDisableCmd cmd = new EnableDisableCmd() { + @Override public void enable() { activatePan(false); activateDrawFeature(false); @@ -319,6 +324,7 @@ activateZoomBox(true); } + @Override public void disable() { activateZoomBox(false); } @@ -336,6 +342,7 @@ protected ImgButton createZoomOutControl() { ImgButton zoomOut = createButton(MSG.zoom_out(), new ClickHandler() { + @Override public void onClick(ClickEvent event) { Map map = floodMap.getMap(); int level = map.getZoom(); @@ -357,6 +364,7 @@ getMap().addControl(pan); EnableDisableCmd cmd = new EnableDisableCmd() { + @Override public void enable() { activateZoomBox(false); activateDrawFeature(false); @@ -366,6 +374,7 @@ activatePan(true); } + @Override public void disable() { activatePan(false); } @@ -380,6 +389,7 @@ protected DrawControl createDrawControl() { EnableDisableCmd cmd = new EnableDisableCmd() { + @Override public void enable() { activateZoomBox(false); activatePan(false); @@ -388,6 +398,7 @@ activateMeasureControl(false); } + @Override public void disable() { activateDrawFeature(false); } @@ -408,12 +419,14 @@ // this doesn't work here. After a feature has been selected, the layer // still has no selected features. opts.onSelect(new SelectFeature.SelectFeatureListener() { + @Override public void onFeatureSelected(VectorFeature feature) { floodMap.selectFeature(feature); } }); opts.onUnSelect(new SelectFeature.UnselectFeatureListener() { + @Override public void onFeatureUnselected(VectorFeature feature) { floodMap.disableFeature(feature); } @@ -423,6 +436,7 @@ getMap().addControl(selectFeature); EnableDisableCmd cmd = new EnableDisableCmd() { + @Override public void enable() { activateDrawFeature(false); activatePan(false); @@ -431,6 +445,7 @@ activateMeasureControl(false); } + @Override public void disable() { activateSelectFeature(false); floodMap.disableFeatures(); @@ -446,6 +461,7 @@ protected ImgButton createRemoveFeatureControl() { ImgButton remove = createButton(MSG.removeFeature(),new ClickHandler() { + @Override public void onClick(ClickEvent event) { Vector barriers = floodMap.getBarrierLayer(); VectorFeature[] features = barriers.getFeatures(); @@ -476,6 +492,7 @@ protected ImgButton createElevationControl() { ImgButton btn = createButton(MSG.adjustElevation(), new ClickHandler() { + @Override public void onClick(ClickEvent evt) { Vector barriers = floodMap.getBarrierLayer(); VectorFeature[] features = barriers.getFeatures(); @@ -527,6 +544,7 @@ protected MeasureControl createMeasureControl() { EnableDisableCmd cmd = new EnableDisableCmd() { + @Override public void enable() { activateDrawFeature(false); activatePan(false); @@ -535,6 +553,7 @@ activateGetFeatureInfo(false); } + @Override public void disable() { // do nothing } @@ -547,6 +566,7 @@ protected Button createDatacageControl() { Button btn = new Button(MSG.databasket()); btn.addClickHandler(new ClickHandler() { + @Override public void onClick(ClickEvent evt) { openDatacageWindow((MapOutputTab) getOutputTab()); } @@ -562,7 +582,7 @@ return null; } - ThemeList tl = ot.getCollection().getThemeList("floodmap"); + //ThemeList tl = ot.getCollection().getThemeList("floodmap"); getFeatureInfo = new GetFeatureInfo( getMap(), @@ -570,6 +590,7 @@ "gml"); EnableDisableCmd cmd = new EnableDisableCmd() { + @Override public void enable() { activateDrawFeature(false); activatePan(false); @@ -579,6 +600,7 @@ activateGetFeatureInfo(true); } + @Override public void disable() { activateGetFeatureInfo(false); } @@ -591,10 +613,24 @@ } + protected Button createManageThemesControl() { + Button btn = new Button(MSG.manageThemes()); + btn.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + ((MapOutputTab)getOutputTab()).toogleThemePanel(); + } + }); + return btn; + } + + protected ImgButton createWMSControl() { final String srs = floodMap.getRiverProjection(); ImgButton add = createButton(MSG.addWMS(), new ClickHandler() { + @Override public void onClick(ClickEvent event) { MapOutputTab ot = (MapOutputTab) getOutputTab(); new ExternalWMSWindow(ot, srs).start();