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
21 Feb '13
Author: echatellier
Date: 2013-02-21 18:16:19 +0100 (Thu, 21 Feb 2013)
New Revision: 149
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/149
Log:
Add document to others entity.
Update List, Manage, Read interface for all modified entities.
Added:
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn$ImagePanel.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ManageListDocumentsPanel.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ManageListDocumentsPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ReadListDocumentsPanel.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ReadListDocumentsPanel.java
trunk/cantharella.web/src/main/webapp/images/open_folder_yellow.png
Removed:
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java
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/java/nc/ird/cantharella/data/model/Personne.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ResultatTestBio.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java
trunk/cantharella.data/src/main/sql/dev_update.sql
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/ManageCampagnePage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.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/extraction/ManageExtractionPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.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/lot/ManageLotPage.html
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/ReadLotPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.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/pages/domain/personne/ListPersonnesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.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/purification/ManagePurificationPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.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/specimen/ManageSpecimenPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.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/station/ManageStationPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.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/pages/domain/testBio/ManageTestBioPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -33,6 +33,7 @@
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
@@ -43,6 +44,7 @@
import javax.validation.constraints.NotNull;
import nc.ird.cantharella.data.model.utils.AbstractModel;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
import nc.ird.cantharella.data.validation.CountryCode;
import org.apache.commons.beanutils.BeanComparator;
@@ -62,7 +64,7 @@
@Entity
@Table
@Embeddable
-public class Campagne extends AbstractModel implements Comparable<Campagne> {
+public class Campagne extends AbstractModel implements Comparable<Campagne>, DocumentAttachable {
/** ID */
@Id
@@ -141,6 +143,12 @@
@Cascade( { CascadeType.SAVE_UPDATE })
private List<Station> stations;
+ /** Attached documents. */
+ @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
+ @JoinColumn(name = "campagne")
+ @Cascade( { CascadeType.SAVE_UPDATE })
+ private List<Document> documents;
+
/**
* Constructor
*/
@@ -150,6 +158,7 @@
stations = new ArrayList<Station>();
personnesDroits = new ArrayList<CampagnePersonneDroits>();
groupesDroits = new ArrayList<CampagneGroupeDroits>();
+ documents = new ArrayList<Document>();
}
/** {@inheritDoc} */
@@ -397,4 +406,29 @@
this.stations = stations;
}
+ /** {@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/Document.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -107,8 +107,11 @@
@Basic(fetch = FetchType.LAZY)
private byte[] fileContent;
+ /** File data thumbnail. */
+ @Basic(fetch = FetchType.LAZY)
+ private byte[] fileContentThumb;
+
/** File mime type. */
- @NotEmpty
@Length(max = LENGTH_MEDIUM_TEXT)
private String fileMimetype;
@@ -327,8 +330,26 @@
public void setFileContent(byte[] fileContent) {
this.fileContent = fileContent;
}
+
+ /**
+ * File content thumbnail getter.
+ *
+ * @return file content thumbnail
+ */
+ public byte[] getFileContentThumb() {
+ return fileContentThumb;
+ }
/**
+ * File content thumbnail setter.
+ *
+ * @param fileContentThumb file content thumbnail
+ */
+ public void setFileContentThumb(byte[] fileContentThumb) {
+ this.fileContentThumb = fileContentThumb;
+ }
+
+ /**
* File mime type getter.
*
* @return file mime type
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -33,6 +33,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;
@@ -46,6 +47,7 @@
import nc.ird.cantharella.data.model.comparators.ExtraitsOfExtractionComp;
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.apache.commons.beanutils.BeanComparator;
import org.apache.commons.collections.comparators.ComparatorChain;
@@ -69,7 +71,7 @@
@Entity
@Indexed
@FullTextFilterDefs( { @FullTextFilterDef(name = "utilisateur-Extraction", impl = UtilisateurSearchFilter.class) })
-public class Extraction extends AbstractModel implements Comparable<Extraction> {
+public class Extraction extends AbstractModel implements Comparable<Extraction>, DocumentAttachable {
/** Id de l'extraction */
@Id
@@ -129,11 +131,18 @@
@ContainedIn
private List<Extrait> extraits;
+ /** Attached documents. */
+ @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
+ @JoinColumn(name = "extraction")
+ @Cascade( { CascadeType.SAVE_UPDATE })
+ private List<Document> documents;
+
/**
* Constructeur
*/
public Extraction() {
extraits = new ArrayList<Extrait>();
+ documents = new ArrayList<Document>();
}
/** {@inheritDoc} */
@@ -322,4 +331,29 @@
this.extraits = extraits;
}
+ /** {@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/Lot.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -33,6 +33,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;
@@ -47,8 +48,11 @@
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.apache.commons.beanutils.BeanComparator;
+import org.hibernate.annotations.Cascade;
+import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Type;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
@@ -69,7 +73,7 @@
@Indexed
@Embeddable
@FullTextFilterDefs( { @FullTextFilterDef(name = "utilisateur-Lot", impl = UtilisateurSearchFilter.class) })
-public class Lot extends AbstractModel implements Comparable<Lot> {
+public class Lot extends AbstractModel implements Comparable<Lot>, DocumentAttachable {
/** ID */
@Id
@@ -162,6 +166,12 @@
@NotNull
private List<Extraction> extractions;
+ /** Attached documents. */
+ @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
+ @JoinColumn(name = "lot")
+ @Cascade( { CascadeType.SAVE_UPDATE })
+ private List<Document> documents;
+
/**
* Constructeur
*/
@@ -169,6 +179,7 @@
personnesDroits = new ArrayList<LotPersonneDroits>();
groupesDroits = new ArrayList<LotGroupeDroits>();
extractions = new ArrayList<Extraction>();
+ documents = new ArrayList<Document>();
}
/** {@inheritDoc} */
@@ -454,4 +465,30 @@
public void setExtractions(List<Extraction> extractions) {
this.extractions = extractions;
}
+
+ /** {@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/Molecule.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -136,7 +136,7 @@
@Cascade( { CascadeType.SAVE_UPDATE })
private List<MoleculeProvenance> provenances;
- /** Liste des documents attachés. */
+ /** Attached documents. */
@OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
@JoinColumn(name = "molecule")
@Cascade( { CascadeType.SAVE_UPDATE })
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MoleculeProvenance.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -54,7 +54,6 @@
@Min(value = 0)
@Max(value = 100)
@Column(precision = DataContext.DECIMAL_PRECISION, scale = DataContext.DECIMAL_SCALE)
- @NotNull
private BigDecimal pourcentage;
/** Molecule dont fait partie la provenance */
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Personne.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Personne.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Personne.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -34,6 +34,7 @@
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
@@ -42,6 +43,7 @@
import javax.validation.constraints.NotNull;
import nc.ird.cantharella.data.model.utils.AbstractModel;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
import nc.ird.cantharella.data.validation.CountryCode;
import org.apache.commons.beanutils.BeanComparator;
@@ -62,7 +64,7 @@
@Entity
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "nom", "prenom" }) })
@Inheritance(strategy = InheritanceType.JOINED)
-public class Personne extends AbstractModel implements Comparable<Personne> {
+public class Personne extends AbstractModel implements Comparable<Personne>, DocumentAttachable {
/** ID */
@Id
@@ -181,6 +183,12 @@
@NotNull
private List<TestBio> testsBioCrees;
+ /** Attached documents. */
+ @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
+ @JoinColumn(name = "personne")
+ @Cascade( { CascadeType.SAVE_UPDATE })
+ private List<Document> documents;
+
/**
* Constructeur
*/
@@ -195,6 +203,7 @@
extractionsCrees = new ArrayList<Extraction>();
purificationsCrees = new ArrayList<Purification>();
testsBioCrees = new ArrayList<TestBio>();
+ documents = new ArrayList<Document>();
}
/** {@inheritDoc} */
@@ -564,4 +573,29 @@
this.testsBioCrees = testsBioCrees;
}
+ /** {@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/Purification.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -33,6 +33,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;
@@ -47,6 +48,7 @@
import nc.ird.cantharella.data.model.comparators.FractionsOfPurificationComp;
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 nc.ird.cantharella.utils.AssertTools;
import org.apache.commons.beanutils.BeanComparator;
@@ -70,7 +72,7 @@
@Entity
@Indexed
@FullTextFilterDefs( { @FullTextFilterDef(name = "utilisateur-Purification", impl = UtilisateurSearchFilter.class) })
-public class Purification extends AbstractModel implements Comparable<Purification> {
+public class Purification extends AbstractModel implements Comparable<Purification>, DocumentAttachable {
/** Id de la purification */
@Id
@@ -150,12 +152,19 @@
@IndexedEmbedded
private Lot lotSource;
+ /** Attached documents. */
+ @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
+ @JoinColumn(name = "purification")
+ @Cascade( { CascadeType.SAVE_UPDATE })
+ private List<Document> documents;
+
/**
* Constructeur
*/
public Purification() {
fractions = new ArrayList<Fraction>();
paramsMetho = new ArrayList<ParamMethoPuriEffectif>();
+ documents = new ArrayList<Document>();
}
/** {@inheritDoc} */
@@ -437,4 +446,29 @@
return extrait.getExtraction().getLot();
}
+ /** {@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/ResultatTestBio.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ResultatTestBio.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/ResultatTestBio.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -23,6 +23,7 @@
package nc.ird.cantharella.data.model;
import java.math.BigDecimal;
+import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -39,6 +40,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 nc.ird.cantharella.data.validation.CollectionUniqueField;
import nc.ird.cantharella.utils.AssertTools;
@@ -64,7 +66,7 @@
@CollectionUniqueField(fieldName = "repere", pathToCollection = "testBio.resultats")
@Indexed
@FullTextFilterDefs( { @FullTextFilterDef(name = "utilisateur-ResultatTestBio", impl = UtilisateurSearchFilter.class) })
-public class ResultatTestBio extends AbstractModel implements Cloneable, Comparable<ResultatTestBio> {
+public class ResultatTestBio extends AbstractModel implements Cloneable, Comparable<ResultatTestBio>, DocumentAttachable {
/**
* Type du résultat de test biologique
@@ -505,4 +507,20 @@
return (Extrait) curProd;
}
+ /** {@inheritDoc} */
+ public List<Document> getDocuments() {
+ return testBio.getDocuments();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addDocument(Document document) {
+ testBio.addDocument(document);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void removeDocument(Document document) {
+ testBio.removeDocument(document);
+ }
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -22,7 +22,9 @@
*/
package nc.ird.cantharella.data.model;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import javax.persistence.Column;
import javax.persistence.Embeddable;
@@ -32,8 +34,10 @@
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;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@@ -41,8 +45,11 @@
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.apache.commons.beanutils.BeanComparator;
+import org.hibernate.annotations.Cascade;
+import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Type;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
@@ -63,7 +70,7 @@
@Indexed
@Embeddable
@FullTextFilterDefs( { @FullTextFilterDef(name = "utilisateur-Specimen", impl = UtilisateurSearchFilter.class) })
-public class Specimen extends AbstractModel implements Comparable<Specimen> {
+public class Specimen extends AbstractModel implements Comparable<Specimen>, DocumentAttachable {
/**
* Types d'organisme pour un spécimen
@@ -164,6 +171,19 @@
@IndexedEmbedded
private Personne createur;
+ /** Attached documents. */
+ @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
+ @JoinColumn(name = "specimen")
+ @Cascade( { CascadeType.SAVE_UPDATE })
+ private List<Document> documents;
+
+ /**
+ * Constructor.
+ */
+ public Specimen() {
+ documents = new ArrayList<Document>();
+ }
+
/** {@inheritDoc} */
@Override
public String toString() {
@@ -432,4 +452,29 @@
this.createur = createur;
}
+ /** {@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/Station.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -31,6 +31,7 @@
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
@@ -40,6 +41,7 @@
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 nc.ird.cantharella.data.validation.CountryCode;
import nc.ird.cantharella.data.validation.Latitude;
import nc.ird.cantharella.data.validation.Longitude;
@@ -47,6 +49,8 @@
import org.apache.commons.beanutils.BeanComparator;
import org.hibernate.annotations.AccessType;
+import org.hibernate.annotations.Cascade;
+import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Type;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
@@ -67,7 +71,7 @@
@Indexed
@Embeddable
@FullTextFilterDefs( { @FullTextFilterDef(name = "utilisateur-Station", impl = UtilisateurSearchFilter.class) })
-public class Station extends AbstractModel implements Cloneable, Comparable<Station> {
+public class Station extends AbstractModel implements Cloneable, Comparable<Station>, DocumentAttachable {
/** ID */
@Id
@@ -131,12 +135,19 @@
@OneToMany(mappedBy = "station", fetch = FetchType.LAZY)
private List<Specimen> specimensRattaches;
+ /** Attached documents. */
+ @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
+ @JoinColumn(name = "station")
+ @Cascade( { CascadeType.SAVE_UPDATE })
+ private List<Document> documents;
+
/**
* Constructeur
*/
public Station() {
lots = new ArrayList<Lot>();
campagnes = new ArrayList<Campagne>();
+ documents = new ArrayList<Document>();
}
/** {@inheritDoc} */
@@ -359,4 +370,29 @@
this.specimensRattaches = specimensRattaches;
}
+ /** {@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);
+ }
}
\ No newline at end of file
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -36,6 +36,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;
@@ -51,6 +52,7 @@
import nc.ird.cantharella.data.model.ResultatTestBio.UniteConcMasse;
import nc.ird.cantharella.data.model.comparators.ResultatsOfTestBioComp;
import nc.ird.cantharella.data.model.utils.AbstractModel;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
import org.apache.commons.beanutils.BeanComparator;
import org.hibernate.annotations.Cascade;
@@ -69,7 +71,7 @@
*/
@Entity
@Embeddable
-public class TestBio extends AbstractModel implements Comparable<TestBio> {
+public class TestBio extends AbstractModel implements Comparable<TestBio>, DocumentAttachable {
/** Id du test bio */
@Id
@@ -143,11 +145,18 @@
@ContainedIn
private List<ResultatTestBio> resultats;
+ /** Attached documents. */
+ @OneToMany(fetch = FetchType.LAZY, orphanRemoval = true)
+ @JoinColumn(name = "resultatTestBio")
+ @Cascade( { CascadeType.SAVE_UPDATE })
+ private List<Document> documents;
+
/**
* Constructeur
*/
public TestBio() {
resultats = new ArrayList<ResultatTestBio>();
+ documents = new ArrayList<Document>();
}
/** {@inheritDoc} */
@@ -397,4 +406,29 @@
this.resultats = resultats;
}
+ /** {@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/sql/dev_update.sql
===================================================================
--- trunk/cantharella.data/src/main/sql/dev_update.sql 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.data/src/main/sql/dev_update.sql 2013-02-21 17:16:19 UTC (rev 149)
@@ -43,6 +43,7 @@
familleChimique varchar(60),
formuleBrute varchar(60) not null,
formuleDevMol text,
+ identifieePar varchar(60),
masseMolaire numeric(9, 4) check (masseMolaire<=99999 AND masseMolaire>=0),
nomCommun varchar(100),
nomIupca varchar(255),
@@ -50,7 +51,6 @@
publiOrigine text,
campagne_idCampagne int4,
createur_idPersonne int4 not null,
- identifieePar varchar(60),
primary key (idMolecule)
);
@@ -91,14 +91,23 @@
dateCreation timestamp not null,
description text,
editeur varchar(100) not null,
- fileContent bytea;,
- fileMimetype varchar(60) not null,
+ fileContent bytea,
+ fileContentThumb bytea,
+ fileMimetype varchar(60),
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,
+ specimen int4,
+ campagne int4,
+ personne int4,
+ extraction int4,
+ station int4,
+ purification int4,
+ lot int4,
+ resultatTestBio int4,
molecule int4,
primary key (idDocument)
);
@@ -119,6 +128,46 @@
references TypeDocument;
alter table Document
+ add constraint FK3737353B51427EB0
+ foreign key (specimen)
+ references Specimen;
+
+ alter table Document
+ add constraint FK3737353B3ED66D5C
+ foreign key (campagne)
+ references Campagne;
+
+ alter table Document
+ add constraint FK3737353B8458C838
+ foreign key (personne)
+ references Personne;
+
+ alter table Document
+ add constraint FK3737353BD9E0906E
+ foreign key (extraction)
+ references Extraction;
+
+ alter table Document
+ add constraint FK3737353BC591F5C8
+ foreign key (station)
+ references Station;
+
+ alter table Document
+ add constraint FK3737353B20A56C82
+ foreign key (purification)
+ references Purification;
+
+ alter table Document
+ add constraint FK3737353B767DEA02
+ foreign key (lot)
+ references Lot;
+
+ alter table Document
+ add constraint FK3737353B8923169C
+ foreign key (resultatTestBio)
+ references TestBio;
+
+ alter table Document
add constraint FK3737353B20FEEDAC
foreign key (molecule)
references Molecule;
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ListCampagnesPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -29,6 +29,7 @@
import nc.ird.cantharella.service.services.CampagneService;
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.DocumentTooltipColumn;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.columns.LinkPropertyColumn;
import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn;
@@ -121,6 +122,14 @@
getString("Campagne.codePays")), "codePays", "codePays", WebContext.COUNTRIES.get(getSession()
.getLocale())));
+ columns.add(new DocumentTooltipColumn<Campagne, String>(Model.of("")) {
+ @Override
+ public void onClick(IModel<Campagne> model) {
+ int idCampagne = model.getObject().getIdCampagne();
+ setResponsePage(new ReadCampagnePage(idCampagne, currentPage));
+ }
+ });
+
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
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -121,6 +121,9 @@
</tbody>
</table>
</fieldset>
+
+ <wicket:panel wicket:id="ManageListDocumentsPanel" />
+
<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/campagne/ManageCampagnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ManageCampagnePage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -39,6 +39,7 @@
import nc.ird.cantharella.service.services.StationService;
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ManageListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.ManagePersonnePage;
import nc.ird.cantharella.web.pages.domain.station.ManageStationPage;
import nc.ird.cantharella.web.pages.renderers.PersonneRenderer;
@@ -196,6 +197,7 @@
super(ManageCampagnePage.class);
assert idCampagne == null || campagne == null;
this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage(this);
this.multipleEntry = multipleEntry;
// Initialisation des modèles
@@ -258,6 +260,11 @@
initParticipantsFields(formView);
initStationsFields(formView);
+
+ // add list document panel
+ ManageListDocumentsPanel manageListDocumentsPanel = new ManageListDocumentsPanel("ManageListDocumentsPanel",
+ campagneModel.getObject(), currentPage);
+ formView.add(manageListDocumentsPanel);
// Action : création de la campagne
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -110,6 +110,9 @@
<span class="value"><wicket:message key="List.none" /></span>
</div>
</fieldset>
+
+ <wicket:panel wicket:id="ReadListDocumentsPanel" />
+
<form wicket:id="Form">
<div class="actions">
<a class="edit" wicket:id="ReadCampagnePage.Campagne.Update" wicket:message="title:Update">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/campagne/ReadCampagnePage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -34,6 +34,7 @@
import nc.ird.cantharella.service.services.StationService;
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ReadListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
import nc.ird.cantharella.web.utils.CallerPage;
@@ -134,6 +135,11 @@
initParticipantsFields(currentPage);
initStationsFields(currentPage);
+ // add list document panel
+ ReadListDocumentsPanel readListDocumentsPanel = new ReadListDocumentsPanel("ReadListDocumentsPanel",
+ campagneModel.getObject(), currentPage);
+ add(readListDocumentsPanel);
+
// Ajout du formulaire pour les actions
final Form<Void> formView = new Form<Void>("Form");
Deleted: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -1,210 +0,0 @@
-/*
- * #%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.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import nc.ird.cantharella.data.model.Document;
-import nc.ird.cantharella.data.model.utils.DocumentAttachable;
-import nc.ird.cantharella.web.config.WebContext;
-import nc.ird.cantharella.web.pages.TemplatePage;
-import nc.ird.cantharella.web.utils.CallerPage;
-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.models.SimpleSortableListDataProvider;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-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.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.form.Form;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.http.WebResponse;
-
-/**
- * Helper providing static method to init document list into entity Read or
- * Manager page.
- *
- * @author Eric Chatellier
- */
-public abstract class DocumentPageHelper {
-
- /**
- * Init attached document table for current entity.
- *
- * @param templatePage parent page
- * @param formView form to add table to
- * @param documentAttachable entity to get documents
- * @param currentPage current page
- */
- public static void initAttachedDocumentsManageTable(final TemplatePage templatePage, final Form<Void> formView,
- final DocumentAttachable documentAttachable, final 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, templatePage.getSession().getLocale());
-
- List<IColumn<Document, String>> columns = new ArrayList<IColumn<Document, String>>();
-
- columns.add(new LinkPropertyColumn<Document, String>(
- new Model<String>(templatePage.getString("Document.titre")), "titre", "titre") {
- @Override
- public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
- templatePage.setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
- }
- });
-
- columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage
- .getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
-
- columns.add(new PropertyColumn<Document, String>(
- new Model<String>(templatePage.getString("Document.createur")), "createur", "createur"));
-
- columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(templatePage
- .getString("Document.link")), "images/download.png", templatePage.getString("Document.link"),
- templatePage.getString("Document.link")) {
- @Override
- public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
- Document document = model.getObject();
- WebResponse response = (WebResponse) templatePage.getResponse();
- response.setContentType(document.getFileMimetype());
- response.setAttachmentHeader(document.getFileName());
- response.write(document.getFileContent());
- }
- });
-
- final DataTable<Document, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>(
- "ListDocumentsPage.AttachedDocuments", columns, attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
-
- columns.add(new AjaxButtonPropertyColumn<Document, String>(
- new Model<String>(templatePage.getString("Actions")), new Model<String>(templatePage
- .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);
- templatePage.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, documentAttachable, 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, documentAttachable, false));
- }
- }.setVisibilityAllowed(true));
- }
-
- /**
- * Init attached document table for current entity.
- *
- * @param templatePage parent page
- * @param documentAttachable entity to get documents
- * @param currentPage current page
- */
- public static void initAttachedDocumentsReadTable(final TemplatePage templatePage,
- final DocumentAttachable documentAttachable, final CallerPage currentPage) {
-
- List<Document> documents = documentAttachable.getDocuments();
-
- SimpleSortableListDataProvider<Document> attachedDocumentsDataProvider = new SimpleSortableListDataProvider<Document>(
- documents, templatePage.getSession().getLocale());
-
- List<IColumn<Document, String>> columns = new ArrayList<IColumn<Document, String>>();
-
- columns.add(new LinkPropertyColumn<Document, String>(
- new Model<String>(templatePage.getString("Document.titre")), "titre", "titre") {
- @Override
- public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
- templatePage.setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
- }
- });
-
- columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage
- .getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
-
- columns.add(new PropertyColumn<Document, String>(
- new Model<String>(templatePage.getString("Document.createur")), "createur", "createur"));
-
- columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(templatePage
- .getString("Document.link")), "images/download.png", templatePage.getString("Document.link"),
- templatePage.getString("Document.link")) {
- @Override
- public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
-
- Document document = model.getObject();
- WebResponse response = (WebResponse) templatePage.getResponse();
- response.setContentType(document.getFileMimetype());
- response.setAttachmentHeader(document.getFileName());
-
- OutputStream out = templatePage.getResponse().getOutputStream();
- InputStream in = new ByteArrayInputStream(document.getFileContent());
- try {
- IOUtils.copy(in, out);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- });
-
- final DataTable<Document, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>(
- "ListDocumentsPage.AttachedDocuments", columns, attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
- templatePage.add(attachedDocumentTable);
- }
-}
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn$ImagePanel.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn$ImagePanel.html (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn$ImagePanel.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -0,0 +1,30 @@
+<!--
+ #%L
+ Cantharella :: Web
+ $Id: SimpleTooltipPanel.html 133 2013-02-19 11:02:25Z echatellier $
+ $HeadURL: http://svn.forge.codelutin.com/svn/cantharella/trunk/cantharella.web/src/ma… $
+ %%
+ 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>
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:panel>
+ <img wicket:id="image" alt="f" />
+</wicket:panel>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -29,9 +29,11 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.Component;
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.WebComponent;
+import org.apache.wicket.markup.html.image.ContextImage;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
@@ -58,6 +60,12 @@
/** {@inheritDoc} */
@Override
+ public Component getHeader(final String componentId) {
+ return new ImagePanel(componentId, Model.of("images/open_folder_yellow.png"));
+ }
+
+ /** {@inheritDoc} */
+ @Override
public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
List<Document> documents = model.getObject().getDocuments();
@@ -107,4 +115,23 @@
link.add(img);
}
}
+
+ /**
+ * Use panel to be able to add an image into wicket <span wicket:id="label">
+ * datatable column header.
+ */
+ public class ImagePanel extends Panel {
+
+ /**
+ * Constructor
+ * @param componentId component id
+ * @param imageSrc image src
+ */
+ public ImagePanel(String componentId, final Model<String> imageSrc) {
+ super(componentId);
+
+ ContextImage image = new ContextImage("image", imageSrc);
+ add(image);
+ }
+ }
}
\ No newline at end of file
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ManageListDocumentsPanel.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ManageListDocumentsPanel.html (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ManageListDocumentsPanel.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -0,0 +1,40 @@
+<!--
+ #%L
+ Cantharella :: Web
+ $Id: ManagePersonnePanel.html 133 2013-02-19 11:02:25Z echatellier $
+ $HeadURL: http://svn.forge.codelutin.com/svn/cantharella/trunk/cantharella.web/src/ma… $
+ %%
+ 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>
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:panel>
+
+ <form wicket:id="form">
+ <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>
+ </form>
+
+</wicket:panel>
+</body>
+</html>
\ No newline at end of file
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ManageListDocumentsPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ManageListDocumentsPanel.java (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ManageListDocumentsPanel.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -0,0 +1,148 @@
+/*
+ * #%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.panel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import nc.ird.cantharella.data.model.Document;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
+import nc.ird.cantharella.web.config.WebContext;
+import nc.ird.cantharella.web.pages.domain.document.ManageDocumentPage;
+import nc.ird.cantharella.web.pages.domain.document.ReadDocumentPage;
+import nc.ird.cantharella.web.utils.CallerPage;
+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.models.SimpleSortableListDataProvider;
+
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+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.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.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;
+import org.apache.wicket.request.http.WebResponse;
+
+/**
+ * Display document list in manage mode.
+ *
+ * @author Eric Chatellier
+ */
+public final class ManageListDocumentsPanel extends Panel {
+
+ /**
+ * Constructeur.
+ * @param id ID
+ * @param documentAttachable entity where documents are attached to
+ * @param currentPage currentPage
+ */
+ public ManageListDocumentsPanel(String id, final DocumentAttachable documentAttachable, final CallerPage currentPage) {
+ super(id);
+
+ List<Document> documents = documentAttachable.getDocuments();
+
+ Form<Void> formView = new Form<Void>("form");
+ add(formView);
+
+ // 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, String>> columns = new ArrayList<IColumn<Document, String>>();
+
+ 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) {
+ setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
+ }
+ });
+
+ columns.add(new PropertyColumn<Document, String>(new Model<String>(getString("Document.typeDocument")),
+ "typeDocument.nom", "typeDocument.nom"));
+
+ columns.add(new PropertyColumn<Document, String>(
+ new Model<String>(getString("Document.createur")), "createur", "createur"));
+
+ 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) {
+ Document document = model.getObject();
+ WebResponse response = (WebResponse) getResponse();
+ response.setContentType(document.getFileMimetype());
+ response.setAttachmentHeader(document.getFileName());
+ response.write(document.getFileContent());
+ }
+ });
+
+ final DataTable<Document, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>(
+ "ListDocumentsPage.AttachedDocuments", columns, attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
+
+ 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) {
+ Document document = model.getObject();
+ documentAttachable.removeDocument(document);
+
+ if (target != null) {
+ target.add(attachedDocumentTable);
+ }
+ }
+ });
+
+ 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, documentAttachable, 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, documentAttachable, false));
+ }
+ }.setVisibilityAllowed(true));
+ }
+}
Property changes on: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ManageListDocumentsPanel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ReadListDocumentsPanel.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ReadListDocumentsPanel.html (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ReadListDocumentsPanel.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -0,0 +1,33 @@
+<!--
+ #%L
+ Cantharella :: Web
+ $Id: ReadPersonnePanel.html 133 2013-02-19 11:02:25Z echatellier $
+ $HeadURL: http://svn.forge.codelutin.com/svn/cantharella/trunk/cantharella.web/src/ma… $
+ %%
+ 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>
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+ <wicket:panel>
+ <fieldset>
+ <legend><wicket:message key="ListDocumentsPage.AttachedDocuments" /></legend>
+ <table cellspacing="0" wicket:id="ListDocumentsPage.AttachedDocuments"/>
+ </fieldset>
+ </wicket:panel>
+</body>
+</html>
\ No newline at end of file
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ReadListDocumentsPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ReadListDocumentsPanel.java (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ReadListDocumentsPanel.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -0,0 +1,101 @@
+/*
+ * #%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.panel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import nc.ird.cantharella.data.model.Document;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
+import nc.ird.cantharella.web.config.WebContext;
+import nc.ird.cantharella.web.pages.domain.document.ReadDocumentPage;
+import nc.ird.cantharella.web.utils.CallerPage;
+import nc.ird.cantharella.web.utils.columns.LinkPropertyColumn;
+import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn;
+import nc.ird.cantharella.web.utils.models.SimpleSortableListDataProvider;
+
+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.panel.Panel;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.request.http.WebResponse;
+
+/**
+ * Display document list in manage mode.
+ * @author Eric Chatellier
+ */
+public final class ReadListDocumentsPanel extends Panel {
+
+ /**
+ * Constructeur
+ * @param id ID
+ * @param documentAttachable document attachable
+ * @param currentPage current page
+ */
+ public ReadListDocumentsPanel(String id, final DocumentAttachable documentAttachable, final CallerPage currentPage) {
+ super(id);
+ List<Document> documents = documentAttachable.getDocuments();
+
+ SimpleSortableListDataProvider<Document> attachedDocumentsDataProvider = new SimpleSortableListDataProvider<Document>(
+ documents, getSession().getLocale());
+
+ List<IColumn<Document, String>> columns = new ArrayList<IColumn<Document, String>>();
+
+ 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) {
+ setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
+ }
+ });
+
+ columns.add(new PropertyColumn<Document, String>(new Model<String>(getString("Document.typeDocument")),
+ "typeDocument.nom", "typeDocument.nom"));
+
+ columns.add(new PropertyColumn<Document, String>(
+ new Model<String>(getString("Document.createur")), "createur", "createur"));
+
+ 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) {
+
+ Document document = model.getObject();
+ WebResponse response = (WebResponse) getResponse();
+ response.setContentType(document.getFileMimetype());
+ response.setAttachmentHeader(document.getFileName());
+ response.write(document.getFileContent());
+ }
+ });
+
+ final DataTable<Document, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>(
+ "ListDocumentsPage.AttachedDocuments", columns, attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
+ add(attachedDocumentTable);
+ }
+}
Property changes on: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/ReadListDocumentsPanel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ListExtractionsPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -30,6 +30,7 @@
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.campagne.ReadCampagnePage;
+import nc.ird.cantharella.web.pages.domain.document.DocumentTooltipColumn;
import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.columns.DecimalPropertyColumn;
@@ -164,6 +165,14 @@
columns.add(new ExtraitsColumn(new Model<String>(templatePage.getString("Extraction.extraits")), templatePage
.getLocale()));
+ columns.add(new DocumentTooltipColumn<Extraction, String>(Model.of("")) {
+ @Override
+ public void onClick(IModel<Extraction> model) {
+ int idExtraction = model.getObject().getIdExtraction();
+ templatePage.setResponsePage(new ReadExtractionPage(idExtraction, callerPage));
+ }
+ });
+
columns.add(new LinkableImagePropertyColumn<Extraction, String>("images/edit.png", templatePage
.getString("Update"), templatePage.getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -134,6 +134,8 @@
</table>
</fieldset>
+ <wicket:panel wicket:id="ManageListDocumentsPanel" />
+
<div class="actions">
<input type="submit" wicket:message="value:Submit" wicket:id="Create" />
<input type="submit" wicket:message="value:Submit" wicket:id="Update" />
@@ -142,8 +144,6 @@
</div>
</form>
-
-
</wicket:extend>
</body>
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ManageExtractionPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -45,6 +45,7 @@
import nc.ird.cantharella.service.utils.normalizers.UniqueFieldNormalizer;
import nc.ird.cantharella.service.utils.normalizers.utils.Normalizer;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ManageListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.lot.ManageLotPage;
import nc.ird.cantharella.web.pages.domain.personne.ManagePersonnePage;
import nc.ird.cantharella.web.pages.renderers.PersonneRenderer;
@@ -223,6 +224,7 @@
super(ManageExtractionPage.class);
assert idManip == null || manip == null;
this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage(this);
this.multipleEntry = multipleEntry;
extraitsDeleted = new HashMap<String, Integer>();
@@ -270,6 +272,11 @@
initExtraitsFields(formView);
+ // add list document panel
+ ManageListDocumentsPanel manageListDocumentsPanel = new ManageListDocumentsPanel("ManageListDocumentsPanel",
+ extractionModel.getObject(), currentPage);
+ formView.add(manageListDocumentsPanel);
+
// Action : create the extraction
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -114,7 +114,9 @@
</div>
</fieldset>
-
+
+ <wicket:panel wicket:id="ReadListDocumentsPanel" />
+
<form wicket:id="Form">
<div class="actions">
<a class="edit" wicket:id="ReadExtractionPage.Extraction.Update" wicket:message="title:Update">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ReadExtractionPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -33,6 +33,7 @@
import nc.ird.cantharella.data.model.Personne;
import nc.ird.cantharella.service.services.ExtractionService;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ReadListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
import nc.ird.cantharella.web.utils.CallerPage;
@@ -184,6 +185,11 @@
}
});
+ // add list document panel
+ ReadListDocumentsPanel readListDocumentsPanel = new ReadListDocumentsPanel("ReadListDocumentsPanel",
+ extractionModel.getObject(), currentPage);
+ add(readListDocumentsPanel);
+
// Formulaire des actions
final Form<Void> formView = new Form<Void>("Form");
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ListLotsPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -31,6 +31,7 @@
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.columns.TaxonomyPropertyColumn;
import nc.ird.cantharella.web.pages.domain.campagne.ReadCampagnePage;
+import nc.ird.cantharella.web.pages.domain.document.DocumentTooltipColumn;
import nc.ird.cantharella.web.pages.domain.specimen.ReadSpecimenPage;
import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
import nc.ird.cantharella.web.utils.CallerPage;
@@ -195,6 +196,14 @@
.getString("Campagne.codePays")), "campagne.codePays", "campagne.codePays", WebContext.COUNTRIES
.get(templatePage.getSession().getLocale())));
+ columns.add(new DocumentTooltipColumn<Lot, String>(Model.of("")) {
+ @Override
+ public void onClick(IModel<Lot> model) {
+ int idLot = model.getObject().getIdLot();
+ templatePage.setResponsePage(new ReadLotPage(idLot, callerPage));
+ }
+ });
+
columns.add(new LinkableImagePropertyColumn<Lot, String>("images/edit.png", templatePage.getString("Update"),
templatePage.getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -93,7 +93,9 @@
<label for="Lot.createur"><wicket:message key="Lot.createur" /></label>
<input type="text" id="Lot.createur" wicket:id="Lot.createur" disabled="disabled"/>
</div>
-
+
+ <wicket:panel wicket:id="ManageListDocumentsPanel" />
+
<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/lot/ManageLotPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ManageLotPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -41,6 +41,7 @@
import nc.ird.cantharella.service.services.SpecimenService;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.campagne.ManageCampagnePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ManageListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.specimen.ManageSpecimenPage;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
@@ -291,6 +292,11 @@
formView.add(new TextField<String>("Lot.createur", new PropertyModel<String>(lotModel, "createur"))
.setEnabled(false));
+ // add list document panel
+ ManageListDocumentsPanel manageListDocumentsPanel = new ManageListDocumentsPanel("ManageListDocumentsPanel",
+ lotModel.getObject(), currentPage);
+ formView.add(manageListDocumentsPanel);
+
// Action : création du lot
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -89,7 +89,9 @@
<span class="label"><wicket:message key="Lot.createur" /></span>
<span class="value" wicket:id="Lot.createur"></span>
</div>
-
+
+ <wicket:panel wicket:id="ReadListDocumentsPanel" />
+
<form wicket:id="Form">
<div class="actions">
<a class="edit" wicket:id="ReadLotPage.Lot.Update" wicket:message="title:Update">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/lot/ReadLotPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -31,6 +31,7 @@
import nc.ird.cantharella.service.services.LotService;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.campagne.ReadCampagnePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ReadListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
import nc.ird.cantharella.web.pages.domain.specimen.ReadSpecimenPage;
import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
@@ -139,6 +140,11 @@
}
});
+ // add list document panel
+ ReadListDocumentsPanel readListDocumentsPanel = new ReadListDocumentsPanel("ReadListDocumentsPanel",
+ lotModel.getObject(), currentPage);
+ add(readListDocumentsPanel);
+
// Formulaire des actions
final Form<Void> formView = new Form<Void>("Form");
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -179,13 +179,7 @@
</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>
+ <wicket:panel wicket:id="ManageListDocumentsPanel" />
<div class="actions">
<input type="submit" wicket:message="value:Submit" wicket:id="Create" />
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -42,7 +42,7 @@
import nc.ird.cantharella.service.services.ProduitService;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.campagne.ManageCampagnePage;
-import nc.ird.cantharella.web.pages.domain.document.DocumentPageHelper;
+import nc.ird.cantharella.web.pages.domain.document.panel.ManageListDocumentsPanel;
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;
@@ -182,7 +182,6 @@
final Form<Void> formView = new Form<Void>("Form");
initProvenanceFields(formView, currentPage);
- DocumentPageHelper.initAttachedDocumentsManageTable(this, formView, moleculeModel.getObject(), currentPage);
// page can be accessed by anyone for editing provenance
// but molecule fields can be edited only by administrators or
@@ -276,7 +275,12 @@
formView.add(new TextField<String>("Molecule.createur", new PropertyModel<String>(moleculeModel, "createur"))
.setEnabled(false));
- // Action : création du lot
+ // add list document panel
+ ManageListDocumentsPanel manageListDocumentsPanel = new ManageListDocumentsPanel("ManageListDocumentsPanel",
+ moleculeModel.getObject(), currentPage);
+ formView.add(manageListDocumentsPanel);
+
+ // Action : create molecule
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
public void onProcess() throws DataConstraintException {
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -152,10 +152,7 @@
</div>
</fieldset>
- <fieldset>
- <legend><wicket:message key="ListDocumentsPage.AttachedDocuments" /></legend>
- <table cellspacing="0" wicket:id="ListDocumentsPage.AttachedDocuments"/>
- </fieldset>
+ <wicket:panel wicket:id="ReadListDocumentsPanel" />
<form wicket:id="Form">
<div class="actions">
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -35,7 +35,7 @@
import nc.ird.cantharella.data.model.Produit;
import nc.ird.cantharella.service.services.MoleculeService;
import nc.ird.cantharella.web.pages.TemplatePage;
-import nc.ird.cantharella.web.pages.domain.document.DocumentPageHelper;
+import nc.ird.cantharella.web.pages.domain.document.panel.ReadListDocumentsPanel;
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;
@@ -108,7 +108,6 @@
moleculeModel = new GenericLoadableDetachableModel<Molecule>(Molecule.class, idMolecule);
initProvenanceFields(currentPage);
- DocumentPageHelper.initAttachedDocumentsReadTable(this, moleculeModel.getObject(), currentPage);
add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")));
add(new Label("Molecule.nomCommun", new PropertyModel<String>(moleculeModel, "nomCommun"))
@@ -151,6 +150,11 @@
}
});
+ // add list document panel
+ ReadListDocumentsPanel readListDocumentsPanel = new ReadListDocumentsPanel("ReadListDocumentsPanel",
+ moleculeModel.getObject(), currentPage);
+ add(readListDocumentsPanel);
+
// Formulaire des actions
final Form<Void> formView = new Form<Void>("Form");
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ListPersonnesPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -31,6 +31,7 @@
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.document.DocumentTooltipColumn;
import nc.ird.cantharella.web.pages.domain.utilisateur.ManageUtilisateurPage;
import nc.ird.cantharella.web.pages.domain.utilisateur.ReadUtilisateurPage;
import nc.ird.cantharella.web.pages.domain.utilisateur.UpdateUtilisateurPage;
@@ -151,6 +152,14 @@
}
});
+ columns.add(new DocumentTooltipColumn<Personne, String>(Model.of("")) {
+ @Override
+ public void onClick(IModel<Personne> model) {
+ int idPersonne = model.getObject().getIdPersonne();
+ setResponsePage(new ReadPersonnePage(idPersonne, currentPage));
+ }
+ });
+
columns.add(new LinkableImagePropertyColumn<Personne, String>("images/edit.png", getString("Update"),
getString("Update")) {
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -28,7 +28,9 @@
<form wicket:id="Form">
<wicket:panel wicket:id="ManagePersonnePanel" />
-
+
+ <wicket:panel wicket:id="ManageListDocumentsPanel" />
+
<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/personne/ManagePersonnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ManagePersonnePage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -30,6 +30,7 @@
import nc.ird.cantharella.service.exceptions.EmailException;
import nc.ird.cantharella.service.services.PersonneService;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ManageListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.panels.ManagePersonnePanel;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
@@ -123,6 +124,7 @@
super(ManagePersonnePage.class);
assert idPersonne == null || personne == null;
this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage(this);
this.multipleEntry = multipleEntry;
// Initialisation du modèle
@@ -140,6 +142,11 @@
final ManagePersonnePanel personnePanel = new ManagePersonnePanel("ManagePersonnePanel", personneModel);
formView.add(personnePanel);
+ // add list document panel
+ ManageListDocumentsPanel manageListDocumentsPanel = new ManageListDocumentsPanel("ManageListDocumentsPanel",
+ personneModel.getObject(), currentPage);
+ formView.add(manageListDocumentsPanel);
+
// Action : création de la personne
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -28,7 +28,9 @@
<div id="sheet">
<wicket:panel wicket:id="ReadPersonnePanel" />
-
+
+ <wicket:panel wicket:id="ReadListDocumentsPanel" />
+
<form wicket:id="Form">
<div class="actions">
<a class="edit" wicket:id="ReadPersonnePage.Personne.Update" wicket:message="title:Update">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/personne/ReadPersonnePage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -26,6 +26,7 @@
import nc.ird.cantharella.data.model.Personne;
import nc.ird.cantharella.service.services.PersonneService;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ReadListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.panels.ReadPersonnePanel;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
@@ -84,6 +85,11 @@
final ReadPersonnePanel personnePanel = new ReadPersonnePanel("ReadPersonnePanel", personneModel);
add(personnePanel);
+ // add list document panel
+ ReadListDocumentsPanel readListDocumentsPanel = new ReadListDocumentsPanel("ReadListDocumentsPanel",
+ personneModel.getObject(), currentPage);
+ add(readListDocumentsPanel);
+
// Action : mise à jour (redirection vers le formulaire)
Link<Personne> updateLink = new Link<Personne>(getResource() + ".Personne.Update",
new Model<Personne>(personne)) {
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ListPurificationsPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -33,6 +33,7 @@
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.columns.LinkProduitPropertyColumn;
import nc.ird.cantharella.web.pages.domain.campagne.ReadCampagnePage;
+import nc.ird.cantharella.web.pages.domain.document.DocumentTooltipColumn;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
import nc.ird.cantharella.web.utils.CallerPage;
@@ -176,6 +177,14 @@
}
});
+ columns.add(new DocumentTooltipColumn<Purification, String>(Model.of("")) {
+ @Override
+ public void onClick(IModel<Purification> model) {
+ int idPurification = model.getObject().getIdPurification();
+ templatePage.setResponsePage(new ReadPurificationPage(idPurification, callerPage));
+ }
+ });
+
columns.add(new LinkableImagePropertyColumn<Purification, String>("images/edit.png", templatePage
.getString("Update"), templatePage.getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -142,6 +142,8 @@
</table>
</fieldset>
+ <wicket:panel wicket:id="ManageListDocumentsPanel" />
+
<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/purification/ManagePurificationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ManagePurificationPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -43,6 +43,7 @@
import nc.ird.cantharella.service.utils.normalizers.UniqueFieldNormalizer;
import nc.ird.cantharella.service.utils.normalizers.utils.Normalizer;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ManageListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.ManagePersonnePage;
import nc.ird.cantharella.web.pages.renderers.PersonneRenderer;
import nc.ird.cantharella.web.utils.CallerPage;
@@ -203,6 +204,7 @@
super(ManagePurificationPage.class);
assert idManip == null || manip == null;
this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage(this);
this.multipleEntry = multipleEntry;
fractionsDeleted = new HashMap<String, Integer>();
@@ -244,6 +246,11 @@
initMethodeFields(formView);
initFractionsFields(formView);
+ // add list document panel
+ ManageListDocumentsPanel manageListDocumentsPanel = new ManageListDocumentsPanel("ManageListDocumentsPanel",
+ purificationModel.getObject(), currentPage);
+ formView.add(manageListDocumentsPanel);
+
// Action : create the purification
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -122,7 +122,9 @@
<span class="value"><wicket:message key="List.none" /></span>
</div>
</fieldset>
-
+
+ <wicket:panel wicket:id="ReadListDocumentsPanel" />
+
<form wicket:id="Form">
<div class="actions">
<a class="edit" wicket:id="ReadPurificationPage.Purification.Update" wicket:message="title:Update">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/purification/ReadPurificationPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -36,6 +36,7 @@
import nc.ird.cantharella.data.model.Purification;
import nc.ird.cantharella.service.services.PurificationService;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ReadListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
import nc.ird.cantharella.web.utils.CallerPage;
@@ -233,6 +234,11 @@
}
});
+ // add list document panel
+ ReadListDocumentsPanel readListDocumentsPanel = new ReadListDocumentsPanel("ReadListDocumentsPanel",
+ purificationModel.getObject(), currentPage);
+ add(readListDocumentsPanel);
+
// Formulaire des actions
final Form<Void> formView = new Form<Void>("Form");
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ListSpecimensPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -30,6 +30,7 @@
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.columns.TaxonomyPropertyColumn;
+import nc.ird.cantharella.web.pages.domain.document.DocumentTooltipColumn;
import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.columns.EnumPropertyColumn;
@@ -155,6 +156,14 @@
}
});
+ columns.add(new DocumentTooltipColumn<Specimen, String>(Model.of("")) {
+ @Override
+ public void onClick(IModel<Specimen> model) {
+ int idSpecimen = model.getObject().getIdSpecimen();
+ templatePage.setResponsePage(new ReadSpecimenPage(idSpecimen, callerPage));
+ }
+ });
+
columns.add(new LinkableImagePropertyColumn<Specimen, String>("images/edit.png", templatePage
.getString("Update"), templatePage.getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -105,7 +105,8 @@
</div>
</fieldset>
-
+ <wicket:panel wicket:id="ManageListDocumentsPanel" />
+
<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/specimen/ManageSpecimenPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ManageSpecimenPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -38,6 +38,7 @@
import nc.ird.cantharella.service.services.SpecimenService;
import nc.ird.cantharella.service.services.StationService;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ManageListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.ManagePersonnePage;
import nc.ird.cantharella.web.pages.domain.station.ManageStationPage;
import nc.ird.cantharella.web.pages.renderers.PersonneRenderer;
@@ -279,6 +280,11 @@
formView.add(new AutoCompleteTextFieldString("Specimen.lieuDepot", new PropertyModel<String>(specimenModel,
"lieuDepot"), lieuxDepot, ComparisonMode.CONTAINS));
+ // add list document panel
+ ManageListDocumentsPanel manageListDocumentsPanel = new ManageListDocumentsPanel("ManageListDocumentsPanel",
+ specimenModel.getObject(), currentPage);
+ formView.add(manageListDocumentsPanel);
+
// Action : création du specimen
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -101,7 +101,9 @@
<span class="value" wicket:id="Specimen.lieuDepot" ></span>
</div>
</fieldset>
-
+
+ <wicket:panel wicket:id="ReadListDocumentsPanel" />
+
<form wicket:id="Form">
<div class="actions">
<a class="edit" wicket:id="ReadSpecimenPage.Specimen.Update" wicket:message="title:Update">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/specimen/ReadSpecimenPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -30,6 +30,7 @@
import nc.ird.cantharella.data.model.Station;
import nc.ird.cantharella.service.services.SpecimenService;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ReadListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
import nc.ird.cantharella.web.pages.domain.station.ReadStationPage;
import nc.ird.cantharella.web.utils.CallerPage;
@@ -143,6 +144,11 @@
add(new Label("Specimen.lieuDepot", new PropertyModel<String>(specimenModel, "lieuDepot"))
.add(new ReplaceEmptyLabelBehavior()));
+ // add list document panel
+ ReadListDocumentsPanel readListDocumentsPanel = new ReadListDocumentsPanel("ReadListDocumentsPanel",
+ specimenModel.getObject(), currentPage);
+ add(readListDocumentsPanel);
+
final Form<Void> formView = new Form<Void>("Form");
// Action : mise à jour
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ListStationsPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -29,6 +29,7 @@
import nc.ird.cantharella.service.services.StationService;
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.DocumentTooltipColumn;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.columns.LinkPropertyColumn;
import nc.ird.cantharella.web.utils.columns.LinkableImagePropertyColumn;
@@ -145,6 +146,14 @@
columns.add(new PropertyColumn<Station, String>(new Model<String>(templatePage.getString("Station.longitude")),
"longitude", "longitude"));
+ columns.add(new DocumentTooltipColumn<Station, String>(Model.of("")) {
+ @Override
+ public void onClick(IModel<Station> model) {
+ int idStation = model.getObject().getIdStation();
+ templatePage.setResponsePage(new ReadStationPage(idStation, callerPage));
+ }
+ });
+
columns.add(new LinkableImagePropertyColumn<Station, String>("images/edit.png", templatePage
.getString("Update"), templatePage.getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -75,7 +75,9 @@
<select id="Station.referentiel" wicket:id="Station.referentiel" />
</div>
</fieldset>
-
+
+ <wicket:panel wicket:id="ManageListDocumentsPanel" />
+
<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/station/ManageStationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ManageStationPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -35,6 +35,7 @@
import nc.ird.cantharella.service.services.StationService;
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ManageListDocumentsPanel;
import nc.ird.cantharella.web.pages.model.ManageStationModel;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
@@ -142,6 +143,7 @@
super(ManageStationPage.class);
assert idStation == null || station == null;
this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage(this);
this.multipleEntry = multipleEntry;
// Initialisation du modèle
@@ -224,6 +226,11 @@
"referentiel"), WebContext.REFERENTIEL_CODES, new MapChoiceRenderer<Integer, String>(
DataContext.REFERENTIELS)));
+ // add list document panel
+ ManageListDocumentsPanel manageListDocumentsPanel = new ManageListDocumentsPanel("ManageListDocumentsPanel",
+ stationModel.getObject(), currentPage);
+ formView.add(manageListDocumentsPanel);
+
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
public void onProcess() throws DataConstraintException {
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -65,6 +65,9 @@
<span class="value" wicket:id="Station.referentiel" ></span>
</div>
</fieldset>
+
+ <wicket:panel wicket:id="ReadListDocumentsPanel" />
+
<form wicket:id="Form">
<div class="actions">
<a class="edit" wicket:id="ReadStationPage.Station.Update" wicket:message="title:Update">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/station/ReadStationPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -29,6 +29,7 @@
import nc.ird.cantharella.service.services.StationService;
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ReadListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.behaviors.JSConfirmationBehavior;
@@ -108,6 +109,11 @@
add(new Label("Station.referentiel", new DisplayMapValuePropertyModel<Integer>(stationModel, "referentiel",
DataContext.REFERENTIELS)).add(new ReplaceEmptyLabelBehavior()));
+ // add list document panel
+ ReadListDocumentsPanel readListDocumentsPanel = new ReadListDocumentsPanel("ReadListDocumentsPanel",
+ stationModel.getObject(), currentPage);
+ add(readListDocumentsPanel);
+
// Ajout du formulaire pour les actions
Form<Void> formView = new Form<Void>("Form");
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-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ListTestsBioPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -33,6 +33,7 @@
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.columns.LinkProduitPropertyColumn;
import nc.ird.cantharella.web.pages.columns.TaxonomyPropertyColumn;
+import nc.ird.cantharella.web.pages.domain.document.DocumentTooltipColumn;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
import nc.ird.cantharella.web.utils.CallerPage;
@@ -198,6 +199,14 @@
}
});
+ columns.add(new DocumentTooltipColumn<ResultatTestBio, String>(Model.of("")) {
+ @Override
+ public void onClick(IModel<ResultatTestBio> model) {
+ int idTestBio = model.getObject().getTestBio().getIdTestBio();
+ templatePage.setResponsePage(new ReadTestBioPage(idTestBio, callerPage));
+ }
+ });
+
columns.add(new LinkableImagePropertyColumn<ResultatTestBio, String>("images/edit.png", templatePage
.getString("Update"), templatePage.getString("Update")) {
// pas de lien d'édition si l'utilisateur n'a pas les droits
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -208,6 +208,8 @@
</table>
</fieldset>
+ <wicket:panel wicket:id="ManageListDocumentsPanel" />
+
<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/testBio/ManageTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ManageTestBioPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -49,6 +49,7 @@
import nc.ird.cantharella.service.utils.normalizers.UniqueFieldNormalizer;
import nc.ird.cantharella.service.utils.normalizers.utils.Normalizer;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ManageListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.personne.ManagePersonnePage;
import nc.ird.cantharella.web.pages.renderers.PersonneRenderer;
import nc.ird.cantharella.web.utils.CallerPage;
@@ -228,6 +229,7 @@
super(ManageTestBioPage.class);
assert idManip == null || manip == null;
this.callerPage = callerPage;
+ final CallerPage currentPage = new CallerPage(this);
this.multipleEntry = multipleEntry;
newResultatModel = new Model<ResultatTestBio>(new ResultatTestBio());
@@ -275,6 +277,11 @@
initMethodeFields(formView);
initResultatsFields(formView);
+ // add list document panel
+ ManageListDocumentsPanel manageListDocumentsPanel = new ManageListDocumentsPanel("ManageListDocumentsPanel",
+ testBioModel.getObject(), currentPage);
+ formView.add(manageListDocumentsPanel);
+
// Action : create the testBio
Button createButton = new SubmittableButton(ACTION_CREATE, new SubmittableButtonEvents() {
@Override
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.html 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.html 2013-02-21 17:16:19 UTC (rev 149)
@@ -170,6 +170,8 @@
</fieldset>
+ <wicket:panel wicket:id="ReadListDocumentsPanel" />
+
<form wicket:id="Form">
<div class="actions">
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java 2013-02-21 14:47:28 UTC (rev 148)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/testBio/ReadTestBioPage.java 2013-02-21 17:16:19 UTC (rev 149)
@@ -36,6 +36,7 @@
import nc.ird.cantharella.data.model.TestBio;
import nc.ird.cantharella.service.services.TestBioService;
import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.pages.domain.document.panel.ReadListDocumentsPanel;
import nc.ird.cantharella.web.pages.domain.extraction.ReadExtractionPage;
import nc.ird.cantharella.web.pages.domain.personne.ReadPersonnePage;
import nc.ird.cantharella.web.pages.domain.purification.ReadPurificationPage;
@@ -117,6 +118,11 @@
initTestMethodFields(idTestBio);
initResultsFields(idTestBio, currentPage);
+ // add list document panel
+ ReadListDocumentsPanel readListDocumentsPanel = new ReadListDocumentsPanel("ReadListDocumentsPanel",
+ testBioModel.getObject(), currentPage);
+ add(readListDocumentsPanel);
+
// Ajout du formulaire pour les actions
Form<Void> formView = new Form<Void>("Form");
Added: trunk/cantharella.web/src/main/webapp/images/open_folder_yellow.png
===================================================================
(Binary files differ)
Property changes on: trunk/cantharella.web/src/main/webapp/images/open_folder_yellow.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
1
0
21 Feb '13
Author: echatellier
Date: 2013-02-21 15:47:28 +0100 (Thu, 21 Feb 2013)
New Revision: 148
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/148
Log:
Fix all project javadoc and some warnings
Removed:
trunk/cantharella.utils/src/main/java/nc/ird/cantharella/utils/BeanLookup.java
trunk/cantharella.utils/src/test/java/nc/ird/cantharella/utils/BeanLookupTest.java
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/HibernateTemplateDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/ProduitBridge.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/UtilisateurSearchFilter.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java
trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/SchemaExporter.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/MoleculeProvenanceBean.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/SearchResult.java
trunk/cantharella.utils/src/test/java/nc/ird/cantharella/utils/BeanToolsTest.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/config/panels/RebuildLuceneIndexPanel.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.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/extraction/ExtraitsColumn.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/data/TableExportToolbar.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/security/AuthSession.java
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/ValidationIntegrator.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -48,6 +48,7 @@
/** Logger */
private static final Logger LOG = LoggerFactory.getLogger(ValidationIntegrator.class);
+ /** {@inheritDoc} */
@Override
public void integrate(Configuration configuration, SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
@@ -65,12 +66,14 @@
eventRegistry.prependListeners(EventType.PRE_UPDATE, validationListener);
}
+ /** {@inheritDoc} */
@Override
public void integrate(MetadataImplementor metadata, SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
integrate((Configuration) null, sessionFactory, serviceRegistry);
}
+ /** {@inheritDoc} */
@Override
public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/HibernateTemplateDao.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/HibernateTemplateDao.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/HibernateTemplateDao.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -53,6 +53,9 @@
@Resource
private SessionFactory sessionFactory;
+ /**
+ * Empty constructor.
+ */
public HibernateTemplateDao() {
}
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-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/dao/impl/ProduitDao.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -62,8 +62,9 @@
}
/**
- * Rend le criteria qui rend le nombre de molécule qui référencent un produit
- * @param produit Le produit
+ * Rend le criteria qui rend le nombre de molécule qui référencent un produit.
+ *
+ * @param refProduit product reference
* @return Le criteria
**/
public static DetachedCriteria getCriteriaCountMoleculeFromProduit(String refProduit) {
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-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Document.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -112,106 +112,236 @@
@Length(max = LENGTH_MEDIUM_TEXT)
private String fileMimetype;
+ /**
+ * Document id getter.
+ *
+ * @return document id
+ */
public Integer getIdDocument() {
return idDocument;
}
+ /**
+ * Document id setter.
+ *
+ * @param idDocument document id
+ */
public void setIdDocument(Integer idDocument) {
this.idDocument = idDocument;
}
+ /**
+ * Titre getter.
+ *
+ * @return titre
+ */
public String getTitre() {
return titre;
}
+ /**
+ * Titre setter.
+ *
+ * @param titre titre
+ */
public void setTitre(String titre) {
this.titre = titre;
}
+ /**
+ * Createur getter.
+ *
+ * @return createur
+ */
public Personne getCreateur() {
return createur;
}
+ /**
+ * Createur setter.
+ *
+ * @param createur createur
+ */
public void setCreateur(Personne createur) {
this.createur = createur;
}
+ /**
+ * Date creation getter.
+ *
+ * @return date creation
+ */
public Date getDateCreation() {
return dateCreation;
}
+ /**
+ * Date creation setter.
+ *
+ * @param dateCreation date creation
+ */
public void setDateCreation(Date dateCreation) {
this.dateCreation = dateCreation;
}
+ /**
+ * Editeur getter.
+ *
+ * @return editeur
+ */
public String getEditeur() {
return editeur;
}
+ /**
+ * Editeur setter.
+ *
+ * @param editeur editeur
+ */
public void setEditeur(String editeur) {
this.editeur = editeur;
}
+ /**
+ * Description getter.
+ *
+ * @return description
+ */
public String getDescription() {
return description;
}
+ /**
+ * Description setter.
+ *
+ * @param description description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ * Langue getter.
+ *
+ * @return langue
+ */
public String getLangue() {
return langue;
}
+ /**
+ * Langue setter.
+ *
+ * @param langue langue
+ */
public void setLangue(String langue) {
this.langue = langue;
}
+ /**
+ * Contrainte legale getter.
+ *
+ * @return contrainte legale
+ */
public String getContrainteLegale() {
return contrainteLegale;
}
+ /**
+ * Contrainte legale setter.
+ *
+ * @param contrainteLegale containte legale
+ */
public void setContrainteLegale(String contrainteLegale) {
this.contrainteLegale = contrainteLegale;
}
+ /**
+ * Ajoute par setter.
+ *
+ * @return ajoute apr
+ */
public Personne getAjoutePar() {
return ajoutePar;
}
+ /**
+ * Ajoute par setter.
+ *
+ * @param ajoutePar
+ */
public void setAjoutePar(Personne ajoutePar) {
this.ajoutePar = ajoutePar;
}
+ /**
+ * Type document getter.
+ *
+ * @return type document
+ */
public TypeDocument getTypeDocument() {
return typeDocument;
}
+ /**
+ * Type document setter.
+ *
+ * @param typeDocument type document
+ */
public void setTypeDocument(TypeDocument typeDocument) {
this.typeDocument = typeDocument;
}
+ /**
+ * File name getter.
+ *
+ * @return file name
+ */
public String getFileName() {
return fileName;
}
+ /**
+ * File name setter.
+ *
+ * @param fileName file name
+ */
public void setFileName(String fileName) {
this.fileName = fileName;
}
+ /**
+ * File content getter.
+ *
+ * @return file content
+ */
public byte[] getFileContent() {
return fileContent;
}
+ /**
+ * File content setter.
+ *
+ * @param fileContent file content
+ */
public void setFileContent(byte[] fileContent) {
this.fileContent = fileContent;
}
+ /**
+ * File mime type getter.
+ *
+ * @return file mime type
+ */
public String getFileMimetype() {
return fileMimetype;
}
+ /**
+ * File mime type setter.
+ *
+ * @param fileMimetype file mime type
+ */
public void setFileMimetype(String fileMimetype) {
this.fileMimetype = fileMimetype;
}
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/FractionsOfPurificationComp.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -31,7 +31,6 @@
/**
* Fractions comparator. Compare on indice with intuitive sort.
- * @see nc.ird.module.utils.IntuitiveStringComparator
* @author Adrien Cheype
*/
public class FractionsOfPurificationComp implements Comparator<Fraction> {
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/comparators/ResultatsOfTestBioComp.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -31,7 +31,6 @@
/**
* ResultatTestBio comparator. Compare on repere with intuitive sort.
- * @see nc.ird.module.utils.IntuitiveStringComparator
* @author Adrien Cheype
*/
public class ResultatsOfTestBioComp implements Comparator<ResultatTestBio> {
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/ProduitBridge.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/ProduitBridge.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/ProduitBridge.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -47,6 +47,7 @@
/** Logger */
private static final Logger LOG = LoggerFactory.getLogger(ProduitBridge.class);
+ /** {@inheritDoc} */
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/UtilisateurSearchFilter.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/UtilisateurSearchFilter.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/search/UtilisateurSearchFilter.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -56,14 +56,29 @@
/** Utilisateur performing the query. */
protected Utilisateur utilisateur;
+ /**
+ * Utilisateur getter.
+ *
+ * @return utilisateur
+ */
public Utilisateur getUtilisateur() {
return utilisateur;
}
+ /**
+ * Utilisateur setter.
+ *
+ * @param utilisateur utilisateur
+ */
public void setUtilisateur(Utilisateur utilisateur) {
this.utilisateur = utilisateur;
}
+ /**
+ * Return filter parameters key.
+ *
+ * @return filter parameters
+ */
@Key
public FilterKey getKey() {
StandardFilterKey key = new StandardFilterKey();
@@ -71,6 +86,7 @@
return key;
}
+ /** {@inheritDoc} */
@Override
public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
OpenBitSet bitSet = new OpenBitSet(reader.maxDoc());
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -82,7 +82,6 @@
* @return @Id or @EmbeddedId field
* @throws UnexpectedException If it does not exist
*/
- @SuppressWarnings("unchecked")
public final static Field getIdField(final Class<? extends AbstractModel> clazz) {
AssertTools.assertNotNull(clazz);
Field field = null;
Modified: trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/SchemaExporter.java
===================================================================
--- trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/SchemaExporter.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.data/src/test/java/nc/ird/cantharella/data/SchemaExporter.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -33,8 +33,18 @@
import org.junit.Test;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
+/**
+ * Schema export test.
+ *
+ * @author Eric Chatellier
+ */
public class SchemaExporter {
+ /**
+ * Export schema creation script.
+ *
+ * @throws IOException
+ */
@Test
public void exportSchema() throws IOException {
LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();
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-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/MoleculeProvenanceBean.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -23,7 +23,6 @@
* #L%
*/
-import java.io.Serializable;
import java.util.List;
import nc.ird.cantharella.data.model.Document;
@@ -45,40 +44,65 @@
* Last update: $Date$
* by : $Author$
*/
-public class MoleculeProvenanceBean implements DocumentAttachable, Serializable {
- private static final long serialVersionUID = 1L;
+public class MoleculeProvenanceBean implements DocumentAttachable {
- /**
- * Molecule
- */
+ /** Molecule. */
protected Molecule molecule;
+ /** Provenance, this field can be null if provenance is not readable by user. */
+ protected MoleculeProvenance provenance;
+
/**
- * Provenance, this field can be null if provenance is not readable by user
+ * Constructor with molecule and null provenance.
+ *
+ * @param molecule molecule
*/
- protected MoleculeProvenance provenance;
-
public MoleculeProvenanceBean(Molecule molecule) {
this.molecule = molecule;
}
+ /**
+ * Constructor with provenance.
+ *
+ * @param provenance
+ */
public MoleculeProvenanceBean(MoleculeProvenance provenance) {
this(provenance.getMolecule());
this.provenance = provenance;
}
+ /**
+ * Molecule id getter.
+ *
+ * @return molecule id
+ */
public Integer getIdMolecule() {
return molecule.getIdMolecule();
}
+ /**
+ * Molecule getter.
+ *
+ * @return molecule
+ */
public Molecule getMolecule() {
return molecule;
}
+ /**
+ * Molecule provenance getter.
+ *
+ * @return molecule provenance (can be null)
+ */
public MoleculeProvenance getMoleculeProvenance() {
return provenance;
}
+ /**
+ * Lot getter.
+ *
+ * @return lot (can be null if provenance is null)
+ */
public Lot getLot() {
Lot result = null;
if (provenance != null) {
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/SearchResult.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/SearchResult.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/SearchResult.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -40,75 +40,149 @@
*/
public class SearchResult implements Serializable {
- /** serialVersionUID. */
- private static final long serialVersionUID = -283841649665446890L;
-
+ /** Search result specimens. */
protected List<Specimen> specimens;
+ /** Search result lots. */
protected List<Lot> lots;
+ /** Search result extractions. */
protected List<Extraction> extractions;
+ /** Search result purification. */
protected List<Purification> purifications;
+ /** Search result resultatTestBios. */
protected List<ResultatTestBio> resultatTestBios;
+ /** Search result stations. */
protected List<Station> stations;
+ /** Search result molecules. */
protected List<Molecule> molecules;
+ /**
+ * Specimens getter.
+ *
+ * @return specimes
+ */
public List<Specimen> getSpecimens() {
return specimens;
}
+ /**
+ * Specimens setter.
+ *
+ * @param specimens specimens
+ */
public void setSpecimens(List<Specimen> specimens) {
this.specimens = specimens;
}
+ /**
+ * Lots getter.
+ *
+ * @return lots
+ */
public List<Lot> getLots() {
return lots;
}
+ /**
+ * Lots setter.
+ *
+ * @param lots lots
+ */
public void setLots(List<Lot> lots) {
this.lots = lots;
}
+ /**
+ * Extraction getter.
+ *
+ * @return extractions
+ */
public List<Extraction> getExtractions() {
return extractions;
}
+ /**
+ * Extraction setter.
+ *
+ * @param extractions extraction
+ */
public void setExtractions(List<Extraction> extractions) {
this.extractions = extractions;
}
+ /**
+ * Purifcations getter.
+ *
+ * @return purification
+ */
public List<Purification> getPurifications() {
return purifications;
}
+ /**
+ * Purification setter.
+ *
+ * @param purifications purification
+ */
public void setPurifications(List<Purification> purifications) {
this.purifications = purifications;
}
+ /**
+ * ResultatTestBios getter.
+ *
+ * @return resultattestbios
+ */
public List<ResultatTestBio> getResultatTestBios() {
return resultatTestBios;
}
+ /**
+ * ResultatTestBios setter.
+ *
+ * @param resultatTestBios resultatTestBios
+ */
public void setResultatTestBios(List<ResultatTestBio> resultatTestBios) {
this.resultatTestBios = resultatTestBios;
}
+ /**
+ * Stations getter.
+ *
+ * @return stations
+ */
public List<Station> getStations() {
return stations;
}
+ /**
+ * Stations setter.
+ *
+ * @param stations stations
+ */
public void setStations(List<Station> stations) {
this.stations = stations;
}
+ /**
+ * Molecule getter.
+ *
+ * @return molecule
+ */
public List<Molecule> getMolecules() {
return molecules;
}
+ /**
+ * Molecule setter.
+ *
+ * @param molecules molecules
+ */
public void setMolecules(List<Molecule> molecules) {
this.molecules = molecules;
}
Deleted: trunk/cantharella.utils/src/main/java/nc/ird/cantharella/utils/BeanLookup.java
===================================================================
--- trunk/cantharella.utils/src/main/java/nc/ird/cantharella/utils/BeanLookup.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.utils/src/main/java/nc/ird/cantharella/utils/BeanLookup.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -1,68 +0,0 @@
-/*
- * #%L
- * Cantharella :: Utils
- * $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.utils;
-
-import nc.ird.cantharella.utils.BeanTools.AccessType;
-
-/**
- * Retrieve a bean field value from the bean field name
- *
- * @author Mickael Tricot
- * @author Adrien Cheype
- */
-public final class BeanLookup {
-
- /** Access type */
- private final AccessType accessType;
-
- /** Bean */
- private final Object bean;
-
- /**
- * Constructor
- *
- * @param bean
- * Bean
- * @param accessType
- * Access type
- */
- public BeanLookup(Object bean, AccessType accessType) {
- super();
- AssertTools.assertNotNull(bean);
- AssertTools.assertNotNull(accessType);
- this.bean = bean;
- this.accessType = accessType;
- }
-
- /** {@inheritDoc} */
- public String lookup(String key) {
- AssertTools.assertNotNull(key);
- Object value;
- try {
- value = BeanTools.getValue(bean, accessType, key);
- } catch (IllegalArgumentException e) {
- value = null;
- }
- return value != null ? value.toString() : null;
- }
-}
\ No newline at end of file
Deleted: trunk/cantharella.utils/src/test/java/nc/ird/cantharella/utils/BeanLookupTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/cantharella/utils/BeanLookupTest.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.utils/src/test/java/nc/ird/cantharella/utils/BeanLookupTest.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -1,131 +0,0 @@
-/*
- * #%L
- * Cantharella :: Utils
- * $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.utils;
-
-import nc.ird.cantharella.utils.BeanLookup;
-import nc.ird.cantharella.utils.BeanTools.AccessType;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * BeanLookup test
- * @author Mickael Tricot
- */
-public final class BeanLookupTest {
-
- /**
- * Bean for the test
- * @author acheype
- */
- public final class Bean {
-
- /** boolean */
- public boolean bool;
-
- /** integer */
- public Integer integer;
-
- /** string */
- public String string;
-
- /**
- * integer getter
- * @return integer
- */
- public Integer getInteger() {
- return integer;
- }
-
- /**
- * string getter
- * @return string
- */
- public String getString() {
- return string;
- }
-
- /**
- * bool getter
- * @return bool
- */
- public boolean isBool() {
- return bool;
- }
-
- /**
- * bool setter
- * @param bool bool
- */
- public void setBool(boolean bool) {
- this.bool = bool;
- }
-
- /**
- * integer setter
- * @param integer integer
- */
- public void setInteger(Integer integer) {
- this.integer = integer;
- }
-
- /**
- * string setter
- * @param string string
- */
- public void setString(String string) {
- this.string = string;
- }
-
- }
-
- /**
- * lookup test
- */
- @Test
- public void lookup() {
- Bean bean = new Bean();
- BeanLookup lookupGetter = new BeanLookup(bean, AccessType.GETTER);
- BeanLookup lookupField = new BeanLookup(bean, AccessType.FIELD);
- Assert.assertNull(lookupGetter.lookup("Toto"));
- Assert.assertNull(lookupField.lookup("Toto"));
- Assert.assertNull(lookupGetter.lookup("integer"));
- Assert.assertNull(lookupField.lookup("integer"));
- Assert.assertNull(lookupGetter.lookup("string"));
- Assert.assertNull(lookupField.lookup("string"));
- bean.setInteger(0);
- bean.setString("");
- bean.setBool(true);
- Assert.assertNull(lookupGetter.lookup("Toto"));
- Assert.assertNull(lookupField.lookup("Toto"));
- Assert.assertEquals(bean.getInteger().toString(), lookupGetter.lookup("integer"));
- Assert.assertEquals(bean.integer.toString(), lookupField.lookup("integer"));
- Assert.assertEquals(bean.getString(), lookupGetter.lookup("string"));
- Assert.assertEquals(bean.string, lookupField.lookup("string"));
- Assert.assertEquals(String.valueOf(bean.isBool()), lookupGetter.lookup("bool"));
- Assert.assertEquals(String.valueOf(bean.bool), lookupField.lookup("bool"));
- bean.setBool(false);
- Assert.assertEquals(String.valueOf(bean.isBool()), lookupGetter.lookup("bool"));
- Assert.assertEquals(String.valueOf(bean.bool), lookupField.lookup("bool"));
- }
-}
Modified: trunk/cantharella.utils/src/test/java/nc/ird/cantharella/utils/BeanToolsTest.java
===================================================================
--- trunk/cantharella.utils/src/test/java/nc/ird/cantharella/utils/BeanToolsTest.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.utils/src/test/java/nc/ird/cantharella/utils/BeanToolsTest.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -421,7 +421,6 @@
* @throws NullPointerException -
* @throws NoSuchFieldException -
*/
- @SuppressWarnings("unchecked")
@Test(expected = NoSuchFieldException.class)
public void getAnnotatedPublicFieldKO() throws SecurityException, NullPointerException, NoSuchFieldException {
BeanTools.getAnnotatedPublicField(new Bean(), Deprecated.class);
@@ -433,7 +432,6 @@
* @throws NullPointerException -
* @throws NoSuchFieldException -
*/
- @SuppressWarnings("unchecked")
@Test
public void getAnnotatedPublicFieldOK() throws SecurityException, NullPointerException, NoSuchFieldException {
Field f = Bean.class.getField("integer");
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-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/columns/TaxonomyPropertyColumn.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -34,6 +34,7 @@
* Column which display taxonomy names. Put "taxonomy" at attribute class of the html column.
* @author Adrien Cheype
* @param <T> Type of the row model
+ * @param <S> Type of sort property
*/
public class TaxonomyPropertyColumn<T, S> extends PropertyColumn<T, S> {
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/RebuildLuceneIndexPanel.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/RebuildLuceneIndexPanel.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/config/panels/RebuildLuceneIndexPanel.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -44,8 +44,6 @@
@SpringBean
private SearchService searchService;
- protected Label rebuildResultLabel;
-
/**
* Constructor
* @param id The panel ID
@@ -55,6 +53,8 @@
final Form<Void> formView = new Form<Void>("Form");
+ final Label rebuildResultLabel = new Label("rebuildResult", new Model<String>(""));
+
Button addButton = new AjaxFallbackButton("Rebuild", formView) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
@@ -69,7 +69,6 @@
}
};
formView.add(addButton);
- rebuildResultLabel = new Label("rebuildResult", new Model<String>(""));
formView.add(rebuildResultLabel);
add(formView);
}
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -155,7 +155,6 @@
* Init attached document table for current entity.
*
* @param templatePage parent page
- * @param formView form to add table to
* @param documentAttachable entity to get documents
* @param currentPage current page
*/
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -49,9 +49,8 @@
public abstract class DocumentTooltipColumn<T extends DocumentAttachable, S> extends AbstractColumn<T, S> {
/**
- * Constructor
+ * Constructor.
* @param displayModel header display model
- * @param documentAttachableModel document attachable model
*/
public DocumentTooltipColumn(IModel<String> displayModel) {
super(displayModel);
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-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ReadDocumentPage.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -59,8 +59,9 @@
/**
* Constructeur
- * @param idDocument ID document
- * @param callerPage Page appelante
+ * @param document document
+ * @param documentAttachable entity where document is attached to
+ * @param callerPage caller page
*/
public ReadDocumentPage(final Document document, final DocumentAttachable documentAttachable,
final CallerPage callerPage) {
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ExtraitsColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ExtraitsColumn.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/extraction/ExtraitsColumn.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -84,6 +84,10 @@
/**
* Improve data model to support optionnal html formatting.
+ *
+ * @param rowModel current row to format
+ * @param html enable html formatting (must be false for csv)
+ * @return data model
*/
protected IModel<Serializable> getDataModel(IModel<Extraction> rowModel, final boolean html) {
return new Model<Serializable>(rowModel) {
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-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/AjaxButtonPropertyColumn.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -48,9 +48,8 @@
/**
* 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
+ * @param buttonLabel Title displayed for the button
+ * @param form form
*/
public AjaxButtonPropertyColumn(Model<String> buttonLabel, Form<?> form) {
this(new Model<String>(), buttonLabel, form);
@@ -59,9 +58,8 @@
/**
* 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
+ * @param buttonLabel Title displayed for the button
+ * @param form form
*/
public AjaxButtonPropertyColumn(IModel<String> displayModel, Model<String> buttonLabel, Form<?> form) {
super(displayModel);
@@ -78,8 +76,8 @@
/**
* 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 target target
+ * @param form form
* @param model Model
*/
public abstract void onSubmit(AjaxRequestTarget target, Form<?> form, IModel<T> model);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/data/TableExportToolbar.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/data/TableExportToolbar.java 2013-02-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/data/TableExportToolbar.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -39,6 +39,13 @@
*/
public class TableExportToolbar extends ExportToolbar {
+ /**
+ * Constructor adding csv export configuration.
+ *
+ * @param table table to add export to
+ * @param fileName export filename
+ * @param locale locale
+ */
public TableExportToolbar(DataTable<?, ?> table, String fileName, Locale locale) {
super(table);
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-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/models/LoadableDetachableSortableListDataProvider.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -48,8 +48,7 @@
* avec "implements IFilterStateLocator<FilterMapHomeMade>"
* @author Mickael Tricot
* @author Adrien Cheype
- * @param <T> Model object type
- * @param <S> the type of the sort property
+ * @param <M> Model object type
*/
public final class LoadableDetachableSortableListDataProvider<M extends AbstractModel> extends
SortableDataProvider<M, String> {
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-21 14:02:23 UTC (rev 147)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/security/AuthSession.java 2013-02-21 14:47:28 UTC (rev 148)
@@ -105,6 +105,13 @@
return false;
}
+ /**
+ * Check user authenticate.
+ *
+ * @param username username
+ * @param password password
+ * @return {@code true} if username and password match
+ */
public boolean authenticate(String username, String password) {
boolean authenticate = personneService.authenticateUtilisateur(username, password);
LOG.debug(String.valueOf(authenticate));
1
0
r147 - in trunk: cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils cantharella.service/src/main/java/nc/ird/cantharella/service/model cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl 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
by echatellier@users.forge.codelutin.com 21 Feb '13
by echatellier@users.forge.codelutin.com 21 Feb '13
21 Feb '13
Author: echatellier
Date: 2013-02-21 15:02:23 +0100 (Thu, 21 Feb 2013)
New Revision: 147
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/147
Log:
Add tooltip support for document column on document attachable
Added:
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn$DocumentTooltipPanel.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/DocumentAttachable.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/MoleculeProvenanceBean.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java
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/molecule/ListMoleculesPage.java
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java
Modified: 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 2013-02-21 12:33:49 UTC (rev 146)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/DocumentAttachable.java 2013-02-21 14:02:23 UTC (rev 147)
@@ -22,6 +22,7 @@
*/
package nc.ird.cantharella.data.model.utils;
+import java.io.Serializable;
import java.util.List;
import nc.ird.cantharella.data.model.Document;
@@ -31,7 +32,7 @@
*
* @author Eric Chatellier
*/
-public interface DocumentAttachable {
+public interface DocumentAttachable extends Serializable {
/**
* Get document attached to entity.
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-21 12:33:49 UTC (rev 146)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/model/MoleculeProvenanceBean.java 2013-02-21 14:02:23 UTC (rev 147)
@@ -24,14 +24,16 @@
*/
import java.io.Serializable;
-import java.util.Objects;
+import java.util.List;
+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.Lot;
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.utils.DocumentAttachable;
import nc.ird.cantharella.service.services.MoleculeService;
/**
@@ -43,7 +45,7 @@
* Last update: $Date$
* by : $Author$
*/
-public class MoleculeProvenanceBean implements Serializable {
+public class MoleculeProvenanceBean implements DocumentAttachable, Serializable {
private static final long serialVersionUID = 1L;
/**
@@ -92,4 +94,21 @@
return result;
}
+ /** {@inheritDoc} */
+ @Override
+ public List<Document> getDocuments() {
+ return molecule.getDocuments();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addDocument(Document document) {
+ molecule.addDocument(document);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void removeDocument(Document document) {
+ molecule.removeDocument(document);
+ }
}
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-21 12:33:49 UTC (rev 146)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-21 14:02:23 UTC (rev 147)
@@ -136,7 +136,8 @@
org.hibernate.Query hibSpecimen = getQuery(fullTextSession, Specimen.class, strQuery, utilisateur);
org.hibernate.Query hibLot = getQuery(fullTextSession, Lot.class, strQuery, utilisateur);
org.hibernate.Query hibExtraction = getQuery(fullTextSession, Extraction.class, strQuery, utilisateur);
- org.hibernate.Query hibPurification = getQuery(fullTextSession, Purification.class, strQuery, utilisateur);
+ org.hibernate.Query hibPurification = getQuery(fullTextSession, Purification.class, strQuery,
+ utilisateur);
org.hibernate.Query hibResultatTestBio = getQuery(fullTextSession, ResultatTestBio.class, strQuery,
utilisateur);
org.hibernate.Query hibStation = getQuery(fullTextSession, Station.class, strQuery, utilisateur);
Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java 2013-02-21 12:33:49 UTC (rev 146)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java 2013-02-21 14:02:23 UTC (rev 147)
@@ -71,8 +71,8 @@
* @param documentAttachable entity to get documents
* @param currentPage current page
*/
- public static void initAttachedDocumentsManageTable(final TemplatePage templatePage,
- final Form<Void> formView, final DocumentAttachable documentAttachable, final CallerPage currentPage) {
+ public static void initAttachedDocumentsManageTable(final TemplatePage templatePage, final Form<Void> formView,
+ final DocumentAttachable documentAttachable, final CallerPage currentPage) {
List<Document> documents = documentAttachable.getDocuments();
@@ -88,22 +88,23 @@
List<IColumn<Document, String>> columns = new ArrayList<IColumn<Document, String>>();
- columns.add(new LinkPropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.titre")), "titre",
- "titre") {
+ columns.add(new LinkPropertyColumn<Document, String>(
+ new Model<String>(templatePage.getString("Document.titre")), "titre", "titre") {
@Override
public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
templatePage.setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
}
});
- columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.typeDocument")),
- "typeDocument.nom", "typeDocument.nom"));
+ columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage
+ .getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
- columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.createur")), "createur",
- "createur"));
+ columns.add(new PropertyColumn<Document, String>(
+ new Model<String>(templatePage.getString("Document.createur")), "createur", "createur"));
- columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.link")),
- "images/download.png", templatePage.getString("Document.link"), templatePage.getString("Document.link")) {
+ columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(templatePage
+ .getString("Document.link")), "images/download.png", templatePage.getString("Document.link"),
+ templatePage.getString("Document.link")) {
@Override
public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
Document document = model.getObject();
@@ -117,8 +118,9 @@
final DataTable<Document, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>(
"ListDocumentsPage.AttachedDocuments", columns, attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
- columns.add(new AjaxButtonPropertyColumn<Document, String>(new Model<String>(templatePage.getString("Actions")),
- new Model<String>(templatePage.getString("Delete")), formView) {
+ columns.add(new AjaxButtonPropertyColumn<Document, String>(
+ new Model<String>(templatePage.getString("Actions")), new Model<String>(templatePage
+ .getString("Delete")), formView) {
@Override
public void onSubmit(AjaxRequestTarget target, Form<?> form, IModel<Document> model) {
Document document = model.getObject();
@@ -157,8 +159,8 @@
* @param documentAttachable entity to get documents
* @param currentPage current page
*/
- public static void initAttachedDocumentsReadTable(final TemplatePage templatePage, final DocumentAttachable documentAttachable,
- final CallerPage currentPage) {
+ public static void initAttachedDocumentsReadTable(final TemplatePage templatePage,
+ final DocumentAttachable documentAttachable, final CallerPage currentPage) {
List<Document> documents = documentAttachable.getDocuments();
@@ -167,22 +169,23 @@
List<IColumn<Document, String>> columns = new ArrayList<IColumn<Document, String>>();
- columns.add(new LinkPropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.titre")), "titre",
- "titre") {
+ columns.add(new LinkPropertyColumn<Document, String>(
+ new Model<String>(templatePage.getString("Document.titre")), "titre", "titre") {
@Override
public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
templatePage.setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
}
});
- columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.typeDocument")),
- "typeDocument.nom", "typeDocument.nom"));
+ columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage
+ .getString("Document.typeDocument")), "typeDocument.nom", "typeDocument.nom"));
- columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.createur")), "createur",
- "createur"));
+ columns.add(new PropertyColumn<Document, String>(
+ new Model<String>(templatePage.getString("Document.createur")), "createur", "createur"));
- columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.link")),
- "images/download.png", templatePage.getString("Document.link"), templatePage.getString("Document.link")) {
+ columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(templatePage
+ .getString("Document.link")), "images/download.png", templatePage.getString("Document.link"),
+ templatePage.getString("Document.link")) {
@Override
public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn$DocumentTooltipPanel.html
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn$DocumentTooltipPanel.html (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn$DocumentTooltipPanel.html 2013-02-21 14:02:23 UTC (rev 147)
@@ -0,0 +1,32 @@
+<!--
+ #%L
+ Cantharella :: Web
+ $Id: SimpleTooltipPanel.html 133 2013-02-19 11:02:25Z echatellier $
+ $HeadURL: http://svn.forge.codelutin.com/svn/cantharella/trunk/cantharella.web/src/ma… $
+ %%
+ 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>
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:panel>
+ <a wicket:id="link">
+ <img wicket:id="tooltip" alt="i" />
+ </a>
+</wicket:panel>
+</body>
+</html>
\ No newline at end of file
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java 2013-02-21 14:02:23 UTC (rev 147)
@@ -0,0 +1,111 @@
+/*
+ * #%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.util.List;
+
+import nc.ird.cantharella.data.model.Document;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.wicket.AttributeModifier;
+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.WebComponent;
+import org.apache.wicket.markup.html.image.Image;
+import org.apache.wicket.markup.html.link.Link;
+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;
+import org.apache.wicket.request.resource.ContextRelativeResource;
+
+/**
+ * Column displaying an image and model as tooltip.
+ * @author Eric Chatellier
+ * @param <T> Generic type
+ * @param <S> the type of the sort property
+ */
+public abstract class DocumentTooltipColumn<T extends DocumentAttachable, S> extends AbstractColumn<T, S> {
+
+ /**
+ * Constructor
+ * @param displayModel header display model
+ * @param documentAttachableModel document attachable model
+ */
+ public DocumentTooltipColumn(IModel<String> displayModel) {
+ super(displayModel);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> model) {
+
+ List<Document> documents = model.getObject().getDocuments();
+ StringBuilder builder = new StringBuilder();
+ if (CollectionUtils.isNotEmpty(documents)) {
+ for (Document document : documents) {
+ builder.append(document.getTitre());
+ builder.append("\n");
+ }
+ }
+
+ DocumentTooltipPanel panel = new DocumentTooltipPanel(componentId, model, Model.of(builder.toString()));
+ panel.setVisibilityAllowed(CollectionUtils.isNotEmpty(documents));
+ item.add(panel);
+ }
+
+ /**
+ * Called when link is clicked.
+ * @param model current model
+ */
+ public abstract void onClick(IModel<T> model);
+
+ /**
+ * Panel which include a linkable image. Used with the LinkableImagePropertyColumn$LinkablePanel.html file
+ */
+ public class DocumentTooltipPanel extends Panel {
+
+ /**
+ * Constructor
+ * @param id Component id
+ * @param model model
+ * @param messageModel Message Model displayed over the image
+ */
+ public DocumentTooltipPanel(String id, final IModel<T> model, IModel<?> messageModel) {
+ super(id);
+
+ Link<T> link = new Link<T>("link") {
+ @Override
+ public void onClick() {
+ DocumentTooltipColumn.this.onClick(model);
+ }
+ };
+ add(link);
+
+ WebComponent img = new Image("tooltip", new ContextRelativeResource("images/attachment.png"));
+ img.add(new AttributeModifier("title", messageModel));
+ link.add(img);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentTooltipColumn.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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-21 12:33:49 UTC (rev 146)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java 2013-02-21 14:02:23 UTC (rev 147)
@@ -159,7 +159,7 @@
final CallerPage currentPage = new CallerPage(this);
// get configuration
- long documentMaxUploadSize = ((WebApplicationImpl)getApplication()).getDocumentMaxUploadSize();
+ long documentMaxUploadSize = ((WebApplicationImpl) getApplication()).getDocumentMaxUploadSize();
// Initialisation du modèle
try {
@@ -267,7 +267,7 @@
// Fichier
formView.add(new SimpleTooltipPanel("Document.file.info", new Model<String>(getString("Document.file.info",
- Model.of(new Object[]{documentMaxUploadSize})))));
+ Model.of(new Object[] { documentMaxUploadSize })))));
formView.add(fileUploadField);
// Action : création du document
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-21 12:33:49 UTC (rev 146)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ListMoleculesPage.java 2013-02-21 14:02:23 UTC (rev 147)
@@ -31,6 +31,7 @@
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.DocumentTooltipColumn;
import nc.ird.cantharella.web.pages.domain.lot.ReadLotPage;
import nc.ird.cantharella.web.utils.CallerPage;
import nc.ird.cantharella.web.utils.behaviors.MoleculeViewBehavior;
@@ -44,7 +45,6 @@
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;
@@ -162,18 +162,12 @@
.getString("Molecule.masseMolaire")), "molecule.masseMolaire", "molecule.masseMolaire",
DecimalDisplFormat.SMALL, templatePage.getLocale()));
- columns.add(new LinkableImagePropertyColumn<MoleculeProvenanceBean, String>("images/attachment.png",
- templatePage.getString("Read"), templatePage.getString("Read")) {
+ columns.add(new DocumentTooltipColumn<MoleculeProvenanceBean, String>(Model.of("")) {
@Override
- public void onClick(Item<ICellPopulator<MoleculeProvenanceBean>> item, String componentId,
- IModel<MoleculeProvenanceBean> model) {
- templatePage.setResponsePage(new ReadMoleculePage(model.getObject().getIdMolecule(), callerPage));
+ public void onClick(IModel<MoleculeProvenanceBean> model) {
+ int idMolecule = model.getObject().getIdMolecule();
+ templatePage.setResponsePage(new ReadMoleculePage(idMolecule, callerPage));
}
-
- @Override
- protected boolean isVisibleAllowed(IModel<MoleculeProvenanceBean> model) {
- return CollectionUtils.isNotEmpty(model.getObject().getMolecule().getDocuments());
- }
});
columns.add(new BooleanPropertyColumn<MoleculeProvenanceBean, String>(new Model<String>(templatePage
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-21 12:33:49 UTC (rev 146)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/utils/columns/LinkableImagePropertyColumn.java 2013-02-21 14:02:23 UTC (rev 147)
@@ -77,20 +77,10 @@
@Override
public void populateItem(Item<ICellPopulator<T>> item, String componentId, IModel<T> 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
1
0
r146 - in trunk/cantharella.web/src/main: java/nc/ird/cantharella/web/config java/nc/ird/cantharella/web/pages java/nc/ird/cantharella/web/pages/domain/document java/nc/ird/cantharella/web/pages/domain/molecule resources
by echatellier@users.forge.codelutin.com 21 Feb '13
by echatellier@users.forge.codelutin.com 21 Feb '13
21 Feb '13
Author: echatellier
Date: 2013-02-21 13:33:49 +0100 (Thu, 21 Feb 2013)
New Revision: 146
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/146
Log:
Move document table init in helper class to be used in multiple class.
Fix configuration (in wicket application class)
Fix display messages.
Added:
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java
Modified:
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/domain/document/ManageDocumentPage.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/resources/cantharella.conf
trunk/cantharella.web/src/main/resources/web_en.properties
trunk/cantharella.web/src/main/resources/web_fr.properties
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-21 12:30:01 UTC (rev 145)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/config/WebApplicationImpl.java 2013-02-21 12:33:49 UTC (rev 146)
@@ -28,6 +28,7 @@
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.utils.AssertTools;
import nc.ird.cantharella.web.pages.ContactPage;
import nc.ird.cantharella.web.pages.HomePage;
import nc.ird.cantharella.web.pages.domain.campagne.ListCampagnesPage;
@@ -72,7 +73,6 @@
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.cantharella.utils.AssertTools;
import org.apache.wicket.ConverterLocator;
import org.apache.wicket.IConverterLocator;
@@ -99,6 +99,7 @@
import org.apache.wicket.util.time.Duration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
/**
* Web application
@@ -134,6 +135,10 @@
/** Wicket configuration (Application.DEVELOPMENT or Application.DEPLOYMENT) */
private final RuntimeConfigurationType wicketConfiguration;
+ /** Configuration document max upload size. */
+ @Value("${document.maxUploadSize}")
+ protected long documentMaxUploadSize;
+
/**
* Constructor
* @param debug Debug mode
@@ -423,4 +428,12 @@
mountPage("/search", SearchPage.class);
}
+ /**
+ * Get document max upload size.
+ *
+ * @return document max upload size
+ */
+ public long getDocumentMaxUploadSize() {
+ return documentMaxUploadSize;
+ }
}
\ No newline at end of file
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-21 12:30:01 UTC (rev 145)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/TemplatePage.java 2013-02-21 12:33:49 UTC (rev 146)
@@ -378,7 +378,7 @@
* Refresh feedback page and scroll up to the anchor if any feedback message
* @param target Ajax target
*/
- protected final void refreshFeedbackPage(AjaxRequestTarget target) {
+ public final void refreshFeedbackPage(AjaxRequestTarget target) {
if (target != null) {
target.add(feedbackPanelContainer);
// scroll up to the anchor if any feedback message
Added: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java (rev 0)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java 2013-02-21 12:33:49 UTC (rev 146)
@@ -0,0 +1,208 @@
+/*
+ * #%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.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import nc.ird.cantharella.data.model.Document;
+import nc.ird.cantharella.data.model.utils.DocumentAttachable;
+import nc.ird.cantharella.web.config.WebContext;
+import nc.ird.cantharella.web.pages.TemplatePage;
+import nc.ird.cantharella.web.utils.CallerPage;
+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.models.SimpleSortableListDataProvider;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+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.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.form.Form;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.request.http.WebResponse;
+
+/**
+ * Helper providing static method to init document list into entity Read or
+ * Manager page.
+ *
+ * @author Eric Chatellier
+ */
+public abstract class DocumentPageHelper {
+
+ /**
+ * Init attached document table for current entity.
+ *
+ * @param templatePage parent page
+ * @param formView form to add table to
+ * @param documentAttachable entity to get documents
+ * @param currentPage current page
+ */
+ public static void initAttachedDocumentsManageTable(final TemplatePage templatePage,
+ final Form<Void> formView, final DocumentAttachable documentAttachable, final 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, templatePage.getSession().getLocale());
+
+ List<IColumn<Document, String>> columns = new ArrayList<IColumn<Document, String>>();
+
+ columns.add(new LinkPropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.titre")), "titre",
+ "titre") {
+ @Override
+ public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
+ templatePage.setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
+ }
+ });
+
+ columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.typeDocument")),
+ "typeDocument.nom", "typeDocument.nom"));
+
+ columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.createur")), "createur",
+ "createur"));
+
+ columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.link")),
+ "images/download.png", templatePage.getString("Document.link"), templatePage.getString("Document.link")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
+ Document document = model.getObject();
+ WebResponse response = (WebResponse) templatePage.getResponse();
+ response.setContentType(document.getFileMimetype());
+ response.setAttachmentHeader(document.getFileName());
+ response.write(document.getFileContent());
+ }
+ });
+
+ final DataTable<Document, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>(
+ "ListDocumentsPage.AttachedDocuments", columns, attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
+
+ columns.add(new AjaxButtonPropertyColumn<Document, String>(new Model<String>(templatePage.getString("Actions")),
+ new Model<String>(templatePage.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);
+ templatePage.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, documentAttachable, 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, documentAttachable, false));
+ }
+ }.setVisibilityAllowed(true));
+ }
+
+ /**
+ * Init attached document table for current entity.
+ *
+ * @param templatePage parent page
+ * @param formView form to add table to
+ * @param documentAttachable entity to get documents
+ * @param currentPage current page
+ */
+ public static void initAttachedDocumentsReadTable(final TemplatePage templatePage, final DocumentAttachable documentAttachable,
+ final CallerPage currentPage) {
+
+ List<Document> documents = documentAttachable.getDocuments();
+
+ SimpleSortableListDataProvider<Document> attachedDocumentsDataProvider = new SimpleSortableListDataProvider<Document>(
+ documents, templatePage.getSession().getLocale());
+
+ List<IColumn<Document, String>> columns = new ArrayList<IColumn<Document, String>>();
+
+ columns.add(new LinkPropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.titre")), "titre",
+ "titre") {
+ @Override
+ public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
+ templatePage.setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
+ }
+ });
+
+ columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.typeDocument")),
+ "typeDocument.nom", "typeDocument.nom"));
+
+ columns.add(new PropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.createur")), "createur",
+ "createur"));
+
+ columns.add(new LinkableImagePropertyColumn<Document, String>(new Model<String>(templatePage.getString("Document.link")),
+ "images/download.png", templatePage.getString("Document.link"), templatePage.getString("Document.link")) {
+ @Override
+ public void onClick(Item<ICellPopulator<Document>> item, String componentId, IModel<Document> model) {
+
+ Document document = model.getObject();
+ WebResponse response = (WebResponse) templatePage.getResponse();
+ response.setContentType(document.getFileMimetype());
+ response.setAttachmentHeader(document.getFileName());
+
+ OutputStream out = templatePage.getResponse().getOutputStream();
+ InputStream in = new ByteArrayInputStream(document.getFileContent());
+ try {
+ IOUtils.copy(in, out);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ final DataTable<Document, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>(
+ "ListDocumentsPage.AttachedDocuments", columns, attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
+ templatePage.add(attachedDocumentTable);
+ }
+}
Property changes on: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/DocumentPageHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
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-21 12:30:01 UTC (rev 145)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java 2013-02-21 12:33:49 UTC (rev 146)
@@ -35,6 +35,7 @@
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.WebApplicationImpl;
import nc.ird.cantharella.web.config.WebContext;
import nc.ird.cantharella.web.pages.TemplatePage;
import nc.ird.cantharella.web.pages.domain.personne.ManagePersonnePage;
@@ -68,7 +69,6 @@
import org.apache.wicket.util.lang.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
/**
* Document management page (creation/edition).
@@ -110,10 +110,6 @@
/** Multiple entry. */
private boolean multipleEntry;
- /** Configuration document max upload size. */
- @Value("${document.maxUploadSize}")
- protected long documentMaxUploadSize;
-
/**
* Constructeur (mode création)
* @param callerPage Page appelante
@@ -162,6 +158,9 @@
final CallerPage currentPage = new CallerPage(this);
+ // get configuration
+ long documentMaxUploadSize = ((WebApplicationImpl)getApplication()).getDocumentMaxUploadSize();
+
// Initialisation du modèle
try {
documentModel = new Model<Document>(idDocument == null && document == null ? new Document()
@@ -267,7 +266,8 @@
});
// Fichier
- formView.add(new SimpleTooltipPanel("Document.file.info", new Model<String>(getString("Document.file.info"))));
+ formView.add(new SimpleTooltipPanel("Document.file.info", new Model<String>(getString("Document.file.info",
+ Model.of(new Object[]{documentMaxUploadSize})))));
formView.add(fileUploadField);
// Action : création du document
@@ -290,7 +290,6 @@
documentModel.getObject().setFileContent(uploadedFile.getBytes());
documentModel.getObject().setFileName(uploadedFile.getClientFileName());
documentModel.getObject().setFileMimetype(uploadedFile.getContentType());
-
}
validateModel();
}
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-21 12:30:01 UTC (rev 145)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-02-21 12:33:49 UTC (rev 146)
@@ -99,7 +99,7 @@
<fieldset>
<legend><wicket:message key="Molecule.provenance" /></legend>
- <table class="large" cellspacing="0" wicket:id="Molecule.provenance.Table">
+ <table cellspacing="0" wicket:id="Molecule.provenance.Table">
<thead>
<tr>
<th class="required">
@@ -182,7 +182,7 @@
<fieldset>
<legend><wicket:message key="ListDocumentsPage.AttachedDocuments" /></legend>
<div wicket:id="ListDocumentsPage.AttachedDocuments.Refresh">
- <table class="large" cellspacing="0" wicket:id="ListDocumentsPage.AttachedDocuments"/>
+ <table 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-21 12:30:01 UTC (rev 145)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-21 12:33:49 UTC (rev 146)
@@ -22,10 +22,6 @@
*/
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;
@@ -34,23 +30,19 @@
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.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.document.ReadDocumentPage;
+import nc.ird.cantharella.web.pages.domain.document.DocumentPageHelper;
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;
@@ -58,34 +50,24 @@
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;
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.panels.SimpleTooltipPanel;
import nc.ird.cantharella.web.utils.security.AuthRole;
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;
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.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;
@@ -98,13 +80,11 @@
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;
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;
@@ -202,7 +182,7 @@
final Form<Void> formView = new Form<Void>("Form");
initProvenanceFields(formView, currentPage);
- initAttachedDocumentsTable(formView, moleculeModel.getObject(), currentPage);
+ DocumentPageHelper.initAttachedDocumentsManageTable(this, formView, moleculeModel.getObject(), currentPage);
// page can be accessed by anyone for editing provenance
// but molecule fields can be edited only by administrators or
@@ -606,99 +586,6 @@
}
/**
- * 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,
- final 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, String>> columns = new ArrayList<IColumn<Document, String>>();
-
- 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) {
- setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
- }
- });
-
- columns.add(new PropertyColumn<Document, String>(new Model<String>(getString("Document.typeDocument")),
- "typeDocument.nom", "typeDocument.nom"));
-
- columns.add(new PropertyColumn<Document, String>(new Model<String>(getString("Document.createur")), "createur",
- "createur"));
-
- 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) {
-
- 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, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>(
- "ListDocumentsPage.AttachedDocuments", columns, attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
-
- 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) {
- 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));
- }
-
- /**
* 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.java
===================================================================
--- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-02-21 12:30:01 UTC (rev 145)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ReadMoleculePage.java 2013-02-21 12:33:49 UTC (rev 146)
@@ -22,27 +22,20 @@
*/
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;
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.document.DocumentPageHelper;
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;
@@ -51,29 +44,20 @@
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.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;
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;
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;
-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;
@@ -82,12 +66,9 @@
import org.apache.wicket.markup.html.link.ResourceLink;
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;
import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.request.resource.ByteArrayResource;
import org.apache.wicket.spring.injection.annot.SpringBean;
@@ -103,14 +84,14 @@
public static final String ACTION_DELETE = "Delete";
/** Modèle : molecule */
- private final IModel<Molecule> moleculeModel;
+ private IModel<Molecule> moleculeModel;
/** Service : molecule */
@SpringBean
private MoleculeService moleculeService;
/** Page appelante */
- private final CallerPage callerPage;
+ private CallerPage callerPage;
/**
* Constructor with molecule id to render.
@@ -127,7 +108,7 @@
moleculeModel = new GenericLoadableDetachableModel<Molecule>(Molecule.class, idMolecule);
initProvenanceFields(currentPage);
- initAttachedDocumentsTable(moleculeModel.getObject(), currentPage);
+ DocumentPageHelper.initAttachedDocumentsReadTable(this, moleculeModel.getObject(), currentPage);
add(new Label("Molecule.idMolecule", new PropertyModel<String>(moleculeModel, "idMolecule")));
add(new Label("Molecule.nomCommun", new PropertyModel<String>(moleculeModel, "nomCommun"))
@@ -318,59 +299,4 @@
};
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, String>> columns = new ArrayList<IColumn<Document, String>>();
-
- 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) {
- setResponsePage(new ReadDocumentPage(model.getObject(), documentAttachable, currentPage));
- }
- });
-
- columns.add(new PropertyColumn<Document, String>(new Model<String>(getString("Document.typeDocument")),
- "typeDocument.nom", "typeDocument.nom"));
-
- columns.add(new PropertyColumn<Document, String>(new Model<String>(getString("Document.createur")), "createur",
- "createur"));
-
- 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) {
-
- 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, String> attachedDocumentTable = new AjaxFallbackDefaultDataTable<Document, String>(
- "ListDocumentsPage.AttachedDocuments", columns, attachedDocumentsDataProvider, WebContext.ROWS_PER_PAGE);
- add(attachedDocumentTable);
- }
}
Modified: trunk/cantharella.web/src/main/resources/cantharella.conf
===================================================================
--- trunk/cantharella.web/src/main/resources/cantharella.conf 2013-02-21 12:30:01 UTC (rev 145)
+++ trunk/cantharella.web/src/main/resources/cantharella.conf 2013-02-21 12:33:49 UTC (rev 146)
@@ -36,4 +36,4 @@
# value for production
#log4j.config=/home/tomcat/.config/log4j_prod.xml
#document file max upload size (Mb)
-document.maxUploadSize=1
\ No newline at end of file
+document.maxUploadSize=1
Modified: trunk/cantharella.web/src/main/resources/web_en.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/web_en.properties 2013-02-21 12:30:01 UTC (rev 145)
+++ trunk/cantharella.web/src/main/resources/web_en.properties 2013-02-21 12:33:49 UTC (rev 146)
@@ -131,7 +131,7 @@
ListTestsBioPage2=Bioassays
ListTestsBioPage.NewTestBio=New bioassay
-ListDocumentsPage.NewDocument=New document
+ListDocumentsPage.NewDocument=Attach new document
ListDocumentsPage.AttachedDocuments=Attached documents
ManageCampagnePage=Campaign management
@@ -414,7 +414,7 @@
Document.link=Link
Document.type=Type
Document.file=File
-Document.file.info=File size must be less than 1Mb
+Document.file.info=File size must be less than ${0}Mb
#BASIC#
Actions=Actions
Modified: trunk/cantharella.web/src/main/resources/web_fr.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/web_fr.properties 2013-02-21 12:30:01 UTC (rev 145)
+++ trunk/cantharella.web/src/main/resources/web_fr.properties 2013-02-21 12:33:49 UTC (rev 146)
@@ -130,7 +130,7 @@
ListTestsBioPage2=Tests biologiques
ListTestsBioPage.NewTestBio=Nouveau test biologique
-ListDocumentsPage.NewDocument=Nouveau document
+ListDocumentsPage.NewDocument=Joindre un nouveau document
ListDocumentsPage.AttachedDocuments=Document(s) attaché(s)
ManageCampagnePage=Gestion d'une campagne
@@ -412,7 +412,7 @@
Document.link=Lien
Document.type=Type
Document.file=Fichier
-Document.file.info=La taille du fichier doit faire moins de 1Mo
+Document.file.info=La taille du fichier doit faire moins de ${0}Mo
#BASIC#
Actions=Actions
1
0
r145 - trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search
by echatellier@users.forge.codelutin.com 21 Feb '13
by echatellier@users.forge.codelutin.com 21 Feb '13
21 Feb '13
Author: echatellier
Date: 2013-02-21 13:30:01 +0100 (Thu, 21 Feb 2013)
New Revision: 145
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/145
Log:
Fix back link to search page
Modified:
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java
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-21 12:15:33 UTC (rev 144)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/search/SearchPage.java 2013-02-21 12:30:01 UTC (rev 145)
@@ -113,7 +113,7 @@
public SearchPage(String query) {
super(SearchPage.class);
this.query = query;
- final CallerPage currentPage = new CallerPage(SearchPage.class);
+ final CallerPage currentPage = new CallerPage(this);
// ca sert a rien, mais wicket est pas content
ExternalLink link = new ExternalLink("advancedLink",
1
0
r144 - in trunk: cantharella.data/src/main/java/nc/ird/cantharella/data/model cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl
by echatellier@users.forge.codelutin.com 21 Feb '13
by echatellier@users.forge.codelutin.com 21 Feb '13
21 Feb '13
Author: echatellier
Date: 2013-02-21 13:15:33 +0100 (Thu, 21 Feb 2013)
New Revision: 144
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/144
Log:
Correction des droits pour les mol?\195?\169cules (visible par tout le monde)
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
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-21 11:32:04 UTC (rev 143)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-02-21 12:15:33 UTC (rev 144)
@@ -41,7 +41,6 @@
import javax.validation.constraints.NotNull;
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;
@@ -49,8 +48,6 @@
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Type;
import org.hibernate.search.annotations.Field;
-import org.hibernate.search.annotations.FullTextFilterDef;
-import org.hibernate.search.annotations.FullTextFilterDefs;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.validator.constraints.Length;
@@ -63,7 +60,6 @@
*/
@Entity
@Indexed
-@FullTextFilterDefs( { @FullTextFilterDef(name = "utilisateur-Molecule", impl = UtilisateurSearchFilter.class) })
public class Molecule extends AbstractModel implements DocumentAttachable {
/** ID */
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-21 11:32:04 UTC (rev 143)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-21 12:15:33 UTC (rev 144)
@@ -58,6 +58,7 @@
import org.hibernate.search.MassIndexer;
import org.hibernate.search.Search;
import org.hibernate.search.SearchFactory;
+import org.hibernate.search.annotations.FullTextFilterDefs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -211,9 +212,11 @@
// convert lucene query to hibernate query
FullTextQuery hibQuery = fullTextSession.createFullTextQuery(query, clazz);
- // add security filter
- FullTextFilter filter = hibQuery.enableFullTextFilter("utilisateur-" + clazz.getSimpleName());
- filter.setParameter("utilisateur", utilisateur);
+ // add security filter (if class has filter defined)
+ if (clazz.getAnnotation(FullTextFilterDefs.class) != null) {
+ FullTextFilter filter = hibQuery.enableFullTextFilter("utilisateur-" + clazz.getSimpleName());
+ filter.setParameter("utilisateur", utilisateur);
+ }
return hibQuery;
}
1
0
r143 - in trunk: cantharella.data/src/main/java/nc/ird/cantharella/data/model cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl
by echatellier@users.forge.codelutin.com 21 Feb '13
by echatellier@users.forge.codelutin.com 21 Feb '13
21 Feb '13
Author: echatellier
Date: 2013-02-21 12:32:04 +0100 (Thu, 21 Feb 2013)
New Revision: 143
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/143
Log:
Exlude id from search query parser
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeTestBio.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Campagne.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -49,9 +49,7 @@
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Type;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
-import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Store;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
@@ -76,7 +74,7 @@
@NotNull
@NotEmpty
@Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field(store = Store.YES)
private String nom;
/** Code pays */
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Extraction.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -52,12 +52,10 @@
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Type;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.ContainedIn;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
-import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Store;
@@ -82,7 +80,7 @@
@Length(max = LENGTH_MEDIUM_TEXT)
@Column(unique = true)
@NotEmpty
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field(store = Store.YES)
private String ref;
/** Manipulateur */
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Lot.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -50,11 +50,9 @@
import org.apache.commons.beanutils.BeanComparator;
import org.hibernate.annotations.Type;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
-import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Store;
@@ -82,7 +80,7 @@
@Column(unique = true)
@NotEmpty
@Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field(store = Store.YES)
private String ref;
/** Campagne */
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeTestBio.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeTestBio.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/MethodeTestBio.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -33,10 +33,7 @@
import org.apache.commons.beanutils.BeanComparator;
import org.hibernate.annotations.Type;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
-import org.hibernate.search.annotations.Index;
-import org.hibernate.search.annotations.Store;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
@@ -57,14 +54,14 @@
@Length(max = LENGTH_MEDIUM_TEXT)
@Column(unique = true)
@NotEmpty
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String nom;
/** Cible pour un test (acronyme du nom de méthode) */
@Length(max = LENGTH_MEDIUM_TEXT)
@Column(unique = true)
@NotEmpty
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String cible;
/** Domaine de recherche pour le test */
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-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Molecule.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -48,14 +48,11 @@
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Type;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
-import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
-import org.hibernate.search.annotations.Store;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
@@ -77,12 +74,12 @@
/** Nom commun */
@Length(max = LENGTH_LONG_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String nomCommun;
/** Famille chimique */
@Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String familleChimique;
/** Famille developpée */
@@ -93,7 +90,7 @@
/** Nom IUPAC */
@Length(max = LENGTH_BIG_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String nomIupca;
/** Formule brute */
@@ -117,7 +114,7 @@
/** Identifiee par. */
@Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String identifieePar;
/** Publication d'origine */
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Produit.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -43,7 +43,6 @@
import nc.ird.cantharella.data.model.utils.AbstractModel;
import org.apache.commons.beanutils.BeanComparator;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.ClassBridge;
import org.hibernate.search.annotations.ContainedIn;
import org.hibernate.search.annotations.Field;
@@ -70,7 +69,7 @@
@Length(max = LENGTH_MEDIUM_TEXT)
@NotEmpty
@Column(unique = true)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field(store = Store.YES)
private String ref;
/** Masse obtenue pour le produit **/
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Purification.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -54,11 +54,9 @@
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Type;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
-import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Store;
@@ -83,7 +81,7 @@
@Length(max = LENGTH_MEDIUM_TEXT)
@Column(unique = true)
@NotEmpty
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field(store = Store.YES)
private String ref;
/** Manipulateur */
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Specimen.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -44,11 +44,9 @@
import org.apache.commons.beanutils.BeanComparator;
import org.hibernate.annotations.Type;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
-import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Store;
@@ -96,28 +94,28 @@
@Column(unique = true)
@NotEmpty
@Length(max = LENGTH_TINY_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field(store = Store.YES)
private String ref;
/** Embranchement */
@Length(max = LENGTH_MEDIUM_TEXT)
@NotEmpty
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String embranchement;
/** Famille */
@Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String famille;
/** Genre */
@Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String genre;
/** Espèce */
@Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String espece;
/** Sous-espèce */
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/Station.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -48,14 +48,11 @@
import org.apache.commons.beanutils.BeanComparator;
import org.hibernate.annotations.AccessType;
import org.hibernate.annotations.Type;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FullTextFilterDef;
import org.hibernate.search.annotations.FullTextFilterDefs;
-import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
-import org.hibernate.search.annotations.Store;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
@@ -81,14 +78,14 @@
@Column(unique = true)
@NotEmpty
@Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String nom;
/** Code pays */
@NotNull
@Length(min = 2, max = 2)
@CountryCode
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String codePays;
/** Complément */
@@ -105,7 +102,7 @@
/** Localité */
@Length(max = LENGTH_MEDIUM_TEXT)
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field
private String localite;
/** Latitude */
Modified: trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/model/TestBio.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -56,10 +56,8 @@
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Type;
-import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.ContainedIn;
import org.hibernate.search.annotations.Field;
-import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Store;
import org.hibernate.validator.constraints.Length;
@@ -82,7 +80,7 @@
@Length(max = LENGTH_MEDIUM_TEXT)
@Column(unique = true)
@NotEmpty
- @Field(index = Index.YES, analyze = Analyze.YES, store = Store.YES)
+ @Field(store = Store.YES)
private String ref;
/** Manipulateur */
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-21 09:37:08 UTC (rev 142)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-21 11:32:04 UTC (rev 143)
@@ -22,6 +22,7 @@
*/
package nc.ird.cantharella.service.services.impl;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -187,11 +188,17 @@
// build a multi field query parser to search in all fields
IndexReader reader = searchFactory.getIndexReaderAccessor().open(clazz);
FieldInfos fieldInfos = ReaderUtil.getMergedFieldInfos(reader);
- String[] fieldArray = new String[fieldInfos.size()];
+ List<String> fieldList = new ArrayList<>();
for (int i = 0; i < fieldInfos.size(); i++) {
- fieldArray[i] = fieldInfos.fieldName(i);
+ String fieldName = fieldInfos.fieldName(i);
+ // il semble impossible de ne pas recuperer l'id du document
+ // on l'exclut donc manuellement
+ if (!fieldName.startsWith("id") && !fieldName.contains(".id")) {
+ fieldList.add(fieldInfos.fieldName(i));
+ }
}
- QueryParser parser = new MultiFieldQueryParser(Version.LUCENE_36, fieldArray, searchFactory.getAnalyzer(clazz));
+ QueryParser parser = new MultiFieldQueryParser(Version.LUCENE_36, fieldList.toArray(new String[fieldList.size()]),
+ searchFactory.getAnalyzer(clazz));
searchFactory.getIndexReaderAccessor().close(reader);
// autorisation de "*" en premier caractere
1
0
r142 - in trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services: . impl
by echatellier@users.forge.codelutin.com 21 Feb '13
by echatellier@users.forge.codelutin.com 21 Feb '13
21 Feb '13
Author: echatellier
Date: 2013-02-21 10:37:08 +0100 (Thu, 21 Feb 2013)
New Revision: 142
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/142
Log:
Manage null or empty query to return empty lists
Modified:
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/SearchService.java
trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/SearchService.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/SearchService.java 2013-02-21 09:34:24 UTC (rev 141)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/SearchService.java 2013-02-21 09:37:08 UTC (rev 142)
@@ -42,7 +42,7 @@
/**
* Search for query result into data model.
*
- * @param query query
+ * @param query query (null value handled : return empty lists)
* @param utilisateur utilisateur to filter results
* @return search result
*/
Modified: trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java
===================================================================
--- trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-21 09:34:24 UTC (rev 141)
+++ trunk/cantharella.service/src/main/java/nc/ird/cantharella/service/services/impl/SearchServiceImpl.java 2013-02-21 09:37:08 UTC (rev 142)
@@ -22,6 +22,7 @@
*/
package nc.ird.cantharella.service.services.impl;
+import java.util.Collections;
import java.util.List;
import javax.annotation.Resource;
@@ -38,6 +39,7 @@
import nc.ird.cantharella.service.model.SearchResult;
import nc.ird.cantharella.service.services.SearchService;
+import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
@@ -117,25 +119,37 @@
//fullTextSession.setCacheMode(CacheMode.IGNORE);
try {
- // wrap Lucene query in a org.hibernate.Query
- org.hibernate.Query hibSpecimen = getQuery(fullTextSession, Specimen.class, strQuery, utilisateur);
- org.hibernate.Query hibLot = getQuery(fullTextSession, Lot.class, strQuery, utilisateur);
- org.hibernate.Query hibExtraction = getQuery(fullTextSession, Extraction.class, strQuery, utilisateur);
- org.hibernate.Query hibPurification = getQuery(fullTextSession, Purification.class, strQuery, utilisateur);
- org.hibernate.Query hibResultatTestBio = getQuery(fullTextSession, ResultatTestBio.class, strQuery,
- utilisateur);
- org.hibernate.Query hibStation = getQuery(fullTextSession, Station.class, strQuery, utilisateur);
- org.hibernate.Query hibMolecule = getQuery(fullTextSession, Molecule.class, strQuery, utilisateur);
- // execute search
- List<Specimen> specimens = hibSpecimen.list();
- List<Lot> lots = hibLot.list();
- List<Extraction> extractions = hibExtraction.list();
- List<Purification> purifications = hibPurification.list();
- List<ResultatTestBio> resultatTestBios = hibResultatTestBio.list();
- List<Station> resultatStations = hibStation.list();
- List<Molecule> resultatMolecules = hibMolecule.list();
+ // default init to empty list if query is null or empty
+ List<Specimen> specimens = Collections.EMPTY_LIST;
+ List<Lot> lots = Collections.EMPTY_LIST;
+ List<Extraction> extractions = Collections.EMPTY_LIST;
+ List<Purification> purifications = Collections.EMPTY_LIST;
+ List<ResultatTestBio> resultatTestBios = Collections.EMPTY_LIST;
+ List<Station> resultatStations = Collections.EMPTY_LIST;
+ List<Molecule> resultatMolecules = Collections.EMPTY_LIST;
+ if (StringUtils.isNotEmpty(strQuery)) {
+ // wrap Lucene query in a org.hibernate.Query
+ org.hibernate.Query hibSpecimen = getQuery(fullTextSession, Specimen.class, strQuery, utilisateur);
+ org.hibernate.Query hibLot = getQuery(fullTextSession, Lot.class, strQuery, utilisateur);
+ org.hibernate.Query hibExtraction = getQuery(fullTextSession, Extraction.class, strQuery, utilisateur);
+ org.hibernate.Query hibPurification = getQuery(fullTextSession, Purification.class, strQuery, utilisateur);
+ org.hibernate.Query hibResultatTestBio = getQuery(fullTextSession, ResultatTestBio.class, strQuery,
+ utilisateur);
+ org.hibernate.Query hibStation = getQuery(fullTextSession, Station.class, strQuery, utilisateur);
+ org.hibernate.Query hibMolecule = getQuery(fullTextSession, Molecule.class, strQuery, utilisateur);
+
+ // perform search
+ specimens = hibSpecimen.list();
+ lots = hibLot.list();
+ extractions = hibExtraction.list();
+ purifications = hibPurification.list();
+ resultatTestBios = hibResultatTestBio.list();
+ resultatStations = hibStation.list();
+ resultatMolecules = hibMolecule.list();
+ }
+
result.setSpecimens(specimens);
result.setLots(lots);
result.setExtractions(extractions);
1
0
Author: echatellier
Date: 2013-02-21 10:34:24 +0100 (Thu, 21 Feb 2013)
New Revision: 141
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/141
Log:
Update to wicket 6.6.0
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-02-20 15:40:59 UTC (rev 140)
+++ trunk/pom.xml 2013-02-21 09:34:24 UTC (rev 141)
@@ -139,7 +139,7 @@
<version.poi>3.9</version.poi>
<version.nuiton-utils>2.6.8</version.nuiton-utils>
<version.servlet-api>2.5</version.servlet-api>
- <version.wicket>6.5.0</version.wicket>
+ <version.wicket>6.6.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
r140 - in trunk: cantharella.data/src/main/java/nc/ird/cantharella/data/config cantharella.data/src/main/resources 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/resources
by echatellier@users.forge.codelutin.com 20 Feb '13
by echatellier@users.forge.codelutin.com 20 Feb '13
20 Feb '13
Author: echatellier
Date: 2013-02-20 16:40:59 +0100 (Wed, 20 Feb 2013)
New Revision: 140
Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/140
Log:
Ajout d'infobulle manquante.
Passage des valeurs fixe en configuration.
Modified:
trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java
trunk/cantharella.data/src/main/resources/cantharella.conf
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/molecule/ManageMoleculePage.html
trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java
trunk/cantharella.web/src/main/resources/cantharella.conf
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/config/DataContext.java
===================================================================
--- trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java 2013-02-20 14:57:34 UTC (rev 139)
+++ trunk/cantharella.data/src/main/java/nc/ird/cantharella/data/config/DataContext.java 2013-02-20 15:40:59 UTC (rev 140)
@@ -168,11 +168,23 @@
protected String dbUserProperty;
/**
- * DB user
+ * Hibernate schema validation property.
*/
- @Value("${db.hbm2ddl:validate}")
+ @Value("${db.hbm2ddl}")
protected String hbm2ddl;
+ /**
+ * Hibernate search lucene index location on filesystem.
+ */
+ @Value("${hibernate.search.indexBase}")
+ protected String hibernateSearchIndexBase;
+
+ /**
+ * Hibernate search analyzer.
+ */
+ @Value("${hibernate.search.analyzer}")
+ protected String hibernateSearchAnalyzer;
+
static {
// The first Locale in the list is the default one
List<Locale> locales = new ArrayList<Locale>();
@@ -295,8 +307,8 @@
//hibernateProperties.setProperty("hibernate.c3p0.min_size", String.valueOf(DB_POOL_MIN_SIZE)); // minPoolSize
// Hibernate search
hibernateProperties.setProperty("hibernate.search.default.directory_provider", "filesystem");
- hibernateProperties.setProperty("hibernate.search.default.indexBase", "/tmp/cantharella/hs");
- hibernateProperties.setProperty("hibernate.search.analyzer", "org.apache.lucene.analysis.fr.FrenchAnalyzer");
+ hibernateProperties.setProperty("hibernate.search.default.indexBase", hibernateSearchIndexBase);
+ hibernateProperties.setProperty("hibernate.search.analyzer", hibernateSearchAnalyzer);
// Hibernate: Session
//hibernateProperties.setProperty("hibernate.current_session_context_class", "thread");
Modified: trunk/cantharella.data/src/main/resources/cantharella.conf
===================================================================
--- trunk/cantharella.data/src/main/resources/cantharella.conf 2013-02-20 14:57:34 UTC (rev 139)
+++ trunk/cantharella.data/src/main/resources/cantharella.conf 2013-02-20 15:40:59 UTC (rev 140)
@@ -31,3 +31,8 @@
# value for production
#db.debug=false
db.hbm2ddl=validate
+
+# Hibernate search lucene index location on filesystem.
+hibernate.search.indexBase=/tmp/cantharella
+# Hibernate search analyzer
+hibernate.search.analyzer=org.apache.lucene.analysis.fr.FrenchAnalyzer
\ No newline at end of file
Modified: 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 2013-02-20 14:57:34 UTC (rev 139)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.html 2013-02-20 15:40:59 UTC (rev 140)
@@ -84,7 +84,8 @@
</div>
<div class="property required">
- <label for="Document.file"><wicket:message key="Document.file" /></label>
+ <label for="Document.file"><wicket:message key="Document.file" />
+ <wicket:container wicket:id="Document.file.info"/></label>
<input type="file" id="Document.file" wicket:id="Document.file" />
</div>
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-20 14:57:34 UTC (rev 139)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/ManageDocumentPage.java 2013-02-20 15:40:59 UTC (rev 140)
@@ -44,6 +44,7 @@
import nc.ird.cantharella.web.utils.forms.SubmittableButton;
import nc.ird.cantharella.web.utils.forms.SubmittableButtonEvents;
import nc.ird.cantharella.web.utils.forms.AutoCompleteTextFieldString.ComparisonMode;
+import nc.ird.cantharella.web.utils.panels.SimpleTooltipPanel;
import nc.ird.cantharella.web.utils.renderers.MapChoiceRenderer;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -67,6 +68,7 @@
import org.apache.wicket.util.lang.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
/**
* Document management page (creation/edition).
@@ -108,6 +110,10 @@
/** Multiple entry. */
private boolean multipleEntry;
+ /** Configuration document max upload size. */
+ @Value("${document.maxUploadSize}")
+ protected long documentMaxUploadSize;
+
/**
* Constructeur (mode création)
* @param callerPage Page appelante
@@ -189,7 +195,7 @@
}
};
formView.setMultiPart(true);
- formView.setMaxSize(Bytes.megabytes(1));
+ formView.setMaxSize(Bytes.megabytes(documentMaxUploadSize));
formView.add(new TextField<String>("Document.titre", new PropertyModel<String>(documentModel, "titre")));
@@ -261,6 +267,7 @@
});
// Fichier
+ formView.add(new SimpleTooltipPanel("Document.file.info", new Model<String>(getString("Document.file.info"))));
formView.add(fileUploadField);
// Action : création du document
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-20 14:57:34 UTC (rev 139)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.html 2013-02-20 15:40:59 UTC (rev 140)
@@ -48,8 +48,9 @@
</div>
<div class="property required">
- <label for="Molecule.formuleBrute"><wicket:message key="Molecule.formuleBrute" /></label>
- <input type="text" id="Molecule.formuleBrute" wicket:id="Molecule.formuleBrute" />
+ <label for="Molecule.formuleBrute"><wicket:message key="Molecule.formuleBrute" />
+ <wicket:container wicket:id="Molecule.formuleBrute.info"/></label>
+ <input type="text" id="Molecule.formuleBrute" wicket:id="Molecule.formuleBrute" />
</div>
<div class="property required">
@@ -61,7 +62,8 @@
<legend><wicket:message key="Molecule.nouvMolecul" /></legend>
<div class="property">
- <label for="Molecule.nouvMolecul"><wicket:message key="Molecule.nouvMolecul" /></label>
+ <label for="Molecule.nouvMolecul"><wicket:message key="Molecule.nouvMolecul" />
+ <wicket:container wicket:id="Molecule.nouvMolecul.info"/></label>
<input type="checkbox" id="Molecule.nouvMolecul" wicket:id="Molecule.nouvMolecul" />
</div>
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-20 14:57:34 UTC (rev 139)
+++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/molecule/ManageMoleculePage.java 2013-02-20 15:40:59 UTC (rev 140)
@@ -69,6 +69,7 @@
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.panels.SimpleTooltipPanel;
import nc.ird.cantharella.web.utils.security.AuthRole;
import nc.ird.cantharella.web.utils.security.AuthRoles;
import nc.ird.cantharella.web.utils.security.AuthSession;
@@ -227,6 +228,8 @@
formView.add(new TextField<String>("Molecule.nomIupca", new PropertyModel<String>(moleculeModel, "nomIupca"))
.setEnabled(editEnabled));
+ formView.add(new SimpleTooltipPanel("Molecule.formuleBrute.info", new Model<String>(
+ getString("Molecule.formuleBrute.info"))));
formView.add(new TextField<String>("Molecule.formuleBrute", new PropertyModel<String>(moleculeModel,
"formuleBrute")).setEnabled(editEnabled));
@@ -243,6 +246,8 @@
formView.add(nouvMoleculRefresh);
// predéclaration des champs activé par la chec
+ formView.add(new SimpleTooltipPanel("Molecule.nouvMolecul.info", new Model<String>(
+ getString("Molecule.nouvMolecul.info"))));
formView.add(new CheckBox("Molecule.nouvMolecul", new PropertyModel<Boolean>(moleculeModel, "nouvMolecul")) {
@Override
protected void onSelectionChanged(Boolean newSelection) {
Modified: trunk/cantharella.web/src/main/resources/cantharella.conf
===================================================================
--- trunk/cantharella.web/src/main/resources/cantharella.conf 2013-02-20 14:57:34 UTC (rev 139)
+++ trunk/cantharella.web/src/main/resources/cantharella.conf 2013-02-20 15:40:59 UTC (rev 140)
@@ -35,4 +35,5 @@
log4j.config=classpath:log4j.xml
# value for production
#log4j.config=/home/tomcat/.config/log4j_prod.xml
-
+#document file max upload size (Mb)
+document.maxUploadSize=1
\ No newline at end of file
Modified: trunk/cantharella.web/src/main/resources/web_en.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/web_en.properties 2013-02-20 14:57:34 UTC (rev 139)
+++ trunk/cantharella.web/src/main/resources/web_en.properties 2013-02-20 15:40:59 UTC (rev 140)
@@ -384,6 +384,8 @@
Molecule.masseMolaire.Required=Molar mass - can’t be null
Molecule.masseMolaire.IConverter.BigDecimal=Molar mass - must be a decimal number
Molecule.downloadMolFile=Download .mol file
+Molecule.formuleBrute.info=Specify in order : Carbon, Hydrogen and then alphabetically
+Molecule.nouvMolecul.info=All users can see molecules. Make sure that molecule is properly published.
TestBio.date.IConverter.Date=The date is incorrectly formatted (DD/MM/YY)
TestBio.concMasseDefaut.IConverter.BigDecimal=Default Conc./Mass - must be a decimal number
@@ -412,6 +414,7 @@
Document.link=Link
Document.type=Type
Document.file=File
+Document.file.info=File size must be less than 1Mb
#BASIC#
Actions=Actions
Modified: trunk/cantharella.web/src/main/resources/web_fr.properties
===================================================================
--- trunk/cantharella.web/src/main/resources/web_fr.properties 2013-02-20 14:57:34 UTC (rev 139)
+++ trunk/cantharella.web/src/main/resources/web_fr.properties 2013-02-20 15:40:59 UTC (rev 140)
@@ -382,6 +382,8 @@
Molecule.masseMolaire.Required=Masse molaire - ne peut être nul
Molecule.masseMolaire.IConverter.BigDecimal=Masse molaire - doit être un nombre décimal
Molecule.downloadMolFile=Télécharger au format mol
+Molecule.formuleBrute.info=Indiquez dans l'ordre : Carbone, Hydrogène puis ordre alphabetique
+Molecule.nouvMolecul.info=Les molécules sont visibles par tous les utilsateurs. Attention à ce que la molécule soit bien publiée.
TestBio.date.IConverter.Date=La date est mal formatée (JJ/MM/AA)
TestBio.concMasseDefaut.IConverter.BigDecimal=Conc./Masse par défaut - doit être un nombre décimal
@@ -410,6 +412,7 @@
Document.link=Lien
Document.type=Type
Document.file=Fichier
+Document.file.info=La taille du fichier doit faire moins de 1Mo
#BASIC#
Actions=Actions
1
0