annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/range/LocationsTable.java @ 1399:748e7c828d03

Issue312. Moved images and get image urls from constants to completly support IE7. flys-client/trunk@3284 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 17 Nov 2011 14:10:51 +0000
parents 39acba4b5f0b
children 047a44270348
rev   line source
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui.range;
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import com.google.gwt.core.client.GWT;
906
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
4 import com.google.gwt.i18n.client.NumberFormat;
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import com.smartgwt.client.types.ListGridFieldType;
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import com.smartgwt.client.types.SelectionStyle;
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import com.smartgwt.client.widgets.grid.ListGrid;
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import com.smartgwt.client.widgets.grid.ListGridField;
906
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
10 import com.smartgwt.client.widgets.grid.ListGridRecord;
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
11
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
12 import com.smartgwt.client.widgets.grid.CellFormatter;
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import de.intevation.flys.client.client.FLYSConstants;
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.flys.client.client.FLYSImages;
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 /**
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 */
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 public class LocationsTable extends ListGrid {
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 /** The message class that provides i18n strings.*/
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public LocationsTable() {
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
28
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
29 String baseUrl = GWT.getHostPageBaseURL();
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
30
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 setWidth100();
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 setHeight100();
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 setSelectionType(SelectionStyle.SINGLE);
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 setSelectionType(SelectionStyle.SINGLE);
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 setShowHeaderContextMenu(false);
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 setShowRecordComponents(true);
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 setShowRecordComponentsByCell(true);
876
dbaef661d0e5 Changed i18n string for empty table and set header fields to fixed order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 781
diff changeset
38 setEmptyMessage(MSG.empty_filter());
dbaef661d0e5 Changed i18n string for empty table and set header fields to fixed order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 781
diff changeset
39 setCanReorderFields(false);
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 ListGridField addfrom = new ListGridField ("", "");
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 addfrom.setType(ListGridFieldType.ICON);
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 addfrom.setWidth(20);
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
44 addfrom.setCellIcon(baseUrl + MSG.markerGreen());
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 ListGridField addto = new ListGridField("", "");
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 addto.setType(ListGridFieldType.ICON);
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 addto.setWidth(20);
1399
748e7c828d03 Issue312.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 906
diff changeset
49 addto.setCellIcon(baseUrl + MSG.markerRed());
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 ListGridField ldescr = new ListGridField(
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 "description", MSG.description());
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 ldescr.setType(ListGridFieldType.TEXT);
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 ldescr.setWidth("*");
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 ListGridField lside = new ListGridField("riverside", MSG.riverside());
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 lside.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
58 lside.setWidth("12%");
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 ListGridField loc = new ListGridField("from", MSG.locations());
903
dd702348b878 Changed columns to the correct type for most tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 886
diff changeset
61 loc.setType(ListGridFieldType.FLOAT);
906
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
62 loc.setCellFormatter(new CellFormatter() {
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
63 public String format(
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
64 Object value,
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
65 ListGridRecord record,
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
66 int rowNum, int colNum) {
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
67 if (value == null) return null;
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
68 try {
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
69 NumberFormat nf;
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
70 double v = Double.parseDouble((String)value);
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
71 nf = NumberFormat.getFormat("###0.00##");
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
72 return nf.format(v);
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
73 }
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
74 catch (Exception e) {
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
75 return value.toString();
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
76 }
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
77 }
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
78 }
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
79 );
39acba4b5f0b Added formatter for numeric columns that converts the decimal separator.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 903
diff changeset
80
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
81 loc.setWidth("12%");
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 ListGridField bottom = new ListGridField("bottom", MSG.bottom_edge());
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 bottom.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
85 bottom.setWidth("10%");
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 ListGridField top = new ListGridField("top", MSG.top_edge());
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 top.setType(ListGridFieldType.TEXT);
886
2161d3acc83f Changed field size from fixed to percental value in helper tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 876
diff changeset
89 top.setWidth("10%");
781
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 setFields(addfrom, addto, ldescr, loc, lside, bottom, top);
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 }
6653cf54b45d The distance panel got two tables for locations and ranges. Both do not load any data until now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org