Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPanel.java @ 5462:f2371f3aaf03
Show top level folder icons only if node has no factory
If you have an empty folder the folder icon is still shown.
This makes it possible to add functional "Top Level" entries
in the Datacage
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 26 Mar 2013 18:29:13 +0100 |
parents | 95e23bcf6a50 |
children | ef32ab3c1679 |
line wrap: on
line source
package de.intevation.flys.client.client.ui.map; import com.google.gwt.core.client.GWT; import com.smartgwt.client.widgets.events.ParentMovedEvent; import com.smartgwt.client.widgets.events.ParentMovedHandler; import com.smartgwt.client.widgets.events.ResizedEvent; import com.smartgwt.client.widgets.events.ResizedHandler; import com.smartgwt.client.widgets.layout.VLayout; import de.intevation.flys.client.shared.model.BBox; import de.intevation.flys.client.shared.model.MapInfo; import org.gwtopenmaps.openlayers.client.Bounds; import org.gwtopenmaps.openlayers.client.MapWidget; /** * Panel that contains a MapWidget and a MapToolbar. * This panel is used by the flood map calculation input helper. */ public class MapPanel extends VLayout { protected MapToolbar toolbar; protected FloodMap floodMap; protected MapWidget floodMapWidget; protected boolean digitizeEnabled; public MapPanel(MapInfo mapInfo, boolean digitizeEnabled) { BBox bbox = mapInfo.getBBox(); this.digitizeEnabled = digitizeEnabled; this.floodMap = new FloodMap( String.valueOf(mapInfo.getSrid()), new Bounds( bbox.getLowerX(), bbox.getLowerY(), bbox.getUpperX(), bbox.getUpperY()), 640, 480); initLayout(); } private void initLayout() { setWidth100(); setHeight100(); floodMapWidget = floodMap.getMapWidget(); toolbar = new MapToolbar(floodMap, digitizeEnabled); addMember(toolbar); addMember(floodMapWidget); addResizedHandler(new ResizedHandler() { @Override public void onResized(ResizedEvent event) { doLayout(); } }); addParentMovedHandler(new ParentMovedHandler() { @Override public void onParentMoved(ParentMovedEvent event) { floodMapWidget.getMap().updateSize(); } }); } protected void doLayout() { int width = getWidth(); int height = getHeight(); GWT.log("MapPanel.size: " + width + "x" + height); width -= 2; // minus black borders height -= toolbar.getHeight() + 4; if (width < 0 || height < 0) { GWT.log("MapPanel: Oops what a size!"); return; } floodMapWidget.setSize(Integer.toString(width), Integer.toString(height)); floodMapWidget.getMap().updateSize(); } public FloodMap getFloodMap() { return floodMap; } public MapToolbar getMapToolbar () { return toolbar; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :