| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.vues.commentaire;
|
1 |
package org.tela_botanica.client.vues.commentaire;
|
| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import java.util.ArrayList;
|
- |
|
| 4 |
import java.util.Iterator;
|
- |
|
| Line 5... |
Line 3... |
| 5 |
import java.util.List;
|
3 |
import java.util.ArrayList;
|
| 6 |
|
4 |
|
| 7 |
import org.tela_botanica.client.ComposantClass;
|
5 |
import org.tela_botanica.client.ComposantClass;
|
| 8 |
import org.tela_botanica.client.Mediateur;
|
6 |
import org.tela_botanica.client.Mediateur;
|
| 9 |
import org.tela_botanica.client.images.Images;
|
7 |
import org.tela_botanica.client.composants.ChampSliderPourcentage;
|
| 10 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
8 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 11 |
import org.tela_botanica.client.modeles.Information;
|
- |
|
| 12 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
- |
|
| 13 |
import org.tela_botanica.client.modeles.personne.Personne;
|
- |
|
| 14 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
- |
|
| 15 |
import org.tela_botanica.client.modeles.publication.Publication;
|
- |
|
| 16 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
9 |
import org.tela_botanica.client.modeles.Information;
|
| 17 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
- |
|
| 18 |
import org.tela_botanica.client.modeles.structure.Structure;
|
10 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
| 19 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
11 |
import org.tela_botanica.client.modeles.commentaire.Commentaire;
|
| 20 |
import org.tela_botanica.client.util.Pattern;
|
12 |
import org.tela_botanica.client.util.Debug;
|
| 21 |
import org.tela_botanica.client.util.UtilArray;
|
13 |
import org.tela_botanica.client.util.UtilArray;
|
| Line 22... |
Line -... |
| 22 |
import org.tela_botanica.client.util.UtilString;
|
- |
|
| 23 |
import org.tela_botanica.client.vues.Formulaire;
|
14 |
import org.tela_botanica.client.util.UtilString;
|
| 24 |
|
- |
|
| 25 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
- |
|
| 26 |
import com.extjs.gxt.ui.client.event.Events;
|
- |
|
| 27 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
- |
|
| 28 |
import com.extjs.gxt.ui.client.store.ListStore;
|
15 |
import org.tela_botanica.client.vues.Formulaire;
|
| 29 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
- |
|
| 30 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
16 |
|
| 31 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
17 |
import com.extjs.gxt.ui.client.event.Events;
|
| 32 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
18 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
| 33 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
- |
|
| 34 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
- |
|
| 35 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
19 |
import com.extjs.gxt.ui.client.widget.form.CheckBox;
|
| 36 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
20 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
| 37 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
- |
|
| Line 38... |
Line 21... |
| 38 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
21 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
| Line 39... |
Line -... |
| 39 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
- |
|
| 40 |
import com.google.gwt.core.client.GWT;
|
- |
|
| 41 |
|
- |
|
| 42 |
|
- |
|
| 43 |
public class CommentaireForm extends Formulaire implements Rafraichissable {
|
- |
|
| 44 |
|
- |
|
| 45 |
private Publication publication;
|
- |
|
| 46 |
private PublicationAPersonneListe publicationAPersonneListe = null;
|
- |
|
| 47 |
private static boolean publicationAPersonneListeChargementOk = false;
|
22 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
| 48 |
private PublicationAPersonneListe auteursAjoutes = null;
|
- |
|
| 49 |
private PublicationAPersonneListe auteursSupprimes = null;
|
- |
|
| 50 |
|
- |
|
| 51 |
private FieldSet auteursFieldset = null;
|
- |
|
| 52 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
- |
|
| 53 |
private LayoutContainer conteneurChamps;
|
- |
|
| 54 |
private ListStore<Personne> auteursStorePartage = null;
|
- |
|
| 55 |
private static boolean auteurStorePartageChargementOk = false;
|
- |
|
| 56 |
|
- |
|
| 57 |
private FieldSet generalitesFieldset = null;
|
- |
|
| 58 |
private TextField<String> titreChp = null;
|
- |
|
| 59 |
private TextField<String> collectionChp = null;
|
- |
|
| 60 |
private TextField<String> uriChp = null;
|
- |
|
| 61 |
|
- |
|
| 62 |
private FieldSet editionFieldset = null;
|
- |
|
| 63 |
private ComboBox<Structure> editeurCombobox = null;
|
- |
|
| Line -... |
Line 23... |
| - |
|
23 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
| - |
|
24 |
|
| - |
|
25 |
|
| - |
|
26 |
public class CommentaireForm extends Formulaire implements Rafraichissable {
|
| - |
|
27 |
|
| 64 |
private TextField<String> datePublicationChp = null;
|
28 |
private Commentaire commentaire;
|
| 65 |
private TextField<String> tomeChp = null;
|
- |
|
| 66 |
private TextField<String> fasciculeChp = null;
|
29 |
|
| 67 |
private TextField<String> pagesChp = null;
|
- |
|
| 68 |
|
- |
|
| Line 69... |
Line 30... |
| 69 |
private String idStructureEdition = "";
|
30 |
private TextField<String> titreChp;
|
| 70 |
|
31 |
private TextArea texteChp;
|
| 71 |
private static boolean formulaireValideOk = false;
|
32 |
private ChampSliderPourcentage ponderationChp;
|
| Line 72... |
Line 33... |
| 72 |
private static boolean publicationValideOk = false;
|
33 |
private CheckBox publicChp;
|
| 73 |
private static boolean auteursValideOk = false;
|
34 |
|
| 74 |
private static boolean attenteAjoutAuteursOk = true;
|
35 |
private static boolean formulaireValideOk = false;
|
| 75 |
private static boolean attenteSuppressionAuteursOk = true;
|
36 |
private static boolean commentaireValideOk = false;
|
| Line 76... |
Line 37... |
| 76 |
|
37 |
|
| 77 |
public CommentaireForm(Mediateur mediateurCourrant, String publicationId) {
|
- |
|
| 78 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
38 |
public CommentaireForm(Mediateur mediateurCourrant, String commentaireId) {
|
| 79 |
}
|
- |
|
| Line 80... |
Line 39... |
| 80 |
|
39 |
initialiserCommentaireForm(mediateurCourrant, commentaireId);
|
| 81 |
public CommentaireForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
40 |
}
|
| Line 82... |
Line 41... |
| 82 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
41 |
|
| 83 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
42 |
public CommentaireForm(Mediateur mediateurCourrant, String commentaireId, Rafraichissable vueARafraichirApresValidation) {
|
| Line 84... |
Line 43... |
| 84 |
}
|
43 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
| 85 |
|
44 |
initialiserCommentaireForm(mediateurCourrant, commentaireId);
|
| 86 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
45 |
}
|
| Line 87... |
Line 46... |
| 87 |
publicationAPersonneListe = new PublicationAPersonneListe();
|
46 |
|
| 88 |
initialiserValidation();
|
- |
|
| 89 |
initialiserAffichageAuteurs();
|
- |
|
| 90 |
|
- |
|
| 91 |
publication = new Publication();
|
- |
|
| 92 |
publication.setId(publicationId);
|
- |
|
| 93 |
|
- |
|
| 94 |
String modeDeCreation = (UtilString.isEmpty(publication.getId()) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
- |
|
| 95 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
47 |
private void initialiserCommentaireForm(Mediateur mediateurCourrant, String commentaireId) {
|
| 96 |
|
48 |
initialiserValidation();
|
| 97 |
panneauFormulaire.setLayout(new FlowLayout());
|
49 |
|
| 98 |
String titre = genererTitreFormulaire();
|
- |
|
| 99 |
panneauFormulaire.setHeading(titre);
|
50 |
commentaire = new Commentaire();
|
| 100 |
|
51 |
commentaire.setId(commentaireId);
|
| Line 101... |
Line 52... |
| 101 |
creerZoneAuteurs();
|
52 |
|
| 102 |
panneauFormulaire.add(auteursFieldset);
|
53 |
String modeDeCreation = (UtilString.isEmpty(commentaire.getId()) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
| 103 |
|
54 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.COMMENTAIRE);
|
| 104 |
creerZoneGeneralites();
|
55 |
|
| 105 |
panneauFormulaire.add(generalitesFieldset);
|
56 |
panneauFormulaire.setLayout(new FormLayout());
|
| 106 |
|
57 |
String titre = genererTitreFormulaire();
|
| 107 |
creerZoneEdition();
|
58 |
panneauFormulaire.setHeading(titre);
|
| Line 108... |
Line -... |
| 108 |
panneauFormulaire.add(editionFieldset);
|
- |
|
| 109 |
|
- |
|
| 110 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
- |
|
| 111 |
mediateurCourrant.selectionnerPublication(this, publicationId);
|
- |
|
| 112 |
mediateurCourrant.selectionnerPublicationAPersonne(this, publicationId, null, PublicationAPersonne.ROLE_AUTEUR);
|
- |
|
| 113 |
}
|
- |
|
| 114 |
}
|
- |
|
| 115 |
|
- |
|
| 116 |
private String genererTitreFormulaire() {
|
- |
|
| 117 |
String titre = "Ajout d'une publication";
|
- |
|
| 118 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
- |
|
| 119 |
titre = "Modification d'une publication - "+i18nC.id()+": "+publication.getId();
|
- |
|
| 120 |
}
|
- |
|
| 121 |
return titre;
|
- |
|
| 122 |
}
|
- |
|
| 123 |
|
- |
|
| 124 |
private void creerZoneAuteurs() {
|
- |
|
| 125 |
FormLayout layout = new FormLayout();
|
59 |
|
| 126 |
layout.setLabelWidth(200);
|
- |
|
| 127 |
|
- |
|
| 128 |
// Fieldset Auteur
|
- |
|
| 129 |
auteursFieldset = new FieldSet();
|
- |
|
| 130 |
auteursFieldset.setHeading("Auteur(s)");
|
- |
|
| 131 |
auteursFieldset.setCollapsible(true);
|
- |
|
| 132 |
auteursFieldset.setLayout(layout);
|
- |
|
| 133 |
|
- |
|
| 134 |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
|
- |
|
| 135 |
auteursStorePartage = new ListStore<Personne>();
|
- |
|
| 136 |
mediateur.clicObtenirListeAuteurs(this);
|
- |
|
| 137 |
|
- |
|
| 138 |
creerChampsAuteur();
|
- |
|
| 139 |
}
|
- |
|
| 140 |
|
- |
|
| 141 |
private void creerChampsAuteur() {
|
- |
|
| 142 |
auteursFieldset.removeAll();
|
- |
|
| 143 |
|
- |
|
| 144 |
conteneurChamps = new LayoutContainer();
|
- |
|
| 145 |
|
- |
|
| 146 |
Button ajouterAuteurBouton = new Button("Ajouter un auteur");
|
- |
|
| 147 |
ajouterAuteurBouton.setIcon(Images.ICONES.ajouter());
|
- |
|
| 148 |
ajouterAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
| 149 |
@Override
|
- |
|
| 150 |
public void componentSelected(ButtonEvent be) {
|
- |
|
| 151 |
creerChampAuteurEtBoutonSupprimer(null);
|
- |
|
| 152 |
}
|
- |
|
| 153 |
});
|
- |
|
| 154 |
|
- |
|
| 155 |
auteursFieldset.add(conteneurChamps);
|
- |
|
| 156 |
auteursFieldset.add(ajouterAuteurBouton);
|
- |
|
| 157 |
auteursFieldset.layout(true);
|
- |
|
| 158 |
|
- |
|
| 159 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
- |
|
| 160 |
creerChampAuteurEtBoutonSupprimer(null);
|
- |
|
| 161 |
}
|
- |
|
| 162 |
}
|
- |
|
| 163 |
|
- |
|
| 164 |
public void creerChampAuteurEtBoutonSupprimer(Personne auteur) {
|
- |
|
| 165 |
final HorizontalPanel panneauHorizontal = new HorizontalPanel();
|
- |
|
| 166 |
panneauHorizontal.setLayout(new FormLayout());
|
- |
|
| 167 |
|
- |
|
| 168 |
final ComboBox<Personne> auteursSaisisComboBox = creerComboBoxAuteursSaisis();
|
- |
|
| 169 |
if (auteur != null) {
|
- |
|
| 170 |
GWT.log("Auteur peuplé : "+auteur.getId(), null);
|
- |
|
| 171 |
auteursSaisisComboBox.setValue(auteursStorePartage.findModel("id_personne", auteur.getId()));
|
- |
|
| 172 |
auteursSaisisComboBox.validate();
|
- |
|
| 173 |
}
|
- |
|
| 174 |
auteurComboboxListe.add(auteursSaisisComboBox);
|
- |
|
| 175 |
auteursSaisisComboBox.setFieldLabel("Auteur "+auteurComboboxListe.size());
|
- |
|
| 176 |
GWT.log("Nbre de combobox auteur dans liste : "+auteurComboboxListe.size(), null);
|
- |
|
| 177 |
|
- |
|
| 178 |
LayoutContainer panneauChampTxtEtBouton = new LayoutContainer();
|
- |
|
| 179 |
panneauChampTxtEtBouton.setLayout(new FormLayout());
|
- |
|
| 180 |
panneauChampTxtEtBouton.add(auteursSaisisComboBox, new FormData(300, 0));
|
- |
|
| 181 |
panneauHorizontal.add(panneauChampTxtEtBouton);
|
- |
|
| 182 |
|
- |
|
| 183 |
Button supprimerAuteurBouton = new Button();
|
- |
|
| 184 |
supprimerAuteurBouton.setIcon(Images.ICONES.supprimer());
|
- |
|
| 185 |
supprimerAuteurBouton.setToolTip(i18nC.supprimer());
|
- |
|
| 186 |
supprimerAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
| 187 |
@Override
|
- |
|
| 188 |
public void componentSelected(ButtonEvent be) {
|
- |
|
| 189 |
auteurComboboxListe.remove(auteursSaisisComboBox);
|
- |
|
| 190 |
conteneurChamps.remove(panneauHorizontal);
|
- |
|
| 191 |
|
- |
|
| 192 |
int numeroAuteurs = 1;
|
- |
|
| 193 |
for (Iterator<ComboBox<Personne>> it = auteurComboboxListe.iterator(); it.hasNext();) {
|
- |
|
| 194 |
it.next().setFieldLabel("Auteur "+numeroAuteurs);
|
- |
|
| 195 |
numeroAuteurs++;
|
- |
|
| 196 |
}
|
- |
|
| 197 |
|
- |
|
| 198 |
auteursFieldset.layout(true);
|
- |
|
| 199 |
}
|
- |
|
| 200 |
});
|
- |
|
| 201 |
panneauHorizontal.add(supprimerAuteurBouton);
|
- |
|
| 202 |
|
- |
|
| 203 |
conteneurChamps.add(panneauHorizontal);
|
- |
|
| 204 |
auteursFieldset.layout(true);
|
- |
|
| 205 |
}
|
- |
|
| 206 |
|
- |
|
| 207 |
private ComboBox<Personne> creerComboBoxAuteursSaisis() {
|
- |
|
| 208 |
ComboBox<Personne> comboBox = new ComboBox<Personne>();
|
- |
|
| 209 |
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
|
- |
|
| 210 |
comboBox.setEditable(true);
|
- |
|
| 211 |
comboBox.setForceSelection(true);
|
- |
|
| 212 |
comboBox.setDisplayField("fmt_nom_complet");
|
- |
|
| 213 |
comboBox.setTriggerAction(TriggerAction.ALL);
|
- |
|
| 214 |
comboBox.setStore(auteursStorePartage);
|
- |
|
| 215 |
comboBox.addStyleName(ComposantClass.OBLIGATOIRE);
|
60 |
creerChamps();
|
| 216 |
comboBox.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
- |
|
| 217 |
|
61 |
|
| 218 |
return comboBox;
|
62 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
| 219 |
}
|
63 |
mediateur.selectionnerCommentaire(this, commentaireId);
|
| 220 |
|
64 |
}
|
| Line 221... |
Line -... |
| 221 |
private void creerZoneGeneralites() {
|
- |
|
| 222 |
FormLayout layout = new FormLayout();
|
- |
|
| 223 |
layout.setLabelWidth(200);
|
- |
|
| 224 |
|
- |
|
| 225 |
// Fieldset Infos Générales
|
65 |
}
|
| 226 |
generalitesFieldset = new FieldSet();
|
66 |
|
| 227 |
generalitesFieldset.setHeading("Informations générales");
|
67 |
private String genererTitreFormulaire() {
|
| 228 |
generalitesFieldset.setCollapsible(true);
|
- |
|
| 229 |
generalitesFieldset.setLayout(layout);
|
- |
|
| 230 |
|
- |
|
| 231 |
titreChp = new TextField<String>();
|
- |
|
| 232 |
titreChp.setName("cpu");
|
- |
|
| 233 |
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
|
- |
|
| 234 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
- |
|
| 235 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
- |
|
| 236 |
generalitesFieldset.add(titreChp, new FormData(450, 0));
|
- |
|
| 237 |
|
- |
|
| 238 |
collectionChp = new TextField<String>();
|
- |
|
| 239 |
collectionChp.setFieldLabel("Intitulé de la revue ou de la collection");
|
- |
|
| 240 |
generalitesFieldset.add(collectionChp, new FormData(450, 0));
|
- |
|
| 241 |
|
- |
|
| 242 |
uriChp = new TextField<String>();
|
- |
|
| 243 |
uriChp.setFieldLabel("URL de la publication");
|
- |
|
| 244 |
generalitesFieldset.add(uriChp, new FormData(450, 0));
|
- |
|
| 245 |
}
|
- |
|
| 246 |
|
- |
|
| 247 |
private void creerZoneEdition() {
|
- |
|
| 248 |
FormLayout layout = new FormLayout();
|
- |
|
| 249 |
layout.setLabelWidth(200);
|
- |
|
| 250 |
|
68 |
String titre = i18nC.commentaireTitreFormAjout();
|
| 251 |
// Fieldset Edition
|
- |
|
| 252 |
editionFieldset = new FieldSet();
|
- |
|
| 253 |
editionFieldset.setHeading("Édition");
|
- |
|
| 254 |
editionFieldset.setCollapsible(true);
|
- |
|
| 255 |
editionFieldset.setLayout(layout);
|
- |
|
| 256 |
|
69 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 257 |
ListStore<Structure> editeurStore = new ListStore<Structure>();
|
70 |
titre = i18nC.commentaireTitreFormModif()+" - "+i18nC.id()+": "+commentaire.getId();
|
| 258 |
editeurCombobox = new ComboBox<Structure>();
|
- |
|
| 259 |
editeurCombobox.setEmptyText("Sélectionner un éditeur...");
|
- |
|
| 260 |
editeurCombobox.setFieldLabel("Éditeur de la publication");
|
- |
|
| 261 |
editeurCombobox.setDisplayField("nom");
|
- |
|
| 262 |
editeurCombobox.setStore(editeurStore);
|
- |
|
| 263 |
editeurCombobox.setEditable(true);
|
- |
|
| 264 |
editeurCombobox.setTriggerAction(TriggerAction.ALL);
|
- |
|
| 265 |
editionFieldset.add(editeurCombobox, new FormData(450, 0));
|
- |
|
| 266 |
mediateur.clicObtenirListeEditeurs(this);
|
71 |
}
|
| 267 |
|
72 |
return titre;
|
| 268 |
datePublicationChp = new TextField<String>();
|
73 |
}
|
| 269 |
datePublicationChp.setMaxLength(4);
|
- |
|
| 270 |
datePublicationChp.setMinLength(4);
|
74 |
|
| 271 |
datePublicationChp.setFieldLabel("Année de publication");
|
75 |
private void creerChamps() {
|
| 272 |
datePublicationChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
76 |
titreChp = new TextField<String>();
|
| 273 |
datePublicationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
77 |
titreChp.setFieldLabel(i18nC.commentaireTitre());
|
| 274 |
editionFieldset.add(datePublicationChp, new FormData(40, 0));
|
78 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
| 275 |
|
79 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
| 276 |
tomeChp = new TextField<String>();
|
80 |
panneauFormulaire.add(titreChp, new FormData(450, 0));
|
| 277 |
tomeChp.setFieldLabel("Série de la revue ou tome");
|
- |
|
| 278 |
editionFieldset.add(tomeChp, new FormData(75, 0));
|
- |
|
| 279 |
|
- |
|
| 280 |
fasciculeChp = new TextField<String>();
|
- |
|
| 281 |
fasciculeChp.setFieldLabel("Fascicule de la revue");
|
- |
|
| 282 |
editionFieldset.add(fasciculeChp, new FormData(75, 0));
|
81 |
|
| 283 |
|
82 |
texteChp = new TextArea();
|
| 284 |
pagesChp = new TextField<String>();
|
83 |
texteChp.setFieldLabel(i18nC.commentaireTexte());
|
| 285 |
pagesChp.setFieldLabel("Pages");
|
84 |
panneauFormulaire.add(texteChp, new FormData(450, 250));
|
| 286 |
pagesChp.setToolTip("Fomat : NBRE ou NBRE-NBRE. ('NBRE' correspond à une suite de chiffres arabes ou romains ou à un point d'interrogation '?' dans le cas d'une donnée inconnue)");
|
- |
|
| 287 |
editionFieldset.add(pagesChp, new FormData(100, 0));
|
- |
|
| 288 |
}
|
- |
|
| 289 |
|
- |
|
| 290 |
public void rafraichir(Object nouvellesDonnees) {
|
- |
|
| 291 |
if (nouvellesDonnees instanceof Publication) {
|
85 |
|
| Line 292... |
Line 86... |
| 292 |
// Si on a reçu les details d'une publication
|
86 |
ponderationChp = new ChampSliderPourcentage(i18nC.commentairePonderation());
|
| 293 |
rafraichirPublication((Publication) nouvellesDonnees);
|
87 |
panneauFormulaire.add(ponderationChp, new FormData(450, 0));
|
| 294 |
} else if (nouvellesDonnees instanceof StructureListe) {
|
88 |
|
| 295 |
// Si on a reçu une liste des editeurs
|
89 |
publicChp = new CheckBox();
|
| 296 |
rafraichirListeEditeurs((StructureListe) nouvellesDonnees);
|
90 |
publicChp.setFieldLabel(i18nC.donneePublic());
|
| 297 |
} else if (nouvellesDonnees instanceof PublicationAPersonneListe) {
|
91 |
panneauFormulaire.add(publicChp, new FormData(50, 0));
|
| Line 298... |
Line 92... |
| 298 |
rafraichirListeAuteurs((PublicationAPersonneListe) nouvellesDonnees);
|
92 |
}
|
| 299 |
} else if (nouvellesDonnees instanceof Information) {
|
- |
|
| 300 |
rafraichirInformation((Information) nouvellesDonnees);
|
- |
|
| 301 |
} else {
|
- |
|
| 302 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
93 |
|
| 303 |
}
|
- |
|
| 304 |
|
- |
|
| 305 |
if (etrePretAAfficherAuteurs()) {
|
- |
|
| 306 |
initialiserAffichageAuteurs();
|
- |
|
| 307 |
afficherAuteurs();
|
- |
|
| 308 |
}
|
- |
|
| 309 |
|
- |
|
| 310 |
if (etreValide()) {
|
- |
|
| 311 |
initialiserValidation();
|
- |
|
| 312 |
repandreRafraichissement();
|
- |
|
| 313 |
controlerFermetureApresRafraichissement();
|
- |
|
| 314 |
}
|
- |
|
| 315 |
}
|
- |
|
| 316 |
|
- |
|
| 317 |
private void miseAJourPublicationAPersonneListe() {
|
- |
|
| 318 |
GWT.log("Mise à jour liste publication à personne", null);
|
94 |
public void rafraichir(Object nouvellesDonnees) {
|
| 319 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
95 |
if (nouvellesDonnees instanceof Commentaire) {
|
| Line 320... |
Line -... |
| 320 |
while (clesAjoutees.hasNext()) {
|
- |
|
| 321 |
String id = clesAjoutees.next();
|
- |
|
| 322 |
publicationAPersonneListe.put(id, auteursAjoutes.get(id));
|
- |
|
| 323 |
GWT.log("Auteurs ajouté :"+publicationAPersonneListe.get(id).getPersonne().getNomComplet(), null);
|
- |
|
| 324 |
}
|
- |
|
| 325 |
|
- |
|
| 326 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
- |
|
| 327 |
while (clesSupprimees.hasNext()) {
|
- |
|
| 328 |
String id = clesSupprimees.next();
|
- |
|
| 329 |
publicationAPersonneListe.remove(id);
|
- |
|
| 330 |
GWT.log("Personne surpprimé :"+id, null);
|
- |
|
| 331 |
}
|
- |
|
| 332 |
GWT.log("Nbre auteurs après maj :"+publicationAPersonneListe.size(), null);
|
- |
|
| 333 |
}
|
- |
|
| 334 |
|
- |
|
| 335 |
private void rafraichirPublication(Publication publi) {
|
96 |
// Si on a reçu les details d'une publication
|
| 336 |
publication = publi;
|
- |
|
| 337 |
peuplerFormulaire();
|
- |
|
| 338 |
}
|
- |
|
| 339 |
|
- |
|
| 340 |
private void rafraichirListeEditeurs(StructureListe editeurs) {
|
97 |
rafraichirCommentaire((Commentaire) nouvellesDonnees);
|
| 341 |
editeurCombobox.getStore().removeAll();
|
- |
|
| 342 |
editeurCombobox.getStore().add((List<Structure>) editeurs.toList());
|
- |
|
| 343 |
|
- |
|
| 344 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
98 |
} else if (nouvellesDonnees instanceof Information) {
|
| 345 |
editeurCombobox.setValue((Structure) editeurs.get(idStructureEdition));
|
99 |
rafraichirInformation((Information) nouvellesDonnees);
|
| 346 |
}
|
100 |
} else {
|
| 347 |
editeurCombobox.expand();
|
- |
|
| 348 |
}
|
- |
|
| 349 |
|
- |
|
| 350 |
private void rafraichirListeAuteurs(PublicationAPersonneListe auteurs) {
|
- |
|
| 351 |
publicationAPersonneListe = auteurs;
|
- |
|
| 352 |
publicationAPersonneListeChargementOk = true;
|
- |
|
| 353 |
}
|
- |
|
| 354 |
|
- |
|
| 355 |
private void rafraichirInformation(Information info) {
|
- |
|
| 356 |
if (info.getType().equals("liste_personne")) {
|
- |
|
| 357 |
PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
|
- |
|
| 358 |
|
101 |
Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
|
| 359 |
List<Personne> liste = listePersonneAuteur.toList();
|
- |
|
| 360 |
auteursStorePartage.removeAll();
|
- |
|
| 361 |
auteursStorePartage.add(liste);
|
- |
|
| 362 |
|
- |
|
| 363 |
auteurStorePartageChargementOk = true;
|
- |
|
| 364 |
} else if (info.getType().equals("publication_valide")) {
|
- |
|
| 365 |
publicationValideOk = true;
|
- |
|
| 366 |
publication.setId((String) info.getDonnee(0));
|
- |
|
| 367 |
|
- |
|
| 368 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
- |
|
| 369 |
attenteAjoutAuteursOk = true;
|
- |
|
| 370 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
|
- |
|
| 371 |
}
|
- |
|
| 372 |
} else if (info.getType().equals("ajout_publication_a_personne")) {
|
- |
|
| 373 |
attenteAjoutAuteursOk = false;
|
- |
|
| 374 |
GWT.log("attenteAjoutAuteursOk", null);
|
- |
|
| 375 |
} else if (info.getType().equals("suppression_publication_a_personne")) {
|
- |
|
| 376 |
attenteSuppressionAuteursOk = false;
|
- |
|
| 377 |
GWT.log("attenteSuppressionAuteursOk", null);
|
- |
|
| 378 |
}
|
- |
|
| 379 |
|
- |
|
| 380 |
if (avoirAuteursMiseAJourCorrectement()) {
|
- |
|
| 381 |
auteursValideOk = true;
|
- |
|
| 382 |
miseAJourPublicationAPersonneListe();
|
- |
|
| 383 |
initialiserAuteurs();
|
- |
|
| 384 |
}
|
- |
|
| 385 |
}
|
- |
|
| 386 |
|
- |
|
| 387 |
private boolean avoirAuteursMiseAJourCorrectement() {
|
- |
|
| 388 |
boolean ok = false;
|
- |
|
| 389 |
if (attenteAjoutAuteursOk == false && attenteSuppressionAuteursOk == false) {
|
- |
|
| 390 |
ok = true;
|
- |
|
| 391 |
}
|
- |
|
| 392 |
return ok;
|
- |
|
| 393 |
}
|
- |
|
| 394 |
|
102 |
}
|
| Line 395... |
Line 103... |
| 395 |
private void afficherAuteurs() {
|
103 |
|
| 396 |
Iterator<String> itap = publicationAPersonneListe.keySet().iterator();
|
104 |
if (etreValide()) {
|
| 397 |
GWT.log("Auteur"+publicationAPersonneListe.size(), null);
|
105 |
initialiserValidation();
|
| 398 |
while (itap.hasNext()) {
|
106 |
repandreRafraichissement();
|
| 399 |
creerChampAuteurEtBoutonSupprimer(publicationAPersonneListe.get(itap.next()).getPersonne());
|
107 |
controlerFermetureApresRafraichissement();
|
| 400 |
}
|
108 |
}
|
| 401 |
}
|
109 |
}
|
| 402 |
|
110 |
|
| Line 403... |
Line 111... |
| 403 |
private void initialiserAffichageAuteurs() {
|
111 |
private void rafraichirCommentaire(Commentaire commentaireRecu) {
|
| 404 |
auteurStorePartageChargementOk = false;
|
112 |
commentaire = commentaireRecu;
|
| 405 |
publicationAPersonneListeChargementOk = false;
|
- |
|
| 406 |
}
|
- |
|
| 407 |
|
113 |
peuplerFormulaire();
|
| 408 |
private boolean etrePretAAfficherAuteurs() {
|
- |
|
| 409 |
boolean ok = false;
|
- |
|
| 410 |
if (auteurStorePartageChargementOk && publicationAPersonneListeChargementOk) {
|
- |
|
| 411 |
ok = true;
|
- |
|
| 412 |
}
|
- |
|
| 413 |
return ok;
|
- |
|
| 414 |
}
|
- |
|
| 415 |
|
114 |
}
|
| Line 416... |
Line 115... |
| 416 |
private Boolean etreValide() {
|
115 |
|
| 417 |
Boolean valide = false;
|
116 |
private void rafraichirInformation(Information info) {
|
| 418 |
GWT.log("formulaire"+formulaireValideOk+" - Publication :"+publicationValideOk+" - Auteurs :"+auteursValideOk, null);
|
117 |
String type = info.getType();
|
| 419 |
if (formulaireValideOk && publicationValideOk && auteursValideOk) {
|
118 |
if (type.equals("ajout_commentaire") || type.equals("modif_commentaire")) {
|
| 420 |
valide = true;
|
119 |
commentaireValideOk = true;
|
| 421 |
}
|
120 |
commentaire.setId((String) info.getDonnee(0));
|
| 422 |
return valide;
|
121 |
}
|
| 423 |
}
|
122 |
}
|
| 424 |
|
123 |
|
| 425 |
private void initialiserValidation() {
|
124 |
private Boolean etreValide() {
|
| 426 |
formulaireValideOk = false;
|
125 |
Boolean valide = false;
|
| Line 427... |
Line 126... |
| 427 |
publicationValideOk = false;
|
126 |
Debug.log("formulaire"+formulaireValideOk+" - Commentaire :"+commentaireValideOk);
|
| 428 |
initialiserAuteurs();
|
127 |
if (formulaireValideOk && commentaireValideOk) {
|
| 429 |
auteursValideOk = false;
|
128 |
valide = true;
|
| 430 |
}
|
129 |
}
|
| 431 |
|
- |
|
| 432 |
private void initialiserAuteurs() {
|
130 |
return valide;
|
| 433 |
attenteAjoutAuteursOk = true;
|
131 |
}
|
| 434 |
auteursAjoutes = new PublicationAPersonneListe();
|
132 |
|
| 435 |
attenteSuppressionAuteursOk = true;
|
133 |
private void initialiserValidation() {
|
| Line 436... |
Line 134... |
| 436 |
auteursSupprimes = new PublicationAPersonneListe();
|
134 |
formulaireValideOk = false;
|
| 437 |
}
|
135 |
commentaireValideOk = false;
|
| 438 |
|
136 |
}
|
| 439 |
private void repandreRafraichissement() {
|
137 |
|
| 440 |
if (vueExterneARafraichirApresValidation != null) {
|
138 |
private void repandreRafraichissement() {
|
| 441 |
String type = "publication_modifiee";
|
139 |
if (vueExterneARafraichirApresValidation != null) {
|
| 442 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
140 |
String type = "commentaire_modifiee";
|
| 443 |
type = "publication_ajoutee";
|
141 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
| 444 |
}
|
- |
|
| 445 |
Information info = new Information(type);
|
- |
|
| 446 |
info.setDonnee(0, publication);
|
- |
|
| 447 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
- |
|
| 448 |
}
|
- |
|
| 449 |
}
|
- |
|
| 450 |
|
- |
|
| 451 |
public boolean soumettreFormulaire() {
|
- |
|
| 452 |
formulaireValideOk = verifierFormulaire();
|
- |
|
| 453 |
GWT.log("Form?"+formulaireValideOk, null);
|
- |
|
| 454 |
if (formulaireValideOk) {
|
- |
|
| 455 |
soumettrePublication();
|
- |
|
| 456 |
soumettreAuteurs();
|
- |
|
| 457 |
}
|
- |
|
| 458 |
return formulaireValideOk;
|
- |
|
| 459 |
}
|
- |
|
| 460 |
|
- |
|
| 461 |
private void soumettrePublication() {
|
- |
|
| 462 |
Publication publicationCollectee = collecterPublication();
|
- |
|
| 463 |
if (publicationCollectee != null) {
|
- |
|
| 464 |
GWT.log("Info public collectée ? ok", null);
|
- |
|
| 465 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
- |
|
| 466 |
mediateur.ajouterPublication(this, publicationCollectee);
|
- |
|
| 467 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
- |
|
| 468 |
mediateur.modifierPublication(this, publicationCollectee);
|
- |
|
| 469 |
}
|
- |
|
| 470 |
}
|
- |
|
| 471 |
}
|
- |
|
| 472 |
|
- |
|
| 473 |
private void soumettreAuteurs() {
|
- |
|
| 474 |
attenteAjoutAuteursOk = false;
|
- |
|
| 475 |
attenteSuppressionAuteursOk = false;
|
- |
|
| 476 |
|
- |
|
| 477 |
PersonneListe personnesInitiales = new PersonneListe();
|
- |
|
| 478 |
if (publicationAPersonneListe != null) {
|
- |
|
| 479 |
GWT.log("Nbre auteur initial :"+publicationAPersonneListe.size(), null);
|
- |
|
| 480 |
Iterator<String> itap = publicationAPersonneListe.keySet().iterator();
|
- |
|
| 481 |
while (itap.hasNext()) {
|
- |
|
| 482 |
Personne personne = publicationAPersonneListe.get(itap.next()).getPersonne();
|
- |
|
| 483 |
GWT.log("Auteur initial :"+personne.getNomComplet(), null);
|
- |
|
| 484 |
personnesInitiales.put(personne.getId(), personne);
|
- |
|
| 485 |
}
|
- |
|
| 486 |
}
|
- |
|
| 487 |
|
- |
|
| 488 |
PersonneListe personnesActuelles = new PersonneListe();
|
- |
|
| 489 |
GWT.log("Nbre auteur actuel :"+auteurComboboxListe.size(), null);
|
- |
|
| 490 |
for (int i = 0; i < auteurComboboxListe.size(); i++) {
|
- |
|
| 491 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
- |
|
| 492 |
Personne personne = auteurComboboxListe.get(i).getValue();
|
- |
|
| 493 |
personnesActuelles.put(personne.getId(), personne);
|
- |
|
| 494 |
}
|
- |
|
| 495 |
}
|
- |
|
| 496 |
|
- |
|
| 497 |
// Auteurs ajoutés
|
- |
|
| 498 |
Iterator<String> clesActuelles = personnesActuelles.keySet().iterator();
|
- |
|
| 499 |
while (clesActuelles.hasNext()) {
|
- |
|
| 500 |
String idActuel = clesActuelles.next();
|
- |
|
| 501 |
if (personnesInitiales.size() == 0 || personnesInitiales.get(idActuel) == null) {
|
- |
|
| 502 |
Personne personne = personnesActuelles.get(idActuel);
|
- |
|
| 503 |
GWT.log("Auteur ajouté :"+personne.getNomComplet(), null);
|
- |
|
| 504 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
- |
|
| 505 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
- |
|
| 506 |
publicationAAuteur.setIdPublication(publication.getId());
|
- |
|
| 507 |
}
|
- |
|
| 508 |
publicationAAuteur.setPersonne(personne);
|
- |
|
| 509 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
- |
|
| 510 |
auteursAjoutes.put(publicationAAuteur.getId(), publicationAAuteur);
|
- |
|
| 511 |
attenteAjoutAuteursOk = true;
|
- |
|
| 512 |
}
|
- |
|
| 513 |
}
|
- |
|
| 514 |
|
- |
|
| 515 |
// Auteurs supprimés
|
- |
|
| 516 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
142 |
type = "commentaire_ajoutee";
|
| 517 |
Iterator<String> clesInitiales = personnesInitiales.keySet().iterator();
|
143 |
}
|
| 518 |
while (clesInitiales.hasNext()) {
|
144 |
Information info = new Information(type);
|
| Line 519... |
Line 145... |
| 519 |
String idInitial = clesInitiales.next();
|
145 |
info.setDonnee(0, commentaire);
|
| 520 |
if (personnesActuelles.size() == 0 || personnesActuelles.get(idInitial) == null) {
|
146 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
| 521 |
Personne personne = personnesInitiales.get(idInitial);
|
147 |
}
|
| Line 522... |
Line -... |
| 522 |
GWT.log("Auteur supprimé :"+personne.getNomComplet(), null);
|
- |
|
| 523 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
- |
|
| 524 |
publicationAAuteur.setIdPublication(publication.getId());
|
- |
|
| 525 |
publicationAAuteur.setPersonne(personne);
|
- |
|
| 526 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
- |
|
| 527 |
auteursSupprimes.put(publicationAAuteur.getId(), publicationAAuteur);
|
- |
|
| 528 |
attenteSuppressionAuteursOk = true;
|
- |
|
| 529 |
}
|
- |
|
| 530 |
}
|
- |
|
| 531 |
}
|
- |
|
| 532 |
|
- |
|
| 533 |
// Execution de les mise à jour pour le mode MODIFICATION
|
148 |
}
|
| 534 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
149 |
|
| 535 |
if (auteursAjoutes != null && auteursAjoutes.size() != 0) {
|
- |
|
| 536 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
|
- |
|
| 537 |
}
|
- |
|
| 538 |
|
- |
|
| 539 |
if (auteursSupprimes != null && auteursSupprimes.size() != 0) {
|
- |
|
| 540 |
mediateur.supprimerPublicationAPersonne(this, auteursSupprimes);
|
- |
|
| 541 |
}
|
- |
|
| 542 |
}
|
- |
|
| 543 |
}
|
- |
|
| 544 |
|
- |
|
| 545 |
public boolean verifierFormulaire() {
|
- |
|
| 546 |
boolean valide = true;
|
- |
|
| 547 |
ArrayList<String> messages = new ArrayList<String>();
|
- |
|
| 548 |
|
- |
|
| 549 |
boolean auteurErreur = true;
|
- |
|
| 550 |
for (int i = 0; i < auteurComboboxListe.size(); i++) {
|
- |
|
| 551 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
- |
|
| 552 |
auteurErreur = false;
|
- |
|
| 553 |
break;
|
- |
|
| 554 |
}
|
- |
|
| 555 |
}
|
150 |
public boolean soumettreFormulaire() {
|
| 556 |
if (auteurErreur) {
|
151 |
formulaireValideOk = verifierFormulaire();
|
| Line 557... |
Line 152... |
| 557 |
messages.add("Veuillez saisir au moins un auteur !");
|
152 |
Debug.log("Form?"+formulaireValideOk);
|
| 558 |
}
|
153 |
if (formulaireValideOk) {
|
| 559 |
|
154 |
soumettreCommentaire();
|
| 560 |
String titre = titreChp.getValue();
|
155 |
}
|
| 561 |
if (titre == null || titre.equals("")) {
|
156 |
return formulaireValideOk;
|
| 562 |
messages.add("Veuillez saisir le titre de la publication !");
|
157 |
}
|
| 563 |
}
|
158 |
|
| 564 |
|
159 |
private void soumettreCommentaire() {
|
| Line 565... |
Line 160... |
| 565 |
String uri = uriChp.getValue();
|
160 |
Commentaire commentaireCollectee = collecterCommentaire();
|
| 566 |
if (uri != null && ! uri.isEmpty() && ! uri.matches(Pattern.url)) {
|
- |
|
| 567 |
messages.add("L'URL saisie n'est pas valide !");
|
161 |
if (commentaireCollectee != null) {
|
| 568 |
}
|
- |
|
| 569 |
|
162 |
Debug.log("Info public collectée ? ok");
|
| 570 |
String datePublication = datePublicationChp.getRawValue();
|
- |
|
| 571 |
if (datePublication == null || datePublication.equals("")) {
|
163 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
| 572 |
messages.add("Veuillez saisir une année de parution !");
|
164 |
mediateur.ajouterCommentaire(this, commentaireCollectee);
|
| 573 |
} else {
|
165 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 574 |
if (!etreDateValide(datePublication)) {
|
- |
|
| 575 |
messages.add("Le format de l'année saisie est incorrect !");
|
- |
|
| 576 |
}
|
- |
|
| 577 |
}
|
- |
|
| 578 |
|
- |
|
| 579 |
String pages = pagesChp.getValue();
|
- |
|
| 580 |
String valeurPage = "(?:[0-9]+|[IVXLCDM]+|\\?)";
|
- |
|
| 581 |
if (pages != null && ! pages.matches("^(?:"+valeurPage+"|"+valeurPage+"-"+valeurPage+")$")) {
|
166 |
mediateur.modifierCommentaire(this, commentaireCollectee);
|
| Line 582... |
Line 167... |
| 582 |
messages.add("Le format des pages est incorrect !");
|
167 |
}
|
| 583 |
}
|
168 |
}
|
| 584 |
|
- |
|
| 585 |
if (messages.size() != 0) {
|
- |
|
| 586 |
String[] tableauDeMessages = {};
|
- |
|
| 587 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
- |
|
| 588 |
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
|
- |
|
| 589 |
valide = false;
|
- |
|
| 590 |
}
|
- |
|
| 591 |
return valide;
|
- |
|
| 592 |
}
|
- |
|
| 593 |
|
- |
|
| 594 |
private void peuplerFormulaire() {
|
- |
|
| 595 |
creerChampsAuteur();
|
- |
|
| 596 |
titreChp.setValue(publication.getTitre());
|
- |
|
| 597 |
collectionChp.setValue(publication.getCollection());
|
- |
|
| Line 598... |
Line 169... |
| 598 |
uriChp.setValue(publication.getURI());
|
169 |
}
|
| 599 |
datePublicationChp.setRawValue(reduireDateParAnnee(publication.getDateParution()));
|
170 |
|
| 600 |
tomeChp.setValue(publication.getIndicationNvt());
|
- |
|
| 601 |
fasciculeChp.setValue(publication.getFascicule());
|
- |
|
| 602 |
pagesChp.setValue(publication.getPages());
|
- |
|
| 603 |
|
- |
|
| 604 |
if (publication.getEditeur().matches("^[0-9]+$")) {
|
- |
|
| 605 |
editeurCombobox.setValue(editeurCombobox.getStore().findModel("id_structure", publication.getEditeur()));
|
- |
|
| 606 |
idStructureEdition = publication.getEditeur();
|
- |
|
| 607 |
} else {
|
- |
|
| 608 |
editeurCombobox.setRawValue(publication.getEditeur());
|
- |
|
| 609 |
}
|
- |
|
| 610 |
}
|
- |
|
| 611 |
|
- |
|
| 612 |
private Publication collecterPublication() {
|
- |
|
| 613 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
- |
|
| 614 |
|
- |
|
| 615 |
String auteurIntituleFormate = "";
|
- |
|
| 616 |
int auteursNombre = auteurComboboxListe.size();
|
- |
|
| 617 |
for (int i = 0; i < auteursNombre; i++) {
|
- |
|
| 618 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
- |
|
| 619 |
Personne auteur = auteurComboboxListe.get(i).getValue();
|
- |
|
| 620 |
auteurIntituleFormate += auteur.getNom()+ " "+auteur.getPrenom();
|
- |
|
| 621 |
if (i != (auteursNombre - 1)) {
|
- |
|
| Line 622... |
Line 171... |
| 622 |
auteurIntituleFormate += ", ";
|
171 |
public boolean verifierFormulaire() {
|
| 623 |
}
|
172 |
boolean valide = true;
|
| Line 624... |
Line 173... |
| 624 |
}
|
173 |
ArrayList<String> messages = new ArrayList<String>();
|
| 625 |
}
|
174 |
|
| Line 626... |
Line 175... |
| 626 |
GWT.log("Auteurs formaté :"+auteurIntituleFormate, null);
|
175 |
String titre = titreChp.getValue();
|
| 627 |
publicationCollectee.setAuteur(auteurIntituleFormate);
|
176 |
if (titre == null || titre.equals("")) {
|
| Line 628... |
Line 177... |
| 628 |
|
177 |
messages.add(i18nC.commentaireMessageTitre());
|
| 629 |
String titre = titreChp.getValue();
|
178 |
}
|
| 630 |
publicationCollectee.setTitre(titre);
|
179 |
|
| 631 |
|
180 |
if (messages.size() != 0) {
|
| 632 |
String collection = collectionChp.getValue();
|
181 |
String[] tableauDeMessages = {};
|
| 633 |
publicationCollectee.setCollection(collection);
|
182 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
| Line 634... |
Line 183... |
| 634 |
|
183 |
MessageBox.alert(i18nC.erreurSaisieTitre(), UtilArray.implode(tableauDeMessages, "<br />"), null);
|
| 635 |
String nomComplet = titreChp.getValue()+" "+collectionChp.getValue();
|
184 |
valide = false;
|
| 636 |
publicationCollectee.setNomComplet(nomComplet);
|
185 |
}
|
| 637 |
|
186 |
return valide;
|
| 638 |
String uri = uriChp.getValue();
|
187 |
}
|
| 639 |
publicationCollectee.setUri(uri);
|
188 |
|
| 640 |
|
189 |
private void peuplerFormulaire() {
|
| 641 |
String editeur = "";
|
- |
|
| 642 |
if (editeurCombobox.getValue() != null) {
|
- |
|
| 643 |
editeur = editeurCombobox.getValue().getId();
|
- |
|
| 644 |
publicationCollectee.setStructureEditeur(editeurCombobox.getValue());
|
- |
|
| 645 |
} else if (editeurCombobox.getRawValue() != "") {
|
- |
|
| 646 |
editeur = editeurCombobox.getRawValue();
|
- |
|
| 647 |
}
|
- |
|
| 648 |
publicationCollectee.setEditeur(editeur);
|
- |
|
| 649 |
|
- |
|
| 650 |
String anneePublication = datePublicationChp.getRawValue();
|
- |
|
| 651 |
String datePublication = anneePublication+"-00-00";
|
- |
|
| 652 |
publicationCollectee.setDateParution(datePublication);
|
- |
|
| 653 |
|
- |
|
| 654 |
String tome = tomeChp.getValue();
|
- |
|
| 655 |
publicationCollectee.setIndicationNvt(tome);
|
- |
|
| 656 |
|
- |
|
| 657 |
String fascicule = fasciculeChp.getValue();
|
190 |
titreChp.setValue(commentaire.getTitre());
|
| 658 |
publicationCollectee.setFascicule(fascicule);
|
191 |
texteChp.setValue(commentaire.getTexte());
|