comparison flys-client/src/main/java/de/intevation/flys/client/shared/model/ThemeList.java @ 1435:f6fbfdc813f0

Allow client to access artifacts data via CollectionItems and Themes. flys-client/trunk@3396 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 13 Dec 2011 09:51:47 +0000
parents 39d9291513cc
children 1d82a2c695a6
comparison
equal deleted inserted replaced
1434:9115b2a28be1 1435:f6fbfdc813f0
1 package de.intevation.flys.client.shared.model; 1 package de.intevation.flys.client.shared.model;
2 2
3 import java.io.Serializable; 3 import java.io.Serializable;
4 4
5 import java.util.LinkedHashMap;
5 import java.util.List; 6 import java.util.List;
6 7
7 8
8 /** 9 /**
10 * Data Model for list of themes (shown facets).
9 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 11 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
10 */ 12 */
11 public class ThemeList implements Serializable { 13 public class ThemeList implements Serializable {
12 14
13 public List<Theme> themes; 15 public List<Theme> themes;
94 else if (tmpPos <= newPos && tmpPos > oldPos && !moveUp) { 96 else if (tmpPos <= newPos && tmpPos > oldPos && !moveUp) {
95 aTheme.setPosition(tmpPos-1); 97 aTheme.setPosition(tmpPos-1);
96 } 98 }
97 } 99 }
98 } 100 }
101
102
103 /**
104 * Create a map from index to description of facets that have a given name.
105 * Only visible facets are taken into account.
106 * @param facetName name to match against facets whose info to put in map.
107 * @return mapping of index to description
108 */
109 public LinkedHashMap<String, String> toMapIndexDescription(String facetName) {
110 int count = getThemeCount();
111 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
112 for (int i = 0; i < count; i++) {
113 Theme theme = getThemeAt(i + 1);
114
115 if (theme == null || theme.getVisible() == 0) {
116 continue;
117 }
118
119 if (theme.getFacet().equals(facetName)) {
120 valueMap.put(String.valueOf(theme.getIndex()),
121 theme.getDescription());
122 }
123 }
124 return valueMap;
125 }
126
127
128 public LinkedHashMap<String, String>
129 toMapArtifactUUIDDescription(String facetName
130 ) {
131 int count = getThemeCount();
132 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
133 for (int i = 0; i < count; i++) {
134 Theme theme = getThemeAt(i + 1);
135
136 if (theme == null || theme.getVisible() == 0) {
137 continue;
138 }
139
140 if (theme.getFacet().equals(facetName)) {
141 valueMap.put(theme.getArtifact(),
142 theme.getDescription());
143 }
144 }
145 return valueMap;
146 }
99 } 147 }
100 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 148 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org