Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePairWidget.java @ 4253:a1bc5b8cff0f
Refactor GaugePanel to create it's own SectionStackSection
The GaugePanel constructor now creates a SectionStackSection instead of
using a provided one.
Improve the rendering of the GaugePanel by having access to the SmartGWT wrapper
(WidgetCanvas) object for the GWT Tree (GaugeTree) directly.
Add methods to close and open the section. Also add a getter for the section.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Thu, 25 Oct 2012 13:52:58 +0200 |
parents | 1755a1bfe5ce |
children | 5e6e89f19a37 |
rev | line source |
---|---|
899
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 import com.google.gwt.core.client.GWT; |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import com.smartgwt.client.widgets.Button; |
4183 | 6 |
7 import com.smartgwt.client.widgets.layout.VLayout; | |
8 import com.smartgwt.client.widgets.layout.HLayout; | |
9 | |
4182
ad2489b595d7
Fix for issue #967
Christian Lins <christian.lins@intevation.de>
parents:
3549
diff
changeset
|
10 import com.smartgwt.client.widgets.events.ClickHandler; |
4183 | 11 import com.smartgwt.client.widgets.events.ClickEvent; |
12 | |
899
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import com.smartgwt.client.widgets.grid.ListGrid; |
4183 | 14 |
15 import de.intevation.flys.client.shared.model.Artifact; | |
16 import de.intevation.flys.client.shared.model.User; | |
17 import de.intevation.flys.client.shared.model.ToLoad; | |
899
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.client.client.FLYSConstants; |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
899
diff
changeset
|
22 /** |
3549
6a8f83c538e3
Merged revisions 5384 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3533
diff
changeset
|
23 * Widget showing two Datacages and a add-this-button. |
6a8f83c538e3
Merged revisions 5384 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3533
diff
changeset
|
24 * Insert a record into a listgrid when add-this-button clicked. |
914
39a39e9be5af
Made DatacageTwinPanel somewhat usable.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
899
diff
changeset
|
25 */ |
899
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 public class DatacagePairWidget |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 extends VLayout |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 { |
3549
6a8f83c538e3
Merged revisions 5384 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3533
diff
changeset
|
29 /** i18n resource. */ |
3533
a4b2220e59a6
Change button title in DatacagePairWidget (#746).
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
30 protected FLYSConstants MSG = |
1284
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
31 GWT.create(FLYSConstants.class); |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1352
diff
changeset
|
32 |
1284
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
33 /** The "remote" ListGrid to insert data to when add-button is clicked. */ |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1352
diff
changeset
|
34 protected ListGrid grid; |
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1352
diff
changeset
|
35 |
1284
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
36 /** First (upper) DataCage Grid. */ |
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
37 protected DatacageWidget firstDatacageWidget; |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1352
diff
changeset
|
38 |
1284
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
39 /** Second (lower) DataCage Grid. */ |
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
40 protected DatacageWidget secondDatacageWidget; |
1298
b0ed67cb5197
Minor refactoring, improved displayed Strings in W-Diff branch.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1295
diff
changeset
|
41 |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1352
diff
changeset
|
42 |
1284
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
43 /** |
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
44 * |
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
45 * @param artifact Artifact to query datacage with. |
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
46 * @param user User to query datacage with. |
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
47 * @param outs outs to query datacage with. |
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
48 * @param grid Grid into which to insert selection of pairs. |
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
49 */ |
cdb1505a32f1
Fix messed up indentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1283
diff
changeset
|
50 public DatacagePairWidget(Artifact artifact, |
1283
e8bb11976c70
Neaten certain GUI aspects with W-Diff waterlevel-pair selection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
51 User user, |
e8bb11976c70
Neaten certain GUI aspects with W-Diff waterlevel-pair selection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
52 String outs, |
e8bb11976c70
Neaten certain GUI aspects with W-Diff waterlevel-pair selection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
53 ListGrid grid) { |
899
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 this.grid = grid; |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 |
1283
e8bb11976c70
Neaten certain GUI aspects with W-Diff waterlevel-pair selection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
56 HLayout hLayout = new HLayout(); |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
57 firstDatacageWidget = new DatacageWidget( |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
58 artifact, |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
59 user, |
2905
51ed89b754ae
FLYS client: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1352
diff
changeset
|
60 outs, |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
61 "load-system:true", |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
62 false); |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
63 secondDatacageWidget = new DatacageWidget( |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
64 artifact, |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
65 user, |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
66 outs, |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
67 "load-system:true", |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1301
diff
changeset
|
68 false); |
1283
e8bb11976c70
Neaten certain GUI aspects with W-Diff waterlevel-pair selection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
69 firstDatacageWidget.setIsMutliSelectable(false); |
e8bb11976c70
Neaten certain GUI aspects with W-Diff waterlevel-pair selection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
917
diff
changeset
|
70 secondDatacageWidget.setIsMutliSelectable(false); |
899
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 hLayout.addMember(firstDatacageWidget); |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 hLayout.addMember(secondDatacageWidget); |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 |
3533
a4b2220e59a6
Change button title in DatacagePairWidget (#746).
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
75 // TODO: icon |
a4b2220e59a6
Change button title in DatacagePairWidget (#746).
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
76 Button plusBtn = new Button(MSG.datacage_add_pair()); |
a4b2220e59a6
Change button title in DatacagePairWidget (#746).
Christian Lins <christian.lins@intevation.de>
parents:
2905
diff
changeset
|
77 plusBtn.setAutoFit(true); |
899
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
78 plusBtn.addClickHandler(new ClickHandler() { |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
79 @Override |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
80 public void onClick(ClickEvent event) { |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
81 plusClicked(); |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
82 } |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
83 }); |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
84 |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
85 addMember(hLayout); |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
86 addMember(plusBtn); |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
87 } |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
88 |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
89 |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
90 /** |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
91 * Callback for add-button. |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
92 * Fires to load for every selected element and handler. |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
93 */ |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
94 public void plusClicked() { |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
95 ToLoad toLoad1 = firstDatacageWidget.getSelection(); |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
96 ToLoad toLoad2 = secondDatacageWidget.getSelection(); |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
97 |
4183 | 98 // TODO further sanitize (toRecommendations.length) |
899
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
99 if (toLoad1 == null || toLoad2 == null) { |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
100 return; |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
101 } |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 |
4183 | 103 grid.addData(new RecommendationPairRecord( |
104 toLoad1.toRecommendations().get(0), | |
105 toLoad2.toRecommendations().get(0))); | |
899
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 } |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
107 } |
6e678b5d08a4
New widget for future use.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |