Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/QDTable.java @ 3518:33ed40aa1201
User ModuleService to get all modules for a user
Don't hardcode the Modules instead load them from the ModuleService. This allows
to show only modules that a user is allowed to access.
flys-client/trunk@5292 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Wed, 29 Aug 2012 12:38:06 +0000 |
parents | 5659b5e8c9a8 |
children | 14774fb42054 |
rev | line source |
---|---|
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui.wq; |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import com.google.gwt.core.client.GWT; |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
4 import com.google.gwt.i18n.client.NumberFormat; |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import com.smartgwt.client.types.ListGridFieldType; |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import com.smartgwt.client.types.SelectionStyle; |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
8 import com.smartgwt.client.widgets.grid.CellFormatter; |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import com.smartgwt.client.widgets.grid.ListGrid; |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import com.smartgwt.client.widgets.grid.ListGridField; |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
11 import com.smartgwt.client.widgets.grid.ListGridRecord; |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.client.client.FLYSConstants; |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 /** |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 */ |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 public class QDTable extends ListGrid { |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** The message class that provides i18n strings.*/ |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 protected FLYSConstants MESSAGE = GWT.create(FLYSConstants.class); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
1369
1fae113b93fd
Issue 118/203.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
912
diff
changeset
|
25 protected boolean lockClick; |
1fae113b93fd
Issue 118/203.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
912
diff
changeset
|
26 |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 public QDTable() { |
1399 | 28 String baseUrl = GWT.getHostPageBaseURL(); |
29 | |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 setWidth100(); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 setHeight100(); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 setSelectionType(SelectionStyle.SINGLE); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 setSelectionType(SelectionStyle.SINGLE); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 setShowHeaderContextMenu(false); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 setShowRecordComponents(true); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 setShowRecordComponentsByCell(true); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 setEmptyMessage(MESSAGE.empty_table()); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
912
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
39 ListGridField addMax = new ListGridField("max", ""); |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
40 addMax.setType(ListGridFieldType.ICON); |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
41 addMax.setWidth(30); |
1399 | 42 addMax.setCellIcon(baseUrl + MESSAGE.markerRed()); |
912
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
43 |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
44 ListGridField addMin = new ListGridField("min", ""); |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
45 addMin.setType(ListGridFieldType.ICON); |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
46 addMin.setWidth(30); |
1399 | 47 addMin.setCellIcon(baseUrl + MESSAGE.markerGreen()); |
912
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
48 |
904
1e08a5b0add9
Changed table header string and set the column width to percental value.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
903
diff
changeset
|
49 ListGridField name = new ListGridField("name", MESSAGE.discharge()); |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 name.setType(ListGridFieldType.TEXT); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 name.setWidth("*"); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 ListGridField type = new ListGridField("type", MESSAGE.type()); |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 type.setType(ListGridFieldType.TEXT); |
904
1e08a5b0add9
Changed table header string and set the column width to percental value.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
903
diff
changeset
|
55 type.setWidth("20%"); |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
57 final NumberFormat nf = NumberFormat.getDecimalFormat(); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
58 |
2460
5659b5e8c9a8
#204 Modified i18n strings in WQD table.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1498
diff
changeset
|
59 ListGridField value = new ListGridField("value", MESSAGE.wq_value_q()); |
903
dd702348b878
Changed columns to the correct type for most tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
894
diff
changeset
|
60 value.setType(ListGridFieldType.FLOAT); |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
61 value.setCellFormatter(new CellFormatter() { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
62 @Override |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
63 public String format(Object v, ListGridRecord r, int row, int col) { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
64 if (v == null) { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
65 return null; |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
66 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
67 |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
68 try { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
69 double value = Double.valueOf(v.toString()); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
70 return nf.format(value); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
71 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
72 catch (NumberFormatException nfe) { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
73 return v.toString(); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
74 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
75 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1401
diff
changeset
|
76 }); |
904
1e08a5b0add9
Changed table header string and set the column width to percental value.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
903
diff
changeset
|
77 value.setWidth("20%"); |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 |
912
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
79 setFields(addMax, addMin, name, type, value); |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 } |
912
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
81 |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
82 public void hideIconFields () { |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
83 hideField("max"); |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
84 hideField("min"); |
1369
1fae113b93fd
Issue 118/203.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
912
diff
changeset
|
85 lockClick = true; |
912
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
86 } |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
87 |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
88 |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
89 public void showIconFields() { |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
90 showField("max"); |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
91 showField("min"); |
1369
1fae113b93fd
Issue 118/203.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
912
diff
changeset
|
92 lockClick = false; |
1fae113b93fd
Issue 118/203.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
912
diff
changeset
|
93 } |
1fae113b93fd
Issue 118/203.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
912
diff
changeset
|
94 |
1fae113b93fd
Issue 118/203.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
912
diff
changeset
|
95 public boolean isLocked() { |
1fae113b93fd
Issue 118/203.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
912
diff
changeset
|
96 return lockClick; |
912
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
97 } |
2c8f1112be37
Rollback for input assistance of "Q/D" table.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
904
diff
changeset
|
98 |
580
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 } |
42512fce9b1b
#140, #122: Splitted the WQD table in the WQInputPanel into two tables: a table for QD values and a table for W values - only the QD table is selectable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |