changeset 1544:2b3d02626823

Opened Collection interface in preparation of Manual Points-Feature. flys-client/trunk@3772 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 26 Jan 2012 13:24:17 +0000
parents 0b79630e3bcb
children 2f0150f21e77
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/shared/model/Collection.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java
diffstat 3 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Jan 26 13:21:21 2012 +0000
+++ b/flys-client/ChangeLog	Thu Jan 26 13:24:17 2012 +0000
@@ -1,3 +1,12 @@
+2012-01-26  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	In preparation of 'manual points' feature, opened Collection
+	interface.
+
+	* src/main/java/de/intevation/flys/client/shared/model/Collection.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java:
+	  (getItem): Pick CollectionItem by identifier.
+
 2012-01-26  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/shared/model/Recommendation.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/Collection.java	Thu Jan 26 13:21:21 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/Collection.java	Thu Jan 26 13:24:17 2012 +0000
@@ -34,6 +34,8 @@
 
     public CollectionItem getItem(int idx);
 
+    public CollectionItem getItem(String uuid);
+
     public Map<String, OutputMode> getOutputModes();
 
     public ThemeList getThemeList(String outName);
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java	Thu Jan 26 13:21:21 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java	Thu Jan 26 13:24:17 2012 +0000
@@ -104,6 +104,7 @@
         this.settings = settings;
     }
 
+
     /**
      * Creates a new DefaultCollection with uuid and name.
      *
@@ -169,6 +170,7 @@
     }
 
 
+    /** Returns item at index (0-based), or null if out of range. */
     public CollectionItem getItem(int idx) {
         if (idx >= getItemLength()) {
             return null;
@@ -178,6 +180,23 @@
     }
 
 
+    /**
+     * Get item whose identifier is the given string.
+     * @param uuid identifier of collection item (artifacts uuid).
+     * @return CollectionItem whose identifier is given String, null if not found.
+     */
+    public CollectionItem getItem(String uuid) {
+        int size = getItemLength();
+        for (int i = 0; i < size; i++) {
+            CollectionItem item = getItem(i);
+            if (item.identifier().equals(uuid)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+
     public Map<String, OutputMode> getOutputModes() {
         Map<String, OutputMode> modes = new HashMap<String, OutputMode>();
 

http://dive4elements.wald.intevation.org