Author: tchemit Date: 2008-01-20 12:22:02 +0000 (Sun, 20 Jan 2008) New Revision: 248 Added: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/ListApplicationBean.java Log: le bean d'une liste d'application (contient en plus les infos de recherche et de pagination) Added: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/ListApplicationBean.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/ListApplicationBean.java (rev 0) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/ListApplicationBean.java 2008-01-20 12:22:02 UTC (rev 248) @@ -0,0 +1,84 @@ +/* +* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, +* Tony Chemit +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* \#\#% */ +package fr.cemagref.simexplorer.is.ui.swing.beans; + +import fr.cemagref.simexplorer.is.entities.metadata.MetaDataEntity; + +/** + * Le bean qui contient la liste des meta données des applications, + * ainsi que la position du premier élément de la liste dans le flux d'origin, + * le model de pagination + * <p/> + * On conserve enfin ici aussi la requete de recherche'index du premier élément de la dans le flux + * + * @author chemit + */ +public class ListApplicationBean { + + protected String query; + + protected PaginationBean pagination; + + protected MetaDataEntity[] list; + + public MetaDataEntity[] getList() { + return list; + } + + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public PaginationBean getPagination() { + return pagination; + } + + public void setPagination(PaginationBean pagination) { + this.pagination = pagination; + } + + public void setList(MetaDataEntity[] list) { + this.list = list; + } + + public MetaDataEntity get(int index) { + checkSize(index); + return getList()[index]; + } + + private void checkSize(int index) { + if (isEmpty() || size() < index) { + throw new IllegalStateException(getClass() + " has size " + size() + " and was required index " + index); + } + } + + public boolean isEmpty() { + return getList().length == 0; + } + + public int size() { + return isEmpty() ? 0 : list.length; + } + + +}
participants (1)
-
tchemit@users.labs.libre-entreprise.org