comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java @ 1283:e8bb11976c70

Neaten certain GUI aspects with W-Diff waterlevel-pair selection. flys-client/trunk@2867 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 30 Sep 2011 07:44:35 +0000
parents d0500e993218
children 2f5fbfeda1d4
comparison
equal deleted inserted replaced
1282:3904519ec161 1283:e8bb11976c70
45 import java.util.ArrayList; 45 import java.util.ArrayList;
46 import java.util.List; 46 import java.util.List;
47 import java.util.Stack; 47 import java.util.Stack;
48 48
49 // TODO: refactor, extract ~DataCageGrid 49 // TODO: refactor, extract ~DataCageGrid
50 /**
51 * Display tree of, for example, previous calculations and allows
52 * selection in order to access/clone these.
53 */
50 public class DatacageWidget 54 public class DatacageWidget
51 extends VLayout 55 extends VLayout
52 { 56 {
53 protected MetaDataServiceAsync metaDataService = 57 protected MetaDataServiceAsync metaDataService =
54 GWT.create(MetaDataService.class); 58 GWT.create(MetaDataService.class);
161 this(artifact, user, outs, handler); 165 this(artifact, user, outs, handler);
162 this.parameters = parameters; 166 this.parameters = parameters;
163 } 167 }
164 168
165 169
170 /**
171 * Sets whether more than one item can be selected.
172 * @param multi if true, allow mutliple selections.
173 */
166 public void setIsMutliSelectable(boolean multi) { 174 public void setIsMutliSelectable(boolean multi) {
167 if (multi) { 175 if (multi) {
168 treeGrid.setSelectionType(SelectionStyle.MULTIPLE); 176 treeGrid.setSelectionType(SelectionStyle.MULTIPLE);
169 } 177 }
170 else { 178 else {
223 } 231 }
224 } 232 }
225 } 233 }
226 234
227 return toLoad; 235 return toLoad;
236 }
237
238
239 /**
240 * Returns the titles of selected items (if any).
241 */
242 public String[] getSelectionTitles() {
243 if (treeGrid == null) {
244 return new String[] {};
245 }
246
247 ListGridRecord [] selection = treeGrid.getSelection();
248
249 if (selection == null) {
250 return new String[] {};
251 }
252
253 List<String> titleList = new ArrayList<String>();
254 for (ListGridRecord record: selection) {
255 if (record instanceof TreeNode) {
256 titleList.add(((TreeNode)record).getAttribute("name"));
257 }
258 }
259
260 return titleList.toArray(new String[titleList.size()]);
228 } 261 }
229 262
230 263
231 /** 264 /**
232 * Callback for add-button. 265 * Callback for add-button.

http://dive4elements.wald.intevation.org