annotate flys-client/src/main/java/org/dive4elements/river/client/shared/model/ThemeList.java @ 5835:821a02bbfb4e

Fixed internal java dependencies
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 13:12:15 +0200
parents f507086aa94b
children
rev   line source
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
1 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
2
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
3 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
4
2438
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
5 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
6 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
7 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
8
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
9
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 /**
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
11 * 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
12 * @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
13 */
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
14 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
15
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 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
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
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
19 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
20 }
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
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 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
24 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
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
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 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
29 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
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
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
2438
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
33 public List<Theme> getActiveThemes() {
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
34 List<Theme> active = new ArrayList<Theme>();
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
35 List<Theme> all = getThemes();
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
36
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
37 if (all == null || all.isEmpty()) {
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
38 return active;
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
39 }
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
40
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
41 for (Theme theme: all) {
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
42 if (theme.getActive() == 1) {
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
43 active.add(theme);
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 }
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
46
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
47 return active;
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
e0f4ea518d59 Query GetFeatureInfo for active layers only.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1473
diff changeset
50
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
51 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
52 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
53 }
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
54
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
55
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
56 /**
1473
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
57 * 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
58 * found.
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
59 * @param uuid Artifacts identifier for which to search theme.
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
60 * @return theme of which getArtifact() equals given uuid.
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
61 */
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
62 public Theme getTheme(String uuid) {
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
63 for (Theme theme: themes) {
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
64 if (theme.getArtifact().equals(uuid)) {
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
65 return theme;
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
66 }
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
67 }
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
68 return null;
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
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
71
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
72 /**
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
73 * 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
74 * 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
75 *
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
76 * @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
77 *
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
78 * @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
79 */
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
80 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
81 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
82 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
83 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
84 }
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
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 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
88 }
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
89
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
90
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
91 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
92 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
93 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
94 }
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
95 }
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
96
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 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
99 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
100 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
101 }
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 }
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
103
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
104
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
105 /**
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
106 * 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
107 * <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
108 *
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
109 * @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
110 * @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
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 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
113 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
114 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
115
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 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
117 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
118 }
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 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
121
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 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
123 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
124
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 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
126 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
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 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
129 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
130 }
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 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
132 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
133 }
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 }
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 }
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
136
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
137
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
138 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
139 * 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
140 * 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
141 * @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
142 * @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
143 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
144 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
145 int count = getThemeCount();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
146 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
1437
1d82a2c695a6 Fix ThemeList.toMaps
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1435
diff changeset
147 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
148 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
149
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
150 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
151 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
152 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
153
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
154 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
155 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
156 theme.getDescription());
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 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
159 return valueMap;
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
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
163 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
164 toMapArtifactUUIDDescription(String facetName
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 int count = getThemeCount();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
167 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
1437
1d82a2c695a6 Fix ThemeList.toMaps
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1435
diff changeset
168 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
169 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
170
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
171 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
172 continue;
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
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
175 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
176 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
177 theme.getDescription());
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 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
180 return valueMap;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
181 }
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
182 }
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
183 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org