Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/wq/WTable.java @ 7588:1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 20 Nov 2013 11:03:26 +0100 |
parents | 1244db8cd1d9 |
children | a52b820c9006 |
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 |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
57 ListGridField startTime = createYearListGridField("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
|
58 |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
59 ListGridField stopTime = createYearListGridField("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
|
60 |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
61 final NumberFormat nf = NumberFormat.getDecimalFormat(); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
62 |
2460
5659b5e8c9a8
#204 Modified i18n strings in WQD table.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1498
diff
changeset
|
63 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
|
64 value.setType(ListGridFieldType.FLOAT); |
1498
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
65 value.setCellFormatter(new CellFormatter() { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
66 @Override |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
67 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
|
68 if (v == null) { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
69 return null; |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
70 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
71 |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
72 try { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
73 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
|
74 return nf.format(value); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
75 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
76 catch (NumberFormatException nfe) { |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
77 return v.toString(); |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
78 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
79 } |
ed16f28e9063
#196 Localize numbers in W/Q/D tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
903
diff
changeset
|
80 }); |
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
|
81 |
6666
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
82 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
|
83 select.setType(ListGridFieldType.ICON); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
84 select.setWidth(70); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
85 select.setCellIcon(baseUrl + MESSAGE.markerGreen()); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
86 |
7587
1244db8cd1d9
issue1542: Reorder columns for main value validity dates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7565
diff
changeset
|
87 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
|
88 hideField("select"); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
89 } |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
90 |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
91 public void showSelect() { |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
92 showField("select"); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
93 } |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
94 |
7588
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
95 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
|
96 final String propertyName, String displayName) { |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
97 ListGridField listGridField = new ListGridField(propertyName, displayName); |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
98 listGridField.setType(ListGridFieldType.DATE); |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
99 listGridField.setWidth("60"); |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
100 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
|
101 return listGridField; |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
102 } |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
103 |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
104 /** Create CellFormatter that prints just the year of a date stored in attributeName. */ |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
105 private static CellFormatter createYearDateFormatter(final String attributeName) { |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
106 return new CellFormatter() { |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
107 @Override |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
108 public String format(Object arg0, ListGridRecord record, int arg2, int arg3) { |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
109 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
|
110 if (date == null) { |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
111 return ""; |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
112 } |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
113 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
|
114 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
|
115 } |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
116 }; |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
117 } |
1f2f64d244fc
issue1542: Only show year of date for mainvalues validity, refactoring.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7587
diff
changeset
|
118 |
6666
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
119 |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
120 /** |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
121 * 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
|
122 * @return null if none found. |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
123 * */ |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
124 public Double findRecordValue(String name) { |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
125 for (ListGridRecord record : getRecords()) { |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
126 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
|
127 return record.getAttributeAsDouble("value"); |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
128 } |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
129 } |
3c4c0ea52bbb
issue1259: in WQAdaptedInputPanel (vollmer w/q-input) allow
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
5993
diff
changeset
|
130 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
|
131 } |
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
|
132 } |
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
|
133 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |