Cantharella-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- 279 discussions
14 Feb '13
Author: echatellier
Date: 2013-02-14 17:39:05 +0100 (Thu, 14 Feb 2013)
New Revision: 109
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/109
Log:
Update to wicket 6.5
Added:
trunk/cantharella.utils/src/license/
trunk/cantharella.utils/src/license/THIRD-PARTY.properties
Modified:
trunk/cantharella.data/src/license/THIRD-PARTY.properties
trunk/cantharella.service/src/license/THIRD-PARTY.properties
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/MoleculeProvenanceBean.java
trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CantharellaConfig.java
trunk/cantharella.web/src/license/THIRD-PARTY.properties
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/LinkProduitPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/TaxonomyPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ListCampagnesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ListExtractionsPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ListLotsPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ListSpecimensPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ListStationsPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ListTestsBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/BooleanPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/DecimalPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/EnumPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportableColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportablePropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportableTextFilteredPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/MapValuePropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/PercentPropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ShortDatePropertyColumn.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/links/CsvExportLink.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/SimpleSortableListDataProvider.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java
trunk/pom.xml
Modified: trunk/cantharella.data/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/cantharella.data/src/license/THIRD-PARTY.properties 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.data/src/license/THIRD-PARTY.properties 2013-02-14 16:39:05 UTC (rev 109)
@@ -9,6 +9,7 @@
# - Eclipse Public License - v 1.0
# - GNU Lesser General Public License, version 2.1
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
+# - Lesser General Public License (LGPL) v 3.0
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
@@ -22,5 +23,6 @@
# Please fill the missing licenses for dependencies :
#
#
-#Fri Jan 18 10:34:09 CET 2013
+#Thu Feb 14 17:34:33 CET 2013
+commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License
Modified: trunk/cantharella.service/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/cantharella.service/src/license/THIRD-PARTY.properties 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.service/src/license/THIRD-PARTY.properties 2013-02-14 16:39:05 UTC (rev 109)
@@ -11,6 +11,7 @@
# - GNU Lesser General Public License, version 2.1
# - GPLv2+CE
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
+# - Lesser General Public License (LGPL) v 3.0
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
@@ -24,5 +25,6 @@
# Please fill the missing licenses for dependencies :
#
#
-#Fri Jan 18 10:45:39 CET 2013
+#Thu Feb 14 17:34:54 CET 2013
+commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/MoleculeProvenanceBean.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/MoleculeProvenanceBean.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/MoleculeProvenanceBean.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -1,5 +1,28 @@
package nc.ird.cantharella.service.model;
+/*
+ * #%L
+ * Cantharella :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
import java.io.Serializable;
import nc.ird.cantharella.data.model.Extrait;
import nc.ird.cantharella.data.model.Fraction;
Added: trunk/cantharella.utils/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/cantharella.utils/src/license/THIRD-PARTY.properties (rev 0)
+++ trunk/cantharella.utils/src/license/THIRD-PARTY.properties 2013-02-14 16:39:05 UTC (rev 109)
@@ -0,0 +1,19 @@
+# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
+#-------------------------------------------------------------------------------
+# Already used licenses in project :
+# - BSD License
+# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+# - Common Public License Version 1.0
+# - Indiana University Extreme! Lab Software License, vesion 1.1.1
+# - Lesser General Public License (LGPL) v 3.0
+# - Lesser General Public License (LPGL)
+# - Lesser General Public License (LPGL) v 2.1
+# - MIT License
+# - New BSD License
+# - The Apache Software License, Version 2.0
+#-------------------------------------------------------------------------------
+# Please fill the missing licenses for dependencies :
+#
+#
+#Thu Feb 14 17:34:15 CET 2013
+commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
Modified: trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CantharellaConfig.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CantharellaConfig.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.utils/src/main/java/nc/ird/module/utils/CantharellaConfig.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -1,5 +1,28 @@
package nc.ird.module.utils;
+/*
+ * #%L
+ * Cantharella :: Utils
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
import java.util.Properties;
import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.ArgumentsParserException;
Modified: trunk/cantharella.web/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/cantharella.web/src/license/THIRD-PARTY.properties 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/license/THIRD-PARTY.properties 2013-02-14 16:39:05 UTC (rev 109)
@@ -7,11 +7,11 @@
# - CDDL
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
# - Common Public License Version 1.0
-# - Copyright (c) 2000-2011 INRIA, France Telecom
# - Eclipse Public License - v 1.0
# - GNU Lesser General Public License, version 2.1
# - GPLv2+CE
# - Indiana University Extreme! Lab Software License, vesion 1.1.1
+# - Lesser General Public License (LGPL) v 3.0
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - License Agreement for Java(TM) Servlet API Specification Interface Classes
@@ -25,7 +25,7 @@
# Please fill the missing licenses for dependencies :
#
#
-#Fri Jan 18 11:06:20 CET 2013
-asm--asm--3.1=Copyright (c) 2000-2011 INRIA, France Telecom
+#Thu Feb 14 17:35:11 CET 2013
+commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License
javax.servlet--servlet-api--2.5=License Agreement for Java(TM) Servlet API Specification Interface Classes
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -80,13 +80,13 @@
import org.apache.wicket.Session;
import org.apache.wicket.authentication.IAuthenticationStrategy;
import org.apache.wicket.authentication.strategy.DefaultAuthenticationStrategy;
+import org.apache.wicket.core.request.mapper.MountedMapper;
+import org.apache.wicket.core.request.mapper.PackageMapper;
import org.apache.wicket.injection.Injector;
import org.apache.wicket.javascript.DefaultJavaScriptCompressor;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response;
-import org.apache.wicket.request.mapper.MountedMapper;
-import org.apache.wicket.request.mapper.PackageMapper;
import org.apache.wicket.request.mapper.mount.MountMapper;
import org.apache.wicket.resource.NoOpTextCompressor;
import org.apache.wicket.resource.loader.IStringResourceLoader;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -46,14 +46,14 @@
import nc.ird.module.utils.AssertTools;
import nc.ird.module.utils.Pair;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.IAjaxIndicatorAware;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.html.IHeaderContributor;
-import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
@@ -65,7 +65,10 @@
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.request.resource.CssResourceReference;
import org.apache.wicket.util.value.ValueMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Template page
@@ -137,11 +140,11 @@
/** {@inheritDoc} */
public void renderHead(IHeaderResponse response) {
// dynamic declaration of the menu Css due to the internationalization
- response.renderCSSReference(getString("TemplatePage.Css.Menu"));
+ response.render(CssHeaderItem.forUrl(getString("TemplatePage.Css.Menu")));
// scroll up to the anchor if any feedback message
if (!getSession().getFeedbackMessages().isEmpty()) {
- response.renderOnLoadJavaScript("location.hash='header'");
+ response.render(OnDomReadyHeaderItem.forScript("location.hash='header'"));
// LOG.debug("session FeedbackMessages is not empty");
// for (FeedbackMessage msg : getSession().getFeedbackMessages()) {
// LOG.debug(msg.getLevelAsString() + " : " + msg.getMessage() + ", from : " + msg.getReporter());
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/LinkProduitPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/LinkProduitPropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/LinkProduitPropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -39,8 +39,9 @@
* fraction). T MUST HAVE a property named "produit" which give a Produit.
* @author Adrien Cheype
* @param <T> Row type
+ * @param <S> the type of the sort property
*/
-public abstract class LinkProduitPropertyColumn<T> extends LinkPropertyColumn<T> {
+public abstract class LinkProduitPropertyColumn<T, S> extends LinkPropertyColumn<T, S> {
/** page used to get messages */
private final TemplatePage page;
@@ -52,7 +53,7 @@
* @param propertyExpression propertyExpression
* @param page page used to get messages
*/
- public LinkProduitPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public LinkProduitPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
TemplatePage page) {
super(displayModel, sortProperty, propertyExpression);
this.page = page;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/TaxonomyPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/TaxonomyPropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/TaxonomyPropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -39,7 +39,7 @@
* @author Adrien Cheype
* @param <T> Type of the row model
*/
-public class TaxonomyPropertyColumn<T> extends PropertyColumn<T> implements ExportableColumn<T> {
+public class TaxonomyPropertyColumn<T, S> extends PropertyColumn<T, S> implements ExportableColumn<T, S> {
/**
* Constructor
@@ -47,7 +47,7 @@
* @param sortProperty Sort property
* @param propertyExpression Property expression
*/
- public TaxonomyPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression) {
+ public TaxonomyPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression) {
super(displayModel, sortProperty, propertyExpression);
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ListCampagnesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ListCampagnesPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ListCampagnesPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -92,16 +92,16 @@
LoadableDetachableSortableListDataProvider<Campagne> campagnesDataProvider = new LoadableDetachableSortableListDataProvider<Campagne>(
campagnes, getSession().getLocale());
- List<IColumn<Campagne>> columns = new ArrayList<IColumn<Campagne>>();
+ List<IColumn<Campagne, String>> columns = new ArrayList<IColumn<Campagne, String>>();
- columns.add(new LinkableImagePropertyColumn<Campagne>("images/read.png", getString("Read"), getString("Read")) {
+ columns.add(new LinkableImagePropertyColumn<Campagne, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
setResponsePage(new ReadCampagnePage(model.getObject().getIdCampagne(), currentPage));
}
});
- columns.add(new LinkPropertyColumn<Campagne>(new Model<String>(getString("Campagne.nom")), "nom", "nom",
+ columns.add(new LinkPropertyColumn<Campagne, String>(new Model<String>(getString("Campagne.nom")), "nom", "nom",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Campagne>> item, String componentId, IModel<Campagne> model) {
@@ -109,16 +109,16 @@
}
});
- columns.add(new ShortDatePropertyColumn<Campagne>(new Model<String>(getString("Campagne.dateDeb")), "dateDeb",
+ columns.add(new ShortDatePropertyColumn<Campagne, String>(new Model<String>(getString("Campagne.dateDeb")), "dateDeb",
"dateDeb", getLocale()));
- columns.add(new ShortDatePropertyColumn<Campagne>(new Model<String>(getString("Campagne.dateFin")), "dateFin",
+ columns.add(new ShortDatePropertyColumn<Campagne, String>(new Model<String>(getString("Campagne.dateFin")), "dateFin",
"dateFin", getLocale()));
- columns.add(new MapValuePropertyColumn<Campagne, String>(new Model<String>(getString("Campagne.codePays")),
+ columns.add(new MapValuePropertyColumn<Campagne, String, String>(new Model<String>(getString("Campagne.codePays")),
"codePays", "codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new LinkableImagePropertyColumn<Campagne>("images/edit.png", getString("Update"),
+ columns.add(new LinkableImagePropertyColumn<Campagne, String>("images/edit.png", getString("Update"),
getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
@Override
@@ -137,7 +137,7 @@
}
});
- final DataTable<Campagne> campagnesDataTable = new AjaxFallbackDefaultDataTable<Campagne>(
+ final DataTable<Campagne, String> campagnesDataTable = new AjaxFallbackDefaultDataTable<Campagne, String>(
"ListCampagnesPage.Campagnes", columns, campagnesDataProvider, WebContext.ROWS_PER_PAGE);
campagnesRefresh.add(campagnesDataTable);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ListExtractionsPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ListExtractionsPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ListExtractionsPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -104,16 +104,16 @@
LoadableDetachableSortableListDataProvider<Extraction> extractionsDataProvider = new LoadableDetachableSortableListDataProvider<Extraction>(
extractions, getSession().getLocale());
- List<IColumn<Extraction>> columns = new ArrayList<IColumn<Extraction>>();
+ List<IColumn<Extraction, String>> columns = new ArrayList<IColumn<Extraction, String>>();
- columns.add(new LinkableImagePropertyColumn<Extraction>("images/read.png", getString("Read"), getString("Read")) {
+ columns.add(new LinkableImagePropertyColumn<Extraction, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
setResponsePage(new ReadExtractionPage(model.getObject().getIdExtraction(), currentPage));
}
});
- columns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Extraction.lot")), "lot", "lot",
+ columns.add(new LinkPropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.lot")), "lot", "lot",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
@@ -121,7 +121,7 @@
}
});
- columns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Extraction.ref")), "ref", "ref",
+ columns.add(new LinkPropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.ref")), "ref", "ref",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
@@ -129,16 +129,16 @@
}
});
- columns.add(new ShortDatePropertyColumn<Extraction>(new Model<String>(getString("Extraction.date")), "date",
+ columns.add(new ShortDatePropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.date")), "date",
"date", getLocale()));
- columns.add(new PropertyColumn<Extraction>(new Model<String>(getString("Extraction.methode2")), "methode",
+ columns.add(new PropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.methode2")), "methode",
"methode"));
- columns.add(new DecimalPropertyColumn<Extraction>(new Model<String>(getString("Extraction.masseDepart2")),
+ columns.add(new DecimalPropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.masseDepart2")),
"masseDepart", "masseDepart", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Campagne")), "lot.campagne",
+ columns.add(new LinkPropertyColumn<Extraction, String>(new Model<String>(getString("Campagne")), "lot.campagne",
"lot.campagne", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
@@ -147,7 +147,7 @@
}
});
- columns.add(new AbstractColumn<Extraction>(new Model<String>(getString("Extraction.extraits"))) {
+ columns.add(new AbstractColumn<Extraction, String>(new Model<String>(getString("Extraction.extraits"))) {
@Override
public void populateItem(Item<ICellPopulator<Extraction>> cellItem, String componentId,
IModel<Extraction> rowModel) {
@@ -186,7 +186,7 @@
});
- columns.add(new LinkableImagePropertyColumn<Extraction>("images/edit.png", getString("Update"),
+ columns.add(new LinkableImagePropertyColumn<Extraction, String>("images/edit.png", getString("Update"),
getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
@Override
@@ -205,7 +205,7 @@
}
});
- final DataTable<Extraction> extractionsDataTable = new AjaxFallbackDefaultDataTable<Extraction>(
+ final DataTable<Extraction, String> extractionsDataTable = new AjaxFallbackDefaultDataTable<Extraction, String>(
"ListExtractionsPage.Extractions", columns, extractionsDataProvider, WebContext.ROWS_PER_PAGE);
extractionsRefresh.add(extractionsDataTable);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ListLotsPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ListLotsPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ListLotsPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -96,16 +96,16 @@
LoadableDetachableSortableListDataProvider<Lot> lotsDataProvider = new LoadableDetachableSortableListDataProvider<Lot>(
lots, getSession().getLocale());
- List<IColumn<Lot>> columns = new ArrayList<IColumn<Lot>>();
+ List<IColumn<Lot, String>> columns = new ArrayList<IColumn<Lot, String>>();
- columns.add(new LinkableImagePropertyColumn<Lot>("images/read.png", getString("Read"), getString("Read")) {
+ columns.add(new LinkableImagePropertyColumn<Lot, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
setResponsePage(new ReadLotPage(model.getObject().getIdLot(), currentPage));
}
});
- columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.ref")), "ref", "ref",
+ columns.add(new LinkPropertyColumn<Lot, String>(new Model<String>(getString("Lot.ref")), "ref", "ref",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
@@ -113,10 +113,10 @@
}
});
- columns.add(new PropertyColumn<Lot>(new Model<String>(getString("Lot.dateRecolte2")), "dateRecolte",
+ columns.add(new PropertyColumn<Lot, String>(new Model<String>(getString("Lot.dateRecolte2")), "dateRecolte",
"dateRecolte"));
- columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.station")), "station", "station",
+ columns.add(new LinkPropertyColumn<Lot, String>(new Model<String>(getString("Lot.station")), "station", "station",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
@@ -124,7 +124,7 @@
}
});
- columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.specimenRef2")), "specimenRef",
+ columns.add(new LinkPropertyColumn<Lot, String>(new Model<String>(getString("Lot.specimenRef2")), "specimenRef",
"specimenRef", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
@@ -132,30 +132,30 @@
}
});
- columns.add(new EnumPropertyColumn<Lot>(new Model<String>(getString("Specimen.typeOrganisme")),
+ columns.add(new EnumPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.typeOrganisme")),
"specimenRef.typeOrganisme", "specimenRef.typeOrganisme", ListLotsPage.this));
- columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.embranchement")),
+ columns.add(new TaxonomyPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.embranchement")),
"specimenRef.embranchement", "specimenRef.embranchement"));
- columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.famille")),
+ columns.add(new TaxonomyPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.famille")),
"specimenRef.famille", "specimenRef.famille"));
- columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.genre")),
+ columns.add(new TaxonomyPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.genre")),
"specimenRef.genre", "specimenRef.genre"));
- columns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.espece")),
+ columns.add(new TaxonomyPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.espece")),
"specimenRef.espece", "specimenRef.espece"));
- columns.add(new PropertyColumn<Lot>(new Model<String>(getString("Lot.partie")), "partie", "partie"));
+ columns.add(new PropertyColumn<Lot, String>(new Model<String>(getString("Lot.partie")), "partie", "partie"));
- columns.add(new DecimalPropertyColumn<Lot>(new Model<String>(getString("Lot.masseFraiche2")), "masseFraiche",
+ columns.add(new DecimalPropertyColumn<Lot, String>(new Model<String>(getString("Lot.masseFraiche2")), "masseFraiche",
"masseFraiche", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new DecimalPropertyColumn<Lot>(new Model<String>(getString("Lot.masseSeche2")), "masseSeche",
+ columns.add(new DecimalPropertyColumn<Lot, String>(new Model<String>(getString("Lot.masseSeche2")), "masseSeche",
"masseSeche", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.campagne")), "campagne", "campagne",
+ columns.add(new LinkPropertyColumn<Lot, String>(new Model<String>(getString("Lot.campagne")), "campagne", "campagne",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
@@ -163,10 +163,10 @@
}
});
- columns.add(new MapValuePropertyColumn<Lot, String>(new Model<String>(getString("Campagne.codePays")),
+ columns.add(new MapValuePropertyColumn<Lot, String, String>(new Model<String>(getString("Campagne.codePays")),
"campagne.codePays", "campagne.codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new LinkableImagePropertyColumn<Lot>("images/edit.png", getString("Update"), getString("Update")) {
+ columns.add(new LinkableImagePropertyColumn<Lot, String>("images/edit.png", getString("Update"), getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
@Override
public void populateItem(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
@@ -184,7 +184,7 @@
}
});
- final DataTable<Lot> lotsDataTable = new AjaxFallbackDefaultDataTable<Lot>("ListLotsPage.Lots", columns,
+ final DataTable<Lot, String> lotsDataTable = new AjaxFallbackDefaultDataTable<Lot, String>("ListLotsPage.Lots", columns,
lotsDataProvider, WebContext.ROWS_PER_PAGE);
lotsRefresh.add(lotsDataTable);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -97,7 +97,7 @@
Utilisateur utilisateur = getSession().getUtilisateur();
final List<MoleculeProvenanceBean> moleculeProvenances = moleculeService.listMoleculeProvenances(utilisateur);
- DataTable<MoleculeProvenanceBean> moleculesDataTable = initMoleculesListTable(this,
+ DataTable<MoleculeProvenanceBean, String> moleculesDataTable = initMoleculesListTable(this,
"ListMoleculesPage.Molecules", currentPage, moleculeProvenances);
moleculesRefresh.add(moleculesDataTable);
}
@@ -113,7 +113,7 @@
* @param moleculeProvenances molecules provenance list
* @return data table component
*/
- public static DataTable<MoleculeProvenanceBean> initMoleculesListTable(final TemplatePage templatePage,
+ public static DataTable<MoleculeProvenanceBean, String> initMoleculesListTable(final TemplatePage templatePage,
final String componentId, final CallerPage callerPage,
List<MoleculeProvenanceBean> moleculeProvenances) {
@@ -121,9 +121,9 @@
new SimpleSortableListDataProvider<MoleculeProvenanceBean>(
moleculeProvenances, templatePage.getSession().getLocale());
- List<IColumn<MoleculeProvenanceBean>> columns = new ArrayList<IColumn<MoleculeProvenanceBean>>();
+ List<IColumn<MoleculeProvenanceBean, String>> columns = new ArrayList<IColumn<MoleculeProvenanceBean, String>>();
- columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean, String>(
"images/read.png", templatePage.getString("Read"), templatePage.getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item, String componentId, IModel<MoleculeProvenanceBean> model) {
@@ -131,7 +131,7 @@
}
});
- columns.add(new LinkPropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new LinkPropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.idMolecule")),
"idMolecule", "idMolecule") {
@Override
@@ -140,7 +140,7 @@
}
});
- columns.add(new AbstractColumn<MoleculeProvenanceBean>(
+ columns.add(new AbstractColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.formuleDevMol"))) {
public void populateItem(Item<ICellPopulator<MoleculeProvenanceBean>> cellItem, String componentId, IModel<MoleculeProvenanceBean> rowModel) {
cellItem.add(new Label(componentId, "-")
@@ -148,23 +148,23 @@
}
});
- columns.add(new PropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new PropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.nomCommun")),
"molecule.nomCommun", "molecule.nomCommun"));
- columns.add(new PropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new PropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.familleChimique")),
"molecule.familleChimique", "molecule.familleChimique"));
- columns.add(new PropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new PropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.formuleBrute")),
"molecule.formuleBrute", "molecule.formuleBrute"));
- columns.add(new DecimalPropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new DecimalPropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.masseMolaire")),
"molecule.masseMolaire", "molecule.masseMolaire", DecimalDisplFormat.SMALL, templatePage.getLocale()));
- columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean, String>(
"images/attachment.png", templatePage.getString("Read"), templatePage.getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item, String componentId, IModel<MoleculeProvenanceBean> model) {
@@ -177,23 +177,23 @@
}
});
- columns.add(new BooleanPropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new BooleanPropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.nouvMolecul")),
"molecule.nouvMolecul", "molecule.nouvMolecul", templatePage));
- columns.add(new PropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new PropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.provenance.embranchement")),
"lot.specimenRef.embranchement", "lot.specimenRef.embranchement"));
- columns.add(new PropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new PropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.provenance.genre")),
"lot.specimenRef.genre", "lot.specimenRef.genre"));
- columns.add(new PropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new PropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.provenance.espece")),
"lot.specimenRef.espece", "lot.specimenRef.espece"));
- columns.add(new LinkPropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new LinkPropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.provenance.lot.ref")),
"lot.ref", "lot.ref") {
@Override
@@ -207,11 +207,11 @@
}
});
- columns.add(new PropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new PropertyColumn<MoleculeProvenanceBean, String>(
new Model<String>(templatePage.getString("Molecule.provenance.programme")),
"lot.campagne.programme", "lot.campagne.programme"));
- columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean>(
+ columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean, String>(
"images/edit.png", templatePage.getString("Update"), templatePage.getString("Update")) {
@Override
public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item,
@@ -221,8 +221,8 @@
}
});
- final DataTable<MoleculeProvenanceBean> moleculesDataTable =
- new AjaxFallbackDefaultDataTable<MoleculeProvenanceBean>(
+ final DataTable<MoleculeProvenanceBean, String> moleculesDataTable =
+ new AjaxFallbackDefaultDataTable<MoleculeProvenanceBean, String>(
componentId, columns, moleculesDataProvider, WebContext.ROWS_PER_PAGE);
return moleculesDataTable;
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -614,9 +614,9 @@
SimpleSortableListDataProvider<Document> attachedDocumentsDataProvider =
new SimpleSortableListDataProvider<Document>(documents, getSession().getLocale());
- List<IColumn<Document>> columns = new ArrayList<IColumn<Document>>();
+ List<IColumn<Document, String>> columns = new ArrayList<IColumn<Document, String>>();
- columns.add(new LinkPropertyColumn<Document>(
+ columns.add(new LinkPropertyColumn<Document, String>(
new Model<String>(getString("Document.titre")), "titre", "titre") {
@Override
public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
@@ -624,13 +624,13 @@
}
});
- columns.add(new PropertyColumn<Document>(
+ columns.add(new PropertyColumn<Document, String>(
new Model<String>(getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
- columns.add(new PropertyColumn<Document>(
+ columns.add(new PropertyColumn<Document, String>(
new Model<String>(getString("Document.createur")), "createur", "createur"));
- columns.add(new LinkableImagePropertyColumn<Document>(new Model<String>(getString("Document.link")),
+ columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(getString("Document.link")),
"images/download.png", getString("Document.link"), getString("Document.link")) {
@Override
public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
@@ -650,10 +650,10 @@
}
});
- final DataTable<Document> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document>("ListDocumentsPage.AttachedDocuments", columns,
+ final DataTable<Document, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>("ListDocumentsPage.AttachedDocuments", columns,
attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
- columns.add(new AjaxButtonPropertyColumn<Document>(new Model<String>(getString("Actions")),
+ columns.add(new AjaxButtonPropertyColumn<Document, String>(new Model<String>(getString("Actions")),
new Model<String>(getString("Delete")), formView) {
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form, IModel<Document> model) {
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -307,9 +307,9 @@
new SimpleSortableListDataProvider<Document>(
documents, getSession().getLocale());
- List<IColumn<Document>> columns = new ArrayList<IColumn<Document>>();
+ List<IColumn<Document, String>> columns = new ArrayList<IColumn<Document, String>>();
- columns.add(new LinkPropertyColumn<Document>(
+ columns.add(new LinkPropertyColumn<Document, String>(
new Model<String>(getString("Document.titre")), "titre", "titre") {
@Override
public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
@@ -317,13 +317,13 @@
}
});
- columns.add(new PropertyColumn<Document>(
+ columns.add(new PropertyColumn<Document, String>(
new Model<String>(getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
- columns.add(new PropertyColumn<Document>(
+ columns.add(new PropertyColumn<Document, String>(
new Model<String>(getString("Document.createur")), "createur", "createur"));
- columns.add(new LinkableImagePropertyColumn<Document>(new Model<String>(getString("Document.link")),
+ columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(getString("Document.link")),
"images/download.png", getString("Document.link"), getString("Document.link")) {
@Override
public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
@@ -343,7 +343,7 @@
}
});
- final DataTable<Document> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document>("ListDocumentsPage.AttachedDocuments", columns,
+ final DataTable<Document, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>("ListDocumentsPage.AttachedDocuments", columns,
attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
add(attachedDocumentTable);
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -103,9 +103,9 @@
final LoadableDetachableSortableListDataProvider<Personne> personnesDataProvider = new LoadableDetachableSortableListDataProvider<Personne>(
personnes, getSession().getLocale());
- List<IColumn<Personne>> columns = new ArrayList<IColumn<Personne>>();
+ List<IColumn<Personne, String>> columns = new ArrayList<IColumn<Personne, String>>();
- columns.add(new LinkableImagePropertyColumn<Personne>("images/read.png", getString("Read"), getString("Read")) {
+ columns.add(new LinkableImagePropertyColumn<Personne, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> model) {
if (model.getObject() instanceof Utilisateur) {
@@ -117,11 +117,11 @@
}
});
- columns.add(new PropertyColumn<Personne>(new Model<String>(getString("Personne.nom")), "nom", "nom"));
+ columns.add(new PropertyColumn<Personne, String>(new Model<String>(getString("Personne.nom")), "nom", "nom"));
- columns.add(new PropertyColumn<Personne>(new Model<String>(getString("Personne.prenom")), "prenom", "prenom"));
+ columns.add(new PropertyColumn<Personne, String>(new Model<String>(getString("Personne.prenom")), "prenom", "prenom"));
- columns.add(new LinkPropertyColumn<Personne>(new Model<String>(getString("Personne.courriel")), "courriel",
+ columns.add(new LinkPropertyColumn<Personne, String>(new Model<String>(getString("Personne.courriel")), "courriel",
"courriel", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> rowModel) {
@@ -134,7 +134,7 @@
}
});
- columns.add(new AbstractColumn<Personne>(new Model<String>(getString("Utilisateur.typeDroit"))) {
+ columns.add(new AbstractColumn<Personne, String>(new Model<String>(getString("Utilisateur.typeDroit"))) {
@Override
public void populateItem(Item<ICellPopulator<Personne>> item, String componentId, IModel<Personne> rowModel) {
String typeDroit;
@@ -149,7 +149,7 @@
}
});
- columns.add(new LinkableImagePropertyColumn<Personne>("images/edit.png", getString("Update"),
+ columns.add(new LinkableImagePropertyColumn<Personne, String>("images/edit.png", getString("Update"),
getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
@@ -178,7 +178,7 @@
}
});
- final DataTable<Personne> personnesDataTable = new AjaxFallbackDefaultDataTable<Personne>(
+ final DataTable<Personne, String> personnesDataTable = new AjaxFallbackDefaultDataTable<Personne, String>(
"ListPersonnesPage.Personnes", columns, personnesDataProvider, WebContext.ROWS_PER_PAGE);
personnesRefresh.add(personnesDataTable);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -96,9 +96,9 @@
LoadableDetachableSortableListDataProvider<Purification> purificationsDataProvider = new LoadableDetachableSortableListDataProvider<Purification>(
purifications, getSession().getLocale());
- List<IColumn<Purification>> columns = new ArrayList<IColumn<Purification>>();
+ List<IColumn<Purification, String>> columns = new ArrayList<IColumn<Purification, String>>();
- columns.add(new LinkableImagePropertyColumn<Purification>("images/read.png", getString("Read"),
+ columns.add(new LinkableImagePropertyColumn<Purification, String>("images/read.png", getString("Read"),
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
@@ -106,7 +106,7 @@
}
});
- columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Extraction.lot")), "lotSource",
+ columns.add(new LinkPropertyColumn<Purification, String>(new Model<String>(getString("Extraction.lot")), "lotSource",
"lotSource", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
@@ -114,7 +114,7 @@
}
});
- columns.add(new LinkProduitPropertyColumn<Purification>(
+ columns.add(new LinkProduitPropertyColumn<Purification, String>(
new Model<String>(getString("ResultatTestBio.produit")), "produit", "produit", (TemplatePage) getPage()) {
@Override
public void onClickIfExtrait(Extrait extrait) {
@@ -127,7 +127,7 @@
}
});
- columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Purification.ref")), "ref",
+ columns.add(new LinkPropertyColumn<Purification, String>(new Model<String>(getString("Purification.ref")), "ref",
"ref", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
@@ -135,13 +135,13 @@
}
});
- columns.add(new ShortDatePropertyColumn<Purification>(new Model<String>(getString("Purification.date")),
+ columns.add(new ShortDatePropertyColumn<Purification, String>(new Model<String>(getString("Purification.date")),
"date", "date", getLocale()));
- columns.add(new PropertyColumn<Purification>(new Model<String>(getString("Purification.methode2")), "methode",
+ columns.add(new PropertyColumn<Purification, String>(new Model<String>(getString("Purification.methode2")), "methode",
"methode"));
- columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Campagne")),
+ columns.add(new LinkPropertyColumn<Purification, String>(new Model<String>(getString("Campagne")),
"lotSource.campagne", "lotSource.campagne", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
@@ -150,7 +150,7 @@
}
});
- columns.add(new LinkableImagePropertyColumn<Purification>("images/edit.png", getString("Update"),
+ columns.add(new LinkableImagePropertyColumn<Purification, String>("images/edit.png", getString("Update"),
getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
@Override
@@ -171,7 +171,7 @@
}
});
- final DataTable<Purification> purificationsDataTable = new AjaxFallbackDefaultDataTable<Purification>(
+ final DataTable<Purification, String> purificationsDataTable = new AjaxFallbackDefaultDataTable<Purification, String>(
"ListPurificationsPage.Purifications", columns, purificationsDataProvider, WebContext.ROWS_PER_PAGE);
purificationsRefresh.add(purificationsDataTable);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -147,7 +147,7 @@
List<MoleculeProvenanceBean> moleculeProvenances = moleculeService.listMoleculeProvenances(molecules, utilisateur);
// call static methods in ListXXXPage
- DataTable<MoleculeProvenanceBean> moleculesDataTable = ListMoleculesPage.initMoleculesListTable(this,
+ DataTable<MoleculeProvenanceBean, String> moleculesDataTable = ListMoleculesPage.initMoleculesListTable(this,
"SearchPage.Molecules.Results", currentPage, moleculeProvenances);
add(moleculesDataTable);
add(new CsvExportLink("SearchPage.Molecules.ExportCSV", moleculesDataTable, "molecules.csv"));
@@ -171,16 +171,16 @@
protected void addSpecimensTable(final CallerPage currentPage, SearchResult searchResult) {
// search result : specimens
List<Specimen> specimens = searchResult.getSpecimens();
- List<IColumn<Specimen>> specimensColumns = new ArrayList<IColumn<Specimen>>();
+ List<IColumn<Specimen, String>> specimensColumns = new ArrayList<IColumn<Specimen, String>>();
- specimensColumns.add(new LinkableImagePropertyColumn<Specimen>("images/read.png", getString("Read"), getString("Read")) {
+ specimensColumns.add(new LinkableImagePropertyColumn<Specimen, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
setResponsePage(new ReadSpecimenPage(model.getObject().getIdSpecimen(), currentPage));
}
});
- specimensColumns.add(new LinkPropertyColumn<Specimen>(new Model<String>(getString("Specimen.ref")), "ref", "ref",
+ specimensColumns.add(new LinkPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.ref")), "ref", "ref",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
@@ -188,22 +188,22 @@
}
});
- specimensColumns.add(new EnumPropertyColumn<Specimen>(new Model<String>(getString("Specimen.typeOrganisme")),
+ specimensColumns.add(new EnumPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.typeOrganisme")),
"typeOrganisme", "typeOrganisme", SearchPage.this));
- specimensColumns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.embranchement")),
+ specimensColumns.add(new TaxonomyPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.embranchement")),
"embranchement", "embranchement"));
- specimensColumns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.famille")), "famille",
+ specimensColumns.add(new TaxonomyPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.famille")), "famille",
"famille"));
- specimensColumns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.genre")), "genre",
+ specimensColumns.add(new TaxonomyPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.genre")), "genre",
"genre"));
- specimensColumns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.espece")), "espece",
+ specimensColumns.add(new TaxonomyPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.espece")), "espece",
"espece"));
- specimensColumns.add(new LinkPropertyColumn<Specimen>(new Model<String>(getString("Specimen.station2")), "station",
+ specimensColumns.add(new LinkPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.station2")), "station",
"station", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
@@ -212,7 +212,7 @@
});
LoadableDetachableSortableListDataProvider<Specimen> specimensDataProvider = new LoadableDetachableSortableListDataProvider<Specimen>(
specimens, getSession().getLocale());
- final DataTable<Specimen> specimensDataTable = new DefaultDataTable<Specimen>(getResource() + ".Specimens.Results",
+ final DataTable<Specimen, String> specimensDataTable = new DefaultDataTable<Specimen, String>(getResource() + ".Specimens.Results",
specimensColumns, specimensDataProvider, Integer.MAX_VALUE);
add(specimensDataTable);
add(new CsvExportLink("SearchPage.Specimens.ExportCSV", specimensDataTable, "specimens.csv"));
@@ -227,16 +227,16 @@
protected void addLotsTable(final CallerPage currentPage, SearchResult searchResult) {
// search result : lots
List<Lot> lots = searchResult.getLots();
- List<IColumn<Lot>> lotsColumns = new ArrayList<IColumn<Lot>>();
+ List<IColumn<Lot, String>> lotsColumns = new ArrayList<IColumn<Lot, String>>();
- lotsColumns.add(new LinkableImagePropertyColumn<Lot>("images/read.png", getString("Read"), getString("Read")) {
+ lotsColumns.add(new LinkableImagePropertyColumn<Lot, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
setResponsePage(new ReadLotPage(model.getObject().getIdLot(), currentPage));
}
});
- lotsColumns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.ref")), "ref", "ref",
+ lotsColumns.add(new LinkPropertyColumn<Lot, String>(new Model<String>(getString("Lot.ref")), "ref", "ref",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
@@ -244,10 +244,10 @@
}
});
- lotsColumns.add(new ExportablePropertyColumn<Lot>(new Model<String>(getString("Lot.dateRecolte2")), "dateRecolte",
+ lotsColumns.add(new ExportablePropertyColumn<Lot, String>(new Model<String>(getString("Lot.dateRecolte2")), "dateRecolte",
"dateRecolte"));
- lotsColumns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.station")), "station", "station",
+ lotsColumns.add(new LinkPropertyColumn<Lot, String>(new Model<String>(getString("Lot.station")), "station", "station",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
@@ -255,7 +255,7 @@
}
});
- lotsColumns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.specimenRef2")), "specimenRef",
+ lotsColumns.add(new LinkPropertyColumn<Lot, String>(new Model<String>(getString("Lot.specimenRef2")), "specimenRef",
"specimenRef", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
@@ -263,30 +263,30 @@
}
});
- lotsColumns.add(new EnumPropertyColumn<Lot>(new Model<String>(getString("Specimen.typeOrganisme")),
+ lotsColumns.add(new EnumPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.typeOrganisme")),
"specimenRef.typeOrganisme", "specimenRef.typeOrganisme", SearchPage.this));
- lotsColumns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.embranchement")),
+ lotsColumns.add(new TaxonomyPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.embranchement")),
"specimenRef.embranchement", "specimenRef.embranchement"));
- lotsColumns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.famille")),
+ lotsColumns.add(new TaxonomyPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.famille")),
"specimenRef.famille", "specimenRef.famille"));
- lotsColumns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.genre")),
+ lotsColumns.add(new TaxonomyPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.genre")),
"specimenRef.genre", "specimenRef.genre"));
- lotsColumns.add(new TaxonomyPropertyColumn<Lot>(new Model<String>(getString("Specimen.espece")),
+ lotsColumns.add(new TaxonomyPropertyColumn<Lot, String>(new Model<String>(getString("Specimen.espece")),
"specimenRef.espece", "specimenRef.espece"));
- lotsColumns.add(new ExportablePropertyColumn<Lot>(new Model<String>(getString("Lot.partie")), "partie", "partie"));
+ lotsColumns.add(new ExportablePropertyColumn<Lot, String>(new Model<String>(getString("Lot.partie")), "partie", "partie"));
- lotsColumns.add(new DecimalPropertyColumn<Lot>(new Model<String>(getString("Lot.masseFraiche2")), "masseFraiche",
+ lotsColumns.add(new DecimalPropertyColumn<Lot, String>(new Model<String>(getString("Lot.masseFraiche2")), "masseFraiche",
"masseFraiche", DecimalDisplFormat.SMALL, getLocale()));
- lotsColumns.add(new DecimalPropertyColumn<Lot>(new Model<String>(getString("Lot.masseSeche2")), "masseSeche",
+ lotsColumns.add(new DecimalPropertyColumn<Lot, String>(new Model<String>(getString("Lot.masseSeche2")), "masseSeche",
"masseSeche", DecimalDisplFormat.SMALL, getLocale()));
- lotsColumns.add(new LinkPropertyColumn<Lot>(new Model<String>(getString("Lot.campagne")), "campagne", "campagne",
+ lotsColumns.add(new LinkPropertyColumn<Lot, String>(new Model<String>(getString("Lot.campagne")), "campagne", "campagne",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Lot>> item, String componentId, IModel<Lot> model) {
@@ -294,12 +294,12 @@
}
});
- lotsColumns.add(new MapValuePropertyColumn<Lot, String>(new Model<String>(getString("Campagne.codePays")),
+ lotsColumns.add(new MapValuePropertyColumn<Lot, String, String>(new Model<String>(getString("Campagne.codePays")),
"campagne.codePays", "campagne.codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
LoadableDetachableSortableListDataProvider<Lot> lotsDataProvider = new LoadableDetachableSortableListDataProvider<Lot>(
lots, getSession().getLocale());
- final DataTable<Lot> lotsDataTable = new DefaultDataTable<Lot>(getResource() + ".Lots.Results", lotsColumns,
+ final DataTable<Lot, String> lotsDataTable = new DefaultDataTable<Lot, String>(getResource() + ".Lots.Results", lotsColumns,
lotsDataProvider, Integer.MAX_VALUE);
add(lotsDataTable);
add(new CsvExportLink("SearchPage.Lots.ExportCSV", lotsDataTable, "lots.csv"));
@@ -315,16 +315,16 @@
// search result : extractions
List<Extraction> extractions = searchResult.getExtractions();
- List<IColumn<Extraction>> extractionsColumns = new ArrayList<IColumn<Extraction>>();
+ List<IColumn<Extraction, String>> extractionsColumns = new ArrayList<IColumn<Extraction, String>>();
- extractionsColumns.add(new LinkableImagePropertyColumn<Extraction>("images/read.png", getString("Read"), getString("Read")) {
+ extractionsColumns.add(new LinkableImagePropertyColumn<Extraction, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
setResponsePage(new ReadExtractionPage(model.getObject().getIdExtraction(), currentPage));
}
});
- extractionsColumns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Extraction.lot")), "lot", "lot",
+ extractionsColumns.add(new LinkPropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.lot")), "lot", "lot",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
@@ -332,7 +332,7 @@
}
});
- extractionsColumns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Extraction.ref")), "ref", "ref",
+ extractionsColumns.add(new LinkPropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.ref")), "ref", "ref",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
@@ -340,16 +340,16 @@
}
});
- extractionsColumns.add(new ShortDatePropertyColumn<Extraction>(new Model<String>(getString("Extraction.date")), "date",
+ extractionsColumns.add(new ShortDatePropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.date")), "date",
"date", getLocale()));
- extractionsColumns.add(new ExportablePropertyColumn<Extraction>(new Model<String>(getString("Extraction.methode2")), "methode",
+ extractionsColumns.add(new ExportablePropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.methode2")), "methode",
"methode"));
- extractionsColumns.add(new DecimalPropertyColumn<Extraction>(new Model<String>(getString("Extraction.masseDepart2")),
+ extractionsColumns.add(new DecimalPropertyColumn<Extraction, String>(new Model<String>(getString("Extraction.masseDepart2")),
"masseDepart", "masseDepart", DecimalDisplFormat.SMALL, getLocale()));
- extractionsColumns.add(new LinkPropertyColumn<Extraction>(new Model<String>(getString("Campagne")), "lot.campagne",
+ extractionsColumns.add(new LinkPropertyColumn<Extraction, String>(new Model<String>(getString("Campagne")), "lot.campagne",
"lot.campagne", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Extraction>> item, String componentId, IModel<Extraction> model) {
@@ -358,7 +358,7 @@
}
});
- extractionsColumns.add(new AbstractColumn<Extraction>(new Model<String>(getString("Extraction.extraits"))) {
+ extractionsColumns.add(new AbstractColumn<Extraction, String>(new Model<String>(getString("Extraction.extraits"))) {
@Override
public void populateItem(Item<ICellPopulator<Extraction>> cellItem, String componentId,
IModel<Extraction> rowModel) {
@@ -399,7 +399,7 @@
LoadableDetachableSortableListDataProvider<Extraction> extractionsDataProvider = new LoadableDetachableSortableListDataProvider<Extraction>(
extractions, getSession().getLocale());
- final DataTable<Extraction> extractionsDataTable = new DefaultDataTable<Extraction>(
+ final DataTable<Extraction, String> extractionsDataTable = new DefaultDataTable<Extraction, String>(
getResource() + ".Extractions.Results", extractionsColumns, extractionsDataProvider, Integer.MAX_VALUE);
add(extractionsDataTable);
add(new CsvExportLink("SearchPage.Extractions.ExportCSV", extractionsDataTable, "extractions.csv"));
@@ -416,9 +416,9 @@
LoadableDetachableSortableListDataProvider<Purification> purificationsDataProvider = new LoadableDetachableSortableListDataProvider<Purification>(
purifications, getSession().getLocale());
- List<IColumn<Purification>> columns = new ArrayList<IColumn<Purification>>();
+ List<IColumn<Purification, String>> columns = new ArrayList<IColumn<Purification, String>>();
- columns.add(new LinkableImagePropertyColumn<Purification>("images/read.png", getString("Read"),
+ columns.add(new LinkableImagePropertyColumn<Purification, String>("images/read.png", getString("Read"),
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
@@ -426,7 +426,7 @@
}
});
- columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Extraction.lot")), "lotSource",
+ columns.add(new LinkPropertyColumn<Purification, String>(new Model<String>(getString("Extraction.lot")), "lotSource",
"lotSource", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
@@ -434,7 +434,7 @@
}
});
- columns.add(new LinkProduitPropertyColumn<Purification>(
+ columns.add(new LinkProduitPropertyColumn<Purification, String>(
new Model<String>(getString("ResultatTestBio.produit")), "produit", "produit", (TemplatePage) getPage()) {
@Override
public void onClickIfExtrait(Extrait extrait) {
@@ -447,7 +447,7 @@
}
});
- columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Purification.ref")), "ref",
+ columns.add(new LinkPropertyColumn<Purification, String>(new Model<String>(getString("Purification.ref")), "ref",
"ref", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
@@ -455,13 +455,13 @@
}
});
- columns.add(new ShortDatePropertyColumn<Purification>(new Model<String>(getString("Purification.date")),
+ columns.add(new ShortDatePropertyColumn<Purification, String>(new Model<String>(getString("Purification.date")),
"date", "date", getLocale()));
- columns.add(new ExportablePropertyColumn<Purification>(new Model<String>(getString("Purification.methode2")), "methode",
+ columns.add(new ExportablePropertyColumn<Purification, String>(new Model<String>(getString("Purification.methode2")), "methode",
"methode"));
- columns.add(new LinkPropertyColumn<Purification>(new Model<String>(getString("Campagne")),
+ columns.add(new LinkPropertyColumn<Purification, String>(new Model<String>(getString("Campagne")),
"lotSource.campagne", "lotSource.campagne", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Purification>> item, String componentId, IModel<Purification> model) {
@@ -470,7 +470,7 @@
}
});
- final DataTable<Purification> purificationsDataTable = new DefaultDataTable<Purification>(
+ final DataTable<Purification, String> purificationsDataTable = new DefaultDataTable<Purification, String>(
getResource() + ".Purifications.Results", columns, purificationsDataProvider, Integer.MAX_VALUE);
add(purificationsDataTable);
add(new CsvExportLink("SearchPage.Purifications.ExportCSV", purificationsDataTable, "purifications.csv"));
@@ -487,9 +487,9 @@
LoadableDetachableSortableListDataProvider<ResultatTestBio> resTestBiosDataProvider = new LoadableDetachableSortableListDataProvider<ResultatTestBio>(
resultatTestBios, getSession().getLocale());
- List<IColumn<ResultatTestBio>> columns = new ArrayList<IColumn<ResultatTestBio>>();
+ List<IColumn<ResultatTestBio, String>> columns = new ArrayList<IColumn<ResultatTestBio, String>>();
- columns.add(new LinkableImagePropertyColumn<ResultatTestBio>("images/read.png", getString("Read"),
+ columns.add(new LinkableImagePropertyColumn<ResultatTestBio, String>("images/read.png", getString("Read"),
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
@@ -498,17 +498,17 @@
}
});
- columns.add(new ExportableTextFilteredPropertyColumn<ResultatTestBio, String>(new Model<String>(
+ columns.add(new ExportableTextFilteredPropertyColumn<ResultatTestBio, String, String>(new Model<String>(
getString("MethodeTestBio.cible2")), "testBio.methode.cible", "testBio.methode.cible"));
- columns.add(new DecimalPropertyColumn<ResultatTestBio>(new Model<String>(
+ columns.add(new DecimalPropertyColumn<ResultatTestBio, String>(new Model<String>(
getString("ResultatTestBio.concMasse2")), "concMasse", "concMasse", DecimalDisplFormat.SMALL,
getLocale()));
- columns.add(new EnumPropertyColumn<ResultatTestBio>(new Model<String>(getString("TestBio.uniteConcMasse2")),
+ columns.add(new EnumPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("TestBio.uniteConcMasse2")),
"uniteConcMasse", "uniteConcMasse", (TemplatePage) getPage()));
- columns.add(new LinkProduitPropertyColumn<ResultatTestBio>(new Model<String>(
+ columns.add(new LinkProduitPropertyColumn<ResultatTestBio, String>(new Model<String>(
getString("ResultatTestBio.produit")), "produit", "produit", (TemplatePage) getPage()) {
@Override
public void onClickIfExtrait(Extrait extrait) {
@@ -521,35 +521,35 @@
}
});
- columns.add(new DecimalPropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.valeur")),
+ columns.add(new DecimalPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("ResultatTestBio.valeur")),
"valeur", "valeur", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new ExportablePropertyColumn<ResultatTestBio>(new Model<String>(getString("MethodeTestBio.uniteResultat2")),
+ columns.add(new ExportablePropertyColumn<ResultatTestBio, String>(new Model<String>(getString("MethodeTestBio.uniteResultat2")),
"testBio.methode.uniteResultat", "testBio.methode.uniteResultat"));
- columns.add(new ExportablePropertyColumn<ResultatTestBio>(new Model<String>(getString("Extrait.typeExtrait2")),
+ columns.add(new ExportablePropertyColumn<ResultatTestBio, String>(new Model<String>(getString("Extrait.typeExtrait2")),
"typeExtraitSource", "typeExtraitSource"));
- columns.add(new BooleanPropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.actif")),
+ columns.add(new BooleanPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("ResultatTestBio.actif")),
"actif", "actif", (TemplatePage) getPage()));
- columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.famille")),
+ columns.add(new TaxonomyPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("Specimen.famille")),
"lotSource.specimenRef.famille", "lotSource.specimenRef.famille"));
- columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.genre")),
+ columns.add(new TaxonomyPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("Specimen.genre")),
"lotSource.specimenRef.genre", "lotSource.specimenRef.genre"));
- columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.espece")),
+ columns.add(new TaxonomyPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("Specimen.espece")),
"lotSource.specimenRef.espece", "lotSource.specimenRef.espece"));
- columns.add(new MapValuePropertyColumn<ResultatTestBio, String>(new Model<String>(
+ columns.add(new MapValuePropertyColumn<ResultatTestBio, String, String>(new Model<String>(
getString("Campagne.codePays")), "lotSource.campagne.codePays", "lotSource.campagne.codePays",
WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new ExportablePropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.repere")),
+ columns.add(new ExportablePropertyColumn<ResultatTestBio, String>(new Model<String>(getString("ResultatTestBio.repere")),
"repere", "repere"));
- columns.add(new LinkPropertyColumn<ResultatTestBio>(new Model<String>(getString("TestBio.ref")), "testBio.ref",
+ columns.add(new LinkPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("TestBio.ref")), "testBio.ref",
"testBio.ref", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
@@ -558,7 +558,7 @@
}
});
- final DataTable<ResultatTestBio> resTestBiosDataTable = new DefaultDataTable<ResultatTestBio>(
+ final DataTable<ResultatTestBio, String> resTestBiosDataTable = new DefaultDataTable<ResultatTestBio, String>(
getResource() + ".ResultatTestBios.Results", columns, resTestBiosDataProvider, Integer.MAX_VALUE);
add(resTestBiosDataTable);
@@ -580,16 +580,16 @@
LoadableDetachableSortableListDataProvider<Station> stationsDataProvider = new LoadableDetachableSortableListDataProvider<Station>(
stations, getSession().getLocale());
- List<IColumn<Station>> columns = new ArrayList<IColumn<Station>>();
+ List<IColumn<Station, String>> columns = new ArrayList<IColumn<Station, String>>();
- columns.add(new LinkableImagePropertyColumn<Station>("images/read.png", getString("Read"), getString("Read")) {
+ columns.add(new LinkableImagePropertyColumn<Station, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
setResponsePage(new ReadStationPage(model.getObject().getIdStation(), currentPage));
}
});
- columns.add(new LinkPropertyColumn<Station>(new Model<String>(getString("Station.nom")), "nom", "nom",
+ columns.add(new LinkPropertyColumn<Station, String>(new Model<String>(getString("Station.nom")), "nom", "nom",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
@@ -597,20 +597,20 @@
}
});
- columns.add(new MapValuePropertyColumn<Station, String>(new Model<String>(getString("Station.codePays")),
+ columns.add(new MapValuePropertyColumn<Station, String, String>(new Model<String>(getString("Station.codePays")),
"codePays", "codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new ExportablePropertyColumn<Station>(new Model<String>(getString("Station.localite")), "localite",
+ columns.add(new ExportablePropertyColumn<Station, String>(new Model<String>(getString("Station.localite")), "localite",
"localite"));
- columns.add(new ExportablePropertyColumn<Station>(new Model<String>(getString("Station.latitude")), "latitude",
+ columns.add(new ExportablePropertyColumn<Station, String>(new Model<String>(getString("Station.latitude")), "latitude",
"latitude"));
- columns.add(new ExportablePropertyColumn<Station>(new Model<String>(getString("Station.longitude")), "longitude",
+ columns.add(new ExportablePropertyColumn<Station, String>(new Model<String>(getString("Station.longitude")), "longitude",
"longitude"));
- final DataTable<Station> stationsDataTable = new AjaxFallbackDefaultDataTable<Station>(
+ final DataTable<Station, String> stationsDataTable = new AjaxFallbackDefaultDataTable<Station, String>(
getResource() + ".Stations.Results", columns, stationsDataProvider, WebContext.ROWS_PER_PAGE);
add(stationsDataTable);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ListSpecimensPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ListSpecimensPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ListSpecimensPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -91,16 +91,16 @@
LoadableDetachableSortableListDataProvider<Specimen> specimensDataProvider = new LoadableDetachableSortableListDataProvider<Specimen>(
specimens, getSession().getLocale());
- List<IColumn<Specimen>> columns = new ArrayList<IColumn<Specimen>>();
+ List<IColumn<Specimen, String>> columns = new ArrayList<IColumn<Specimen, String>>();
- columns.add(new LinkableImagePropertyColumn<Specimen>("images/read.png", getString("Read"), getString("Read")) {
+ columns.add(new LinkableImagePropertyColumn<Specimen, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
setResponsePage(new ReadSpecimenPage(model.getObject().getIdSpecimen(), currentPage));
}
});
- columns.add(new LinkPropertyColumn<Specimen>(new Model<String>(getString("Specimen.ref")), "ref", "ref",
+ columns.add(new LinkPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.ref")), "ref", "ref",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
@@ -108,22 +108,22 @@
}
});
- columns.add(new EnumPropertyColumn<Specimen>(new Model<String>(getString("Specimen.typeOrganisme")),
+ columns.add(new EnumPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.typeOrganisme")),
"typeOrganisme", "typeOrganisme", ListSpecimensPage.this));
- columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.embranchement")),
+ columns.add(new TaxonomyPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.embranchement")),
"embranchement", "embranchement"));
- columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.famille")), "famille",
+ columns.add(new TaxonomyPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.famille")), "famille",
"famille"));
- columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.genre")), "genre",
+ columns.add(new TaxonomyPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.genre")), "genre",
"genre"));
- columns.add(new TaxonomyPropertyColumn<Specimen>(new Model<String>(getString("Specimen.espece")), "espece",
+ columns.add(new TaxonomyPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.espece")), "espece",
"espece"));
- columns.add(new LinkPropertyColumn<Specimen>(new Model<String>(getString("Specimen.station2")), "station",
+ columns.add(new LinkPropertyColumn<Specimen, String>(new Model<String>(getString("Specimen.station2")), "station",
"station", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Specimen>> item, String componentId, IModel<Specimen> model) {
@@ -131,7 +131,7 @@
}
});
- columns.add(new LinkableImagePropertyColumn<Specimen>("images/edit.png", getString("Update"),
+ columns.add(new LinkableImagePropertyColumn<Specimen, String>("images/edit.png", getString("Update"),
getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
@Override
@@ -154,7 +154,7 @@
}
});
- final DataTable<Specimen> specimensDataTable = new AjaxFallbackDefaultDataTable<Specimen>(
+ final DataTable<Specimen, String> specimensDataTable = new AjaxFallbackDefaultDataTable<Specimen, String>(
"ListSpecimensPage.Specimens", columns, specimensDataProvider, WebContext.ROWS_PER_PAGE);
specimensRefresh.add(specimensDataTable);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ListStationsPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ListStationsPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ListStationsPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -91,16 +91,16 @@
LoadableDetachableSortableListDataProvider<Station> stationsDataProvider = new LoadableDetachableSortableListDataProvider<Station>(
stations, getSession().getLocale());
- List<IColumn<Station>> columns = new ArrayList<IColumn<Station>>();
+ List<IColumn<Station, String>> columns = new ArrayList<IColumn<Station, String>>();
- columns.add(new LinkableImagePropertyColumn<Station>("images/read.png", getString("Read"), getString("Read")) {
+ columns.add(new LinkableImagePropertyColumn<Station, String>("images/read.png", getString("Read"), getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
setResponsePage(new ReadStationPage(model.getObject().getIdStation(), currentPage));
}
});
- columns.add(new LinkPropertyColumn<Station>(new Model<String>(getString("Station.nom")), "nom", "nom",
+ columns.add(new LinkPropertyColumn<Station, String>(new Model<String>(getString("Station.nom")), "nom", "nom",
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<Station>> item, String componentId, IModel<Station> model) {
@@ -108,19 +108,19 @@
}
});
- columns.add(new MapValuePropertyColumn<Station, String>(new Model<String>(getString("Station.codePays")),
+ columns.add(new MapValuePropertyColumn<Station, String, String>(new Model<String>(getString("Station.codePays")),
"codePays", "codePays", WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new PropertyColumn<Station>(new Model<String>(getString("Station.localite")), "localite",
+ columns.add(new PropertyColumn<Station, String>(new Model<String>(getString("Station.localite")), "localite",
"localite"));
- columns.add(new PropertyColumn<Station>(new Model<String>(getString("Station.latitude")), "latitude",
+ columns.add(new PropertyColumn<Station, String>(new Model<String>(getString("Station.latitude")), "latitude",
"latitude"));
- columns.add(new PropertyColumn<Station>(new Model<String>(getString("Station.longitude")), "longitude",
+ columns.add(new PropertyColumn<Station, String>(new Model<String>(getString("Station.longitude")), "longitude",
"longitude"));
- columns.add(new LinkableImagePropertyColumn<Station>("images/edit.png", getString("Update"),
+ columns.add(new LinkableImagePropertyColumn<Station, String>("images/edit.png", getString("Update"),
getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
@Override
@@ -143,7 +143,7 @@
}
});
- final DataTable<Station> stationsDataTable = new AjaxFallbackDefaultDataTable<Station>(
+ final DataTable<Station, String> stationsDataTable = new AjaxFallbackDefaultDataTable<Station, String>(
"ListStationsPage.Stations", columns, stationsDataProvider, WebContext.ROWS_PER_PAGE);
stationsRefresh.add(stationsDataTable);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ListTestsBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ListTestsBioPage.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ListTestsBioPage.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -100,9 +100,9 @@
LoadableDetachableSortableListDataProvider<ResultatTestBio> resTestBiosDataProvider = new LoadableDetachableSortableListDataProvider<ResultatTestBio>(
resTestsBios, getSession().getLocale());
- List<IColumn<ResultatTestBio>> columns = new ArrayList<IColumn<ResultatTestBio>>();
+ List<IColumn<ResultatTestBio, String>> columns = new ArrayList<IColumn<ResultatTestBio, String>>();
- columns.add(new LinkableImagePropertyColumn<ResultatTestBio>("images/read.png", getString("Read"),
+ columns.add(new LinkableImagePropertyColumn<ResultatTestBio, String>("images/read.png", getString("Read"),
getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
@@ -111,17 +111,17 @@
}
});
- columns.add(new TextFilteredPropertyColumn<ResultatTestBio, String>(new Model<String>(
+ columns.add(new TextFilteredPropertyColumn<ResultatTestBio, String, String>(new Model<String>(
getString("MethodeTestBio.cible2")), "testBio.methode.cible", "testBio.methode.cible"));
- columns.add(new DecimalPropertyColumn<ResultatTestBio>(new Model<String>(
+ columns.add(new DecimalPropertyColumn<ResultatTestBio, String>(new Model<String>(
getString("ResultatTestBio.concMasse2")), "concMasse", "concMasse", DecimalDisplFormat.SMALL,
getLocale()));
- columns.add(new EnumPropertyColumn<ResultatTestBio>(new Model<String>(getString("TestBio.uniteConcMasse2")),
+ columns.add(new EnumPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("TestBio.uniteConcMasse2")),
"uniteConcMasse", "uniteConcMasse", (TemplatePage) getPage()));
- columns.add(new LinkProduitPropertyColumn<ResultatTestBio>(new Model<String>(
+ columns.add(new LinkProduitPropertyColumn<ResultatTestBio, String>(new Model<String>(
getString("ResultatTestBio.produit")), "produit", "produit", (TemplatePage) getPage()) {
@Override
public void onClickIfExtrait(Extrait extrait) {
@@ -134,35 +134,35 @@
}
});
- columns.add(new DecimalPropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.valeur")),
+ columns.add(new DecimalPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("ResultatTestBio.valeur")),
"valeur", "valeur", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new PropertyColumn<ResultatTestBio>(new Model<String>(getString("MethodeTestBio.uniteResultat2")),
+ columns.add(new PropertyColumn<ResultatTestBio, String>(new Model<String>(getString("MethodeTestBio.uniteResultat2")),
"testBio.methode.uniteResultat", "testBio.methode.uniteResultat"));
- columns.add(new PropertyColumn<ResultatTestBio>(new Model<String>(getString("Extrait.typeExtrait2")),
+ columns.add(new PropertyColumn<ResultatTestBio, String>(new Model<String>(getString("Extrait.typeExtrait2")),
"typeExtraitSource", "typeExtraitSource"));
- columns.add(new BooleanPropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.actif")),
+ columns.add(new BooleanPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("ResultatTestBio.actif")),
"actif", "actif", (TemplatePage) getPage()));
- columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.famille")),
+ columns.add(new TaxonomyPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("Specimen.famille")),
"lotSource.specimenRef.famille", "lotSource.specimenRef.famille"));
- columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.genre")),
+ columns.add(new TaxonomyPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("Specimen.genre")),
"lotSource.specimenRef.genre", "lotSource.specimenRef.genre"));
- columns.add(new TaxonomyPropertyColumn<ResultatTestBio>(new Model<String>(getString("Specimen.espece")),
+ columns.add(new TaxonomyPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("Specimen.espece")),
"lotSource.specimenRef.espece", "lotSource.specimenRef.espece"));
- columns.add(new MapValuePropertyColumn<ResultatTestBio, String>(new Model<String>(
+ columns.add(new MapValuePropertyColumn<ResultatTestBio, String, String>(new Model<String>(
getString("Campagne.codePays")), "lotSource.campagne.codePays", "lotSource.campagne.codePays",
WebContext.COUNTRIES.get(getSession().getLocale())));
- columns.add(new PropertyColumn<ResultatTestBio>(new Model<String>(getString("ResultatTestBio.repere")),
+ columns.add(new PropertyColumn<ResultatTestBio, String>(new Model<String>(getString("ResultatTestBio.repere")),
"repere", "repere"));
- columns.add(new LinkPropertyColumn<ResultatTestBio>(new Model<String>(getString("TestBio.ref")), "testBio.ref",
+ columns.add(new LinkPropertyColumn<ResultatTestBio, String>(new Model<String>(getString("TestBio.ref")), "testBio.ref",
"testBio.ref", getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<ResultatTestBio>> item, String componentId,
@@ -171,7 +171,7 @@
}
});
- columns.add(new LinkableImagePropertyColumn<ResultatTestBio>("images/edit.png", getString("Update"),
+ columns.add(new LinkableImagePropertyColumn<ResultatTestBio, String>("images/edit.png", getString("Update"),
getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
@Override
@@ -193,7 +193,7 @@
}
});
- final DataTable<ResultatTestBio> resTestBiosDataTable = new AjaxFallbackDefaultDataTable<ResultatTestBio>(
+ final DataTable<ResultatTestBio, String> resTestBiosDataTable = new AjaxFallbackDefaultDataTable<ResultatTestBio, String>(
"ListTestsBioPage.ResultatsTestsBio", columns, resTestBiosDataProvider, WebContext.ROWS_PER_PAGE);
// DRAFT FOR FILTER TABLE
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeEditorBehavior.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -22,12 +22,18 @@
*/
package nc.ird.cantharella.web.utils.behaviors;
+import nc.ird.cantharella.web.pages.HomePage;
+
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
-import org.apache.wicket.markup.html.IHeaderResponse;
+import org.apache.wicket.core.util.string.JavaScriptUtils;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.Response;
-import org.apache.wicket.util.string.JavaScriptUtils;
+import org.apache.wicket.request.resource.CssResourceReference;
+import org.apache.wicket.request.resource.JavaScriptResourceReference;
/**
* Permet d'ajouter la formule dans un attribut formula. L'attribut est ensuite
@@ -61,14 +67,14 @@
/** {@inheritDoc} */
@Override
public void renderHead(Component component, IHeaderResponse response) {
- response.renderCSSReference("ChemDoodleWeb/css/ChemDoodleWeb.css");
- response.renderCSSReference("ChemDoodleWeb/css/jquery-ui-1.9.2.custom.css");
- response.renderJavaScriptReference("js/jquery-1.9.1.min.js");
- response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb-libs.js");
- response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb.js");
- response.renderJavaScriptReference("ChemDoodleWeb/js/jquery-ui-1.9.2.custom.min.js");
- response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb-sketcher.js");
- response.renderJavaScriptReference("js/moleditor.js");
+ response.render(CssHeaderItem.forUrl("ChemDoodleWeb/css/ChemDoodleWeb.css"));
+ response.render(CssHeaderItem.forUrl("ChemDoodleWeb/css/jquery-ui-1.9.2.custom.css"));
+ response.render(JavaScriptHeaderItem.forUrl("js/jquery-1.9.1.min.js"));
+ response.render(JavaScriptHeaderItem.forUrl("ChemDoodleWeb/js/ChemDoodleWeb-libs.js"));
+ response.render(JavaScriptHeaderItem.forUrl("ChemDoodleWeb/js/ChemDoodleWeb.js"));
+ response.render(JavaScriptHeaderItem.forUrl("ChemDoodleWeb/js/jquery-ui-1.9.2.custom.min.js"));
+ response.render(JavaScriptHeaderItem.forUrl("ChemDoodleWeb/js/ChemDoodleWeb-sketcher.js"));
+ response.render(JavaScriptHeaderItem.forUrl("js/moleditor.js"));
}
/** {@inheritDoc} */
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/behaviors/MoleculeViewBehavior.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -22,12 +22,18 @@
*/
package nc.ird.cantharella.web.utils.behaviors;
+import nc.ird.cantharella.web.pages.HomePage;
+
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
-import org.apache.wicket.markup.html.IHeaderResponse;
+import org.apache.wicket.core.util.string.JavaScriptUtils;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.Response;
-import org.apache.wicket.util.string.JavaScriptUtils;
+import org.apache.wicket.request.resource.CssResourceReference;
+import org.apache.wicket.request.resource.JavaScriptResourceReference;
/**
* Permet d'ajouter la formule dans un attribut formula. L'attribut est ensuite
@@ -80,11 +86,11 @@
/** {@inheritDoc} */
@Override
public void renderHead(Component component, IHeaderResponse response) {
- response.renderCSSReference("ChemDoodleWeb/css/ChemDoodleWeb.css");
- response.renderJavaScriptReference("js/jquery-1.9.1.min.js");
- response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb-libs.js");
- response.renderJavaScriptReference("ChemDoodleWeb/js/ChemDoodleWeb.js");
- response.renderJavaScriptReference("js/molviewer.js");
+ response.render(CssHeaderItem.forUrl("ChemDoodleWeb/css/ChemDoodleWeb.css"));
+ response.render(JavaScriptHeaderItem.forUrl("js/jquery-1.9.1.min.js"));
+ response.render(JavaScriptHeaderItem.forUrl("ChemDoodleWeb/js/ChemDoodleWeb-libs.js"));
+ response.render(JavaScriptHeaderItem.forUrl("ChemDoodleWeb/js/ChemDoodleWeb.js"));
+ response.render(JavaScriptHeaderItem.forUrl("js/molviewer.js"));
}
/** {@inheritDoc} */
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -36,8 +36,9 @@
* Column embeded in a datatable which represent an linkable image
* @author Adrien Cheype
* @param <T> Generic type
+ * @param <S> the type of the sort property
*/
-abstract public class AjaxButtonPropertyColumn<T> extends AbstractColumn<T> {
+abstract public class AjaxButtonPropertyColumn<T, S> extends AbstractColumn<T, S> {
/** Title displayed for the button */
private Model<String> buttonLabel;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/BooleanPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/BooleanPropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/BooleanPropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -36,8 +36,9 @@
* PropertyColumn which display booleans
* @author Adrien Cheype
* @param <T> Type of the row model
+ * @param <S> the type of the sort property
*/
-public class BooleanPropertyColumn<T> extends AbstractColumn<T> implements ExportableColumn<T> {
+public class BooleanPropertyColumn<T, S> extends AbstractColumn<T, S> implements ExportableColumn<T, S> {
/** wicket property expression */
private final String propertyExpression;
@@ -52,7 +53,7 @@
* @param propertyExpression Wicket property expression
* @param page Page used to get True, False message
*/
- public BooleanPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public BooleanPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
TemplatePage page) {
super(displayModel, sortProperty);
this.propertyExpression = propertyExpression;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/DecimalPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/DecimalPropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/DecimalPropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -38,8 +38,9 @@
* PropertyColumn which display numbers with decimal format
* @author Adrien Cheype
* @param <T> Type of the row model
+ * @param <S> the type of the sort property
*/
-public class DecimalPropertyColumn<T> extends AbstractColumn<T> implements ExportableColumn<T> {
+public class DecimalPropertyColumn<T, S> extends AbstractColumn<T, S> implements ExportableColumn<T, S> {
/** wicket property expression */
private final String propertyExpression;
@@ -58,7 +59,7 @@
* @param format format to display
* @param locale Locale used to format decimal
*/
- public DecimalPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public DecimalPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
DecimalDisplFormat format, Locale locale) {
super(displayModel, sortProperty);
this.propertyExpression = propertyExpression;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/EnumPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/EnumPropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/EnumPropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -36,8 +36,9 @@
* PropertyColumns which display corresponding messages for enum values
* @author Adrien Cheype
* @param <T> Type of the row model
+ * @param <S> the type of the sort property
*/
-public class EnumPropertyColumn<T> extends AbstractColumn<T> implements ExportableColumn<T> {
+public class EnumPropertyColumn<T, S> extends AbstractColumn<T, S> implements ExportableColumn<T, S> {
/** wicket property expression */
private final String propertyExpression;
@@ -52,7 +53,7 @@
* @param propertyExpression Wicket property expression
* @param page Page used to get enum messages
*/
- public EnumPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public EnumPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
TemplatePage page) {
super(displayModel, sortProperty);
this.propertyExpression = propertyExpression;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportableColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportableColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportableColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -30,8 +30,9 @@
* @author echatellier
*
* @param <T>
+ * @param <S> the type of the sort property
*/
-public interface ExportableColumn<T> extends IColumn<T> {
+public interface ExportableColumn<T, S> extends IColumn<T, S> {
/** Export column name. */
String getHeaderName();
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportablePropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportablePropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportablePropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -32,9 +32,10 @@
* @author echatellier
*
* @param <T>
+ * @param <S> the type of the sort property
*/
-public class ExportablePropertyColumn<T> extends PropertyColumn<T> implements
- ExportableColumn<T> {
+public class ExportablePropertyColumn<T, S> extends PropertyColumn<T, S> implements
+ ExportableColumn<T, S> {
/**
* Constructor.
@@ -43,7 +44,7 @@
* @param sortProperty wicket sort property
* @param propertyExpression wicket sort expression
*/
- public ExportablePropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression) {
+ public ExportablePropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression) {
super(displayModel, sortProperty, propertyExpression);
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportableTextFilteredPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportableTextFilteredPropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ExportableTextFilteredPropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -33,8 +33,9 @@
*
* @param <T>
* @param <F>
+ * @param <S> the type of the sort property
*/
-public class ExportableTextFilteredPropertyColumn<T, F> extends TextFilteredPropertyColumn<T, F> implements ExportableColumn<T> {
+public class ExportableTextFilteredPropertyColumn<T, F, S> extends TextFilteredPropertyColumn<T, F, S> implements ExportableColumn<T, S> {
/**
* Constructor.
@@ -44,7 +45,7 @@
* @param propertyExpression wicket sort expression
*/
public ExportableTextFilteredPropertyColumn(IModel<String> displayModel,
- String sortProperty, String propertyExpression) {
+ S sortProperty, String propertyExpression) {
super(displayModel, sortProperty, propertyExpression);
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkPropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkPropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -38,8 +38,9 @@
* Column embeded in a datatable which represent a link code from
* https://cwiki.apache.org/WICKET/adding-links-in-a-defaultdatatable.html
* @param <T> Generic type
+ * @param <S> the type of the sort property
*/
-abstract public class LinkPropertyColumn<T> extends PropertyColumn<T> implements ExportableColumn<T>{
+abstract public class LinkPropertyColumn<T, S> extends PropertyColumn<T, S> implements ExportableColumn<T, S>{
/** Popup settings */
private PopupSettings popupSettings;
@@ -57,7 +58,7 @@
* @param propertyExpression Property expression
* @param popupSettings Popup setting
*/
- public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public LinkPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
PopupSettings popupSettings) {
this(displayModel, sortProperty, propertyExpression);
this.popupSettings = popupSettings;
@@ -70,7 +71,7 @@
* @param propertyExpression Property expression
* @param linkTitle Title displayed for the link
*/
- public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public LinkPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
String linkTitle) {
this(displayModel, sortProperty, propertyExpression);
this.linkTitle = linkTitle;
@@ -84,7 +85,7 @@
* @param linkTitle Title displayed for the link
* @param popupSettings Popup setting
*/
- public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public LinkPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
String linkTitle, PopupSettings popupSettings) {
this(displayModel, sortProperty, propertyExpression);
this.linkTitle = linkTitle;
@@ -107,7 +108,7 @@
* @param sortProperty Sort property
* @param propertyExpression Property expression
*/
- public LinkPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression) {
+ public LinkPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression) {
super(displayModel, sortProperty, propertyExpression);
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -36,8 +36,9 @@
* Column embeded in a datatable which represent an linkable image
* @author Adrien Cheype
* @param <T> Generic type
+ * @param <S> the type of the sort property
*/
-abstract public class LinkableImagePropertyColumn<T> extends AbstractColumn<T> {
+abstract public class LinkableImagePropertyColumn<T, S> extends AbstractColumn<T, S> {
/** Relative url for the image */
private String imageSrc;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/MapValuePropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/MapValuePropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/MapValuePropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -37,9 +37,10 @@
* PropertyColumn which display string resulting values of applying model value on a map.
* @author Adrien Cheype
* @param <T> Type of the row model
+ * @param <S> the type of the sort property
* @param <U> Type of the map key. The map is thus parametred by <U, String>
*/
-public class MapValuePropertyColumn<T, U> extends AbstractColumn<T> implements ExportableColumn<T> {
+public class MapValuePropertyColumn<T, S, U> extends AbstractColumn<T, S> implements ExportableColumn<T, S> {
/** wicket property expression */
private final String propertyExpression;
@@ -54,7 +55,7 @@
* @param propertyExpression Wicket property expression
* @param map Applying map
*/
- public MapValuePropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public MapValuePropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
Map<U, String> map) {
super(displayModel, sortProperty);
this.propertyExpression = propertyExpression;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/PercentPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/PercentPropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/PercentPropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -36,8 +36,9 @@
* PropertyColumns which display numbers with percent format
* @author Adrien Cheype
* @param <T> Type of the row model
+ * @param <S> the type of the sort property
*/
-public class PercentPropertyColumn<T> extends AbstractColumn<T> {
+public class PercentPropertyColumn<T, S> extends AbstractColumn<T, S> {
/** wicket property expression */
private final String propertyExpression;
@@ -52,7 +53,7 @@
* @param propertyExpression Wicket property expression
* @param locale Locale used to format decimal
*/
- public PercentPropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public PercentPropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
Locale locale) {
super(displayModel, sortProperty);
this.propertyExpression = propertyExpression;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ShortDatePropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ShortDatePropertyColumn.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/ShortDatePropertyColumn.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -37,8 +37,9 @@
* PropertyColumns which display dates with a short format
* @author Adrien Cheype
* @param <T> Type of the row model
+ * @param <S> the type of the sort property
*/
-public class ShortDatePropertyColumn<T> extends AbstractColumn<T> implements ExportableColumn<T> {
+public class ShortDatePropertyColumn<T, S> extends AbstractColumn<T, S> implements ExportableColumn<T, S> {
/** wicket property expression */
private final String propertyExpression;
@@ -53,7 +54,7 @@
* @param propertyExpression Wicket property expression
* @param locale Locale used to format decimal
*/
- public ShortDatePropertyColumn(IModel<String> displayModel, String sortProperty, String propertyExpression,
+ public ShortDatePropertyColumn(IModel<String> displayModel, S sortProperty, String propertyExpression,
Locale locale) {
super(displayModel, sortProperty);
this.propertyExpression = propertyExpression;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/links/CsvExportLink.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/links/CsvExportLink.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/links/CsvExportLink.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -45,13 +45,13 @@
* @author Eric Chatellier
* @param <T> datatable type
*/
-public class CsvExportLink<T> extends Link<Void> {
+public class CsvExportLink<T, S> extends Link<Void> {
/** For serializable methods */
private static final long serialVersionUID = 20130204L;
/** Data table containing data to export. */
- private final DataTable<T> table;
+ private final DataTable<T, S> table;
/** Download filename. */
private final String filename;
@@ -63,7 +63,7 @@
* @param table data table
* @param filename csv filename
*/
- public CsvExportLink(String id, DataTable<T> table, String filename) {
+ public CsvExportLink(String id, DataTable<T, S> table, String filename) {
super(id);
this.table = table;
this.filename = filename;
@@ -94,10 +94,10 @@
} else {
writer = new CsvWriter(out, ',');
}
- List<ExportableColumn<T>> exportable = getExportableColumns();
+ List<ExportableColumn<T, S>> exportable = getExportableColumns();
// write header
- for (ExportableColumn<T> column : exportable) {
+ for (ExportableColumn<T, S> column : exportable) {
writer.write(column.getHeaderName());
}
writer.endLine();
@@ -105,7 +105,7 @@
Iterator<? extends T> it = table.getDataProvider().iterator(0, table.getDataProvider().size());
while (it.hasNext()) {
T object = it.next();
- for (ExportableColumn<T> col : exportable) {
+ for (ExportableColumn<T, S> col : exportable) {
col.exportCsv(object, writer);
}
writer.endLine();
@@ -119,11 +119,11 @@
* @return exportable column list
*/
@SuppressWarnings("unchecked")
- private List<ExportableColumn<T>> getExportableColumns() {
- List<ExportableColumn<T>> exportable = new ArrayList<ExportableColumn<T>>(table.getColumns().size());
- for (IColumn<?> column : table.getColumns()) {
- if (column instanceof ExportableColumn<?>) {
- exportable.add((ExportableColumn<T>) column);
+ private List<ExportableColumn<T, S>> getExportableColumns() {
+ List<ExportableColumn<T, S>> exportable = new ArrayList<ExportableColumn<T, S>>(table.getColumns().size());
+ for (IColumn<?, ?> column : table.getColumns()) {
+ if (column instanceof ExportableColumn<?, ?>) {
+ exportable.add((ExportableColumn<T, S>) column);
}
}
return exportable;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -48,9 +48,10 @@
* avec "implements IFilterStateLocator<FilterMapHomeMade>"
* @author Mickael Tricot
* @author Adrien Cheype
- * @param <M> Model object type
+ * @param <T> Model object type
+ * @param <S> the type of the sort property
*/
-public final class LoadableDetachableSortableListDataProvider<M extends AbstractModel> extends SortableDataProvider<M> {
+public final class LoadableDetachableSortableListDataProvider<M extends AbstractModel> extends SortableDataProvider<M, String> {
/** Logger */
private static final Logger LOG = LoggerFactory.getLogger(LoadableDetachableSortableListDataProvider.class);
@@ -86,7 +87,7 @@
/** {@inheritDoc} */
@Override
- public Iterator<? extends M> iterator(int first, int count) {
+ public Iterator<? extends M> iterator(long first, long count) {
if (getSort() != null && !StringUtils.isEmpty(getSort().getProperty())) {
Collections.sort(list, new Comparator<M>() {
@@ -121,7 +122,7 @@
});
}
- return list.subList(first, Math.min(first + count, size())).iterator();
+ return list.subList((int)first, (int)Math.min(first + count, size())).iterator();
}
/** {@inheritDoc} */
@@ -133,7 +134,7 @@
/** {@inheritDoc} */
@Override
- public int size() {
+ public long size() {
return list.size();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/SimpleSortableListDataProvider.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/SimpleSortableListDataProvider.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/SimpleSortableListDataProvider.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -50,7 +50,7 @@
* @author Adrien Cheype
* @param <M> Model object type
*/
-public class SimpleSortableListDataProvider<M> extends SortableDataProvider<M> {
+public class SimpleSortableListDataProvider<M> extends SortableDataProvider<M, String> {
private static final long serialVersionUID = 1L;
@@ -87,7 +87,7 @@
/** {@inheritDoc} */
@Override
- public Iterator<M> iterator(int first, int count) {
+ public Iterator<M> iterator(long first, long count) {
if (getSort() != null && !StringUtils.isEmpty(getSort().getProperty())) {
Collections.sort(list, new Comparator<M>() {
@@ -122,7 +122,7 @@
});
}
- return list.subList(first, Math.min(first + count, size())).iterator();
+ return list.subList((int)first, (int)Math.min(first + count, size())).iterator();
}
/** {@inheritDoc} */
@@ -140,7 +140,7 @@
/** {@inheritDoc} */
@Override
- public int size() {
+ public long size() {
return list.size();
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java 2013-02-14 16:39:05 UTC (rev 109)
@@ -105,8 +105,6 @@
return false;
}
- /** {@inheritDoc} */
- @Override
public boolean authenticate(String username, String password) {
boolean authenticate = personneService.authenticateUtilisateur(username, password);
LOG.debug(String.valueOf(authenticate));
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-02-14 15:39:46 UTC (rev 108)
+++ trunk/pom.xml 2013-02-14 16:39:05 UTC (rev 109)
@@ -130,7 +130,7 @@
<version.servlet-api>2.5</version.servlet-api>
- <version.wicket>1.5.9</version.wicket>
+ <version.wicket>6.5.0</version.wicket>
<!-- FIXME echatellier Probleme de parallelisation des tests unitaire,
cause org.hibernate.HibernateException: Don't change the reference to a collection
1
0
r108 - in trunk: cantharella.service/src/main/java/nc/ird/cantharella/service/services cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search
by echatellier@users.forge.codelutin.com 14 Feb '13
by echatellier@users.forge.codelutin.com 14 Feb '13
14 Feb '13
Author: echatellier
Date: 2013-02-14 16:39:46 +0100 (Thu, 14 Feb 2013)
New Revision: 108
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/108
Log:
Merge SearchPage datatable with ListMoleculesPage datatable (common code)
Modified:
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java 2013-02-14 15:01:31 UTC (rev 107)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/MoleculeService.java 2013-02-14 15:39:46 UTC (rev 108)
@@ -84,6 +84,16 @@
List<MoleculeProvenanceBean> listMoleculeProvenances(Utilisateur utilisateur);
/**
+ * List molecule provenance and molecule without provenance or provenance
+ * not visible by current user.
+ *
+ * @param molecules molecules list to transform
+ * @param utilisateur utilisateur to filter results
+ * @return Molecules
+ */
+ List<MoleculeProvenanceBean> listMoleculeProvenances(List<Molecule> molecules, Utilisateur utilisateur);
+
+ /**
* Charge une molecule
* @param numero numero
* @return Le lot correspondant
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-02-14 15:01:31 UTC (rev 107)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-02-14 15:39:46 UTC (rev 108)
@@ -104,9 +104,16 @@
/** {@inheritDoc} */
@Override
public List<MoleculeProvenanceBean> listMoleculeProvenances(Utilisateur utilisateur) {
+ List<Molecule> molecules = listMolecules();
+ List<MoleculeProvenanceBean> result = listMoleculeProvenances(molecules, utilisateur);
+ return result;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public List<MoleculeProvenanceBean> listMoleculeProvenances(List<Molecule> molecules, Utilisateur utilisateur) {
List<MoleculeProvenanceBean> result = new ArrayList<MoleculeProvenanceBean>();
- List<Molecule> molecules = listMolecules();
-
+
for (Molecule molecule : molecules) {
boolean isOneProductVisible = false;
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-02-14 15:01:31 UTC (rev 107)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-02-14 15:39:46 UTC (rev 108)
@@ -96,32 +96,52 @@
// Liste des molecules
Utilisateur utilisateur = getSession().getUtilisateur();
final List<MoleculeProvenanceBean> moleculeProvenances = moleculeService.listMoleculeProvenances(utilisateur);
+
+ DataTable<MoleculeProvenanceBean> moleculesDataTable = initMoleculesListTable(this,
+ "ListMoleculesPage.Molecules", currentPage, moleculeProvenances);
+ moleculesRefresh.add(moleculesDataTable);
+ }
+ /**
+ * Init data table with molecule provenances list.
+ *
+ * This method is static to be resued in several places.
+ *
+ * @param templatePage parent page
+ * @param componentId data table id
+ * @param callerPage caller page
+ * @param moleculeProvenances molecules provenance list
+ * @return data table component
+ */
+ public static DataTable<MoleculeProvenanceBean> initMoleculesListTable(final TemplatePage templatePage,
+ final String componentId, final CallerPage callerPage,
+ List<MoleculeProvenanceBean> moleculeProvenances) {
+
SimpleSortableListDataProvider<MoleculeProvenanceBean> moleculesDataProvider =
new SimpleSortableListDataProvider<MoleculeProvenanceBean>(
- moleculeProvenances, getSession().getLocale());
+ moleculeProvenances, templatePage.getSession().getLocale());
List<IColumn<MoleculeProvenanceBean>> columns = new ArrayList<IColumn<MoleculeProvenanceBean>>();
columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean>(
- "images/read.png", getString("Read"), getString("Read")) {
+ "images/read.png", templatePage.getString("Read"), templatePage.getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item, String componentId, IModel<MoleculeProvenanceBean> model) {
- setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
+ templatePage.setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), callerPage));
}
});
columns.add(new LinkPropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.idMolecule")),
+ new Model<String>(templatePage.getString("Molecule.idMolecule")),
"idMolecule", "idMolecule") {
@Override
public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item, String componentId, IModel<MoleculeProvenanceBean> model) {
- setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
+ templatePage.setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), callerPage));
}
});
columns.add(new AbstractColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.formuleDevMol"))) {
+ new Model<String>(templatePage.getString("Molecule.formuleDevMol"))) {
public void populateItem(Item<ICellPopulator<MoleculeProvenanceBean>> cellItem, String componentId, IModel<MoleculeProvenanceBean> rowModel) {
cellItem.add(new Label(componentId, "-")
.add(new MoleculeViewBehavior(new PropertyModel<String>(rowModel, "molecule.formuleDevMol"))));
@@ -129,26 +149,26 @@
});
columns.add(new PropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.nomCommun")),
+ new Model<String>(templatePage.getString("Molecule.nomCommun")),
"molecule.nomCommun", "molecule.nomCommun"));
columns.add(new PropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.familleChimique")),
+ new Model<String>(templatePage.getString("Molecule.familleChimique")),
"molecule.familleChimique", "molecule.familleChimique"));
columns.add(new PropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.formuleBrute")),
+ new Model<String>(templatePage.getString("Molecule.formuleBrute")),
"molecule.formuleBrute", "molecule.formuleBrute"));
columns.add(new DecimalPropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.masseMolaire")),
- "molecule.masseMolaire", "molecule.masseMolaire", DecimalDisplFormat.SMALL, getLocale()));
+ new Model<String>(templatePage.getString("Molecule.masseMolaire")),
+ "molecule.masseMolaire", "molecule.masseMolaire", DecimalDisplFormat.SMALL, templatePage.getLocale()));
columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean>(
- "images/attachment.png", getString("Read"), getString("Read")) {
+ "images/attachment.png", templatePage.getString("Read"), templatePage.getString("Read")) {
@Override
public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item, String componentId, IModel<MoleculeProvenanceBean> model) {
- setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
+ templatePage.setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), callerPage));
}
@Override
@@ -158,23 +178,23 @@
});
columns.add(new BooleanPropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.nouvMolecul")),
- "molecule.nouvMolecul", "molecule.nouvMolecul", this));
+ new Model<String>(templatePage.getString("Molecule.nouvMolecul")),
+ "molecule.nouvMolecul", "molecule.nouvMolecul", templatePage));
columns.add(new PropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.provenance.embranchement")),
+ new Model<String>(templatePage.getString("Molecule.provenance.embranchement")),
"lot.specimenRef.embranchement", "lot.specimenRef.embranchement"));
columns.add(new PropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.provenance.genre")),
+ new Model<String>(templatePage.getString("Molecule.provenance.genre")),
"lot.specimenRef.genre", "lot.specimenRef.genre"));
columns.add(new PropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.provenance.espece")),
+ new Model<String>(templatePage.getString("Molecule.provenance.espece")),
"lot.specimenRef.espece", "lot.specimenRef.espece"));
columns.add(new LinkPropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.provenance.lot.ref")),
+ new Model<String>(templatePage.getString("Molecule.provenance.lot.ref")),
"lot.ref", "lot.ref") {
@Override
public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item,
@@ -182,29 +202,28 @@
Lot lot = model.getObject().getLot();
if (lot != null) {
int idLot = lot.getIdLot();
- setResponsePage(new ReadLotPage(idLot, currentPage));
+ templatePage.setResponsePage(new ReadLotPage(idLot, callerPage));
}
}
});
columns.add(new PropertyColumn<MoleculeProvenanceBean>(
- new Model<String>(getString("Molecule.provenance.programme")),
+ new Model<String>(templatePage.getString("Molecule.provenance.programme")),
"lot.campagne.programme", "lot.campagne.programme"));
columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean>(
- "images/edit.png", getString("Update"), getString("Update")) {
+ "images/edit.png", templatePage.getString("Update"), templatePage.getString("Update")) {
@Override
public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item,
String componentId, IModel<MoleculeProvenanceBean> model) {
int idMolecule = model.getObject().getIdMolecule();
- setResponsePage(new ManageMoleculePage(idMolecule, currentPage));
+ templatePage.setResponsePage(new ManageMoleculePage(idMolecule, callerPage));
}
});
final DataTable<MoleculeProvenanceBean> moleculesDataTable =
new AjaxFallbackDefaultDataTable<MoleculeProvenanceBean>(
- "ListMoleculesPage.Molecules", columns,
- moleculesDataProvider, WebContext.ROWS_PER_PAGE);
- moleculesRefresh.add(moleculesDataTable);
+ componentId, columns, moleculesDataProvider, WebContext.ROWS_PER_PAGE);
+ return moleculesDataTable;
}
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-02-14 15:01:31 UTC (rev 107)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-02-14 15:39:46 UTC (rev 108)
@@ -36,7 +36,9 @@
import nc.ird.cantharella.data.model.Specimen;
import nc.ird.cantharella.data.model.Station;
import nc.ird.cantharella.data.model.Utilisateur;
+import nc.ird.cantharella.service.model.MoleculeProvenanceBean;
import nc.ird.cantharella.service.model.SearchResult;
+import nc.ird.cantharella.service.services.MoleculeService;
import nc.ird.cantharella.service.services.SearchService;
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
@@ -45,14 +47,12 @@
import nc.ird.cantharella.web.pages.domain.campagne.ReadCampagnePage;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
-import nc.ird.cantharella.web.pages.domain.molecule.ReadMoleculePage;
+import nc.ird.cantharella.web.pages.domain.molecule.ListMoleculesPage;
import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
-import nc.ird.cantharella.web.pages.domain.specimen.ListSpecimensPage;
import nc.ird.cantharella.web.pages.domain.specimen.ReadSpecimenPage;
import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
import nc.ird.cantharella.web.pages.domain.testBio.ReadTestBioPage;
import nc.ird.cantharella.web.utils.CallerPage;
-import nc.ird.cantharella.web.utils.behaviors.MoleculeViewBehavior;
import nc.ird.cantharella.web.utils.behaviors.ReplaceEmptyLabelBehavior;
import nc.ird.cantharella.web.utils.columns.BooleanPropertyColumn;
import nc.ird.cantharella.web.utils.columns.DecimalPropertyColumn;
@@ -76,7 +76,6 @@
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DefaultDataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
@@ -103,6 +102,10 @@
@SpringBean
protected SearchService searchService;
+ /** Molecule service. */
+ @SpringBean
+ protected MoleculeService moleculeService;
+
/** Nombre d'extraits affichés dans la colonne de résumés des extraits. */
private static final int MAX_EXTRAITS_DISPLAY = 4;
@@ -114,7 +117,7 @@
public SearchPage(String query) {
super(SearchPage.class);
this.query = query;
- final CallerPage currentPage = new CallerPage(ListSpecimensPage.class);
+ final CallerPage currentPage = new CallerPage(SearchPage.class);
// ca sert a rien, mais wicket est pas content
ExternalLink link = new ExternalLink("advancedLink", "http://lucene.apache.org/core/3_6_2/queryparsersyntax.html");
@@ -138,7 +141,16 @@
addPurificationsTable(currentPage, searchResult);
addTestBiosTable(currentPage, searchResult);
addStationsTable(currentPage, searchResult);
- addMoleculesTable(currentPage, searchResult);
+
+ // additionnal transformation for molecule provenances
+ List<Molecule> molecules = searchResult.getMolecules();
+ List<MoleculeProvenanceBean> moleculeProvenances = moleculeService.listMoleculeProvenances(molecules, utilisateur);
+
+ // call static methods in ListXXXPage
+ DataTable<MoleculeProvenanceBean> moleculesDataTable = ListMoleculesPage.initMoleculesListTable(this,
+ "SearchPage.Molecules.Results", currentPage, moleculeProvenances);
+ add(moleculesDataTable);
+ add(new CsvExportLink("SearchPage.Molecules.ExportCSV", moleculesDataTable, "molecules.csv"));
}
/**
@@ -604,66 +616,4 @@
add(stationsDataTable);
add(new CsvExportLink("SearchPage.Stations.ExportCSV", stationsDataTable, "stations.csv"));
}
-
- /**
- * Format molécules result into table.
- *
- * @param currentPage current page
- * @param searchResult search results
- */
- protected void addMoleculesTable(final CallerPage currentPage, SearchResult searchResult) {
-
- // Liste des molecules
- final List<Molecule> molecules = searchResult.getMolecules();
-
- LoadableDetachableSortableListDataProvider<Molecule> moleculesDataProvider = new LoadableDetachableSortableListDataProvider<Molecule>(
- molecules, getSession().getLocale());
-
- List<IColumn<Molecule>> columns = new ArrayList<IColumn<Molecule>>();
-
- columns.add(new LinkableImagePropertyColumn<Molecule>("images/read.png", getString("Read"), getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Molecule>> item, String componentId, IModel<Molecule> model) {
- setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
- }
- });
- columns.add(new LinkPropertyColumn<Molecule>(new Model<String>(getString("Molecule.idMolecule")), "idMolecule", "idMolecule",
- getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Molecule>> item, String componentId, IModel<Molecule> model) {
- setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
- }
- });
- columns.add(new AbstractColumn<Molecule>(new Model<String>(getString("Molecule.formuleDevMol"))) {
- public void populateItem(Item<ICellPopulator<Molecule>> cellItem, String componentId, IModel<Molecule> rowModel) {
- cellItem.add(new Label(componentId, "-")
- .add(new MoleculeViewBehavior(new PropertyModel<String>(rowModel, "formuleDevMol"))));
- }
- });
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.nomCommun")), "nomCommun",
- "nomCommun"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.familleChimique")), "familleChimique",
- "familleChimique"));
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.formuleBrute")), "formuleBrute",
- "formuleBrute"));
- columns.add(new DecimalPropertyColumn<Molecule>(new Model<String>(getString("Molecule.masseMolaire")), "masseMolaire",
- "masseMolaire", DecimalDisplFormat.SMALL, getLocale()));
- columns.add(new BooleanPropertyColumn<Molecule>(new Model<String>(getString("Molecule.nouvMolecul")), "nouvMolecul",
- "nouvMolecul", this));
- columns.add(new LinkPropertyColumn<Molecule>(new Model<String>(getString("Molecule.campagne")), "campagne",
- "campagne", getString("Read")) {
- @Override
- public void onClick(Item<ICellPopulator<Molecule>> item, String componentId, IModel<Molecule> model) {
- setResponsePage(new ReadCampagnePage(model.getObject().getCampagne().getIdCampagne(), currentPage));
- }
- });
- columns.add(new PropertyColumn<Molecule>(new Model<String>(getString("Molecule.identifieePar")), "identifieePar",
- "identifieePar"));
-
- final DataTable<Molecule> moleculesDataTable = new AjaxFallbackDefaultDataTable<Molecule>(
- getResource() + ".Molecules.Results", columns,
- moleculesDataProvider, WebContext.ROWS_PER_PAGE);
- add(moleculesDataTable);
- add(new CsvExportLink("SearchPage.Molecules.ExportCSV", moleculesDataTable, "molecules.csv"));
- }
}
1
0
r107 - in trunk: cantharella.data/src/main/java/nc/ird/cantharella/data/model cantharella.data/src/main/resources/sql cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns cantharella.web/src/main/resources cantharella.web/src/main/webapp/images
by echatellier@users.forge.codelutin.com 14 Feb '13
by echatellier@users.forge.codelutin.com 14 Feb '13
14 Feb '13
Author: echatellier
Date: 2013-02-14 16:01:31 +0100 (Thu, 14 Feb 2013)
New Revision: 107
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/107
Log:
refs #1653: Gestion des donn?\195?\169es binaire des fichiers en bytea;
Added:
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn$ButtonPanel.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java
trunk/cantharella.web/src/main/webapp/images/download.png
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java
trunk/cantharella.data/src/main/resources/sql/dev_update.sql
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java
trunk/cantharella.web/src/main/resources/web_en.properties
trunk/cantharella.web/src/main/resources/web_fr.properties
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java 2013-02-14 15:01:31 UTC (rev 107)
@@ -23,7 +23,6 @@
package nc.ird.cantharella.data.model;
-import java.io.InputStream;
import java.util.Date;
import javax.persistence.Basic;
@@ -103,10 +102,9 @@
@Length(max = LENGTH_MEDIUM_TEXT)
private String fileName;
- /* File data.
- @Lob
- @Basic(fetch=FetchType.LAZY, optional=true)
- private byte[] fileContent;*/
+ /** File data. */
+ @Basic(fetch = FetchType.LAZY)
+ private byte[] fileContent;
/** File mime type. */
@NotEmpty
@@ -201,13 +199,13 @@
this.fileName = fileName;
}
- /*public byte[] getFileContent() {
+ public byte[] getFileContent() {
return fileContent;
}
public void setFileContent(byte[] fileContent) {
this.fileContent = fileContent;
- }*/
+ }
public String getFileMimetype() {
return fileMimetype;
Modified: trunk/cantharella.data/src/main/resources/sql/dev_update.sql
===================================================================
--- trunk/cantharella.data/src/main/resources/sql/dev_update.sql 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.data/src/main/resources/sql/dev_update.sql 2013-02-14 15:01:31 UTC (rev 107)
@@ -91,7 +91,7 @@
dateCreation timestamp not null,
description text,
editeur varchar(100) not null,
- fileContent oid,
+ fileContent bytea;,
fileMimetype varchar(60) not null,
fileName varchar(60) not null,
langue varchar(2),
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java 2013-02-14 15:01:31 UTC (rev 107)
@@ -265,7 +265,7 @@
public void onValidate() {
final FileUpload uploadedFile = fileUploadField.getFileUpload();
if (uploadedFile != null) {
- //documentModel.getObject().setFileContent(uploadedFile.getBytes());
+ documentModel.getObject().setFileContent(uploadedFile.getBytes());
documentModel.getObject().setFileName(uploadedFile.getClientFileName());
documentModel.getObject().setFileMimetype(uploadedFile.getContentType());
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java 2013-02-14 15:01:31 UTC (rev 107)
@@ -120,7 +120,7 @@
@Override
public void onSuccess() {
- successNextPage(ManageLotPage.class, ACTION_DELETE);
+ successNextPage(ManageDocumentPage.class, ACTION_DELETE);
redirect();
}
});
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-02-14 15:01:31 UTC (rev 107)
@@ -181,7 +181,7 @@
<fieldset>
<legend><wicket:message key="ListDocumentsPage.AttachedDocuments" /></legend>
<div wicket:id="ListDocumentsPage.AttachedDocuments.Refresh">
- <table cellspacing="0" wicket:id="ListDocumentsPage.AttachedDocuments"/>
+ <table class="large" cellspacing="0" wicket:id="ListDocumentsPage.AttachedDocuments"/>
</div>
<a wicket:id="NewDocument" class="add"><wicket:message key="ListDocumentsPage.NewDocument" /></a>
</fieldset>
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-14 15:01:31 UTC (rev 107)
@@ -22,6 +22,10 @@
*/
package nc.ird.cantharella.web.pages.domain.molecule;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@@ -47,6 +51,7 @@
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.campagne.ManageCampagnePage;
import nc.ird.cantharella.web.pages.domain.document.ManageDocumentPage;
+import nc.ird.cantharella.web.pages.domain.document.ReadDocumentPage;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
import nc.ird.cantharella.web.pages.renderers.ProduitRenderer;
@@ -54,6 +59,9 @@
import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
import nc.ird.cantharella.web.utils.behaviors.MoleculeEditorBehavior;
import nc.ird.cantharella.web.utils.behaviors.MoleculeViewBehavior;
+import nc.ird.cantharella.web.utils.columns.AjaxButtonPropertyColumn;
+import nc.ird.cantharella.web.utils.columns.LinkPropertyColumn;
+import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn;
import nc.ird.cantharella.web.utils.forms.AutoCompleteTextFieldString;
import nc.ird.cantharella.web.utils.forms.AutoCompleteTextFieldString.ComparisonMode;
import nc.ird.cantharella.web.utils.forms.SubmittableButton;
@@ -66,6 +74,7 @@
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.cantharella.web.utils.security.AuthSession;
+import org.apache.commons.io.IOUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -96,6 +105,7 @@
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -278,21 +288,6 @@
formView.add(new TextField<String>("Molecule.createur", new PropertyModel<String>(moleculeModel, "createur"))
.setEnabled(false));
- // Action : création d'un nouveau document
- // ajaxSubmitLink permet de sauvegarder l'état du formulaire
- formView.add(new AjaxSubmitLink("NewDocument") {
- @Override
- protected void onSubmit(AjaxRequestTarget request, Form<?> form) {
- setResponsePage(new ManageDocumentPage(currentPage, moleculeModel.getObject(), false));
- }
-
- // si erreur, le formulaire est également enregistré puis la redirection effectuée
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- setResponsePage(new ManageDocumentPage(currentPage, moleculeModel.getObject(), false));
- }
- }.setVisibilityAllowed(editEnabled));
-
// Action : création du lot
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
@@ -606,7 +601,7 @@
* @param documentAttachable entity to get documents
* @param currentPage current page
*/
- private void initAttachedDocumentsTable(final Form<Void> formView, final DocumentAttachable documentAttachable, CallerPage currentPage) {
+ private void initAttachedDocumentsTable(final Form<Void> formView, final DocumentAttachable documentAttachable, final CallerPage currentPage) {
List<Document> documents = documentAttachable.getDocuments();
@@ -617,48 +612,77 @@
formView.add(attachedDocumentRefresh);
SimpleSortableListDataProvider<Document> attachedDocumentsDataProvider =
- new SimpleSortableListDataProvider<Document>(
- documents, getSession().getLocale());
+ new SimpleSortableListDataProvider<Document>(documents, getSession().getLocale());
List<IColumn<Document>> columns = new ArrayList<IColumn<Document>>();
+ columns.add(new LinkPropertyColumn<Document>(
+ new Model<String>(getString("Document.titre")), "titre", "titre") {
+ @Override
+ public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
+ setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
+ }
+ });
+
columns.add(new PropertyColumn<Document>(
- new Model<String>(getString("Document.titre")), "titre", "titre"));
-
- columns.add(new PropertyColumn<Document>(
new Model<String>(getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
-
+
columns.add(new PropertyColumn<Document>(
new Model<String>(getString("Document.createur")), "createur", "createur"));
-
- columns.add(new PropertyColumn<Document>(
- new Model<String>(getString("Document.fileName")), "fileName", "fileName"));
- columns.add(new AbstractColumn<Document>(new Model<String>(), "idMolecule") {
+ columns.add(new LinkableImagePropertyColumn<Document>(new Model<String>(getString("Document.link")),
+ "images/download.png", getString("Document.link"), getString("Document.link")) {
@Override
- public void populateItem(Item<ICellPopulator<Document>> cellItem, String componentId, final IModel<Document> rowModel) {
- cellItem.add(new AjaxFallbackButton(componentId, new Model<String>(getString("Delete")), formView) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- documentAttachable.removeDocument(rowModel.getObject());
+ public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
- if (target != null) {
- target.add(attachedDocumentRefresh);
- refreshFeedbackPage(target);
- }
- }
+ Document document = model.getObject();
+ WebResponse response = (WebResponse) getResponse();
+ response.setContentType(document.getFileMimetype());
+ response.setAttachmentHeader(document.getFileName());
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- // never called
- }
- });
+ OutputStream out = getResponse().getOutputStream();
+ InputStream in = new ByteArrayInputStream(document.getFileContent());
+ try {
+ IOUtils.copy(in, out);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
});
final DataTable<Document> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document>("ListDocumentsPage.AttachedDocuments", columns,
attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
+
+ columns.add(new AjaxButtonPropertyColumn<Document>(new Model<String>(getString("Actions")),
+ new Model<String>(getString("Delete")), formView) {
+ @Override
+ public void onSubmit(AjaxRequestTarget target, Form<?> form, IModel<Document> model) {
+ Document document = model.getObject();
+ documentAttachable.removeDocument(document);
+
+ if (target != null) {
+ target.add(attachedDocumentTable);
+ refreshFeedbackPage(target);
+ }
+ }
+ });
+
attachedDocumentRefresh.add(attachedDocumentTable);
+
+ // Action : création d'un nouveau document
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewDocument") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget request, Form<?> form) {
+ setResponsePage(new ManageDocumentPage(currentPage, moleculeModel.getObject(), false));
+ }
+
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManageDocumentPage(currentPage, moleculeModel.getObject(), false));
+ }
+ }.setVisibilityAllowed(true));
}
/**
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-02-14 15:01:31 UTC (rev 107)
@@ -22,6 +22,10 @@
*/
package nc.ird.cantharella.web.pages.domain.molecule;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -48,6 +52,7 @@
import nc.ird.cantharella.web.utils.behaviors.MoleculeViewBehavior;
import nc.ird.cantharella.web.utils.behaviors.ReplaceEmptyLabelBehavior;
import nc.ird.cantharella.web.utils.columns.LinkPropertyColumn;
+import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn;
import nc.ird.cantharella.web.utils.forms.SubmittableButton;
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.models.DisplayBooleanPropertyModel;
@@ -61,6 +66,7 @@
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.cantharella.web.utils.security.AuthSession;
+import org.apache.commons.io.IOUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
@@ -80,6 +86,7 @@
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.spring.injection.annot.SpringBean;
/**
@@ -312,13 +319,30 @@
columns.add(new PropertyColumn<Document>(
new Model<String>(getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
-
+
columns.add(new PropertyColumn<Document>(
new Model<String>(getString("Document.createur")), "createur", "createur"));
-
- columns.add(new PropertyColumn<Document>(
- new Model<String>(getString("Document.fileName")), "fileName", "fileName"));
+ columns.add(new LinkableImagePropertyColumn<Document>(new Model<String>(getString("Document.link")),
+ "images/download.png", getString("Document.link"), getString("Document.link")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
+
+ Document document = model.getObject();
+ WebResponse response = (WebResponse) getResponse();
+ response.setContentType(document.getFileMimetype());
+ response.setAttachmentHeader(document.getFileName());
+
+ OutputStream out = getResponse().getOutputStream();
+ InputStream in = new ByteArrayInputStream(document.getFileContent());
+ try {
+ IOUtils.copy(in, out);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
final DataTable<Document> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document>("ListDocumentsPage.AttachedDocuments", columns,
attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
add(attachedDocumentTable);
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn$ButtonPanel.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn$ButtonPanel.html (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn$ButtonPanel.html 2013-02-14 15:01:31 UTC (rev 107)
@@ -0,0 +1,31 @@
+<!--
+ #%L
+ Cantharella :: Web
+ $Id:$
+ $HeadURL:$
+ %%
+ Copyright (C) 2009 - 2012 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
+<body>
+<wicket:panel>
+ <input type="submit" wicket:id="button" />
+</wicket:panel>
+</body>
+</html>
\ No newline at end of file
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java 2013-02-14 15:01:31 UTC (rev 107)
@@ -0,0 +1,110 @@
+/*
+ * #%L
+ * Cantharella :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package nc.ird.cantharella.web.utils.columns;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+/**
+ * Column embeded in a datatable which represent an linkable image
+ * @author Adrien Cheype
+ * @param <T> Generic type
+ */
+abstract public class AjaxButtonPropertyColumn<T> extends AbstractColumn<T> {
+
+ /** Title displayed for the button */
+ private Model<String> buttonLabel;
+
+ /** Form. */
+ private Form<?> form;
+
+ /**
+ * Constructor
+ * @param imageSrc Relative url for the image
+ * @param linkTitle Title displayed for the link
+ * @param altMessage Alternative message displayed when image can't be rendered
+ */
+ public AjaxButtonPropertyColumn(Model<String> buttonLabel, Form<?> form) {
+ this(new Model<String>(), buttonLabel, form);
+ }
+
+ /**
+ * Constructor
+ * @param displayModel header display model
+ * @param imageSrc Relative url for the image
+ * @param linkTitle Title displayed for the link
+ * @param altMessage Alternative message displayed when image can't be rendered
+ */
+ public AjaxButtonPropertyColumn(IModel<String> displayModel, Model<String> buttonLabel, Form<?> form) {
+ super(displayModel);
+ this.buttonLabel = buttonLabel;
+ this.form = form;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
+ ButtonPanel panel = new ButtonPanel(item, componentId, model);
+ item.add(panel);
+ }
+
+ /**
+ * Override this method to react to link clicks. Your own/internal row id will most likely be inside the model.
+ * @param item Item
+ * @param componentId Component id
+ * @param model Model
+ */
+ public abstract void onSubmit(AjaxRequestTarget target, Form<?> form, IModel<T> model);
+
+ /**
+ * Panel which include a linkable image. Used with the LinkableImagePropertyColumn$LinkablePanel.html file
+ */
+ public class ButtonPanel extends Panel {
+
+ /**
+ * Constructor
+ * @param item Item
+ * @param componentId Component id
+ * @param model Model
+ */
+ public ButtonPanel(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> model) {
+ super(componentId);
+
+ AjaxButton button = new AjaxButton("button", buttonLabel, form) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ AjaxButtonPropertyColumn.this.onSubmit(target, form, model);
+ }
+ };
+
+ add(button);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java 2013-02-14 15:01:31 UTC (rev 107)
@@ -55,7 +55,18 @@
* @param altMessage Alternative message displayed when image can't be rendered
*/
public LinkableImagePropertyColumn(String imageSrc, String linkTitle, String altMessage) {
- super(new Model<String>());
+ this(new Model<String>(), imageSrc, linkTitle, altMessage);
+ }
+
+ /**
+ * Constructor
+ * @param displayModel header display model
+ * @param imageSrc Relative url for the image
+ * @param linkTitle Title displayed for the link
+ * @param altMessage Alternative message displayed when image can't be rendered
+ */
+ public LinkableImagePropertyColumn(IModel<String> displayModel, String imageSrc, String linkTitle, String altMessage) {
+ super(displayModel);
this.imageSrc = imageSrc;
this.linkTitle = linkTitle;
this.altMessage = altMessage;
Modified: trunk/cantharella.web/src/main/resources/web_en.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/web_en.properties 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.web/src/main/resources/web_en.properties 2013-02-14 15:01:31 UTC (rev 107)
@@ -385,7 +385,7 @@
Molecule.masseMolaire.Required=Molar mass - can’t be null
Molecule.masseMolaire.IConverter.BigDecimal=Molar mass - must be a decimal number
-TestBio.date.IConverter.Date= The date is incorrectly formatted (DD/MM/YY)
+TestBio.date.IConverter.Date=The date is incorrectly formatted (DD/MM/YY)
TestBio.concMasseDefaut.IConverter.BigDecimal=Default Conc./Mass - must be a decimal number
TestBio.resultats.valeur.IConverter.BigDecimal=Value - must be a decimal number
TestBio.resultats.repere.Required=Mark – can’t be null
@@ -408,6 +408,9 @@
TestBio.resultats.noProduit=The bioassay must contain at least a result of type "product"
TestBio.resultsNotAccessibles=Some results are not displayed because you don't have the required rights over their products.
+Document.dateCreation.IConverter.Date=The date is incorrectly formatted (DD/MM/YY)
+Document.link=Link
+
#BASIC#
Actions=Actions
Submit=Submit
Modified: trunk/cantharella.web/src/main/resources/web_fr.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/web_fr.properties 2013-02-14 01:47:03 UTC (rev 106)
+++ trunk/cantharella.web/src/main/resources/web_fr.properties 2013-02-14 15:01:31 UTC (rev 107)
@@ -406,6 +406,9 @@
TestBio.resultats.noProduit=Le test biologique doit comporter au moins un résultat de type "produit"
TestBio.resultsNotAccessibles=Certains résultats ne sont pas affichés car vous n'avez pas les droits nécessaires sur leur produit.
+Document.dateCreation.IConverter.Date=La date est mal formatée (JJ/MM/AA)
+Document.link=Lien
+
#BASIC#
Actions=Actions
Submit=Valider
Added: trunk/cantharella.web/src/main/webapp/images/download.png
===================================================================
(Binary files differ)
Property changes on: trunk/cantharella.web/src/main/webapp/images/download.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
1
0
Author: acheype
Date: 2013-02-14 02:47:03 +0100 (Thu, 14 Feb 2013)
New Revision: 106
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/106
Log:
just typing errors fixed
Modified:
trunk/src/site/rst/configuration.rst
Modified: trunk/src/site/rst/configuration.rst
===================================================================
--- trunk/src/site/rst/configuration.rst 2013-02-13 15:53:11 UTC (rev 105)
+++ trunk/src/site/rst/configuration.rst 2013-02-14 01:47:03 UTC (rev 106)
@@ -21,7 +21,7 @@
.. * #L%
.. -
-Configuraiton
+Configuration
=============
All configuration variables can be put in file **cantharella.conf**. This file can be in:
@@ -33,7 +33,7 @@
- JVM variables
Configuration files and variables are read in this order, last file found
-overwrite variable from previous file.
+overwrite variables from previous file.
Classpath
---------
1
0
r105 - in trunk: cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document
by echatellier@users.forge.codelutin.com 13 Feb '13
by echatellier@users.forge.codelutin.com 13 Feb '13
13 Feb '13
Author: echatellier
Date: 2013-02-13 16:53:11 +0100 (Wed, 13 Feb 2013)
New Revision: 105
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/105
Log:
fixes #1650: Extraction interface - modification
fixes #1651: Purification interface - modification
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java 2013-02-13 15:03:01 UTC (rev 104)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java 2013-02-13 15:53:11 UTC (rev 105)
@@ -22,7 +22,12 @@
*/
package nc.ird.cantharella.data.dao.impl;
+import java.util.Collections;
+
import nc.ird.cantharella.data.dao.AbstractModelDao;
+import nc.ird.cantharella.data.model.Molecule;
+import nc.ird.cantharella.data.model.MoleculeProvenance;
+import nc.ird.cantharella.data.model.Produit;
import nc.ird.cantharella.data.model.Purification;
import nc.ird.cantharella.data.model.ResultatTestBio;
@@ -60,4 +65,14 @@
Restrictions.eq("prod.ref", refProduit)).setProjection(Projections.rowCount());
}
+ /**
+ * Rend le criteria qui rend le nombre de molécule qui référencent un produit
+ * @param produit Le produit
+ * @return Le criteria
+ **/
+ public static DetachedCriteria getCriteriaCountMoleculeFromProduit(String refProduit) {
+ return DetachedCriteria.forClass(MoleculeProvenance.class).createAlias("produit", "prod").add(
+ Restrictions.eq("prod.ref", refProduit)).setProjection(Projections.rowCount());
+ }
+
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java 2013-02-13 15:03:01 UTC (rev 104)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/ProduitServiceImpl.java 2013-02-13 15:53:11 UTC (rev 105)
@@ -121,6 +121,7 @@
@Override
public boolean isProduitReferenced(Produit produit) {
return dao.count(ProduitDao.getCriteriaCountPurifFromProduit(produit.getRef())) > 0
- && dao.count(ProduitDao.getCriteriaCountTestBioFromProduit(produit.getRef())) > 0;
+ || dao.count(ProduitDao.getCriteriaCountTestBioFromProduit(produit.getRef())) > 0
+ || dao.count(ProduitDao.getCriteriaCountMoleculeFromProduit(produit.getRef())) > 0;
}
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java 2013-02-13 15:03:01 UTC (rev 104)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java 2013-02-13 15:53:11 UTC (rev 105)
@@ -22,8 +22,6 @@
*/
package nc.ird.cantharella.web.pages.domain.document;
-import java.io.IOException;
-import java.sql.Blob;
import java.util.Date;
import java.util.List;
@@ -45,7 +43,6 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButton;
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.renderers.MapChoiceRenderer;
-import net.sf.ehcache.hibernate.HibernateUtil;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
@@ -65,10 +62,8 @@
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.util.lang.Bytes;
-import org.hibernate.engine.jdbc.internal.LobCreatorBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.jdbc.support.lob.LobCreator;
/**
* Document management page (creation/edition).
1
0
13 Feb '13
Author: echatellier
Date: 2013-02-13 16:03:01 +0100 (Wed, 13 Feb 2013)
New Revision: 104
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/104
Log:
refs #1653: Add a linked document
refs #1654: Consult linked document metadata
refs #1656: Manage documents at info level
refs #1657: Display documents at info level
refs #1658: Display documents at lists level
Added:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/DocumentAttachable.java
trunk/cantharella.data/src/test/resources/log4j.xml
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/DocumentNormalizer.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java
trunk/cantharella.web/src/main/webapp/images/attachment.png
Removed:
trunk/cantharella.data/src/test/resources/log4j.xml
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java
trunk/cantharella.data/src/main/resources/data_en.properties
trunk/cantharella.data/src/main/resources/data_fr.properties
trunk/cantharella.data/src/main/resources/sql/dev_update.sql
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/DocumentService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java
trunk/cantharella.web/src/main/resources/web_en.properties
trunk/cantharella.web/src/main/resources/web_fr.properties
Added: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java (rev 0)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -0,0 +1,219 @@
+/*
+ * #%L
+ * Cantharella :: Data
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package nc.ird.cantharella.data.model;
+
+import java.io.InputStream;
+import java.util.Date;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.validation.constraints.NotNull;
+
+import nc.ird.cantharella.data.model.utils.AbstractModel;
+import nc.ird.cantharella.data.validation.CountryCode;
+
+import org.hibernate.annotations.Type;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.NotEmpty;
+
+/**
+ * Document entity.
+ *
+ * @author Eric Chatellier
+ */
+@Entity
+public class Document extends AbstractModel {
+
+ /** Id du document. */
+ @Id
+ @GeneratedValue
+ private Integer idDocument;
+
+ /** Titre. */
+ @Length(max = LENGTH_LONG_TEXT)
+ @NotEmpty
+ private String titre;
+
+ /** Createur. */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private Personne createur;
+
+ /** Date de creation. */
+ @NotNull
+ private Date dateCreation;
+
+ /** Editeur. */
+ @Length(max = LENGTH_LONG_TEXT)
+ @NotEmpty
+ private String editeur;
+
+ /** Description. */
+ @Lob
+ @Type(type="org.hibernate.type.StringClobType") // see HHH-6105
+ private String description;
+
+ /** Langue. */
+ @Length(min = 2, max = 2)
+ @CountryCode
+ private String langue;
+
+ /** Contrainte légale. */
+ @Length(max = LENGTH_LONG_TEXT)
+ private String contrainteLegale;
+
+ /** Ajouté par. */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private Personne ajoutePar;
+
+ /** Type document. */
+ @NotNull
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private TypeDocument typeDocument;
+
+ /** File name. */
+ @NotEmpty
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String fileName;
+
+ /* File data.
+ @Lob
+ @Basic(fetch=FetchType.LAZY, optional=true)
+ private byte[] fileContent;*/
+
+ /** File mime type. */
+ @NotEmpty
+ @Length(max = LENGTH_MEDIUM_TEXT)
+ private String fileMimetype;
+
+ public Integer getIdDocument() {
+ return idDocument;
+ }
+
+ public void setIdDocument(Integer idDocument) {
+ this.idDocument = idDocument;
+ }
+
+ public String getTitre() {
+ return titre;
+ }
+
+ public void setTitre(String titre) {
+ this.titre = titre;
+ }
+
+ public Personne getCreateur() {
+ return createur;
+ }
+
+ public void setCreateur(Personne createur) {
+ this.createur = createur;
+ }
+
+ public Date getDateCreation() {
+ return dateCreation;
+ }
+
+ public void setDateCreation(Date dateCreation) {
+ this.dateCreation = dateCreation;
+ }
+
+ public String getEditeur() {
+ return editeur;
+ }
+
+ public void setEditeur(String editeur) {
+ this.editeur = editeur;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getLangue() {
+ return langue;
+ }
+
+ public void setLangue(String langue) {
+ this.langue = langue;
+ }
+
+ public String getContrainteLegale() {
+ return contrainteLegale;
+ }
+
+ public void setContrainteLegale(String contrainteLegale) {
+ this.contrainteLegale = contrainteLegale;
+ }
+
+ public Personne getAjoutePar() {
+ return ajoutePar;
+ }
+
+ public void setAjoutePar(Personne ajoutePar) {
+ this.ajoutePar = ajoutePar;
+ }
+
+ public TypeDocument getTypeDocument() {
+ return typeDocument;
+ }
+
+ public void setTypeDocument(TypeDocument typeDocument) {
+ this.typeDocument = typeDocument;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ /*public byte[] getFileContent() {
+ return fileContent;
+ }
+
+ public void setFileContent(byte[] fileContent) {
+ this.fileContent = fileContent;
+ }*/
+
+ public String getFileMimetype() {
+ return fileMimetype;
+ }
+
+ public void setFileMimetype(String fileMimetype) {
+ this.fileMimetype = fileMimetype;
+ }
+}
Property changes on: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -30,6 +30,7 @@
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
@@ -41,6 +42,7 @@
import nc.ird.cantharella.data.config.DataContext;
import nc.ird.cantharella.data.model.search.UtilisateurSearchFilter;
import nc.ird.cantharella.data.model.utils.AbstractModel;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
@@ -66,7 +68,7 @@
@FullTextFilterDefs( {
@FullTextFilterDef(name = "utilisateur-Molecule", impl = UtilisateurSearchFilter.class)
})
-public class Molecule extends AbstractModel {
+public class Molecule extends AbstractModel implements DocumentAttachable {
/** ID */
@Id
@@ -134,11 +136,17 @@
@IndexedEmbedded
private Personne createur;
- /** Produit utilisé obtenir le résultat **/
+ /** Produit utilisé obtenir le résultat */
@OneToMany(mappedBy = "molecule", fetch = FetchType.LAZY, orphanRemoval = true)
@Cascade({ CascadeType.SAVE_UPDATE })
private List<MoleculeProvenance> provenances;
+ /** Liste des documents attachés. */
+ @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
+ @JoinColumn(name="molecule")
+ @Cascade({ CascadeType.SAVE_UPDATE })
+ private List<Document> documents;
+
/**
* Id molecule getter.
*
@@ -390,4 +398,30 @@
public void setProvenances(List<MoleculeProvenance> provenances) {
this.provenances = provenances;
}
+
+ /** {@inheritDoc} */
+ public List<Document> getDocuments() {
+ return documents;
+ }
+
+ /**
+ * Documents setter.
+ *
+ * @param documents the documents to set
+ */
+ public void setDocuments(List<Document> documents) {
+ this.documents = documents;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addDocument(Document document) {
+ documents.add(document);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void removeDocument(Document document) {
+ documents.remove(document);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -38,7 +38,7 @@
import nc.ird.cantharella.data.model.utils.AbstractModel;
/**
- * MoleculeProvenance association entity between {@link Molecule} and {@Produit}.
+ * MoleculeProvenance association entity between {@link Molecule} and {@link Produit}.
*
* @author Eric Chatellier
*/
Added: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/DocumentAttachable.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/DocumentAttachable.java (rev 0)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/DocumentAttachable.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -0,0 +1,53 @@
+/*
+ * #%L
+ * Cantharella :: Data
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package nc.ird.cantharella.data.model.utils;
+
+import java.util.List;
+
+import nc.ird.cantharella.data.model.Document;
+
+/**
+ * Interface to mark entity on which documents can be attached.
+ *
+ * @author Eric Chatellier
+ */
+public interface DocumentAttachable {
+
+ /**
+ * Get document attached to entity.
+ * @return document list
+ */
+ List<Document> getDocuments();
+
+ /**
+ * Attach new document.
+ * @param document new document to attach
+ */
+ void addDocument(Document document);
+
+ /**
+ * Remove an attached document.
+ * @param document document to remove
+ */
+ void removeDocument(Document document);
+}
Property changes on: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/DocumentAttachable.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/cantharella.data/src/main/resources/data_en.properties
===================================================================
--- trunk/cantharella.data/src/main/resources/data_en.properties 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.data/src/main/resources/data_en.properties 2013-02-13 15:03:01 UTC (rev 104)
@@ -244,6 +244,22 @@
ErreurTestBio.nom=Name
ErreurTestBio.description=Description
+TypeDocument.nom=Nom
+TypeDocument.domaine=Domaine
+TypeDocument.description=Description
+
+Document.titre=Titre
+Document.createur=Créateur
+Document.dateCreation=Date de création
+Document.editeur=Éditeur
+Document.description=Description
+Document.langue=Langue
+Document.contrainteLegale=Contrainte légale
+Document.ajoutePar=Ajouté par
+Document.typeDocument=Type
+Document.fileName=Nom
+Document.fileMimetype=Format
+
#Internationalisation des enums#
TypeDroit.ADMINISTRATEUR=Administrator
TypeDroit.UTILISATEUR=User
Modified: trunk/cantharella.data/src/main/resources/data_fr.properties
===================================================================
--- trunk/cantharella.data/src/main/resources/data_fr.properties 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.data/src/main/resources/data_fr.properties 2013-02-13 15:03:01 UTC (rev 104)
@@ -243,6 +243,23 @@
ErreurTestBio.nom=Nom
ErreurTestBio.description=Description
+TypeDocument.nom=Nom
+TypeDocument.domaine=Domaine
+TypeDocument.description=Description
+
+Document.titre=Titre
+Document.createur=Créateur
+Document.dateCreation=Date de création
+Document.editeur=Éditeur
+Document.description=Description
+Document.langue=Langue
+Document.contrainteLegale=Contrainte légale
+Document.ajoutePar=Ajouté par
+Document.typeDocument=Type
+Document.fileName=Nom
+Document.fileMimetype=Format
+
+
#Internationalisation des enums#
TypeDroit.ADMINISTRATEUR=Administrateur
TypeDroit.UTILISATEUR=Utilisateur
Modified: trunk/cantharella.data/src/main/resources/sql/dev_update.sql
===================================================================
--- trunk/cantharella.data/src/main/resources/sql/dev_update.sql 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.data/src/main/resources/sql/dev_update.sql 2013-02-13 15:03:01 UTC (rev 104)
@@ -83,5 +83,43 @@
references Produit;
create sequence molecule_sequence;
-
+
+-- Document (12/02/2013)
+ create table Document (
+ idDocument int4 not null,
+ contrainteLegale varchar(100),
+ dateCreation timestamp not null,
+ description text,
+ editeur varchar(100) not null,
+ fileContent oid,
+ fileMimetype varchar(60) not null,
+ fileName varchar(60) not null,
+ langue varchar(2),
+ titre varchar(100) not null,
+ ajoutePar_idPersonne int4 not null,
+ createur_idPersonne int4 not null,
+ typeDocument_idTypeDocument int4 not null,
+ molecule int4,
+ primary key (idDocument)
+ );
+
+ alter table Document
+ add constraint FK3737353B2F46DB31
+ foreign key (ajoutePar_idPersonne)
+ references Personne;
+
+ alter table Document
+ add constraint FK3737353B822055B9
+ foreign key (createur_idPersonne)
+ references Personne;
+
+ alter table Document
+ add constraint FK3737353BBECBA92F
+ foreign key (typeDocument_idTypeDocument)
+ references TypeDocument;
+
+ alter table Document
+ add constraint FK3737353B20FEEDAC
+ foreign key (molecule)
+ references Molecule;
COMMIT;
\ No newline at end of file
Deleted: trunk/cantharella.data/src/test/resources/log4j.xml
===================================================================
(Binary files differ)
Copied: trunk/cantharella.data/src/test/resources/log4j.xml (from rev 58, trunk/cantharella.data/src/test/resources/log4j.xml)
===================================================================
(Binary files differ)
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/DocumentService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/DocumentService.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/DocumentService.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -26,7 +26,10 @@
import nc.ird.cantharella.data.exceptions.DataConstraintException;
import nc.ird.cantharella.data.exceptions.DataNotFoundException;
+import nc.ird.cantharella.data.model.Document;
import nc.ird.cantharella.data.model.TypeDocument;
+import nc.ird.cantharella.data.model.Utilisateur;
+import nc.ird.cantharella.service.utils.normalizers.DocumentNormalizer;
import nc.ird.cantharella.service.utils.normalizers.TypeDocumentNormalizer;
import nc.ird.cantharella.service.utils.normalizers.UniqueFieldNormalizer;
import nc.ird.cantharella.service.utils.normalizers.utils.Normalize;
@@ -85,4 +88,21 @@
*/
void deleteTypeDocument(TypeDocument typeDocument) throws DataConstraintException;
+ /**
+ * Load a document.
+ *
+ * @param idDocument id
+ * @return the corresponding document
+ * @throws DataNotFoundException if not found
+ */
+ Document loadDocument(Integer idDocument) throws DataNotFoundException;
+
+ /**
+ * Check if a user can update or delete a document.
+ * @param document document
+ * @param utilisateur Utilisateur
+ * @return TRUE si il a le droit
+ */
+ boolean updateOrdeleteDocumentEnabled(Document document, Utilisateur utilisateur);
+
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/DocumentServiceImpl.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -28,7 +28,9 @@
import nc.ird.cantharella.data.exceptions.DataConstraintException;
import nc.ird.cantharella.data.exceptions.DataNotFoundException;
import nc.ird.cantharella.data.exceptions.UnexpectedException;
+import nc.ird.cantharella.data.model.Document;
import nc.ird.cantharella.data.model.TypeDocument;
+import nc.ird.cantharella.data.model.Utilisateur;
import nc.ird.cantharella.service.services.DocumentService;
import nc.ird.module.utils.AssertTools;
@@ -100,4 +102,17 @@
throw new UnexpectedException(e);
}
}
+
+ /** {@inheritDoc} */
+ @Override
+ public Document loadDocument(Integer idDocument) throws DataNotFoundException {
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean updateOrdeleteDocumentEnabled(Document document, Utilisateur utilisateur) {
+ return false;
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/MoleculeServiceImpl.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -38,7 +38,6 @@
import nc.ird.cantharella.data.model.Produit;
import nc.ird.cantharella.data.model.Utilisateur;
import nc.ird.cantharella.data.model.Utilisateur.TypeDroit;
-import nc.ird.cantharella.data.model.utils.AbstractModel;
import nc.ird.cantharella.service.model.MoleculeProvenanceBean;
import nc.ird.cantharella.service.services.LotService;
import nc.ird.cantharella.service.services.MoleculeService;
Added: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/DocumentNormalizer.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/DocumentNormalizer.java (rev 0)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/DocumentNormalizer.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -0,0 +1,43 @@
+/*
+ * #%L
+ * Cantharella :: Service
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package nc.ird.cantharella.service.utils.normalizers;
+
+import nc.ird.cantharella.data.model.Document;
+import nc.ird.cantharella.service.utils.normalizers.utils.Normalizer;
+import nc.ird.module.utils.AssertTools;
+
+/**
+ * Document normalizer
+ * @author Eric Chatellier
+ */
+public final class DocumentNormalizer extends Normalizer<Document> {
+
+ /** {@inheritDoc} */
+ @Override
+ protected Document normalize(Document document) {
+ AssertTools.assertNotNull(document);
+ // Unique field
+ document.setTitre(Normalizer.normalize(ConfigNameNormalizer.class, document.getTitre()));
+ return document;
+ }
+}
Property changes on: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/utils/normalizers/DocumentNormalizer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -22,81 +22,83 @@
*/
package nc.ird.cantharella.web.config;
-import java.math.BigDecimal;
-
-import nc.ird.cantharella.data.config.DataContext;
-import nc.ird.cantharella.data.exceptions.DataConstraintException;
-import nc.ird.cantharella.data.exceptions.UnexpectedException;
-import nc.ird.cantharella.service.services.PersonneService;
-import nc.ird.cantharella.web.pages.ContactPage;
-import nc.ird.cantharella.web.pages.HomePage;
-import nc.ird.cantharella.web.pages.domain.campagne.ListCampagnesPage;
-import nc.ird.cantharella.web.pages.domain.campagne.ManageCampagnePage;
-import nc.ird.cantharella.web.pages.domain.campagne.ReadCampagnePage;
-import nc.ird.cantharella.web.pages.domain.config.ListConfigurationPage;
-import nc.ird.cantharella.web.pages.domain.extraction.ListExtractionsPage;
-import nc.ird.cantharella.web.pages.domain.extraction.ManageExtractionPage;
-import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
-import nc.ird.cantharella.web.pages.domain.lot.ListLotsPage;
-import nc.ird.cantharella.web.pages.domain.lot.ManageLotPage;
-import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
+import java.math.BigDecimal;
+
+import nc.ird.cantharella.data.config.DataContext;
+import nc.ird.cantharella.data.exceptions.DataConstraintException;
+import nc.ird.cantharella.data.exceptions.UnexpectedException;
+import nc.ird.cantharella.service.services.PersonneService;
+import nc.ird.cantharella.web.pages.ContactPage;
+import nc.ird.cantharella.web.pages.HomePage;
+import nc.ird.cantharella.web.pages.domain.campagne.ListCampagnesPage;
+import nc.ird.cantharella.web.pages.domain.campagne.ManageCampagnePage;
+import nc.ird.cantharella.web.pages.domain.campagne.ReadCampagnePage;
+import nc.ird.cantharella.web.pages.domain.config.ListConfigurationPage;
+import nc.ird.cantharella.web.pages.domain.document.ManageDocumentPage;
+import nc.ird.cantharella.web.pages.domain.document.ReadDocumentPage;
+import nc.ird.cantharella.web.pages.domain.extraction.ListExtractionsPage;
+import nc.ird.cantharella.web.pages.domain.extraction.ManageExtractionPage;
+import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
+import nc.ird.cantharella.web.pages.domain.lot.ListLotsPage;
+import nc.ird.cantharella.web.pages.domain.lot.ManageLotPage;
+import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
import nc.ird.cantharella.web.pages.domain.molecule.ListMoleculesPage;
import nc.ird.cantharella.web.pages.domain.molecule.ManageMoleculePage;
import nc.ird.cantharella.web.pages.domain.molecule.ReadMoleculePage;
-import nc.ird.cantharella.web.pages.domain.personne.ListPersonnesPage;
-import nc.ird.cantharella.web.pages.domain.personne.ManagePersonnePage;
-import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
-import nc.ird.cantharella.web.pages.domain.purification.ListPurificationsPage;
-import nc.ird.cantharella.web.pages.domain.purification.ManagePurificationPage;
-import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
+import nc.ird.cantharella.web.pages.domain.personne.ListPersonnesPage;
+import nc.ird.cantharella.web.pages.domain.personne.ManagePersonnePage;
+import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
+import nc.ird.cantharella.web.pages.domain.purification.ListPurificationsPage;
+import nc.ird.cantharella.web.pages.domain.purification.ManagePurificationPage;
+import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
import nc.ird.cantharella.web.pages.domain.search.SearchPage;
-import nc.ird.cantharella.web.pages.domain.specimen.ListSpecimensPage;
-import nc.ird.cantharella.web.pages.domain.specimen.ManageSpecimenPage;
-import nc.ird.cantharella.web.pages.domain.specimen.ReadSpecimenPage;
-import nc.ird.cantharella.web.pages.domain.station.ListStationsPage;
-import nc.ird.cantharella.web.pages.domain.station.ManageStationPage;
-import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
-import nc.ird.cantharella.web.pages.domain.testBio.ListTestsBioPage;
-import nc.ird.cantharella.web.pages.domain.testBio.ManageTestBioPage;
-import nc.ird.cantharella.web.pages.domain.testBio.ReadTestBioPage;
-import nc.ird.cantharella.web.pages.domain.utilisateur.ManageUtilisateurPage;
-import nc.ird.cantharella.web.pages.domain.utilisateur.RegisterPage;
-import nc.ird.cantharella.web.pages.domain.utilisateur.ResetPasswordPage;
-import nc.ird.cantharella.web.pages.domain.utilisateur.UpdateUtilisateurPage;
-import nc.ird.cantharella.web.pages.errors.AccessDeniedPage;
-import nc.ird.cantharella.web.pages.errors.InternalErrorPage;
-import nc.ird.cantharella.web.pages.errors.PageExpiredErrorPage;
-import nc.ird.cantharella.web.utils.converters.BigDecimalConverterImpl;
-import nc.ird.cantharella.web.utils.converters.DoubleConverterImpl;
-import nc.ird.cantharella.web.utils.security.AuthSession;
-import nc.ird.cantharella.web.utils.security.AuthStrategy;
-import nc.ird.module.utils.AssertTools;
-
+import nc.ird.cantharella.web.pages.domain.specimen.ListSpecimensPage;
+import nc.ird.cantharella.web.pages.domain.specimen.ManageSpecimenPage;
+import nc.ird.cantharella.web.pages.domain.specimen.ReadSpecimenPage;
+import nc.ird.cantharella.web.pages.domain.station.ListStationsPage;
+import nc.ird.cantharella.web.pages.domain.station.ManageStationPage;
+import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
+import nc.ird.cantharella.web.pages.domain.testBio.ListTestsBioPage;
+import nc.ird.cantharella.web.pages.domain.testBio.ManageTestBioPage;
+import nc.ird.cantharella.web.pages.domain.testBio.ReadTestBioPage;
+import nc.ird.cantharella.web.pages.domain.utilisateur.ManageUtilisateurPage;
+import nc.ird.cantharella.web.pages.domain.utilisateur.RegisterPage;
+import nc.ird.cantharella.web.pages.domain.utilisateur.ResetPasswordPage;
+import nc.ird.cantharella.web.pages.domain.utilisateur.UpdateUtilisateurPage;
+import nc.ird.cantharella.web.pages.errors.AccessDeniedPage;
+import nc.ird.cantharella.web.pages.errors.InternalErrorPage;
+import nc.ird.cantharella.web.pages.errors.PageExpiredErrorPage;
+import nc.ird.cantharella.web.utils.converters.BigDecimalConverterImpl;
+import nc.ird.cantharella.web.utils.converters.DoubleConverterImpl;
+import nc.ird.cantharella.web.utils.security.AuthSession;
+import nc.ird.cantharella.web.utils.security.AuthStrategy;
+import nc.ird.module.utils.AssertTools;
+
+import org.apache.wicket.ConverterLocator;
+import org.apache.wicket.IConverterLocator;
+import org.apache.wicket.RuntimeConfigurationType;
+import org.apache.wicket.Session;
+import org.apache.wicket.authentication.IAuthenticationStrategy;
+import org.apache.wicket.authentication.strategy.DefaultAuthenticationStrategy;
+import org.apache.wicket.injection.Injector;
+import org.apache.wicket.javascript.DefaultJavaScriptCompressor;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.request.Request;
+import org.apache.wicket.request.Response;
+import org.apache.wicket.request.mapper.MountedMapper;
+import org.apache.wicket.request.mapper.PackageMapper;
+import org.apache.wicket.request.mapper.mount.MountMapper;
+import org.apache.wicket.resource.NoOpTextCompressor;
+import org.apache.wicket.resource.loader.IStringResourceLoader;
+import org.apache.wicket.settings.IExceptionSettings;
+import org.apache.wicket.settings.IRequestCycleSettings.RenderStrategy;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
+import org.apache.wicket.util.cookies.CookieUtils;
+import org.apache.wicket.util.lang.PackageName;
+import org.apache.wicket.util.time.Duration;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.wicket.ConverterLocator;
-import org.apache.wicket.IConverterLocator;
-import org.apache.wicket.RuntimeConfigurationType;
-import org.apache.wicket.Session;
-import org.apache.wicket.authentication.IAuthenticationStrategy;
-import org.apache.wicket.authentication.strategy.DefaultAuthenticationStrategy;
-import org.apache.wicket.injection.Injector;
-import org.apache.wicket.javascript.DefaultJavaScriptCompressor;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.request.Request;
-import org.apache.wicket.request.Response;
-import org.apache.wicket.request.mapper.MountedMapper;
-import org.apache.wicket.request.mapper.PackageMapper;
-import org.apache.wicket.request.mapper.mount.MountMapper;
-import org.apache.wicket.resource.NoOpTextCompressor;
-import org.apache.wicket.resource.loader.IStringResourceLoader;
-import org.apache.wicket.settings.IExceptionSettings;
-import org.apache.wicket.settings.IRequestCycleSettings.RenderStrategy;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
-import org.apache.wicket.util.cookies.CookieUtils;
-import org.apache.wicket.util.lang.PackageName;
-import org.apache.wicket.util.time.Duration;
+import org.slf4j.LoggerFactory;
/**
* Web application
@@ -385,7 +387,7 @@
mountPage("/station/edit", ManageStationPage.class);
getRootRequestMapperAsCompound().add(new MountedMapper("/station/view", ReadStationPage.class));
mountPage("/station/view", ReadStationPage.class);
-
+
getRootRequestMapperAsCompound().add(new MountedMapper("/molecule/list", ListMoleculesPage.class));
mountPage("/molecule/list", ListMoleculesPage.class);
getRootRequestMapperAsCompound().add(new MountedMapper("/molecule/edit", ManageMoleculePage.class));
@@ -398,7 +400,12 @@
getRootRequestMapperAsCompound().add(new MountedMapper("/testBio/edit", ManageTestBioPage.class));
mountPage("/testBio/edit", ManageTestBioPage.class);
getRootRequestMapperAsCompound().add(new MountedMapper("/testBio/view", ReadTestBioPage.class));
- mountPage("/testBio/view", ReadTestBioPage.class);
+ mountPage("/testBio/view", ReadTestBioPage.class);
+
+ getRootRequestMapperAsCompound().add(new MountedMapper("/document/edit", ManageDocumentPage.class));
+ mountPage("/document/edit", ManageDocumentPage.class);
+ getRootRequestMapperAsCompound().add(new MountedMapper("/document/view", ReadDocumentPage.class));
+ mountPage("/document/view", ReadDocumentPage.class);
getRootRequestMapperAsCompound().add(new MountedMapper("/utilisateur/edit", ManageUtilisateurPage.class));
mountPage("/utilisateur/edit", ManageUtilisateurPage.class);
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.html (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.html 2013-02-13 15:03:01 UTC (rev 104)
@@ -0,0 +1,102 @@
+<!--
+ #%L
+ Cantharella :: Web
+ $Id:$
+ $HeadURL:$
+ %%
+ Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
+<body>
+<wicket:extend>
+
+ <form wicket:id="ManageDocumentPage.Form">
+
+ <div class="property required">
+ <label for="Document.titre"><wicket:message key="Document.titre" /></label>
+ <input type="text" id="Document.titre" wicket:id="Document.titre" />
+ </div>
+
+ <div class="property required">
+ <label for="Document.createur"><wicket:message key="Document.createur" /></label>
+ <select id="Document.createur" wicket:id="Document.createur" />
+ <a wicket:id="NewPersonne" class="add"><wicket:message key="ListPersonnesPage.NewPersonne" /></a>
+ </div>
+
+ <div class="property required">
+ <label for="Document.dateCreation"><wicket:message key="Document.dateCreation" /></label>
+ <input type="text" id="Document.dateCreation" wicket:id="Document.dateCreation" />
+ </div>
+
+ <div class="property required">
+ <label for="Document.editeur"><wicket:message key="Document.editeur" /></label>
+ <input type="text" id="Document.editeur" wicket:id="Document.editeur" />
+ </div>
+
+ <div class="property">
+ <label for="Document.description"><wicket:message key="Document.description" /></label>
+ <textarea id="Document.description" wicket:id="Document.description"></textarea>
+ </div>
+
+ <div class="property">
+ <label for="Document.langue"><wicket:message key="Document.langue" /></label>
+ <select id="Document.langue" wicket:id="Document.langue" />
+ </div>
+
+ <div class="property">
+ <label for="Document.contrainteLegale"><wicket:message key="Document.contrainteLegale" /></label>
+ <input type="text" id="Document.contrainteLegale" wicket:id="Document.contrainteLegale" />
+ </div>
+
+ <div class="property required">
+ <label for="Document.ajoutePar"><wicket:message key="Document.ajoutePar" /></label>
+ <input type="text" id="Document.ajoutePar" wicket:id="Document.ajoutePar" />
+ </div>
+
+ <div class="property required">
+ <label for="TypeDocument.nom"><wicket:message key="TypeDocument.nom" /></label>
+ <select id="TypeDocument.nom" wicket:id="TypeDocument.nom" />
+ </div>
+
+ <div class="property">
+ <label for="TypeDocument.domaine"><wicket:message key="TypeDocument.domaine" /></label>
+ <span id="TypeDocument.domain" wicket:id="TypeDocument.domaine" />
+ </div>
+
+ <div class="property">
+ <label for="TypeDocument.description"><wicket:message key="TypeDocument.description" /></label>
+ <span id="TypeDocument.description" wicket:id="TypeDocument.description" />
+ </div>
+
+ <div class="property required">
+ <label for="Document.fileName"><wicket:message key="Document.fileName" /></label>
+ <input type="file" id="Document.fileName" wicket:id="Document.fileName" />
+ </div>
+
+ <div class="actions">
+ <input type="submit" wicket:message="value:Submit" wicket:id="Create" />
+ <input type="submit" wicket:message="value:Submit" wicket:id="Update" />
+ <input type="submit" wicket:message="value:Delete" wicket:id="Delete" class="warning" />
+ <a wicket:id="Cancel"><wicket:message key="Cancel" /></a>
+ </div>
+ </form>
+
+</wicket:extend>
+</body>
+</html>
\ No newline at end of file
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -0,0 +1,361 @@
+/*
+ * #%L
+ * Cantharella :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package nc.ird.cantharella.web.pages.domain.document;
+
+import java.io.IOException;
+import java.sql.Blob;
+import java.util.Date;
+import java.util.List;
+
+import nc.ird.cantharella.data.exceptions.DataConstraintException;
+import nc.ird.cantharella.data.exceptions.DataNotFoundException;
+import nc.ird.cantharella.data.exceptions.UnexpectedException;
+import nc.ird.cantharella.data.model.Document;
+import nc.ird.cantharella.data.model.Personne;
+import nc.ird.cantharella.data.model.TypeDocument;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
+import nc.ird.cantharella.data.validation.utils.ModelValidator;
+import nc.ird.cantharella.service.services.DocumentService;
+import nc.ird.cantharella.service.services.PersonneService;
+import nc.ird.cantharella.web.config.WebContext;
+import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.personne.ManagePersonnePage;
+import nc.ird.cantharella.web.utils.CallerPage;
+import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
+import nc.ird.cantharella.web.utils.forms.SubmittableButton;
+import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
+import nc.ird.cantharella.web.utils.renderers.MapChoiceRenderer;
+import net.sf.ehcache.hibernate.HibernateUtil;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
+import org.apache.wicket.extensions.markup.html.form.DateTextField;
+import org.apache.wicket.extensions.yui.calendar.DatePicker;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.TextArea;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.form.upload.FileUpload;
+import org.apache.wicket.markup.html.form.upload.FileUploadField;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.wicket.util.lang.Bytes;
+import org.hibernate.engine.jdbc.internal.LobCreatorBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.jdbc.support.lob.LobCreator;
+
+/**
+ * Document management page (creation/edition).
+ *
+ * @author Eric Chatellier
+ */
+public class ManageDocumentPage extends TemplatePage {
+
+ /** Action : create */
+ private static final String ACTION_CREATE = "Create";
+
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
+
+ /** Action : update */
+ private static final String ACTION_UPDATE = "Update";
+
+ /** Logger */
+ private static final Logger LOG = LoggerFactory.getLogger(ManageDocumentPage.class);
+
+ /** Model : document. */
+ private final IModel<Document> documentModel;
+
+ /** Service : document */
+ @SpringBean
+ private DocumentService documentService;
+
+ /** Service : personnes */
+ @SpringBean
+ private PersonneService personneService;
+
+ /** Model validateur */
+ @SpringBean(name = "webModelValidator")
+ private ModelValidator validator;
+
+ /** Entity where document is attached. */
+ private DocumentAttachable documentAttachable;
+
+ /** Caller page. */
+ private final CallerPage callerPage;
+
+ /** Multiple entry. */
+ private boolean multipleEntry;
+
+ /**
+ * Constructeur (mode création)
+ * @param callerPage Page appelante
+ * @param documentAttachable entity where document is attached to
+ * @param multipleEntry Saisie multiple
+ */
+ public ManageDocumentPage(CallerPage callerPage, DocumentAttachable documentAttachable, boolean multipleEntry) {
+ this(null, null, documentAttachable, callerPage, multipleEntry);
+ }
+
+ /**
+ * Constructeur (mode édition)
+ * @param idDocument ID document
+ * @param callerPage Page appelante
+ */
+ public ManageDocumentPage(Integer idDocument, CallerPage callerPage) {
+ this(idDocument, null, null, callerPage, false);
+ }
+
+ /**
+ * Constructeur (mode saisie du lot suivante)
+ * @param document document
+ * @param callerPage Page appelante
+ */
+ public ManageDocumentPage(Document document, CallerPage callerPage) {
+ this(null, document, null, callerPage, true);
+ }
+
+ /**
+ * Constructeur. Si idDocument et document sont null, on créée un nouveau Document.
+ * Si idDocument est renseigné, on édite le document
+ * correspondant. Si document est renseigné, on créée un nouveau document à
+ * partir des informations qu'il contient.
+ * @param idDocument ID document
+ * @param document document
+ * @param documentAttachable entity where document is attached to
+ * @param callerPage Page appelante
+ * @param multipleEntry Saisie multiple
+ */
+ private ManageDocumentPage(Integer idDocument, Document document, final DocumentAttachable documentAttachable,
+ final CallerPage callerPage, boolean multipleEntry) {
+ super(ManageDocumentPage.class);
+ assert idDocument == null || document == null;
+ this.callerPage = callerPage;
+ this.multipleEntry = multipleEntry;
+ this.documentAttachable = documentAttachable;
+
+ final CallerPage currentPage = new CallerPage(this);
+
+ // Initialisation du modèle
+ try {
+ documentModel = new Model<Document>(idDocument == null && document == null ? new Document() : document != null ? document
+ : documentService.loadDocument(idDocument));
+ } catch (DataNotFoundException e) {
+ LOG.error(e.getMessage(), e);
+ throw new UnexpectedException(e);
+ }
+
+ boolean createMode = idDocument == null;
+ if (createMode) {
+ documentModel.getObject().setCreateur(getSession().getUtilisateur());
+ documentModel.getObject().setAjoutePar(getSession().getUtilisateur());
+ }
+
+ // Initialisation des listes (pour le dropDownChoice)
+ List<Personne> personnes = personneService.listPersonnes();
+ List<TypeDocument> typeDocuments = documentService.listTypeDocuments();
+
+ // champ fichier
+ final FileUploadField fileUploadField = new FileUploadField("Document.fileName");
+
+ // initialisation du formulaire wicket
+ final Form<Void> formView = new Form<Void>("ManageDocumentPage.Form") {
+ @Override
+ protected void onSubmit() {
+ super.onSubmit();
+
+
+ }
+ };
+ formView.setMultiPart(true);
+ formView.setMaxSize(Bytes.megabytes(1));
+
+ formView.add(new TextField<String>("Document.titre", new PropertyModel<String>(documentModel, "titre")));
+
+ final DropDownChoice<Personne> createurInput = new DropDownChoice<Personne>("Document.createur",
+ new PropertyModel<Personne>(documentModel, "createur"), personnes);
+ createurInput.setOutputMarkupId(true);
+ createurInput.setNullValid(false);
+ formView.add(createurInput);
+
+ // Action : création d'une nouvelle personne
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewPersonne") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManagePersonnePage(currentPage, false));
+ }
+
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManagePersonnePage(currentPage, false));
+ }
+ });
+
+ formView.add(new DateTextField("Document.dateCreation", new PropertyModel<Date>(documentModel, "dateCreation"))
+ .add(new DatePicker()));
+ formView.add(new TextField<String>("Document.editeur", new PropertyModel<String>(documentModel, "editeur")));
+
+ formView.add(new TextArea<String>("Document.description", new PropertyModel<String>(documentModel, "description")));
+
+ formView.add(new DropDownChoice<String>("Document.langue",
+ new PropertyModel<String>(documentModel, "langue"), WebContext.COUNTRY_CODES.get(getSession()
+ .getLocale()), new MapChoiceRenderer<String, String>(WebContext.COUNTRIES.get(getSession()
+ .getLocale()))));
+ formView.add(new TextField<String>("Document.contrainteLegale", new PropertyModel<String>(documentModel, "contrainteLegale")));
+
+ // AjoutePar en lecture seule
+ formView.add(new TextField<String>("Document.ajoutePar", new PropertyModel<String>(documentModel, "ajoutePar"))
+ .setEnabled(false));
+
+ // Type de document
+ final DropDownChoice<TypeDocument> typeDocumentInput = new DropDownChoice<TypeDocument>("TypeDocument.nom",
+ new PropertyModel<TypeDocument>(documentModel, "typeDocument"), typeDocuments);
+ typeDocumentInput.setOutputMarkupId(true);
+ typeDocumentInput.setNullValid(false);
+ formView.add(typeDocumentInput);
+
+ final Label typeDocumentDomainLabel = new Label("TypeDocument.domaine", new PropertyModel<String>(documentModel, "typeDocument.domaine"));
+ typeDocumentDomainLabel.setOutputMarkupId(true);
+ formView.add(typeDocumentDomainLabel);
+
+ final Label typeDocumentDescriptionLabel = new Label("TypeDocument.description", new PropertyModel<String>(documentModel, "typeDocument.description"));
+ typeDocumentDescriptionLabel.setOutputMarkupId(true);
+ formView.add(typeDocumentDescriptionLabel);
+
+ // Fichier
+ formView.add(fileUploadField);
+
+ // Action : création du document
+ Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ documentAttachable.addDocument(documentModel.getObject());
+ }
+
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_CREATE);
+ redirect();
+ }
+
+ @Override
+ public void onValidate() {
+ final FileUpload uploadedFile = fileUploadField.getFileUpload();
+ if (uploadedFile != null) {
+ //documentModel.getObject().setFileContent(uploadedFile.getBytes());
+ documentModel.getObject().setFileName(uploadedFile.getClientFileName());
+ documentModel.getObject().setFileMimetype(uploadedFile.getContentType());
+
+ }
+ validateModel();
+ }
+ });
+ createButton.setVisibilityAllowed(createMode);
+ formView.add(createButton);
+
+ // Action : mise à jour du document
+ Button updateButton = new SubmittableButton(ACTION_UPDATE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ // nothing, will be updated by cascade
+ }
+
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_UPDATE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+
+ @Override
+ public void onValidate() {
+ validateModel();
+ }
+ });
+ updateButton.setVisibilityAllowed(!createMode
+ && documentService.updateOrdeleteDocumentEnabled(documentModel.getObject(), getSession().getUtilisateur()));
+ formView.add(updateButton);
+
+ // Action : suppression du document
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ documentAttachable.removeDocument(documentModel.getObject());
+ }
+
+ @Override
+ public void onSuccess() {
+ successNextPage(ACTION_DELETE);
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ deleteButton.setVisibilityAllowed(!createMode
+ && documentService.updateOrdeleteDocumentEnabled(documentModel.getObject(), getSession().getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
+
+ formView.add(new Link<Void>("Cancel") {
+ // Cas où le formulaire est annulé
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) this.getPage());
+ }
+ });
+
+ add(formView);
+ }
+
+ /**
+ * Redirection vers une autre page. Cas où le formulaire est validé
+ */
+ private void redirect() {
+ if (multipleEntry) {
+ // Redirection vers l'écran de saisie d'un nouveau document, en fournissant déjà quelques données
+ Document nextDocument = new Document();
+ setResponsePage(new ManageDocumentPage(nextDocument, callerPage));
+ } else if (callerPage != null) {
+ // On passe l'id du document associé à cette page, en paramètre de la prochaine page, pour lui permettre de
+ // l'exploiter si besoin
+ //callerPage.addPageParameter(Document.class.getSimpleName(), documentModel.getObject().getIdDocument());
+ callerPage.responsePage(this);
+ }
+ }
+
+ /**
+ * Validate model
+ */
+ private void validateModel() {
+ if (documentModel.getObject().getCreateur() == null) {
+ documentModel.getObject().setCreateur(getSession().getUtilisateur());
+ }
+ addValidationErrors(validator.validate(documentModel.getObject(), getSession().getLocale()));
+ }
+}
Property changes on: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.html (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.html 2013-02-13 15:03:01 UTC (rev 104)
@@ -0,0 +1,110 @@
+<!--
+ #%L
+ Cantharella :: Web
+ $Id:$
+ $HeadURL:$
+ %%
+ Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
+<body>
+<wicket:extend>
+ <div id="sheet">
+ <div class="property">
+ <span class="label"><wicket:message key="Document.titre" /></span>
+ <span class="value" wicket:id="Document.titre"></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Document.createur" /></span>
+ <span class="value" wicket:id="Document.createur"></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Document.editeur" /></span>
+ <span class="value" wicket:id="Document.editeur"></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Document.dateCreation" /></span>
+ <span class="value" wicket:id="Document.dateCreation"></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Document.description" /></span>
+ <span class="value" wicket:id="Document.description"></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Document.langue" /></span>
+ <span class="value" wicket:id="Document.langue" ></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Document.contrainteLegale" /></span>
+ <span class="value" wicket:id="Document.contrainteLegale" ></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Document.ajoutePar" /></span>
+ <span class="value" wicket:id="Document.ajoutePar" ></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="TypeDocument.nom" /></span>
+ <span class="value" wicket:id="TypeDocument.nom" ></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="TypeDocument.domaine" /></span>
+ <span class="value" wicket:id="TypeDocument.domaine" ></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="TypeDocument.description" /></span>
+ <span class="value" wicket:id="TypeDocument.description" ></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Document.fileName" /></span>
+ <span class="value" wicket:id="Document.fileName"></span>
+ </div>
+
+ <div class="property">
+ <span class="label"><wicket:message key="Document.fileMimetype" /></span>
+ <span class="value" wicket:id="Document.fileMimetype"></span>
+ </div>
+
+ <form wicket:id="Form">
+ <div class="actions">
+ <a class="edit" wicket:id="ReadDocumentPage.Document.Update" wicket:message="title:Update">
+ <wicket:message key="Update" />
+ </a>
+
+ <input type="submit" wicket:message="value:Delete" wicket:id="Delete" class="warning" />
+
+ <a wicket:id="ReadDocumentPage.Document.Back" wicket:message="title:Back">
+ <wicket:message key="Back" />
+ </a>
+ </div>
+ </form>
+ </div>
+</wicket:extend>
+</body>
+</html>
\ No newline at end of file
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -0,0 +1,149 @@
+/*
+ * #%L
+ * Cantharella :: Web
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2013 IRD (Institut de Recherche pour le Developpement) and by respective authors (see below)
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package nc.ird.cantharella.web.pages.domain.document;
+
+import nc.ird.cantharella.data.exceptions.DataConstraintException;
+import nc.ird.cantharella.data.model.Document;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
+import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.lot.ManageLotPage;
+import nc.ird.cantharella.web.utils.CallerPage;
+import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
+import nc.ird.cantharella.web.utils.behaviors.ReplaceEmptyLabelBehavior;
+import nc.ird.cantharella.web.utils.forms.SubmittableButton;
+import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+
+/**
+ * Document read page.
+ *
+ * @author Eric Chatellier
+ */
+public class ReadDocumentPage extends TemplatePage {
+
+ /** Action : delete */
+ public static final String ACTION_DELETE = "Delete";
+
+ /** Model : document */
+ private final IModel<Document> documentModel;
+
+ /** Caller page. */
+ private final CallerPage callerPage;
+
+ /**
+ * Constructeur
+ * @param idDocument ID document
+ * @param callerPage Page appelante
+ */
+ public ReadDocumentPage(final Document document, final DocumentAttachable documentAttachable, final CallerPage callerPage) {
+ super(ReadDocumentPage.class);
+ this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage(this);
+
+ // Initialisation du modèle
+ documentModel = new Model<Document>(document);
+
+ add(new Label("Document.titre", new PropertyModel<String>(documentModel, "titre"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Document.createur", new PropertyModel<String>(documentModel, "createur"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Document.dateCreation", new PropertyModel<String>(documentModel, "dateCreation"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Document.editeur", new PropertyModel<String>(documentModel, "editeur"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Document.description", new PropertyModel<String>(documentModel, "description"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Document.langue", new PropertyModel<String>(documentModel, "langue"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Document.contrainteLegale", new PropertyModel<String>(documentModel, "contrainteLegale"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Document.ajoutePar", new PropertyModel<String>(documentModel, "ajoutePar"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("TypeDocument.nom", new PropertyModel<String>(documentModel, "typeDocument.nom"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("TypeDocument.domaine", new PropertyModel<String>(documentModel, "typeDocument.domaine"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("TypeDocument.description", new PropertyModel<String>(documentModel, "typeDocument.description"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Document.fileName", new PropertyModel<String>(documentModel, "fileName"))
+ .add(new ReplaceEmptyLabelBehavior()));
+ add(new Label("Document.fileMimetype", new PropertyModel<String>(documentModel, "fileMimetype"))
+ .add(new ReplaceEmptyLabelBehavior()));
+
+ // Formulaire des actions
+ final Form<Void> formView = new Form<Void>("Form");
+
+ // Action : mise à jour (redirection vers le formulaire)
+ Link<Document> updateLink = new Link<Document>(getResource() + ".Document.Update", new Model<Document>(documentModel.getObject())) {
+ @Override
+ public void onClick() {
+ setResponsePage(new ManageDocumentPage(getModelObject().getIdDocument(), currentPage));
+ }
+ };
+ //FIXME updateLink.setVisibilityAllowed(documentService.updateOrdeleteDocumentEnabled(documentModel.getObject(), getSession()
+ // .getUtilisateur()));
+ formView.add(updateLink);
+
+ // Action : suppression
+ Button deleteButton = new SubmittableButton(ACTION_DELETE, ManageLotPage.class, new SubmittableButtonEvents() {
+ @Override
+ public void onProcess() throws DataConstraintException {
+ documentAttachable.removeDocument(documentModel.getObject());
+ }
+
+ @Override
+ public void onSuccess() {
+ successNextPage(ManageLotPage.class, ACTION_DELETE);
+ redirect();
+ }
+ });
+ // FIXME deleteButton.setVisibilityAllowed(documentService.updateOrdeleteDocumentEnabled(documentModel.getObject(), getSession()
+ // .getUtilisateur()));
+ deleteButton.add(new JSConfirmationBehavior(getString("Confirm")));
+ deleteButton.setDefaultFormProcessing(false);
+ formView.add(deleteButton);
+
+ // Action : retour
+ formView.add(new Link<Void>(getResource() + ".Document.Back") {
+ @Override
+ public void onClick() {
+ callerPage.responsePage((TemplatePage) getPage());
+ }
+ });
+ add(formView);
+ }
+
+ /**
+ * Redirection vers une autre page
+ */
+ private void redirect() {
+ callerPage.responsePage(this);
+ }
+}
Property changes on: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -220,7 +220,7 @@
// ajaxSubmitLink permet de sauvegarder l'état du formulaire
formView.add(new AjaxSubmitLink("NewCampagne") {
@Override
- protected void onSubmit(AjaxRequestTarget arg0, Form<?> arg1) {
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
setResponsePage(new ManageCampagnePage(currentPage, false));
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.List;
+
import nc.ird.cantharella.data.model.Lot;
import nc.ird.cantharella.data.model.Utilisateur;
import nc.ird.cantharella.service.model.MoleculeProvenanceBean;
@@ -41,6 +42,8 @@
import nc.ird.cantharella.web.utils.models.SimpleSortableListDataProvider;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
+
+import org.apache.commons.collections.CollectionUtils;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
@@ -141,6 +144,19 @@
new Model<String>(getString("Molecule.masseMolaire")),
"molecule.masseMolaire", "molecule.masseMolaire", DecimalDisplFormat.SMALL, getLocale()));
+ columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean>(
+ "images/attachment.png", getString("Read"), getString("Read")) {
+ @Override
+ public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item, String componentId, IModel<MoleculeProvenanceBean> model) {
+ setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), currentPage));
+ }
+
+ @Override
+ protected boolean isVisibleAllowed(IModel<MoleculeProvenanceBean> model) {
+ return CollectionUtils.isNotEmpty(model.getObject().getMolecule().getDocuments());
+ }
+ });
+
columns.add(new BooleanPropertyColumn<MoleculeProvenanceBean>(
new Model<String>(getString("Molecule.nouvMolecul")),
"molecule.nouvMolecul", "molecule.nouvMolecul", this));
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-02-13 15:03:01 UTC (rev 104)
@@ -178,6 +178,14 @@
</table>
</fieldset>
+ <fieldset>
+ <legend><wicket:message key="ListDocumentsPage.AttachedDocuments" /></legend>
+ <div wicket:id="ListDocumentsPage.AttachedDocuments.Refresh">
+ <table cellspacing="0" wicket:id="ListDocumentsPage.AttachedDocuments"/>
+ </div>
+ <a wicket:id="NewDocument" class="add"><wicket:message key="ListDocumentsPage.NewDocument" /></a>
+ </fieldset>
+
<div class="actions">
<input type="submit" wicket:message="value:Submit" wicket:id="Create" />
<input type="submit" wicket:message="value:Submit" wicket:id="Update" />
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -30,19 +30,23 @@
import nc.ird.cantharella.data.exceptions.DataNotFoundException;
import nc.ird.cantharella.data.exceptions.UnexpectedException;
import nc.ird.cantharella.data.model.Campagne;
+import nc.ird.cantharella.data.model.Document;
import nc.ird.cantharella.data.model.Extrait;
import nc.ird.cantharella.data.model.Fraction;
import nc.ird.cantharella.data.model.Molecule;
import nc.ird.cantharella.data.model.MoleculeProvenance;
import nc.ird.cantharella.data.model.Produit;
import nc.ird.cantharella.data.model.Utilisateur;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
import nc.ird.cantharella.data.validation.utils.ModelValidator;
import nc.ird.cantharella.service.services.CampagneService;
import nc.ird.cantharella.service.services.MoleculeService;
import nc.ird.cantharella.service.services.PersonneService;
import nc.ird.cantharella.service.services.ProduitService;
+import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.campagne.ManageCampagnePage;
+import nc.ird.cantharella.web.pages.domain.document.ManageDocumentPage;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
import nc.ird.cantharella.web.pages.renderers.ProduitRenderer;
@@ -56,6 +60,7 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel.DecimalDisplFormat;
+import nc.ird.cantharella.web.utils.models.SimpleSortableListDataProvider;
import nc.ird.cantharella.web.utils.panels.PropertyLabelLinkProduitPanel;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
@@ -67,6 +72,12 @@
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
+import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
@@ -79,6 +90,7 @@
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.AbstractPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
@@ -146,7 +158,6 @@
/**
* Constructeur (mode création).
* @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
*/
public ManageMoleculePage(CallerPage callerPage) {
this(null, callerPage);
@@ -156,9 +167,7 @@
* Constructeur. Si idMolecule est null, on créée une nouvelle Molecule. Si idMolecule est renseigné, on édite la molecule
* correspondante.
* @param idMolecule ID molecule
- * @param lot Lot
* @param callerPage Page appelante
- * @param multipleEntry Saisie multiple
*/
public ManageMoleculePage(Integer idMolecule, final CallerPage callerPage) {
super(ManageMoleculePage.class);
@@ -187,6 +196,7 @@
final Form<Void> formView = new Form<Void>("Form");
initProvenanceFields(formView, currentPage);
+ initAttachedDocumentsTable(formView, moleculeModel.getObject(), currentPage);
// page can be accessed by anyone for editing provenance
// but molecule fields can be edited only by administrators or
@@ -268,6 +278,21 @@
formView.add(new TextField<String>("Molecule.createur", new PropertyModel<String>(moleculeModel, "createur"))
.setEnabled(false));
+ // Action : création d'un nouveau document
+ // ajaxSubmitLink permet de sauvegarder l'état du formulaire
+ formView.add(new AjaxSubmitLink("NewDocument") {
+ @Override
+ protected void onSubmit(AjaxRequestTarget request, Form<?> form) {
+ setResponsePage(new ManageDocumentPage(currentPage, moleculeModel.getObject(), false));
+ }
+
+ // si erreur, le formulaire est également enregistré puis la redirection effectuée
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ setResponsePage(new ManageDocumentPage(currentPage, moleculeModel.getObject(), false));
+ }
+ }.setVisibilityAllowed(editEnabled));
+
// Action : création du lot
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
@@ -575,6 +600,68 @@
}
/**
+ * Init attached document table for current entity.
+ *
+ * @param formView form to add table to
+ * @param documentAttachable entity to get documents
+ * @param currentPage current page
+ */
+ private void initAttachedDocumentsTable(final Form<Void> formView, final DocumentAttachable documentAttachable, CallerPage currentPage) {
+
+ List<Document> documents = documentAttachable.getDocuments();
+
+ // On englobe le "DataView" dans un composant neutre que l'on pourra
+ // rafraichir quand la liste évoluera
+ final MarkupContainer attachedDocumentRefresh = new WebMarkupContainer("ListDocumentsPage.AttachedDocuments.Refresh");
+ attachedDocumentRefresh.setOutputMarkupId(true);
+ formView.add(attachedDocumentRefresh);
+
+ SimpleSortableListDataProvider<Document> attachedDocumentsDataProvider =
+ new SimpleSortableListDataProvider<Document>(
+ documents, getSession().getLocale());
+
+ List<IColumn<Document>> columns = new ArrayList<IColumn<Document>>();
+
+ columns.add(new PropertyColumn<Document>(
+ new Model<String>(getString("Document.titre")), "titre", "titre"));
+
+ columns.add(new PropertyColumn<Document>(
+ new Model<String>(getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
+
+ columns.add(new PropertyColumn<Document>(
+ new Model<String>(getString("Document.createur")), "createur", "createur"));
+
+ columns.add(new PropertyColumn<Document>(
+ new Model<String>(getString("Document.fileName")), "fileName", "fileName"));
+
+ columns.add(new AbstractColumn<Document>(new Model<String>(), "idMolecule") {
+ @Override
+ public void populateItem(Item<ICellPopulator<Document>> cellItem, String componentId, final IModel<Document> rowModel) {
+ cellItem.add(new AjaxFallbackButton(componentId, new Model<String>(getString("Delete")), formView) {
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+ documentAttachable.removeDocument(rowModel.getObject());
+
+ if (target != null) {
+ target.add(attachedDocumentRefresh);
+ refreshFeedbackPage(target);
+ }
+ }
+
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ // never called
+ }
+ });
+ }
+ });
+
+ final DataTable<Document> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document>("ListDocumentsPage.AttachedDocuments", columns,
+ attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
+ attachedDocumentRefresh.add(attachedDocumentTable);
+ }
+
+ /**
* Redirection vers une autre page. Cas où le formulaire est validé
*/
private void redirect() {
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.html 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.html 2013-02-13 15:03:01 UTC (rev 104)
@@ -152,6 +152,11 @@
</div>
</fieldset>
+ <fieldset>
+ <legend><wicket:message key="ListDocumentsPage.AttachedDocuments" /></legend>
+ <table cellspacing="0" wicket:id="ListDocumentsPage.AttachedDocuments"/>
+ </fieldset>
+
<form wicket:id="Form">
<div class="actions">
<a class="edit" wicket:id="ReadMoleculePage.Molecule.Update" wicket:message="title:Update">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -27,14 +27,18 @@
import nc.ird.cantharella.data.exceptions.DataConstraintException;
import nc.ird.cantharella.data.model.Campagne;
+import nc.ird.cantharella.data.model.Document;
import nc.ird.cantharella.data.model.Extrait;
import nc.ird.cantharella.data.model.Fraction;
import nc.ird.cantharella.data.model.Molecule;
import nc.ird.cantharella.data.model.MoleculeProvenance;
import nc.ird.cantharella.data.model.Personne;
import nc.ird.cantharella.data.model.Produit;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
import nc.ird.cantharella.service.services.MoleculeService;
+import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.ReadDocumentPage;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.lot.ManageLotPage;
import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
@@ -43,12 +47,14 @@
import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
import nc.ird.cantharella.web.utils.behaviors.MoleculeViewBehavior;
import nc.ird.cantharella.web.utils.behaviors.ReplaceEmptyLabelBehavior;
+import nc.ird.cantharella.web.utils.columns.LinkPropertyColumn;
import nc.ird.cantharella.web.utils.forms.SubmittableButton;
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.models.DisplayBooleanPropertyModel;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel;
import nc.ird.cantharella.web.utils.models.DisplayDecimalPropertyModel.DecimalDisplFormat;
import nc.ird.cantharella.web.utils.models.GenericLoadableDetachableModel;
+import nc.ird.cantharella.web.utils.models.SimpleSortableListDataProvider;
import nc.ird.cantharella.web.utils.panels.PropertyLabelLinkPanel;
import nc.ird.cantharella.web.utils.panels.PropertyLabelLinkProduitPanel;
import nc.ird.cantharella.web.utils.security.AuthRole;
@@ -57,6 +63,11 @@
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
@@ -64,6 +75,7 @@
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
@@ -106,6 +118,7 @@
moleculeModel = new GenericLoadableDetachableModel<Molecule>(Molecule.class, idMolecule);
initProvenanceFields(currentPage);
+ initAttachedDocumentsTable(moleculeModel.getObject(), currentPage);
add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")));
add(new Label("Molecule.nomCommun", new PropertyModel<String>(moleculeModel, "nomCommun")).add(new ReplaceEmptyLabelBehavior()));
@@ -271,4 +284,43 @@
};
add(noTableProvenances);
}
+
+ /**
+ * Init attached document table for current entity.
+ *
+ * @param formView form to add table to
+ * @param documentAttachable entity to get documents
+ * @param currentPage current page
+ */
+ private void initAttachedDocumentsTable(final DocumentAttachable documentAttachable, final CallerPage currentPage) {
+
+ List<Document> documents = documentAttachable.getDocuments();
+
+ SimpleSortableListDataProvider<Document> attachedDocumentsDataProvider =
+ new SimpleSortableListDataProvider<Document>(
+ documents, getSession().getLocale());
+
+ List<IColumn<Document>> columns = new ArrayList<IColumn<Document>>();
+
+ columns.add(new LinkPropertyColumn<Document>(
+ new Model<String>(getString("Document.titre")), "titre", "titre") {
+ @Override
+ public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
+ setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
+ }
+ });
+
+ columns.add(new PropertyColumn<Document>(
+ new Model<String>(getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
+
+ columns.add(new PropertyColumn<Document>(
+ new Model<String>(getString("Document.createur")), "createur", "createur"));
+
+ columns.add(new PropertyColumn<Document>(
+ new Model<String>(getString("Document.fileName")), "fileName", "fileName"));
+
+ final DataTable<Document> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document>("ListDocumentsPage.AttachedDocuments", columns,
+ attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
+ add(attachedDocumentTable);
+ }
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java 2013-02-13 15:03:01 UTC (rev 104)
@@ -64,10 +64,21 @@
/** {@inheritDoc} */
@Override
public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
- item.add(new LinkableImagePanel(item, componentId, model));
+ LinkableImagePanel panel = new LinkableImagePanel(item, componentId, model);
+ panel.setVisibilityAllowed(isVisibleAllowed(model));
+ item.add(panel);
}
/**
+ * Overridable method to mask panel.
+ * @param model model
+ * @return true if panel is visible
+ */
+ protected boolean isVisibleAllowed(IModel<T> model) {
+ return true;
+ }
+
+ /**
* Override this method to react to link clicks. Your own/internal row id will most likely be inside the model.
* @param item Item
* @param componentId Component id
Modified: trunk/cantharella.web/src/main/resources/web_en.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/web_en.properties 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/resources/web_en.properties 2013-02-13 15:03:01 UTC (rev 104)
@@ -131,6 +131,9 @@
ListTestsBioPage2=Bioassays
ListTestsBioPage.NewTestBio=New bioassay
+ListDocumentsPage.NewDocument=New document
+ListDocumentsPage.AttachedDocuments=Attached documents
+
ManageCampagnePage=Campaign management
ManageCampagnePage.Create.OK=Campaign added
ManageCampagnePage.Create.DataConstraintException=The name already exists
@@ -207,6 +210,12 @@
ManageTestBioPage.Delete.OK=Bioassay deleted
ManageTestBioPage.Delete.DataConstraintException=There are data linked to this biassay
+ManageDocumentPage=Document management
+ManageDocumentPage.Create.OK=Document added
+ManageDocumentPage.Update.OK=Document updated
+ManageDocumentPage.Delete.OK=Document deleted
+ManageDocumentPage.Form.uploadTooLarge=La taille du document ne peut pas dépasser ${maxSize}
+
UpdateUtilisateurPage=Account management
UpdateUtilisateurPage.Password=Password
UpdateUtilisateurPage.Profile=Profile
@@ -280,6 +289,7 @@
ReadPurificationPage=Viewing a purification
ReadMoleculePage=Viewing a molecule
ReadTestBioPage=Viewing a bioassay
+ReadDocumentPage=Viewing a document
SearchPage=Search
SearchPage.Search=Search
Modified: trunk/cantharella.web/src/main/resources/web_fr.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/web_fr.properties 2013-02-13 11:57:28 UTC (rev 103)
+++ trunk/cantharella.web/src/main/resources/web_fr.properties 2013-02-13 15:03:01 UTC (rev 104)
@@ -130,6 +130,9 @@
ListTestsBioPage2=Tests biologiques
ListTestsBioPage.NewTestBio=Nouveau test biologique
+ListDocumentsPage.NewDocument=Nouveau document
+ListDocumentsPage.AttachedDocuments=Document(s) attaché(s)
+
ManageCampagnePage=Gestion d'une campagne
ManageCampagnePage.Create.OK=Campagne ajoutée
ManageCampagnePage.Create.DataConstraintException=Le nom existe déjà
@@ -206,6 +209,12 @@
ManageTestBioPage.Delete.OK=Test biologique supprimé
ManageTestBioPage.Delete.DataConstraintException=Il existe des données liées à ce test biologique
+ManageDocumentPage=Gestion d'un document
+ManageDocumentPage.Create.OK=Document ajouté
+ManageDocumentPage.Update.OK=Document mis à jour
+ManageDocumentPage.Delete.OK=Document supprimé
+ManageDocumentPage.Form.uploadTooLarge=La taille du document ne peut pas dépasser ${maxSize}
+
UpdateUtilisateurPage=Gestion du compte
UpdateUtilisateurPage.Password=Mot de passe
UpdateUtilisateurPage.Profile=Profil
@@ -279,6 +288,7 @@
ReadPurificationPage=Consultation d'une purification
ReadMoleculePage=Consultation d'une molécule
ReadTestBioPage=Consultation d'un test biologique
+ReadDocumentPage=Consultation d'un document
SearchPage=Recherche
SearchPage.Search=Rechercher
Added: trunk/cantharella.web/src/main/webapp/images/attachment.png
===================================================================
(Binary files differ)
Property changes on: trunk/cantharella.web/src/main/webapp/images/attachment.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
1
0
Author: bpoussin
Date: 2013-02-13 12:57:28 +0100 (Wed, 13 Feb 2013)
New Revision: 103
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/103
Log:
site files are in english, menu must be in english too
Modified:
trunk/src/site/site.xml
Modified: trunk/src/site/site.xml
===================================================================
--- trunk/src/site/site.xml 2013-02-13 11:49:36 UTC (rev 102)
+++ trunk/src/site/site.xml 2013-02-13 11:57:28 UTC (rev 103)
@@ -48,8 +48,8 @@
<item name="Code Lutin" href="http://www.codelutin.com"/>
</links>
- <menu name="Utilisateur">
- <item name="Accueil" href="index.html"/>
+ <menu name="User">
+ <item name="About" href="index.html"/>
<item name="Configuration" href="configuration.html"/>
</menu>
<menu ref="reports"/>
1
0
Author: bpoussin
Date: 2013-02-13 12:49:36 +0100 (Wed, 13 Feb 2013)
New Revision: 102
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/102
Log:
xml file is not binary :(
Modified:
trunk/src/site/site.xml
Property changes on: trunk/src/site/site.xml
___________________________________________________________________
Deleted: svn:mime-type
- application/xml
1
0
13 Feb '13
Author: bpoussin
Date: 2013-02-13 12:48:45 +0100 (Wed, 13 Feb 2013)
New Revision: 101
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/101
Log:
rename site file description, because there is only on language
Added:
trunk/src/site/resources/images/jrst-logo.png
trunk/src/site/site.xml
Removed:
trunk/src/site/site_en.xml
Modified:
trunk/src/site/rst/configuration.rst
Added: trunk/src/site/resources/images/jrst-logo.png
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/resources/images/jrst-logo.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Modified: trunk/src/site/rst/configuration.rst
===================================================================
--- trunk/src/site/rst/configuration.rst 2013-02-13 11:21:32 UTC (rev 100)
+++ trunk/src/site/rst/configuration.rst 2013-02-13 11:48:45 UTC (rev 101)
@@ -24,7 +24,7 @@
Configuraiton
=============
-All configuration can be put in file **cantharella.conf**. This file can be in:
+All configuration variables can be put in file **cantharella.conf**. This file can be in:
- classpath
- system configuration directory
Copied: trunk/src/site/site.xml (from rev 95, trunk/src/site/site_en.xml)
===================================================================
(Binary files differ)
Deleted: trunk/src/site/site_en.xml
===================================================================
(Binary files differ)
1
0
Author: bpoussin
Date: 2013-02-13 12:21:32 +0100 (Wed, 13 Feb 2013)
New Revision: 100
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/100
Log:
move images site in site directory
Added:
trunk/src/site/resources/
Removed:
trunk/src/resources/
1
0