Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Thu Sep 29 14:52:29 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Fri Sep 30 07:44:35 2011 +0000 @@ -47,6 +47,10 @@ import java.util.Stack; // TODO: refactor, extract ~DataCageGrid +/** + * Display tree of, for example, previous calculations and allows + * selection in order to access/clone these. + */ public class DatacageWidget extends VLayout { @@ -163,6 +167,10 @@ } + /** + * Sets whether more than one item can be selected. + * @param multi if true, allow mutliple selections. + */ public void setIsMutliSelectable(boolean multi) { if (multi) { treeGrid.setSelectionType(SelectionStyle.MULTIPLE); @@ -229,6 +237,31 @@ /** + * Returns the titles of selected items (if any). + */ + public String[] getSelectionTitles() { + if (treeGrid == null) { + return new String[] {}; + } + + ListGridRecord [] selection = treeGrid.getSelection(); + + if (selection == null) { + return new String[] {}; + } + + List<String> titleList = new ArrayList<String>(); + for (ListGridRecord record: selection) { + if (record instanceof TreeNode) { + titleList.add(((TreeNode)record).getAttribute("name")); + } + } + + return titleList.toArray(new String[titleList.size()]); + } + + + /** * Callback for add-button. * Fires to load for every selected element and handler. */