comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadOffEpochPanel.java @ 6712:e1ec4d4f53c6

Cosmetics.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 30 Jul 2013 15:56:34 +0200
parents ea9eef426962
children d56a19830e04
comparison
equal deleted inserted replaced
6711:0f0f09badd29 6712:e1ec4d4f53c6
36 import org.dive4elements.river.client.shared.model.DefaultData; 36 import org.dive4elements.river.client.shared.model.DefaultData;
37 import org.dive4elements.river.client.shared.model.DefaultDataItem; 37 import org.dive4elements.river.client.shared.model.DefaultDataItem;
38 import org.dive4elements.river.client.shared.model.SedimentLoadInfoObject; 38 import org.dive4elements.river.client.shared.model.SedimentLoadInfoObject;
39 import org.dive4elements.river.client.shared.model.SedimentLoadInfoRecord; 39 import org.dive4elements.river.client.shared.model.SedimentLoadInfoRecord;
40 40
41 41 /** Show input to select an official epoch. */
42 public class SedLoadOffEpochPanel 42 public class SedLoadOffEpochPanel
43 extends PeriodPanel 43 extends PeriodPanel
44 { 44 {
45 protected SedimentLoadInfoServiceAsync sedLoadInfoService = 45 protected SedimentLoadInfoServiceAsync sedLoadInfoService =
46 GWT.create(SedimentLoadInfoService.class); 46 GWT.create(SedimentLoadInfoService.class);
47 47
48 private ListGrid sedLoadTable; 48 private ListGrid sedLoadTable;
49 49
50 /** Creates layout with title. */
50 public Canvas createWidget(DataList data) { 51 public Canvas createWidget(DataList data) {
51 VLayout root = new VLayout(); 52 VLayout root = new VLayout();
52 53
53 Label title = new Label(data.get(0).getDescription()); 54 Label title = new Label(data.get(0).getDescription());
54 title.setHeight("25px"); 55 title.setHeight("25px");
102 fetchSedimentLoadData(); 103 fetchSedimentLoadData();
103 104
104 return layout; 105 return layout;
105 } 106 }
106 107
108 /** Creates the helper grid in which off epochs can be selected. */
107 protected Canvas createHelper() { 109 protected Canvas createHelper() {
108 sedLoadTable = new ListGrid(); 110 sedLoadTable = new ListGrid();
109 sedLoadTable.setShowHeaderContextMenu(false); 111 sedLoadTable.setShowHeaderContextMenu(false);
110 sedLoadTable.setWidth100(); 112 sedLoadTable.setWidth100();
111 sedLoadTable.setShowRecordComponents(true); 113 sedLoadTable.setShowRecordComponents(true);
152 new DataItem[] { item })); 154 new DataItem[] { item }));
153 return data.toArray(new Data[data.size()]); 155 return data.toArray(new Data[data.size()]);
154 } 156 }
155 157
156 protected void fetchSedimentLoadData() { 158 protected void fetchSedimentLoadData() {
157 Config config = Config.getInstance(); 159 Config config = Config.getInstance();
158 String locale = config.getLocale (); 160 String locale = config.getLocale ();
159 161
160 ArtifactDescription adescr = artifact.getArtifactDescription(); 162 ArtifactDescription adescr = artifact.getArtifactDescription();
161 DataList[] data = adescr.getOldData(); 163 DataList[] data = adescr.getOldData();
162 164
163 double[] km = artifact.getArtifactDescription().getKMRange(); 165 double[] km = artifact.getArtifactDescription().getKMRange();
164 String river = artifact.getArtifactDescription().getRiver(); 166 String river = artifact.getArtifactDescription().getRiver();
165 167
166 sedLoadInfoService.getSedimentLoadInfo(locale, river, "epoch", km[0], km[1], 168 sedLoadInfoService.getSedimentLoadInfo(locale, river, "epoch", km[0], km[1],
167 new AsyncCallback<SedimentLoadInfoObject[]>() { 169 new AsyncCallback<SedimentLoadInfoObject[]>() {
168 public void onFailure(Throwable caught) { 170 public void onFailure(Throwable caught) {
169 GWT.log("Could not recieve sediment load informations."); 171 GWT.log("Could not receive sediment load informations.");
170 SC.warn(caught.getMessage()); 172 SC.warn(caught.getMessage());
171 } 173 }
172 174
173 public void onSuccess(SedimentLoadInfoObject[] sedLoad) { 175 public void onSuccess(SedimentLoadInfoObject[] sedLoad) {
174 int num = sedLoad != null ? sedLoad.length :0; 176 int num = sedLoad != null ? sedLoad.length :0;
175 GWT.log("Recieved " + num + " sediment load informations."); 177 GWT.log("Received " + num + " sediment load informations.");
176 178
177 if (num == 0) { 179 if (num == 0) {
178 return; 180 return;
179 } 181 }
180 182
189 for(SedimentLoadInfoObject sl: sedLoad) { 191 for(SedimentLoadInfoObject sl: sedLoad) {
190 SedimentLoadInfoRecord rec = new SedimentLoadInfoRecord(sl); 192 SedimentLoadInfoRecord rec = new SedimentLoadInfoRecord(sl);
191 sedLoadTable.addData(rec); 193 sedLoadTable.addData(rec);
192 } 194 }
193 } 195 }
194
195 } 196 }
197 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org