Author: tchemit Date: 2008-01-20 13:52:58 +0000 (Sun, 20 Jan 2008) New Revision: 267 Removed: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/ApplicationBean.java 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/PaginationBean.java Log: structuration des beans Deleted: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/ApplicationBean.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/ApplicationBean.java 2008-01-20 13:52:27 UTC (rev 266) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/ApplicationBean.java 2008-01-20 13:52:58 UTC (rev 267) @@ -1,112 +0,0 @@ -/* -* \#\#% 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; -import fr.cemagref.simexplorer.is.entities.metadata.Version; -import fr.cemagref.simexplorer.is.contenttype.ContentType; - -import java.util.Map; -import java.util.Date; - -/** - * Le bean qui contient le détail d'une application, ses métat données, ses - * versions. - * <p/> - * - * @author chemit - */ -public class ApplicationBean { - - protected MetaDataEntity data; - - protected Version[] versions; - - public MetaDataEntity getData() { - return data; - } - - public void setData(MetaDataEntity data) { - this.data = data; - } - - public Version[] getVersions() { - return versions; - } - - public void setVersions(Version[] versions) { - this.versions = versions; - } - - public Map<String, ContentType> getAttachments() { - return getData().getAttachments(); - } - - public Date getCreationDate() { - return getData().getCreationDate(); - } - - public String getDescription() { - return getData().getDescription(); - } - - public Map<String, String> getDescriptors() { - return getData().getDescriptors(); - } - - public String getType() { - return getData().getType(); - } - - public boolean isLatest() { - return getData().isLatest(); - } - - public String getHash() { - return getData().getHash(); - } - - public String getName() { - return getData().getName(); - } - - public String getParentDataUuid() { - return getData().getParentDataUuid(); - } - - public String getParentDataVersion() { - return getData().getParentDataVersion(); - } - - public String getParentVersionUuid() { - return getData().getParentVersionUuid(); - } - - public String getParentVersionVersion() { - return getData().getParentVersionVersion(); - } - - public String getUuid() { - return getData().getUuid(); - } - - public Version getVersion() { - return getData().getVersion(); - } -} \ No newline at end of file Deleted: 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 2008-01-20 13:52:27 UTC (rev 266) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/ListApplicationBean.java 2008-01-20 13:52:58 UTC (rev 267) @@ -1,84 +0,0 @@ -/* -* \#\#% 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; - } - - -} Deleted: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/PaginationBean.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/PaginationBean.java 2008-01-20 13:52:27 UTC (rev 266) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/beans/PaginationBean.java 2008-01-20 13:52:58 UTC (rev 267) @@ -1,84 +0,0 @@ -/* -* \#\#% 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; - -/** - * Le modèle de pagination d'une liste - * - * @author tony - */ -public class PaginationBean { - - /** the index */ - long firstIndex; - - /** size of the total flow */ - long size; - - /** size of a page */ - int width; - - public long getFirstIndex() { - return firstIndex; - } - - public long getSize() { - return size; - } - - public int getWidth() { - return width; - } - - public boolean hasNext() { - return size - firstIndex > width; - } - - public boolean hasPrevious() { - return firstIndex >= width; - } - - public int getCurrentPage() { - int page = (int) (firstIndex / width); - if (page > 0 && firstIndex % width > 0) { - page++; - } - return page; - } - - public int getNbPages() { - return (int) (size % width); - } - - public void increment() { - if (firstIndex + width > size) { - firstIndex = size - width; - return; - } - firstIndex += width; - } - - public void decrement() { - if (firstIndex < width) { - firstIndex = 0; - } else { - firstIndex -= width; - } - } -}
participants (1)
-
tchemit@users.labs.libre-entreprise.org