Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfoWindow.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 | 8af500d62098 |
children | e0ab5a566688 |
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.Label; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.shared.model.FeatureInfo; import java.util.List; import java.util.Map; import java.util.Set; import org.gwtopenmaps.openlayers.client.feature.VectorFeature; import org.gwtopenmaps.openlayers.client.util.Attributes; import org.gwtopenmaps.openlayers.client.util.JSObject; public class GetFeatureInfoWindow extends Window { protected FLYSConstants MSG = GWT.create(FLYSConstants.class); protected List<FeatureInfo> features; public static final int ROW_HEIGHT = 25; public GetFeatureInfoWindow(List<FeatureInfo> features) { super(); this.features = features; initLayout(); } protected void initLayout() { VLayout root = new VLayout(); for (FeatureInfo feature: features) { root.addMember(createFeatureRow(feature)); } addItem(root); setWidth(500); setHeight(500); setTitle(MSG.getFeatureInfoWindowTitle()); setIsModal(true); setShowModalMask(true); centerInPage(); } protected HLayout createFeatureRow(FeatureInfo feature) { HLayout r = new HLayout(); r.setHeight(ROW_HEIGHT); r.setStyleName("featureinfo-row"); r.setMembersMargin(5); Label l = new Label("Layer: " + feature.getLayername()); l.setHeight(ROW_HEIGHT); l.setWrap(false); r.addMember(l); Map<String, String> attrs = feature.getAttrs(); Set<Map.Entry<String, String>> entries = attrs.entrySet(); for (Map.Entry<String, String> entry: entries) { Label attr = new Label(entry.getKey() + ": " + entry.getValue()); attr.setHeight(ROW_HEIGHT); r.addMember(attr); } return r; } protected String[][] extractProperties(VectorFeature feature) { Attributes tmp = feature.getAttributes(); JSObject jsobj = tmp.getJSObject(); String tmpNames = jsobj.getPropertyNames(); String[] allNames = tmpNames.split(","); String[][] attr = new String[allNames.length][]; for (int i = 0, n = attr.length; i < n; i++) { attr[i] = new String[] { allNames[i], jsobj.getPropertyAsString(allNames[i]) }; } return attr; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :