Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/InfoTree.java @ 4269:0c766c475805
Add Panel and Tree UI classes for dispayling the measurement station info
The new ui classes are using the new extracted base class InfoPanel and InfoTree
which are in common with the gauge info.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 26 Oct 2012 12:22:06 +0200 |
parents | f75968f0ce80 |
children |
rev | line source |
---|---|
4268
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.client.ui; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
3 import java.util.Iterator; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
4 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
5 import com.google.gwt.core.client.GWT; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
6 import com.google.gwt.user.client.ui.ScrollPanel; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
7 import com.google.gwt.user.client.ui.Tree; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
8 import com.google.gwt.user.client.ui.TreeItem; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
9 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.client.client.FLYS; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.client.client.FLYSConstants; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.client.shared.model.Data; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.client.shared.model.DataList; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.client.shared.model.RiverInfo; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 /** |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
17 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 */ |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 public abstract class InfoTree extends ScrollPanel { |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 protected FLYS flys; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 protected Tree tree; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 protected DataList[] data; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 /** The message class that provides i18n strings.*/ |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
26 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 public void openAll() { |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
29 for (Iterator<TreeItem> it = tree.treeItemIterator(); it.hasNext();) { |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 TreeItem item = it.next(); |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 item.setState(true); |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
32 } |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 } |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
34 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
35 public void setData(DataList[] data) { |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
36 this.data = data; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
37 if (tree.getItemCount() > 0) { |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
38 open(); |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 } |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
40 } |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 protected Double getDoubleValue(Data d) { |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
43 String tmp = d.getStringValue(); |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
44 if (tmp != null) { |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
45 return Double.valueOf(tmp); |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
46 } |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 return null; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
48 } |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
50 public abstract void open() ; |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
51 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
52 public abstract void setRiverInfo(RiverInfo riverinfo); |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
53 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
54 |
f75968f0ce80
Refactor GaugePanel and GaugeInfo to extract a base class
Björn Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
55 } |