# HG changeset patch # User Felix Wolfsteller # Date 1327584257 0 # Node ID 2b3d02626823bbb17747fa11da1eb4215ed34c37 # Parent 0b79630e3bcbf7e298d58fef93c0fa5528670d08 Opened Collection interface in preparation of Manual Points-Feature. flys-client/trunk@3772 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 0b79630e3bcb -r 2b3d02626823 flys-client/ChangeLog --- 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 + + 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 * src/main/java/de/intevation/flys/client/shared/model/Recommendation.java: diff -r 0b79630e3bcb -r 2b3d02626823 flys-client/src/main/java/de/intevation/flys/client/shared/model/Collection.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 getOutputModes(); public ThemeList getThemeList(String outName); diff -r 0b79630e3bcb -r 2b3d02626823 flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java --- 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 getOutputModes() { Map modes = new HashMap();