annotate gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ThemeList.java @ 8870:c26fb37899ca

Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui. Also using now the localization info from the server instead of localizing the modules again on the client side.
author gernotbelger
date Wed, 07 Feb 2018 11:59:13 +0100
parents 5e38e2924c07
children
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 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
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
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
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 */
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 5993
diff changeset
152 public LinkedHashMap<String, String> toMapIndexDescription(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 5993
diff changeset
153 String facetName
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 5993
diff changeset
154 ) {
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
155 int count = getThemeCount();
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 5993
diff changeset
156 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 5993
diff changeset
157 new LinkedHashMap<String, String>();
1437
1d82a2c695a6 Fix ThemeList.toMaps
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1435
diff changeset
158 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
159 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
160
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
161 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
162 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
163 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
164
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
165 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
166 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
167 theme.getDescription());
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 return valueMap;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
171 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
172
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 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
175 toMapArtifactUUIDDescription(String facetName
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
176 ) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
177 int count = getThemeCount();
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 5993
diff changeset
178 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 5993
diff changeset
179 new LinkedHashMap<String, String>();
1437
1d82a2c695a6 Fix ThemeList.toMaps
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1435
diff changeset
180 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
181 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
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 == 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
184 continue;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
185 }
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 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
188 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
189 theme.getDescription());
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
190 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
191 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
192 return valueMap;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 528
diff changeset
193 }
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
194 }
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
195 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org