Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java @ 1593:ff9d71469b7c
Adjusted to be able to feed data to reference curves.
flys-client/trunk@3902 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 03 Feb 2012 13:57:27 +0000 |
parents | 8ab010967f78 |
children | ddf43791244c |
comparison
equal
deleted
inserted
replaced
1592:f34bbb5fb6d2 | 1593:ff9d71469b7c |
---|---|
36 import de.intevation.flys.client.client.ui.range.DistanceInfoDataSource; | 36 import de.intevation.flys.client.client.ui.range.DistanceInfoDataSource; |
37 | 37 |
38 | 38 |
39 /** | 39 /** |
40 * This UIProvider serves as base for UI Providers to enter a single location (km). | 40 * This UIProvider serves as base for UI Providers to enter a single location (km). |
41 * | |
42 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
43 */ | 41 */ |
44 public abstract class LocationPanel | 42 public abstract class LocationPanel |
45 extends AbstractUIProvider | 43 extends AbstractUIProvider |
46 { | 44 { |
47 /** A container that will contain the location or the distance panel. */ | 45 /** A container that will contain the location or the distance panel. */ |
54 protected double max; | 52 protected double max; |
55 | 53 |
56 /** The values entered in the location mode. */ | 54 /** The values entered in the location mode. */ |
57 protected double[] values; | 55 protected double[] values; |
58 | 56 |
57 /** Name of the data item that keeps this location(s). */ | |
58 protected String dataItemName; | |
59 | |
59 /** The input panel for locations. */ | 60 /** The input panel for locations. */ |
60 protected DoubleArrayPanel locationPanel; | 61 protected DoubleArrayPanel locationPanel; |
61 | 62 |
62 /** Name of the data item that keeps locations. */ | |
63 protected String DATA_ITEM_NAME = "ld_locations"; | |
64 | 63 |
65 /** | 64 /** |
66 * Creates a new LocationDistancePanel instance. | 65 * Creates a new LocationDistancePanel instance. |
67 */ | 66 */ |
68 public LocationPanel() { | 67 public LocationPanel() { |
78 * | 77 * |
79 * @return a panel. | 78 * @return a panel. |
80 */ | 79 */ |
81 @Override | 80 @Override |
82 public Canvas create(DataList data) { | 81 public Canvas create(DataList data) { |
82 findDataItemName(data); | |
83 | |
83 VLayout layout = new VLayout(); | 84 VLayout layout = new VLayout(); |
84 layout.setMembersMargin(10); | 85 layout.setMembersMargin(10); |
85 | 86 |
86 Label label = new Label(MSG.location ()); | 87 Label label = new Label(MSG.location ()); |
87 Canvas widget = createWidget(data); | 88 Canvas widget = createWidget(data); |
98 | 99 |
99 return layout; | 100 return layout; |
100 } | 101 } |
101 | 102 |
102 | 103 |
104 public void findDataItemName(DataList list) { | |
105 this.dataItemName = list.getAll().get(0).getLabel(); | |
106 } | |
107 | |
108 | |
109 public String getDataItemName() { | |
110 return this.dataItemName; | |
111 } | |
112 | |
103 | 113 |
104 /** | 114 /** |
105 * This method creates a Canvas element showing the old Data objects in the | 115 * This method creates a Canvas element showing the old Data objects in the |
106 * DataList <i>data</i>. | 116 * DataList <i>data</i>. |
107 */ | 117 */ |
108 public Canvas createOld(DataList dataList) { | 118 public Canvas createOld(DataList dataList) { |
119 findDataItemName(dataList); | |
120 | |
109 List<Data> items = dataList.getAll(); | 121 List<Data> items = dataList.getAll(); |
110 Data dLocation = getData(items, DATA_ITEM_NAME); | 122 Data dLocation = getData(items, getDataItemName()); |
111 DataItem[] loc = dLocation.getItems(); | 123 DataItem[] loc = dLocation.getItems(); |
112 | 124 |
113 HLayout layout = new HLayout(); | 125 HLayout layout = new HLayout(); |
114 layout.setWidth("400px"); | 126 layout.setWidth("400px"); |
115 | 127 |