ingo@524: package de.intevation.flys.client.shared.model;
ingo@524:
ingo@524: import java.io.Serializable;
ingo@524:
ingo@524: import java.util.List;
ingo@524:
ingo@524:
ingo@524: /**
ingo@524: * @author Ingo Weinzierl
ingo@524: */
ingo@524: public class ThemeList implements Serializable {
ingo@524:
ingo@524: public List themes;
ingo@524:
ingo@524:
ingo@524: public ThemeList() {
ingo@524: }
ingo@524:
ingo@524:
ingo@524: public ThemeList(List themes) {
ingo@524: this.themes = themes;
ingo@524: }
ingo@524:
ingo@524:
ingo@524: public List getThemes() {
ingo@524: return themes;
ingo@524: }
ingo@524:
ingo@524:
ingo@524: public int getThemeCount() {
ingo@524: return themes.size();
ingo@524: }
ingo@524:
ingo@524:
ingo@524: /**
ingo@524: * Returns a theme at a specific position. NOTE: Themes start at position
ingo@524: * 1. So, take care in loops, that might start at index 0!
ingo@524: *
ingo@524: * @param pos The position of the desired theme.
ingo@524: *
ingo@524: * @return a theme.
ingo@524: */
ingo@524: public Theme getThemeAt(int pos) {
ingo@524: for (Theme theme: themes) {
ingo@524: if (theme.getPosition() == pos) {
ingo@524: return theme;
ingo@524: }
ingo@524: }
ingo@524:
ingo@524: return null;
ingo@524: }
ingo@526:
ingo@526:
ingo@526: public void removeTheme(Theme theme) {
ingo@526: if (theme != null) {
ingo@526: themes.remove(theme);
ingo@526: }
ingo@526: }
ingo@526:
ingo@526:
ingo@526: public void addTheme(Theme theme) {
ingo@526: if (theme != null) {
ingo@526: themes.add(theme);
ingo@526: }
ingo@526: }
ingo@524: }
ingo@524: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :