changeset 1390:13d07b7daa89

Issue 342. The tables have now a unified design. All columns are set to left align and decimal separators are set to ',' in german and '.' in the english version. flys-client/trunk@3220 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 10 Nov 2011 13:38:36 +0000
parents d29a9fa10313
children f554dce42d66
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java
diffstat 2 files changed, 79 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Nov 09 18:00:12 2011 +0000
+++ b/flys-client/ChangeLog	Thu Nov 10 13:38:36 2011 +0000
@@ -1,3 +1,12 @@
+2011-11-10  Raimund Renkert <raimund.renkert@intevation.de>
+
+	Issue 342
+
+	* src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java:
+	  The tables have now a unified design. All columns are set to left
+	  align and decimal separators are set to ',' in german and '.' in the
+	  english version.
+
 2011-11-09  Raimund Renkert <raimund.renkert@intevation.de>
 
 	Issue 265.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Wed Nov 09 18:00:12 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Thu Nov 10 13:38:36 2011 +0000
@@ -35,6 +35,7 @@
 import com.smartgwt.client.data.Record;
 
 import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.Alignment;
 
 import de.intevation.flys.client.shared.model.Data;
 import de.intevation.flys.client.shared.model.DataItem;
@@ -208,6 +209,24 @@
         distanceTable.setEmptyMessage(MESSAGES.empty_filter());
         distanceTable.setCanReorderFields(false);
 
+        CellFormatter cf = new CellFormatter() {
+            public String format(
+                Object value,
+                ListGridRecord record,
+                int rowNum, int colNum) {
+                    if (value == null) return null;
+                    try {
+                        NumberFormat nf;
+                        double v = Double.parseDouble((String)value);
+                        nf = NumberFormat.getFormat("###0.00##");
+                        return nf.format(v);
+                    }
+                    catch (Exception e) {
+                        return value.toString();
+                    }
+            }
+        };
+
         ListGridField addDistance = new ListGridField ("", "");
         addDistance.setType (ListGridFieldType.ICON);
         addDistance.setWidth (20);
@@ -260,48 +279,15 @@
         ddescr.setType(ListGridFieldType.TEXT);
         ddescr.setWidth("*");
         ListGridField from = new ListGridField("from", MESSAGES.from());
-        from.setCellFormatter(new CellFormatter() {
-            public String format(
-                Object value,
-                ListGridRecord record,
-                int rowNum, int colNum) {
-                    if (value == null) return null;
-                    try {
-                        NumberFormat nf;
-                        double v = Double.parseDouble((String)value);
-                        nf = NumberFormat.getFormat("###0.00##");
-                        return nf.format(v);
-                    }
-                    catch (Exception e) {
-                        return value.toString();
-                    }
-                }
-            }
-        );
+        from.setCellFormatter(cf);
 
         from.setWidth("12%");
         ListGridField to = new ListGridField("to", MESSAGES.to());
         to.setType(ListGridFieldType.FLOAT);
-        to.setCellFormatter(new CellFormatter() {
-            public String format(
-                Object value,
-                ListGridRecord record,
-                int rowNum, int colNum) {
-                    if (value == null) return null;
-                    try {
-                        NumberFormat nf;
-                        double v = Double.parseDouble((String)value);
-                        nf = NumberFormat.getFormat("###0.00##");
-                        return nf.format(v);
-                    }
-                    catch (Exception e) {
-                        return value.toString();
-                    }
-                }
-            }
-        );
+        to.setCellFormatter(cf);
 
         to.setWidth("12%");
+        to.setAlign(Alignment.LEFT);
         ListGridField dside = new ListGridField("riverside",
                 MESSAGES.riverside());
         dside.setType(ListGridFieldType.TEXT);
@@ -311,11 +297,13 @@
             new ListGridField("bottom", MESSAGES.bottom_edge());
         bottom.setType(ListGridFieldType.TEXT);
         bottom.setWidth("10%");
+        bottom.setCellFormatter(cf);
 
         ListGridField top =
             new ListGridField("top", MESSAGES.top_edge());
         top.setType(ListGridFieldType.TEXT);
         top.setWidth("10%");
+        top.setCellFormatter(cf);
 
         distanceTable.setFields(
             addDistance, ddescr, from, to, dside, bottom, top);
@@ -333,6 +321,26 @@
         locationsTable.setEmptyMessage(MESSAGES.empty_filter());
         locationsTable.setCanReorderFields(false);
 
+        CellFormatter cf = new CellFormatter() {
+            public String format(
+                Object value,
+                ListGridRecord record,
+                int rowNum, int colNum) {
+                    if (value == null) return null;
+                    try {
+                        NumberFormat nf;
+                        double v = Double.parseDouble((String)value);
+                        nf = NumberFormat.getFormat("###0.00##");
+                        return nf.format(v);
+                    }
+                    catch (Exception e) {
+                        return value.toString();
+                    }
+                }
+            };
+
+
+
         ListGridField addLocation = new ListGridField ("", "");
         addLocation.setType (ListGridFieldType.ICON);
         addLocation.setWidth (20);
@@ -374,18 +382,22 @@
         lside.setType(ListGridFieldType.TEXT);
         lside.setWidth("12%");
         ListGridField loc = new ListGridField("from", MESSAGES.locations());
+        loc.setAlign(Alignment.LEFT);
         loc.setType(ListGridFieldType.FLOAT);
         loc.setWidth("12%");
+        loc.setCellFormatter(cf);
 
         ListGridField bottom =
             new ListGridField("bottom", MESSAGES.bottom_edge());
         bottom.setType(ListGridFieldType.TEXT);
         bottom.setWidth("10%");
+        bottom.setCellFormatter(cf);
 
         ListGridField top =
             new ListGridField("top", MESSAGES.top_edge());
         top.setType(ListGridFieldType.TEXT);
         top.setWidth("10%");
+        top.setCellFormatter(cf);
 
         locationsTable.setFields(addLocation, ldescr, loc, lside, bottom, top);
     }
@@ -402,6 +414,24 @@
         locationDistanceTable.setEmptyMessage(MESSAGES.empty_filter());
         locationDistanceTable.setCanReorderFields(false);
 
+        CellFormatter cf = new CellFormatter() {
+            public String format(
+                Object value,
+                ListGridRecord record,
+                int rowNum, int colNum) {
+                    if (value == null) return null;
+                    try {
+                        NumberFormat nf;
+                        double v = Double.parseDouble((String)value);
+                        nf = NumberFormat.getFormat("###0.00##");
+                        return nf.format(v);
+                    }
+                    catch (Exception e) {
+                        return value.toString();
+                    }
+            }
+        };
+
         ListGridField addfrom = new ListGridField ("", "");
         addfrom.setType (ListGridFieldType.ICON);
         addfrom.setWidth (20);
@@ -444,11 +474,13 @@
             new ListGridField("bottom", MESSAGES.bottom_edge());
         bottom.setType(ListGridFieldType.TEXT);
         bottom.setWidth("10%");
+        bottom.setCellFormatter(cf);
 
         ListGridField top =
             new ListGridField("top", MESSAGES.top_edge());
         top.setType(ListGridFieldType.TEXT);
         top.setWidth("10%");
+        top.setCellFormatter(cf);
 
         ListGridField ldescr = new ListGridField("description",
                 MESSAGES.description());
@@ -460,7 +492,9 @@
         lside.setWidth("12%");
         ListGridField loc = new ListGridField("from", MESSAGES.locations());
         loc.setType(ListGridFieldType.FLOAT);
+        loc.setAlign(Alignment.LEFT);
         loc.setWidth("12%");
+        loc.setCellFormatter(cf);
 
         locationDistanceTable.setFields(
             addfrom, addto2, ldescr, loc, lside, bottom, top);

http://dive4elements.wald.intevation.org