| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.vues;
|
1 |
package org.tela_botanica.client.vues;
|
| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import java.util.ArrayList;
|
3 |
import java.util.ArrayList;
|
| 4 |
import java.util.Iterator;
|
4 |
import java.util.Iterator;
|
| 5 |
import java.util.List;
|
- |
|
| Line 6... |
Line 5... |
| 6 |
import java.util.Set;
|
5 |
import java.util.List;
|
| 7 |
|
6 |
|
| 8 |
import org.tela_botanica.client.Mediateur;
|
7 |
import org.tela_botanica.client.Mediateur;
|
| 9 |
import org.tela_botanica.client.RegistreId;
|
8 |
import org.tela_botanica.client.images.Images;
|
| 10 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
9 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 11 |
import org.tela_botanica.client.modeles.Information;
|
10 |
import org.tela_botanica.client.modeles.Information;
|
| 12 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
11 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
| 13 |
import org.tela_botanica.client.modeles.Personne;
|
12 |
import org.tela_botanica.client.modeles.Personne;
|
| 14 |
import org.tela_botanica.client.modeles.PersonneListe;
|
13 |
import org.tela_botanica.client.modeles.PersonneListe;
|
| 15 |
import org.tela_botanica.client.modeles.Publication;
|
14 |
import org.tela_botanica.client.modeles.Publication;
|
| 16 |
import org.tela_botanica.client.modeles.PublicationAPersonne;
|
- |
|
| 17 |
import org.tela_botanica.client.modeles.PublicationAPersonneListe;
|
15 |
import org.tela_botanica.client.modeles.PublicationAPersonne;
|
| 18 |
import org.tela_botanica.client.modeles.PublicationListe;
|
16 |
import org.tela_botanica.client.modeles.PublicationAPersonneListe;
|
| 19 |
import org.tela_botanica.client.modeles.Structure;
|
17 |
import org.tela_botanica.client.modeles.Structure;
|
| 20 |
import org.tela_botanica.client.modeles.StructureListe;
|
18 |
import org.tela_botanica.client.modeles.StructureListe;
|
| Line 21... |
Line -... |
| 21 |
import org.tela_botanica.client.util.Pattern;
|
- |
|
| 22 |
import org.tela_botanica.client.util.UtilArray;
|
- |
|
| 23 |
|
- |
|
| 24 |
import com.extjs.gxt.ui.client.Registry;
|
19 |
import org.tela_botanica.client.util.Pattern;
|
| 25 |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
- |
|
| 26 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
- |
|
| 27 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
- |
|
| 28 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
- |
|
| 29 |
import com.extjs.gxt.ui.client.event.Events;
|
20 |
import org.tela_botanica.client.util.UtilArray;
|
| 30 |
import com.extjs.gxt.ui.client.event.KeyListener;
|
21 |
|
| 31 |
import com.extjs.gxt.ui.client.event.Listener;
|
22 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
| 32 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
23 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
| 33 |
import com.extjs.gxt.ui.client.store.ListStore;
|
24 |
import com.extjs.gxt.ui.client.store.ListStore;
|
| 34 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
25 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
| 35 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
26 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
| 36 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
- |
|
| 37 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
27 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
| 38 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
- |
|
| 39 |
import com.extjs.gxt.ui.client.widget.form.DateField;
|
- |
|
| 40 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
28 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
| 41 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
29 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
| 42 |
import com.extjs.gxt.ui.client.widget.form.Radio;
|
- |
|
| 43 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
- |
|
| 44 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
- |
|
| 45 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
- |
|
| 46 |
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
- |
|
| 47 |
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
30 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
| 48 |
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
31 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
| 49 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
32 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
| 50 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
33 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
| 51 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
- |
|
| 52 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
- |
|
| 53 |
import com.google.gwt.core.client.GWT;
|
- |
|
| Line 54... |
Line 34... |
| 54 |
import com.google.gwt.user.client.Window;
|
34 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
| Line 55... |
Line 35... |
| 55 |
import com.google.gwt.user.client.ui.HTML;
|
35 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
| 56 |
import com.google.gwt.user.client.ui.Label;
|
36 |
import com.google.gwt.core.client.GWT;
|
| - |
|
37 |
|
| Line 57... |
Line 38... |
| 57 |
|
38 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
| 58 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
39 |
|
| 59 |
|
- |
|
| 60 |
private Publication publication;
|
40 |
private Publication publication;
|
| 61 |
private PublicationAPersonneListe publicationAPersonneListe = null;
|
41 |
private PublicationAPersonneListe publicationAPersonneListe = null;
|
| - |
|
42 |
private boolean publicationAPersonneListeChargementOk = false;
|
| Line 62... |
Line 43... |
| 62 |
|
43 |
|
| 63 |
private FieldSet auteursFieldset = null;
|
44 |
private FieldSet auteursFieldset = null;
|
| 64 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
45 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
| 65 |
private PersonneListe listePersonneAuteur = null;
|
46 |
private LayoutContainer conteneurChamps;
|
| Line 78... |
Line 59... |
| 78 |
private TextField<String> fasciculeChp = null;
|
59 |
private TextField<String> fasciculeChp = null;
|
| 79 |
private TextField<String> pagesChp = null;
|
60 |
private TextField<String> pagesChp = null;
|
| Line 80... |
Line 61... |
| 80 |
|
61 |
|
| 81 |
private String idStructureEdition = "";
|
62 |
private String idStructureEdition = "";
|
| 82 |
private String idAuteurs = "";
|
- |
|
| 83 |
|
- |
|
| 84 |
protected boolean listePersonneAuteurInitialisee = false;
|
- |
|
| Line 85... |
Line 63... |
| 85 |
protected boolean listeAuteurPublicationInitialisee = false;
|
63 |
private String idAuteurs = "";
|
| 86 |
|
64 |
|
| 87 |
private boolean formValide = false;
|
65 |
private boolean formulaireValideOk = false;
|
| Line 88... |
Line 66... |
| 88 |
private boolean validationPublication = false;
|
66 |
private boolean publicationValideOk = false;
|
| Line -... |
Line 67... |
| - |
|
67 |
private boolean auteursValideOk = false;
|
| 89 |
private boolean validationAuteurs = false;
|
68 |
|
| 90 |
|
69 |
private Rafraichissable vueExterneARafraichirApresValidation = null;
|
| 91 |
private Rafraichissable vueExterneARafraichirApresValidation = null;
|
70 |
|
| Line 92... |
Line 71... |
| 92 |
|
71 |
|
| 93 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
- |
|
| 94 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
72 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
| - |
|
73 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
| 95 |
}
|
74 |
}
|
| Line 96... |
Line 75... |
| 96 |
|
75 |
|
| 97 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
- |
|
| 98 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
76 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
| 99 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
77 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
| - |
|
78 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
| 100 |
}
|
79 |
}
|
| 101 |
|
- |
|
| 102 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
80 |
|
| Line 103... |
Line 81... |
| 103 |
String modeDeCreation = Formulaire.MODE_AJOUTER;
|
81 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
| 104 |
publication = new Publication();
|
82 |
publication = new Publication();
|
| 105 |
if (publicationId != null) {
|
83 |
publication.setId(publicationId);
|
| Line 106... |
Line 84... |
| 106 |
modeDeCreation = Formulaire.MODE_MODIFIER;
|
84 |
|
| 107 |
}
|
85 |
String modeDeCreation = (publication.getId().isEmpty() ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
| Line 108... |
Line 86... |
| 108 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
86 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
| 109 |
|
87 |
|
| Line 110... |
Line 88... |
| 110 |
panneauFormulaire.setLayout(new FlowLayout());
|
88 |
panneauFormulaire.setLayout(new FlowLayout());
|
| 111 |
String titre = (modeDeCreation.equals(Formulaire.MODE_AJOUTER) ? "Ajout d'une publication" : "Modification d'une publication");
|
89 |
String titre = genererTitreFormulaire();
|
| 112 |
panneauFormulaire.setHeading(titre);
|
90 |
panneauFormulaire.setHeading(titre);
|
| - |
|
91 |
|
| 113 |
|
92 |
creerZoneAuteurs();
|
| 114 |
creerZoneAuteurs();
|
93 |
panneauFormulaire.add(auteursFieldset);
|
| - |
|
94 |
|
| - |
|
95 |
creerZoneGeneralites();
|
| - |
|
96 |
panneauFormulaire.add(generalitesFieldset);
|
| - |
|
97 |
|
| - |
|
98 |
creerZoneEdition();
|
| - |
|
99 |
panneauFormulaire.add(editionFieldset);
|
| - |
|
100 |
|
| - |
|
101 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
| - |
|
102 |
mediateurCourrant.selectionnerPublication(this, publicationId);
|
| 115 |
panneauFormulaire.add(auteursFieldset);
|
103 |
mediateurCourrant.selectionnerPublicationAPersonne(this, publicationId, null, PublicationAPersonne.ROLE_AUTEUR);
|
| Line 116... |
Line 104... |
| 116 |
|
104 |
}
|
| 117 |
creerZoneGeneralites();
|
105 |
}
|
| 118 |
panneauFormulaire.add(generalitesFieldset);
|
106 |
|
| Line 136... |
Line 124... |
| 136 |
|
124 |
|
| 137 |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
|
125 |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
|
| 138 |
auteursStorePartage = new ListStore<Personne>();
|
126 |
auteursStorePartage = new ListStore<Personne>();
|
| Line 139... |
Line 127... |
| 139 |
mediateur.clicObtenirListeAuteurs(this);
|
127 |
mediateur.clicObtenirListeAuteurs(this);
|
| 140 |
|
128 |
|
| Line 141... |
Line 129... |
| 141 |
genererChampsAuteur(false);
|
129 |
creerChampsAuteur();
|
| 142 |
}
|
130 |
}
|
| Line 143... |
Line 131... |
| 143 |
|
131 |
|
| Line 144... |
Line 132... |
| 144 |
private void genererChampsAuteur(boolean vider) {
|
132 |
private void creerChampsAuteur() {
|
| - |
|
133 |
auteursFieldset.removeAll();
|
| 145 |
auteursFieldset.removeAll();
|
134 |
|
| 146 |
|
135 |
conteneurChamps = new LayoutContainer();
|
| 147 |
conteneurChamps = new LayoutContainer();
|
136 |
|
| 148 |
|
137 |
Button ajouterAuteurBouton = new Button("Ajouter un auteur");
|
| 149 |
Button ajoutAuteurBtn = new Button("Ajouter un auteur");
|
- |
|
| 150 |
ajoutAuteurBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
| 151 |
@Override
|
- |
|
| 152 |
public void componentSelected(ButtonEvent be) {
|
- |
|
| 153 |
creerTextFieldEtBouton(null);
|
- |
|
| 154 |
|
- |
|
| 155 |
int nbAuteurs = 0;
|
- |
|
| 156 |
for (Iterator<ComboBox<Personne>> it = auteurComboboxListe.iterator(); it.hasNext();) {
|
- |
|
| 157 |
if (auteurComboboxListe.size() > 1) {
|
- |
|
| 158 |
it.next().setFieldLabel("Auteur "+nbAuteurs);
|
- |
|
| 159 |
nbAuteurs++;
|
138 |
ajouterAuteurBouton.setIcon(Images.ICONES.ajouter());
|
| 160 |
}
|
139 |
ajouterAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| Line 161... |
Line 140... |
| 161 |
}
|
140 |
@Override
|
| 162 |
|
141 |
public void componentSelected(ButtonEvent be) {
|
| 163 |
auteursFieldset.layout(true);
|
142 |
creerChampAuteurEtBoutonSupprimer(null);
|
| Line 164... |
Line 143... |
| 164 |
}
|
143 |
}
|
| 165 |
});
|
144 |
});
|
| 166 |
|
145 |
|
| 167 |
auteursFieldset.add(conteneurChamps);
|
146 |
auteursFieldset.add(conteneurChamps);
|
| Line 168... |
Line 147... |
| 168 |
auteursFieldset.add(ajoutAuteurBtn);
|
147 |
auteursFieldset.add(ajouterAuteurBouton);
|
| 169 |
auteursFieldset.layout(true);
|
148 |
auteursFieldset.layout(true);
|
| 170 |
|
149 |
|
| Line 171... |
Line 150... |
| 171 |
if (!vider) {
|
150 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
| 172 |
creerTextFieldEtBouton(null);
|
151 |
creerChampAuteurEtBoutonSupprimer(null);
|
| 173 |
}
|
152 |
}
|
| 174 |
}
|
153 |
}
|
| 175 |
|
154 |
|
| 176 |
public void creerTextFieldEtBouton(Personne auteur) {
|
155 |
public void creerChampAuteurEtBoutonSupprimer(Personne auteur) {
|
| - |
|
156 |
final HorizontalPanel panneauHorizontal = new HorizontalPanel();
|
| Line 177... |
Line 157... |
| 177 |
final HorizontalPanel panneauHorizontal = new HorizontalPanel();
|
157 |
panneauHorizontal.setLayout(new FormLayout());
|
| 178 |
panneauHorizontal.setLayout(new FormLayout());
|
158 |
|
| 179 |
|
159 |
final ComboBox<Personne> auteursSaisisComboBox = creerComboBoxAuteursSaisis();
|
| - |
|
160 |
if (auteur != null) {
|
| 180 |
final ComboBox<Personne> auteursSaisisComboBox = creerComboBoxAuteursSaisis();
|
161 |
GWT.log(auteur.getId(), null);
|
| 181 |
if (auteur != null) {
|
162 |
auteursSaisisComboBox.setValue(auteursStorePartage.findModel("id_personne", auteur.getId()));
|
| - |
|
163 |
}
|
| - |
|
164 |
auteurComboboxListe.add(auteursSaisisComboBox);
|
| 182 |
GWT.log(auteur.getId(), null);
|
165 |
auteursSaisisComboBox.setFieldLabel("Auteur "+auteurComboboxListe.size());
|
| 183 |
auteursSaisisComboBox.setValue(auteursStorePartage.findModel("id_personne", auteur.getId()));
|
166 |
|
| 184 |
}
|
167 |
LayoutContainer panneauChampTxtEtBouton = new LayoutContainer();
|
| 185 |
auteurComboboxListe.add(auteursSaisisComboBox);
|
- |
|
| 186 |
|
- |
|
| 187 |
LayoutContainer lc = new LayoutContainer();
|
- |
|
| 188 |
lc.setLayout(new FormLayout());
|
- |
|
| 189 |
lc.add(auteursSaisisComboBox, new FormData(300, 0));
|
- |
|
| 190 |
|
- |
|
| 191 |
Button supp = new Button("-");
|
- |
|
| 192 |
supp.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
168 |
panneauChampTxtEtBouton.setLayout(new FormLayout());
|
| 193 |
@Override
|
169 |
panneauChampTxtEtBouton.add(auteursSaisisComboBox, new FormData(300, 0));
|
| - |
|
170 |
panneauHorizontal.add(panneauChampTxtEtBouton);
|
| - |
|
171 |
|
| - |
|
172 |
Button supprimerAuteurBouton = new Button();
|
| - |
|
173 |
supprimerAuteurBouton.setIcon(Images.ICONES.supprimer());
|
| - |
|
174 |
supprimerAuteurBouton.setToolTip(i18nC.supprimer());
|
| - |
|
175 |
supprimerAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| - |
|
176 |
@Override
|
| 194 |
public void componentSelected(ButtonEvent be) {
|
177 |
public void componentSelected(ButtonEvent be) {
|
| 195 |
int nbAuteurs = 0;
|
178 |
auteurComboboxListe.remove(auteursSaisisComboBox);
|
| 196 |
if (auteurComboboxListe.size() != 1) {
|
- |
|
| 197 |
for (Iterator<ComboBox<Personne>> it = auteurComboboxListe.iterator(); it.hasNext();) {
|
179 |
conteneurChamps.remove(panneauHorizontal);
|
| 198 |
it.next().setFieldLabel("Auteur "+nbAuteurs);
|
- |
|
| 199 |
nbAuteurs++;
|
180 |
|
| - |
|
181 |
int numeroAuteurs = 1;
|
| 200 |
}
|
182 |
for (Iterator<ComboBox<Personne>> it = auteurComboboxListe.iterator(); it.hasNext();) {
|
| 201 |
}
|
183 |
it.next().setFieldLabel("Auteur "+numeroAuteurs);
|
| 202 |
auteurComboboxListe.remove(auteursSaisisComboBox);
|
184 |
numeroAuteurs++;
|
| Line 203... |
Line 185... |
| 203 |
conteneurChamps.remove(panneauHorizontal);
|
185 |
}
|
| Line 301... |
Line 283... |
| 301 |
rafraichirInformation((Information) nouvellesDonnees);
|
283 |
rafraichirInformation((Information) nouvellesDonnees);
|
| 302 |
} else {
|
284 |
} else {
|
| 303 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
285 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
| 304 |
}
|
286 |
}
|
| Line -... |
Line 287... |
| - |
|
287 |
|
| - |
|
288 |
if (etrePretAAfficherAuteurs()) {
|
| - |
|
289 |
afficherAuteurs();
|
| - |
|
290 |
}
|
| 305 |
|
291 |
|
| 306 |
if (etreValide()) {
|
292 |
if (etreValide()) {
|
| 307 |
reinitialiserValidation();
|
293 |
initialiserValidation();
|
| 308 |
repandreRafraichissement();
|
294 |
repandreRafraichissement();
|
| 309 |
controlerFermetureApresRafraichissement();
|
295 |
controlerFermetureApresRafraichissement();
|
| 310 |
}
|
296 |
}
|
| Line 311... |
Line 297... |
| 311 |
}
|
297 |
}
|
| 312 |
|
298 |
|
| 313 |
private void rafraichirPublication(Publication publi) {
|
- |
|
| 314 |
publication = publi;
|
299 |
private void rafraichirPublication(Publication publi) {
|
| 315 |
|
- |
|
| 316 |
genererChampsAuteur(true);
|
- |
|
| 317 |
titreChp.setValue(publication.getTitre());
|
- |
|
| 318 |
collectionChp.setValue(publication.getCollection());
|
- |
|
| 319 |
uriChp.setValue(publication.getURI());
|
- |
|
| 320 |
datePublicationChp.setRawValue(reduireDateParAnnee(publication.getDateParution()));
|
- |
|
| 321 |
tomeChp.setValue(publication.getIndicationNvt());
|
- |
|
| 322 |
fasciculeChp.setValue(publication.getFascicule());
|
- |
|
| 323 |
pagesChp.setValue(publication.getPages());
|
- |
|
| 324 |
|
- |
|
| 325 |
if (publication.getEditeur().matches("^[0-9]+$")) {
|
- |
|
| 326 |
editeurCombobox.setValue(editeurCombobox.getStore().findModel("id_structure", publication.getEditeur()));
|
- |
|
| 327 |
idStructureEdition = publication.getEditeur();
|
- |
|
| 328 |
} else {
|
- |
|
| 329 |
editeurCombobox.setRawValue(publication.getEditeur());
|
300 |
publication = publi;
|
| Line 330... |
Line 301... |
| 330 |
}
|
301 |
peuplerFormulaire();
|
| 331 |
}
|
302 |
}
|
| 332 |
|
303 |
|
| Line 340... |
Line 311... |
| 340 |
editeurCombobox.expand();
|
311 |
editeurCombobox.expand();
|
| 341 |
}
|
312 |
}
|
| Line 342... |
Line 313... |
| 342 |
|
313 |
|
| 343 |
private void rafraichirListeAuteurs(PublicationAPersonneListe auteurs) {
|
314 |
private void rafraichirListeAuteurs(PublicationAPersonneListe auteurs) {
|
| 344 |
publicationAPersonneListe = auteurs;
|
- |
|
| 345 |
|
- |
|
| 346 |
if (listePersonneAuteurInitialisee) {
|
315 |
publicationAPersonneListe = auteurs;
|
| 347 |
Iterator<String> itap = publicationAPersonneListe.keySet().iterator();
|
- |
|
| 348 |
while (itap.hasNext()) {
|
- |
|
| 349 |
creerTextFieldEtBouton(publicationAPersonneListe.get(itap.next()).getPersonne());
|
- |
|
| 350 |
}
|
- |
|
| 351 |
|
- |
|
| 352 |
int nbAuteurs = 0;
|
- |
|
| 353 |
for (Iterator<ComboBox<Personne>> it = auteurComboboxListe.iterator(); it.hasNext();) {
|
- |
|
| 354 |
if (auteurComboboxListe.size() > 1) {
|
- |
|
| 355 |
it.next().setFieldLabel("Auteur "+nbAuteurs);
|
- |
|
| 356 |
nbAuteurs++;
|
- |
|
| 357 |
}
|
- |
|
| 358 |
}
|
- |
|
| 359 |
listeAuteurPublicationInitialisee = true;
|
- |
|
| 360 |
}
|
316 |
publicationAPersonneListeChargementOk = true;
|
| Line 361... |
Line 317... |
| 361 |
}
|
317 |
}
|
| 362 |
|
318 |
|
| 363 |
private void rafraichirInformation(Information info) {
|
- |
|
| 364 |
if (info.getType().equals("liste_personne")) {
|
319 |
private void rafraichirInformation(Information info) {
|
| - |
|
320 |
if (info.getType().equals("liste_personne")) {
|
| 365 |
listePersonneAuteurInitialisee = true;
|
321 |
PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
|
| 366 |
listePersonneAuteur = (PersonneListe) info.getDonnee(0);
|
322 |
|
| 367 |
List<Personne> liste = listePersonneAuteur.toList();
|
323 |
List<Personne> liste = listePersonneAuteur.toList();
|
| - |
|
324 |
auteursStorePartage.removeAll();
|
| - |
|
325 |
auteursStorePartage.add(liste);
|
| 368 |
auteursStorePartage.removeAll();
|
326 |
|
| 369 |
auteursStorePartage.add(liste);
|
327 |
auteurStorePartageChargementOk = true;
|
| 370 |
} else if (info.getType().equals("publication_valide")) {
|
328 |
} else if (info.getType().equals("publication_valide")) {
|
| Line 371... |
Line 329... |
| 371 |
validationPublication = true;
|
329 |
publicationValideOk = true;
|
| 372 |
publication.setId((String) info.getDonnee(0));
|
330 |
publication.setId((String) info.getDonnee(0));
|
| 373 |
|
331 |
|
| 374 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
332 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
| 375 |
mediateur.ajouterAuteurPublication(this, idAuteurs, PublicationAPersonne.ROLE_AUTEUR, publication.getId());
|
333 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), idAuteurs, PublicationAPersonne.ROLE_AUTEUR);
|
| 376 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
334 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 377 |
mediateur.modifierAuteurPublication(this, idAuteurs, publication.getId());
|
335 |
mediateur.modifierPublicationAPersonne(this, publication.getId(), idAuteurs, PublicationAPersonne.ROLE_AUTEUR);
|
| 378 |
}
|
336 |
}
|
| 379 |
} else if (info.getType().equals("auteur_valide")) {
|
337 |
} else if (info.getType().equals("auteur_valide")) {
|
| Line -... |
Line 338... |
| - |
|
338 |
auteursValideOk = true;
|
| - |
|
339 |
}
|
| - |
|
340 |
}
|
| - |
|
341 |
|
| - |
|
342 |
private void afficherAuteurs() {
|
| - |
|
343 |
Iterator<String> itap = publicationAPersonneListe.keySet().iterator();
|
| - |
|
344 |
while (itap.hasNext()) {
|
| - |
|
345 |
creerChampAuteurEtBoutonSupprimer(publicationAPersonneListe.get(itap.next()).getPersonne());
|
| - |
|
346 |
}
|
| - |
|
347 |
initialiserAffichageAuteurs();
|
| - |
|
348 |
}
|
| - |
|
349 |
|
| - |
|
350 |
private void initialiserAffichageAuteurs() {
|
| - |
|
351 |
auteurStorePartageChargementOk = false;
|
| - |
|
352 |
publicationAPersonneListeChargementOk = false;
|
| - |
|
353 |
}
|
| - |
|
354 |
|
| - |
|
355 |
private boolean etrePretAAfficherAuteurs() {
|
| - |
|
356 |
boolean ok = false;
|
| - |
|
357 |
if (auteurStorePartageChargementOk && publicationAPersonneListeChargementOk) {
|
| - |
|
358 |
ok = true;
|
| 380 |
validationAuteurs = true;
|
359 |
}
|
| 381 |
}
|
360 |
return ok;
|
| - |
|
361 |
}
|
| 382 |
}
|
362 |
|
| 383 |
|
363 |
private Boolean etreValide() {
|
| 384 |
private Boolean etreValide() {
|
364 |
Boolean valide = false;
|
| 385 |
Boolean valide = false;
|
365 |
GWT.log("formulaire"+formulaireValideOk+" - Publication :"+publicationValideOk+" - Auteurs :"+auteursValideOk, null);
|
| 386 |
if (formValide && validationPublication && validationAuteurs) {
|
366 |
if (formulaireValideOk && publicationValideOk && auteursValideOk) {
|
| Line 387... |
Line 367... |
| 387 |
valide = true;
|
367 |
valide = true;
|
| 388 |
}
|
368 |
}
|
| 389 |
return valide;
|
369 |
return valide;
|
| 390 |
}
|
370 |
}
|
| 391 |
|
371 |
|
| Line 392... |
Line 372... |
| 392 |
private void reinitialiserValidation() {
|
372 |
private void initialiserValidation() {
|
| 393 |
formValide = false;
|
373 |
formulaireValideOk = false;
|
| 394 |
validationPublication = false;
|
374 |
publicationValideOk = false;
|
| Line 406... |
Line 386... |
| 406 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
386 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
| 407 |
}
|
387 |
}
|
| 408 |
}
|
388 |
}
|
| Line 409... |
Line 389... |
| 409 |
|
389 |
|
| 410 |
public boolean soumettreFormulaire() {
|
390 |
public boolean soumettreFormulaire() {
|
| - |
|
391 |
formulaireValideOk = verifierFormulaire();
|
| 411 |
formValide = verifierFormulaire();
|
392 |
GWT.log("Form?"+formulaireValideOk, null);
|
| 412 |
if (formValide) {
|
393 |
if (formulaireValideOk) {
|
| 413 |
Publication publicationCollectee = collecterPublication();
|
394 |
Publication publicationCollectee = collecterPublication();
|
| - |
|
395 |
if (publicationCollectee != null) {
|
| 414 |
if (publicationCollectee != null) {
|
396 |
GWT.log("Info collectée ? ok", null);
|
| 415 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
397 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
| 416 |
mediateur.ajouterPublication(this, publicationCollectee);
|
398 |
mediateur.ajouterPublication(this, publicationCollectee);
|
| 417 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
399 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 418 |
mediateur.modifierPublication(this, publicationCollectee);
|
400 |
mediateur.modifierPublication(this, publicationCollectee);
|
| 419 |
}
|
401 |
}
|
| 420 |
}
|
402 |
}
|
| 421 |
}
|
403 |
}
|
| 422 |
return formValide;
|
404 |
return formulaireValideOk;
|
| Line 423... |
Line 405... |
| 423 |
}
|
405 |
}
|
| 424 |
|
406 |
|
| 425 |
protected boolean verifierFormulaire() {
|
407 |
protected boolean verifierFormulaire() {
|
| Line 469... |
Line 451... |
| 469 |
valide = false;
|
451 |
valide = false;
|
| 470 |
}
|
452 |
}
|
| 471 |
return valide;
|
453 |
return valide;
|
| 472 |
}
|
454 |
}
|
| Line -... |
Line 455... |
| - |
|
455 |
|
| - |
|
456 |
private void peuplerFormulaire() {
|
| - |
|
457 |
creerChampsAuteur();
|
| - |
|
458 |
titreChp.setValue(publication.getTitre());
|
| - |
|
459 |
collectionChp.setValue(publication.getCollection());
|
| - |
|
460 |
uriChp.setValue(publication.getURI());
|
| - |
|
461 |
datePublicationChp.setRawValue(reduireDateParAnnee(publication.getDateParution()));
|
| - |
|
462 |
tomeChp.setValue(publication.getIndicationNvt());
|
| - |
|
463 |
fasciculeChp.setValue(publication.getFascicule());
|
| - |
|
464 |
pagesChp.setValue(publication.getPages());
|
| - |
|
465 |
|
| - |
|
466 |
if (publication.getEditeur().matches("^[0-9]+$")) {
|
| - |
|
467 |
editeurCombobox.setValue(editeurCombobox.getStore().findModel("id_structure", publication.getEditeur()));
|
| - |
|
468 |
idStructureEdition = publication.getEditeur();
|
| - |
|
469 |
} else {
|
| - |
|
470 |
editeurCombobox.setRawValue(publication.getEditeur());
|
| - |
|
471 |
}
|
| - |
|
472 |
}
|
| 473 |
|
473 |
|
| 474 |
private Publication collecterPublication() {
|
474 |
private Publication collecterPublication() {
|
| 475 |
Publication publicationARetourner = null;
|
475 |
Publication publicationARetourner = null;
|
| Line 476... |
Line 476... |
| 476 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
476 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
| - |
|
477 |
|
| 477 |
|
478 |
String auteurIntituleFormate = "";
|
| 478 |
String auteur = "";
|
479 |
int auteursNombre = auteurComboboxListe.size();
|
| 479 |
for (int i = 0; i < auteurComboboxListe.size(); i++) {
|
480 |
for (int i = 0; i < auteursNombre; i++) {
|
| - |
|
481 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
| 480 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
482 |
Personne auteur = auteurComboboxListe.get(i).getValue();
|
| 481 |
idAuteurs += auteurComboboxListe.get(i).getValue().getId();
|
483 |
idAuteurs += auteur.getId();
|
| 482 |
auteur += auteurComboboxListe.get(i).getValue().getNom()+ " "+auteurComboboxListe.get(i).getValue().getPrenom();
|
484 |
auteurIntituleFormate += auteur.getNom()+ " "+auteur.getPrenom();
|
| 483 |
if (i != auteurComboboxListe.size() -1) {
|
485 |
if (i != (auteursNombre - 1)) {
|
| 484 |
auteur += ", ";
|
486 |
auteurIntituleFormate += ", ";
|
| 485 |
idAuteurs += ",";
|
487 |
idAuteurs += ",";
|
| 486 |
}
|
488 |
}
|
| - |
|
489 |
}
|
| - |
|
490 |
}
|
| 487 |
}
|
491 |
GWT.log("Auteurs formaté :"+auteurIntituleFormate, null);
|
| Line 488... |
Line 492... |
| 488 |
}
|
492 |
GWT.log("Auteurs ids :"+idAuteurs, null);
|
| 489 |
publicationCollectee.setAuteur(auteur);
|
493 |
publicationCollectee.setAuteur(auteurIntituleFormate);
|
| Line 490... |
Line 494... |
| 490 |
|
494 |
|