Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/ThemeList.java @ 870:d5fb88ba99d2
Display status message and progress information in the WSPLGEN loading panel.
flys-client/trunk@2690 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 09 Sep 2011 15:08:15 +0000 |
parents | 39d9291513cc |
children | f6fbfdc813f0 |
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 |
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
|
5 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
|
6 |
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 * @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
|
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 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
|
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 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
|
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 |
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 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
|
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 |
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 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
|
21 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
|
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 |
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 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
|
26 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
|
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 |
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 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
|
31 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
|
32 } |
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 * 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
|
37 * 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
|
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 * @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
|
40 * |
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
|
41 * @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
|
42 */ |
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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 } |
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
|
48 } |
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
|
49 |
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
|
50 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
|
51 } |
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
|
52 |
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
|
53 |
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
|
54 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
|
55 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
|
56 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
|
57 } |
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
|
58 } |
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
|
59 |
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
|
60 |
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
|
61 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
|
62 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
|
63 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
|
64 } |
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
|
65 } |
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
|
66 |
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
|
67 |
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
|
68 /** |
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
|
69 * 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
|
70 * <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
|
71 * |
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
|
72 * @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
|
73 * @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
|
74 */ |
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
|
75 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
|
76 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
|
77 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
|
78 |
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
|
79 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
|
80 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
|
81 } |
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
|
82 |
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
|
83 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
|
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 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
|
86 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
|
87 |
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 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
|
89 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
|
90 } |
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 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
|
92 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
|
93 } |
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 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
|
95 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
|
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 } |
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 } |
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
|
99 } |
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
|
100 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |