[Dive4elements-commits] [PATCH] Rework FeatureInfo Window fopr issue 775
Wald Commits
scm-commit at wald.intevation.org
Wed Apr 24 15:04:57 CEST 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1366808294 -7200
# Node ID e0ab5a566688d9069dd242abc6b8a0d91d62553b
# Parent c24820c235d933f3f97ca37f5ef112e80d27f5c3
Rework FeatureInfo Window fopr issue 775
Looks much better now :)
diff -r c24820c235d9 -r e0ab5a566688 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed Apr 24 14:51:55 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed Apr 24 14:58:14 2013 +0200
@@ -1262,5 +1262,7 @@
String requireTheme();
+ String PATH();
+
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r c24820c235d9 -r e0ab5a566688 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed Apr 24 14:51:55 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed Apr 24 14:58:14 2013 +0200
@@ -389,7 +389,7 @@
removeFeature = images/removeFeature.png
getFeatureInfo = images/info.png
getFeatureInfoTooltip = Information Tool
-getFeatureInfoWindowTitle = Informations for Map Layers.
+getFeatureInfoWindowTitle = Information for Map Layer:
addWMS = images/add_map.png
printMapSettings = images/print_map_settings.png
addWMSTooltip = Load layers from external WMS service.
@@ -664,3 +664,5 @@
mapDate = Place, Date
mapLogo = Logo
+# Get Feature Info Window
+PATH = Path
diff -r c24820c235d9 -r e0ab5a566688 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed Apr 24 14:51:55 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed Apr 24 14:58:14 2013 +0200
@@ -389,7 +389,7 @@
removeFeature = images/removeFeature.png
getFeatureInfo = images/info.png
getFeatureInfoTooltip = Informationswerkzeug
-getFeatureInfoWindowTitle = Informationen zu Kartenebenen
+getFeatureInfoWindowTitle = Information zur Kartenebene:
addWMS = images/add_map.png
printMapSettings = images/print_map_settings.png
addWMSTooltip = Laden von Kartenebenen eines externen WMS Dienstes.
@@ -662,3 +662,6 @@
mapSource = Datenquelle
mapDate = Ort, Datum
mapLogo = Logo
+
+# Get Feature Info Window
+PATH = Dateipfad
diff -r c24820c235d9 -r e0ab5a566688 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Wed Apr 24 14:51:55 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Wed Apr 24 14:58:14 2013 +0200
@@ -387,7 +387,7 @@
removeFeature = images/removeFeature.png
getFeatureInfo = images/info.png
getFeatureInfoTooltip = Information Tool
-getFeatureInfoWindowTitle = Informations for Map Layers.
+getFeatureInfoWindowTitle = Information for Map Layer:
addWMS = images/add_map.png
printMapSettings = images/print_map_settings.png
addWMSTooltip = Load layers from external WMS service.
@@ -612,3 +612,7 @@
measurement_station_url = https://flys-intern.intevation.de/MessstellenInfo/
measurement_station_info_link = Measurement Station Info
measurement_station_gauge_name = Reference Gauge
+
+# Get Feature Info Window
+PATH = Path
+
diff -r c24820c235d9 -r e0ab5a566688 flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfo.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfo.java Wed Apr 24 14:51:55 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfo.java Wed Apr 24 14:58:14 2013 +0200
@@ -20,6 +20,7 @@
import de.intevation.flys.client.client.services.GFIServiceAsync;
import de.intevation.flys.client.shared.model.FacetRecord;
import de.intevation.flys.client.shared.model.Theme;
+import de.intevation.flys.client.shared.model.AttributedTheme;
import de.intevation.flys.client.client.ui.ThemePanel;
@@ -59,12 +60,12 @@
}
- protected void newGetFeatureInfoWindow(List<FeatureInfo> features) {
+ protected void newGetFeatureInfoWindow(List<FeatureInfo> features, String title) {
if (gfiWindow != null) {
gfiWindow.destroy();
}
- gfiWindow = new GetFeatureInfoWindow(features);
+ gfiWindow = new GetFeatureInfoWindow(features, title);
gfiWindow.show();
}
@@ -80,6 +81,7 @@
for (ListGridRecord rec : themePanel.getSelectedRecords()) {
Theme act_theme = ((FacetRecord)rec).getTheme();
+ final AttributedTheme at = (AttributedTheme)act_theme;
gfiService.query(
act_theme,
infoFormat,
@@ -97,7 +99,7 @@
@Override
public void onSuccess(List<FeatureInfo> features) {
if (features != null && !features.isEmpty())
- newGetFeatureInfoWindow(features);
+ newGetFeatureInfoWindow(features, at.getAttr("description"));
}
}
);
diff -r c24820c235d9 -r e0ab5a566688 flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfoWindow.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfoWindow.java Wed Apr 24 14:51:55 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfoWindow.java Wed Apr 24 14:58:14 2013 +0200
@@ -4,15 +4,19 @@
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 com.smartgwt.client.widgets.viewer.DetailViewer;
+import com.smartgwt.client.widgets.viewer.DetailViewerField;
+import com.smartgwt.client.widgets.viewer.DetailViewerRecord;
import de.intevation.flys.client.client.FLYSConstants;
import de.intevation.flys.client.shared.model.FeatureInfo;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.MissingResourceException;
import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
import org.gwtopenmaps.openlayers.client.util.Attributes;
@@ -25,13 +29,16 @@
protected List<FeatureInfo> features;
+ protected String title;
+
public static final int ROW_HEIGHT = 25;
- public GetFeatureInfoWindow(List<FeatureInfo> features) {
+ public GetFeatureInfoWindow(List<FeatureInfo> features, String title) {
super();
this.features = features;
+ this.title = title;
initLayout();
}
@@ -41,44 +48,60 @@
VLayout root = new VLayout();
for (FeatureInfo feature: features) {
- root.addMember(createFeatureRow(feature));
+ // Currently this should alway be only one
+ root.addMember(createFeatureViewer(feature));
+ setTitle(MSG.getFeatureInfoWindowTitle() + " " + title);
}
addItem(root);
setWidth(500);
- setHeight(500);
- setTitle(MSG.getFeatureInfoWindowTitle());
+ setHeight(300);
- setIsModal(true);
- setShowModalMask(true);
+ setIsModal(false);
+// 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);
+ protected DetailViewer createFeatureViewer(FeatureInfo feature) {
+ DetailViewer detailViewer = new DetailViewer();
+ detailViewer.setWidth(487);
Map<String, String> attrs = feature.getAttrs();
Set<Map.Entry<String, String>> entries = attrs.entrySet();
+ List <DetailViewerField> fields = new ArrayList<DetailViewerField>();
+ DetailViewerRecord dr = new DetailViewerRecord();
+
+ DetailViewerField path_field = null; // Make sure path is always the last element
for (Map.Entry<String, String> entry: entries) {
- Label attr = new Label(entry.getKey() + ": " + entry.getValue());
- attr.setHeight(ROW_HEIGHT);
+ String localized;
+ try {
+ localized = MSG.getString(entry.getKey());
+ } catch (MissingResourceException mre) {
+ localized = entry.getKey();
+// We filter unwanted information by localization
+// Uncomment to filter out unlocalized elements
+// continue;
+ }
+ if (entry.getKey().equals("PATH")) {
+ path_field = new DetailViewerField(entry.getKey(), localized);
+ } else {
+ fields.add(new DetailViewerField(entry.getKey(), localized));
+ }
+ dr.setAttribute(entry.getKey(), entry.getValue());
+ }
+ if (path_field != null)
+ fields.add(path_field);
- r.addMember(attr);
- }
+ DetailViewerField[] fieldArray = new DetailViewerField[fields.size()];
+ detailViewer.setFields(fields.toArray(fieldArray));
+ detailViewer.setData(new DetailViewerRecord[]{dr});
+ detailViewer.setCanSelectText(true);
- return r;
+ return detailViewer;
}
More information about the Dive4elements-commits
mailing list