annotate gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ThemeList.java @ 5861:172338b1407f

GWT client: Added copyright header.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 14:30:15 +0200
parents 5aa05a7a34b7
children ea9eef426962
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
6 * documentation coming with Dive4Elements River for details.
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.shared.model;
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import java.io.Serializable;
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
2438
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
13 import java.util.ArrayList;
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
14 import java.util.LinkedHashMap;
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import java.util.List;
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 /**
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
19 * Data Model for list of themes (shown facets).
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 */
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 public class ThemeList implements Serializable {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 public List<Theme> themes;
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public ThemeList() {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 }
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 public ThemeList(List<Theme> themes) {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 this.themes = themes;
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 }
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 public List<Theme> getThemes() {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 return themes;
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 }
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
2438
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
41 public List<Theme> getActiveThemes() {
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
42 List<Theme> active = new ArrayList<Theme>();
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
43 List<Theme> all = getThemes();
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
44
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
45 if (all == null || all.isEmpty()) {
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
46 return active;
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
47 }
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
48
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
49 for (Theme theme: all) {
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
50 if (theme.getActive() == 1) {
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
51 active.add(theme);
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
52 }
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
53 }
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
54
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
55 return active;
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
56 }
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
57
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
58
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 public int getThemeCount() {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 return themes.size();
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 }
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 /**
1473
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
65 * Returns (first) theme of which the artifact has given uuid, null if none
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
66 * found.
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
67 * @param uuid Artifacts identifier for which to search theme.
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
68 * @return theme of which getArtifact() equals given uuid.
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
69 */
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
70 public Theme getTheme(String uuid) {
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
71 for (Theme theme: themes) {
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
72 if (theme.getArtifact().equals(uuid)) {
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
73 return theme;
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
74 }
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
75 }
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
76 return null;
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
77 }
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
78
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
79
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
80 /**
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 * Returns a theme at a specific position. <b>NOTE: Themes start at position
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 * 1. So, take care in loops, that might start at index 0!</b>
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 *
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 * @param pos The position of the desired theme.
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 *
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 * @return a theme.
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 */
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 public Theme getThemeAt(int pos) {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 for (Theme theme: themes) {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 if (theme.getPosition() == pos) {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 return theme;
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 }
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 return null;
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 }
526
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
97
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
98
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
99 public void removeTheme(Theme theme) {
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
100 if (theme != null) {
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
101 themes.remove(theme);
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
102 }
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
103 }
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
104
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
105
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
106 public void addTheme(Theme theme) {
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
107 if (theme != null) {
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
108 themes.add(theme);
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
109 }
96e60e0a4345 Added a service stub to update/modify the attribute of a collection (used in the theme control panel).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
110 }
528
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
111
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
112
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
113 /**
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
114 * Modifies the order of themes in this list and the position of the
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
115 * <i>theme</i> itself.
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
116 *
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
117 * @param theme The theme which position has to be modified.
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
118 * @param newPos The new position.
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
119 */
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
120 public void setThemePosition(Theme theme, int newPos) {
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
121 int count = getThemeCount();
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
122 int oldPos = theme.getPosition();
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
123
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
124 if (newPos == oldPos || newPos > count || newPos < 1) {
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
125 return;
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
126 }
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
127
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
128 boolean moveUp = newPos < oldPos;
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
129
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
130 for (Theme aTheme: themes) {
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
131 int tmpPos = aTheme.getPosition();
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
132
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
133 if (theme.equals(aTheme)) {
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
134 theme.setPosition(newPos);
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
135 }
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
136 else if (tmpPos >= newPos && tmpPos < oldPos && moveUp) {
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
137 aTheme.setPosition(tmpPos+1);
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
138 }
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
139 else if (tmpPos <= newPos && tmpPos > oldPos && !moveUp) {
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
140 aTheme.setPosition(tmpPos-1);
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
141 }
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
142 }
39d9291513cc Connected the actions in the navigation panel with the theme list in the ChartThemePanel - themes can be moved now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 526
diff changeset
143 }
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
144
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
145
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
146 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
147 * Create a map from index to description of facets that have a given name.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
148 * Only visible facets are taken into account.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
149 * @param facetName name to match against facets whose info to put in map.
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
150 * @return mapping of index to description
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
151 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
152 public LinkedHashMap<String, String> toMapIndexDescription(String facetName) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
153 int count = getThemeCount();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
154 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
1437
1d82a2c695a6 Fix ThemeList.toMaps
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1435
diff changeset
155 for (int i = 0; i <= count; i++) {
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
156 Theme theme = getThemeAt(i + 1);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
157
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
158 if (theme == null || theme.getVisible() == 0) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
159 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
160 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
161
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
162 if (theme.getFacet().equals(facetName)) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
163 valueMap.put(String.valueOf(theme.getIndex()),
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
164 theme.getDescription());
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
165 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
166 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
167 return valueMap;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
168 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
169
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
170
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
171 public LinkedHashMap<String, String>
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
172 toMapArtifactUUIDDescription(String facetName
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
173 ) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
174 int count = getThemeCount();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
175 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
1437
1d82a2c695a6 Fix ThemeList.toMaps
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1435
diff changeset
176 for (int i = 0; i <= count; i++) {
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
177 Theme theme = getThemeAt(i + 1);
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
178
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
179 if (theme == null || theme.getVisible() == 0) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
180 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
181 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
182
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
183 if (theme.getFacet().equals(facetName)) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
184 valueMap.put(theme.getArtifact(),
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
185 theme.getDescription());
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
186 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
187 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
188 return valueMap;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
189 }
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 }
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org