comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java @ 777:3b02a798d75d

#181 Repaired activate/deactivate function in theme list. flys-client/trunk@2265 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 29 Jun 2011 07:59:46 +0000
parents c17c593f8732
children 374712890b94
comparison
equal deleted inserted replaced
776:b82bed27429f 777:3b02a798d75d
236 FacetRecord rec = (FacetRecord) list.getRecord(row); 236 FacetRecord rec = (FacetRecord) list.getRecord(row);
237 237
238 Theme theme = rec.getTheme(); 238 Theme theme = rec.getTheme();
239 theme.setActive(rec.getActive()); 239 theme.setActive(rec.getActive());
240 240
241 updateThemeList(rec.getTheme()); 241 updateCollection();
242 }
243
244
245 /**
246 * Update the theme list of the current collection with a modified theme. If
247 * a theme is really modified, the CollectionAttributeService is triggered
248 * to save the changes to the artifact server.
249 *
250 * @param theme The modified theme.
251 */
252 protected void updateThemeList(Theme theme) {
253 GWT.log("Update theme: " + theme.getFacet());
254
255 ThemeList themeList = getThemeList();
256
257 String a = theme.getArtifact();
258 String f = theme.getFacet();
259
260 int num = themeList != null ? themeList.getThemeCount() : 0;
261
262 boolean updateRequired = false;
263
264 for (int i = 1; i <= num; i++) {
265 Theme old = themeList.getThemeAt(i);
266
267 if (f.equals(old.getFacet()) && a.equals(old.getArtifact())) {
268 themeList.removeTheme(old);
269 themeList.addTheme(theme);
270
271 updateRequired = true;
272
273 break;
274 }
275 }
276
277 if (updateRequired) {
278 updateCollection();
279 }
280 } 242 }
281 243
282 244
283 /** 245 /**
284 * This method triggers the CollectionAttributeService. Based on the current 246 * This method triggers the CollectionAttributeService. Based on the current

http://dive4elements.wald.intevation.org