Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.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 | c057ef91b268 |
children | 6d749af6a9c2 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Fri Jul 13 10:09:20 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Fri Jul 13 11:31:25 2012 +0000 @@ -1,35 +1,31 @@ package de.intevation.flys.client.client.ui.map; -import java.util.List; - import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Widget; - import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.events.ResizedEvent; import com.smartgwt.client.widgets.events.ResizedHandler; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; -import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; -import org.gwtopenmaps.openlayers.client.Bounds; -import org.gwtopenmaps.openlayers.client.Map; -import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener; -import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener.FeatureAddedEvent; -import org.gwtopenmaps.openlayers.client.event.VectorFeatureRemovedListener; -import org.gwtopenmaps.openlayers.client.event.VectorFeatureRemovedListener.FeatureRemovedEvent; -import org.gwtopenmaps.openlayers.client.feature.VectorFeature; -import org.gwtopenmaps.openlayers.client.format.GeoJSON; -import org.gwtopenmaps.openlayers.client.layer.Layer; -import org.gwtopenmaps.openlayers.client.layer.Vector; -import org.gwtopenmaps.openlayers.client.layer.WMS; -import org.gwtopenmaps.openlayers.client.layer.WMSParams; -import org.gwtopenmaps.openlayers.client.layer.WMSOptions; - +import de.intevation.flys.client.client.Config; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.RedrawRequestEvent; +import de.intevation.flys.client.client.event.RedrawRequestHandler; +import de.intevation.flys.client.client.services.LoadArtifactService; +import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; +import de.intevation.flys.client.client.services.MapOutputService; +import de.intevation.flys.client.client.services.MapOutputServiceAsync; +import de.intevation.flys.client.client.services.StepForwardService; +import de.intevation.flys.client.client.services.StepForwardServiceAsync; +import de.intevation.flys.client.client.ui.CollectionView; +import de.intevation.flys.client.client.ui.OutputTab; +import de.intevation.flys.client.client.ui.ThemePanel; import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.ArtifactDescription; import de.intevation.flys.client.shared.model.AttributedTheme; @@ -40,25 +36,25 @@ import de.intevation.flys.client.shared.model.DefaultData; import de.intevation.flys.client.shared.model.DefaultDataItem; import de.intevation.flys.client.shared.model.MapConfig; +import de.intevation.flys.client.shared.model.OutputMode; import de.intevation.flys.client.shared.model.Recommendation; import de.intevation.flys.client.shared.model.Theme; import de.intevation.flys.client.shared.model.ThemeList; -import de.intevation.flys.client.shared.model.OutputMode; import de.intevation.flys.client.shared.model.WMSLayer; -import de.intevation.flys.client.client.Config; -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.services.LoadArtifactService; -import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; -import de.intevation.flys.client.client.services.StepForwardService; -import de.intevation.flys.client.client.services.StepForwardServiceAsync; -import de.intevation.flys.client.client.services.MapOutputService; -import de.intevation.flys.client.client.services.MapOutputServiceAsync; -import de.intevation.flys.client.client.event.RedrawRequestHandler; -import de.intevation.flys.client.client.event.RedrawRequestEvent; -import de.intevation.flys.client.client.ui.CollectionView; -import de.intevation.flys.client.client.ui.OutputTab; -import de.intevation.flys.client.client.ui.ThemePanel; +import java.util.List; + +import org.gwtopenmaps.openlayers.client.Bounds; +import org.gwtopenmaps.openlayers.client.Map; +import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener; +import org.gwtopenmaps.openlayers.client.event.VectorFeatureRemovedListener; +import org.gwtopenmaps.openlayers.client.feature.VectorFeature; +import org.gwtopenmaps.openlayers.client.format.GeoJSON; +import org.gwtopenmaps.openlayers.client.layer.Layer; +import org.gwtopenmaps.openlayers.client.layer.Vector; +import org.gwtopenmaps.openlayers.client.layer.WMS; +import org.gwtopenmaps.openlayers.client.layer.WMSOptions; +import org.gwtopenmaps.openlayers.client.layer.WMSParams; public class MapOutputTab @@ -88,6 +84,7 @@ protected MapToolbar controlPanel; protected ThemePanel themePanel; + protected Canvas themePanelCanvas; protected Widget mapPanel; protected FloodMap floodMap; @@ -104,10 +101,12 @@ collectionView.registerTabHandler(this); mapService.doOut(collection, new AsyncCallback<MapConfig>() { + @Override public void onFailure(Throwable caught) { GWT.log("MAP ERROR: " + caught.getMessage()); } + @Override public void onSuccess(MapConfig c) { GWT.log("MAP SUCCESS!"); @@ -144,7 +143,7 @@ hlayout.setWidth100(); hlayout.setMembersMargin(2); - final Canvas themePanelWrapper = createThemePanel(); + this.themePanelCanvas = createThemePanel(); controlPanel = createControlPanel(); mapPanel = floodMap.getMapWidget(); @@ -153,16 +152,17 @@ layout.setHeight("99%"); layout.add(mapPanel); - hlayout.addMember(themePanelWrapper); + hlayout.addMember(themePanelCanvas); hlayout.addMember(layout); rootLayout.addMember(controlPanel); rootLayout.addMember(hlayout); hlayout.addResizedHandler(new ResizedHandler() { + @Override public void onResized(ResizedEvent e) { Integer height = hlayout.getHeight(); - Integer width = hlayout.getWidth() - themePanelWrapper.getWidth(); + Integer width = hlayout.getWidth() - themePanelCanvas.getWidth(); height = height * 99 / 100; width = width * 99 / 100; @@ -182,6 +182,7 @@ Vector vector = floodMap.getBarrierLayer(); vector.addVectorFeatureAddedListener( new VectorFeatureAddedListener() { + @Override public void onFeatureAdded(FeatureAddedEvent e) { saveBarriers(); } @@ -190,6 +191,7 @@ vector.addVectorFeatureRemovedListener( new VectorFeatureRemovedListener() { + @Override public void onFeatureRemoved(FeatureRemovedEvent e) { saveBarriers(); } @@ -246,10 +248,12 @@ @Override public void onRedrawRequest(RedrawRequestEvent event) { mapService.doOut(collection, new AsyncCallback<MapConfig>() { + @Override public void onFailure(Throwable caught) { GWT.log("MAP ERROR: " + caught.getMessage()); } + @Override public void onSuccess(MapConfig c) { GWT.log("We want to refresh the map now!"); themePanel.updateCollection(); @@ -407,8 +411,8 @@ AttributedTheme at = (AttributedTheme) theme; - String type = at.getAttr("name"); - String desc = at.getAttr("description"); + //String type = at.getAttr("name"); + //String desc = at.getAttr("description"); String url = at.getAttr("url"); String layers = at.getAttr("layers"); @@ -454,11 +458,13 @@ mode, this, new MapThemePanel.ActivateCallback() { + @Override public void activate(Theme theme, boolean active) { activateTheme(theme, active); } }, new MapThemePanel.ThemeMovedCallback() { + @Override public void onThemeMoved(Theme theme, int oldIdx, int newIdx) { // this code synchronizes the ThemePanel and the OpenLayers // internal order of layers. @@ -479,6 +485,7 @@ } }, new MapThemePanel.LayerZoomCallback() { + @Override public void onLayerZoom(Theme theme, String extent) { Bounds zoomTo = boundsFromString(extent); @@ -530,11 +537,13 @@ feedService.go(locale, getArtifact(), new Data[] { data }, new AsyncCallback<Artifact>() { + @Override public void onFailure(Throwable caught) { GWT.log("Could not save barrier geometries: " + caught.getMessage()); } + @Override public void onSuccess(Artifact artifact) { GWT.log("Successfully saved barrier geometries."); } @@ -543,6 +552,7 @@ } + @Override public void onTabSelected(TabSelectedEvent tse) { if(floodMap == null) { return; @@ -555,5 +565,9 @@ floodMap.activateScaleLine(false); } } + + public void toogleThemePanel() { + this.themePanelCanvas.setVisible(!themePanelCanvas.isVisible()); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :