view flys-client/src/main/java/de/intevation/flys/client/shared/model/ThemeList.java @ 526:96e60e0a4345

Added a service stub to update/modify the attribute of a collection (used in the theme control panel). flys-client/trunk@2005 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 25 May 2011 14:58:42 +0000
parents ba238f917b94
children 39d9291513cc
line wrap: on
line source
package de.intevation.flys.client.shared.model;

import java.io.Serializable;

import java.util.List;


/**
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class ThemeList implements Serializable {

    public List<Theme> themes;


    public ThemeList() {
    }


    public ThemeList(List<Theme> themes) {
        this.themes = themes;
    }


    public List<Theme> getThemes() {
        return themes;
    }


    public int getThemeCount() {
        return themes.size();
    }


    /**
     * Returns a theme at a specific position. <b>NOTE: Themes start at position
     * 1. So, take care in loops, that might start at index 0!</b>
     *
     * @param pos The position of the desired theme.
     *
     * @return a theme.
     */
    public Theme getThemeAt(int pos) {
        for (Theme theme: themes) {
            if (theme.getPosition() == pos) {
                return theme;
            }
        }

        return null;
    }


    public void removeTheme(Theme theme) {
        if (theme != null) {
            themes.remove(theme);
        }
    }


    public void addTheme(Theme theme) {
        if (theme != null) {
            themes.add(theme);
        }
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org