Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/wq/WTable.java @ 9801:1d7a72a50183 3.2.x tip
Assume Compose V2, consistently
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 23 Nov 2023 10:14:13 +0100 |
parents | 5e38e2924c07 |
children |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.client.ui.wq; |
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
|
10 |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
11 import java.util.Date; |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
12 |
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
|
13 import com.google.gwt.core.client.GWT; |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
14 import com.google.gwt.i18n.client.DateTimeFormat; |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
15 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
|
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 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
|
18 import com.smartgwt.client.types.SelectionStyle; |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
19 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
|
20 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
|
21 import com.smartgwt.client.widgets.grid.ListGridField; |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
22 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
|
23 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
24 import org.dive4elements.river.client.client.FLYSConstants; |
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
|
25 |
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
|
26 /** |
6666
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
27 * Table showing W main values. |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
28 * TODO becomes very similiar to QDTable. Probably mergeable. |
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
|
29 * @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
|
30 */ |
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 public class WTable 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
|
32 |
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 /** 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
|
34 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
|
35 |
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 |
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 public WTable() { |
6666
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
38 String baseUrl = GWT.getHostPageBaseURL(); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
39 |
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
|
40 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
|
41 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
|
42 setSelectionType(SelectionStyle.NONE); |
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
|
43 setSelectionType(SelectionStyle.NONE); |
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
|
44 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
|
45 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
|
46 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
|
47 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
|
48 |
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
|
49 ListGridField name = new ListGridField("name", MESSAGE.name()); |
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 |
7565
84107f13167c
issue1542: Include validity also in qdtable, reorder code, widen column width.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7557
diff
changeset
|
53 ListGridField type = new ListGridField("type", MESSAGE.type()); |
84107f13167c
issue1542: Include validity also in qdtable, reorder code, widen column width.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7557
diff
changeset
|
54 type.setType(ListGridFieldType.TEXT); |
84107f13167c
issue1542: Include validity also in qdtable, reorder code, widen column width.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7557
diff
changeset
|
55 type.setWidth("50"); |
84107f13167c
issue1542: Include validity also in qdtable, reorder code, widen column width.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7557
diff
changeset
|
56 |
8856 | 57 ListGridField startTime = createYearListGridField( |
58 "starttime", MESSAGE.starttime()); | |
7557
2ca1f3991e17
issue1542: Make WQInfoObjects and server provide start and end date for mainvalues, display in table.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
6666
diff
changeset
|
59 |
8856 | 60 ListGridField stopTime = createYearListGridField( |
61 "stoptime", MESSAGE.stoptime()); | |
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
|
62 |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
63 final NumberFormat nf = NumberFormat.getDecimalFormat(); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
64 |
2460
5659b5e8c9a8
#204 Modified i18n strings in WQD table.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1498
diff
changeset
|
65 ListGridField value = new ListGridField("value", MESSAGE.wq_value_w()); |
903
dd702348b878
Changed columns to the correct type for most tables.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
580
diff
changeset
|
66 value.setType(ListGridFieldType.FLOAT); |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
67 value.setCellFormatter(new CellFormatter() { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
68 @Override |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
69 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:
903
diff
changeset
|
70 if (v == null) { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
71 return null; |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
72 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
73 |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
74 try { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
75 double value = Double.valueOf(v.toString()); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
76 return nf.format(value); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
77 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
78 catch (NumberFormatException nfe) { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
79 return v.toString(); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
80 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
81 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
82 }); |
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
|
83 |
6666
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
84 ListGridField select = new ListGridField("select", MESSAGE.selection()); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
85 select.setType(ListGridFieldType.ICON); |
7590
a52b820c9006
Allow more compact display of mainvalue-table.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7588
diff
changeset
|
86 select.setWidth(60); |
6666
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
87 select.setCellIcon(baseUrl + MESSAGE.markerGreen()); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
88 |
7587
1244db8cd1d9
issue1542: Reorder columns for main value validity dates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7565
diff
changeset
|
89 setFields(select, name, startTime, stopTime, type, value); |
6666
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
90 hideField("select"); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
91 } |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
92 |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
93 public void showSelect() { |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
94 showField("select"); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
95 } |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
96 |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
97 public static ListGridField createYearListGridField( |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
98 final String propertyName, String displayName) { |
8856 | 99 ListGridField listGridField = new ListGridField( |
100 propertyName, displayName); | |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
101 listGridField.setType(ListGridFieldType.DATE); |
7590
a52b820c9006
Allow more compact display of mainvalue-table.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7588
diff
changeset
|
102 listGridField.setWidth("50"); |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
103 listGridField.setCellFormatter(createYearDateFormatter(propertyName)); |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
104 return listGridField; |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
105 } |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
106 |
8856 | 107 /** Create CellFormatter that prints just the year of a date |
108 * stored in attributeName. */ | |
109 private static CellFormatter createYearDateFormatter( | |
110 final String attributeName | |
111 ) { | |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
112 return new CellFormatter() { |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
113 @Override |
8856 | 114 public String format( |
115 Object arg0, ListGridRecord record, int arg2, int arg3) { | |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
116 Date date = record.getAttributeAsDate(attributeName); |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
117 if (date == null) { |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
118 return ""; |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
119 } |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
120 DateTimeFormat fmt = DateTimeFormat.getFormat("yyyy"); |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
121 return fmt.format(date); |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
122 } |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
123 }; |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
124 } |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
125 |
6666
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
126 |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
127 /** |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
128 * Search all records for one with attribute name equals to given name. |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
129 * @return null if none found. |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
130 * */ |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
131 public Double findRecordValue(String name) { |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
132 for (ListGridRecord record : getRecords()) { |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
133 if (record.getAttribute("name").equals(name)) { |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
134 return record.getAttributeAsDouble("value"); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
135 } |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
136 } |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
137 return null; |
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
|
138 } |
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
|
139 } |
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
|
140 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |