annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/ThemeList.java @ 1473:71ba43bd0e3f

Added convenient accessor. flys-client/trunk@3518 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 22 Dec 2011 08:53:15 +0000
parents 1d82a2c695a6
children e0f4ea518d59
rev   line source
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
1 package de.intevation.flys.client.shared.model;
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
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
5 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
6 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
7
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 /**
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
10 * 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
11 * @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
12 */
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 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
14
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 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
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 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
19 }
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 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
23 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
24 }
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 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
28 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
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
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 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
33 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
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
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 /**
1473
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
38 * 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
39 * found.
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
40 * @param uuid Artifacts identifier for which to search theme.
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
41 * @return theme of which getArtifact() equals given uuid.
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
42 */
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
43 public Theme getTheme(String uuid) {
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
44 for (Theme theme: themes) {
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
45 if (theme.getArtifact().equals(uuid)) {
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
46 return theme;
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
47 }
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
48 }
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
49 return null;
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
50 }
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
51
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
52
71ba43bd0e3f Added convenient accessor.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1437
diff changeset
53 /**
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
54 * 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
55 * 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
56 *
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
57 * @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
58 *
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 * @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
60 */
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 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
62 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
63 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
64 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
65 }
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
66 }
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
67
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
68 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
69 }
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
70
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
71
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
72 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
73 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
74 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
75 }
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
76 }
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
77
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
78
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
79 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
80 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
81 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
82 }
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
83 }
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
84
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
85
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
86 /**
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
87 * 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
88 * <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
89 *
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
90 * @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
91 * @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
92 */
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
93 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
94 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
95 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
96
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
97 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
98 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
99 }
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
100
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
101 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
102
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 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
104 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
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 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
107 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
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 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
110 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
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 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
113 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
114 }
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 }
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
117
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
118
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
119 /**
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
120 * 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
121 * 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
122 * @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
123 * @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
124 */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
125 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
126 int count = getThemeCount();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
127 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
1437
1d82a2c695a6 Fix ThemeList.toMaps
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1435
diff changeset
128 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
129 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
130
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
131 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
132 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
133 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
134
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
135 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
136 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
137 theme.getDescription());
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 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
140 return valueMap;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
141 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
142
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>
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
145 toMapArtifactUUIDDescription(String facetName
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 int count = getThemeCount();
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
148 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
1437
1d82a2c695a6 Fix ThemeList.toMaps
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1435
diff changeset
149 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
150 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
151
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
152 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
153 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
154 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
155
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
156 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
157 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
158 theme.getDescription());
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
159 }
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 return valueMap;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
162 }
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
163 }
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
164 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org