1 |
package org.tela_botanica.client.vues.publication;
|
1 |
package org.tela_botanica.client.vues.publication;
|
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;
|
5 |
import java.util.List;
|
6 |
|
6 |
|
7 |
import org.tela_botanica.client.ComposantClass;
|
7 |
import org.tela_botanica.client.ComposantClass;
|
8 |
import org.tela_botanica.client.Mediateur;
|
8 |
import org.tela_botanica.client.Mediateur;
|
9 |
import org.tela_botanica.client.images.Images;
|
9 |
import org.tela_botanica.client.images.Images;
|
10 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
10 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
11 |
import org.tela_botanica.client.modeles.Information;
|
11 |
import org.tela_botanica.client.modeles.Information;
|
12 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
12 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
13 |
import org.tela_botanica.client.modeles.personne.Personne;
|
13 |
import org.tela_botanica.client.modeles.personne.Personne;
|
14 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
14 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
15 |
import org.tela_botanica.client.modeles.projet.Projet;
|
15 |
import org.tela_botanica.client.modeles.projet.Projet;
|
16 |
import org.tela_botanica.client.modeles.projet.ProjetListe;
|
16 |
import org.tela_botanica.client.modeles.projet.ProjetListe;
|
17 |
import org.tela_botanica.client.modeles.publication.Publication;
|
17 |
import org.tela_botanica.client.modeles.publication.Publication;
|
18 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
18 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
19 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
19 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
20 |
import org.tela_botanica.client.modeles.structure.Structure;
|
20 |
import org.tela_botanica.client.modeles.structure.Structure;
|
21 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
21 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
22 |
import org.tela_botanica.client.util.Debug;
|
22 |
import org.tela_botanica.client.util.Debug;
|
23 |
import org.tela_botanica.client.util.Pattern;
|
23 |
import org.tela_botanica.client.util.Pattern;
|
24 |
import org.tela_botanica.client.util.UtilArray;
|
24 |
import org.tela_botanica.client.util.UtilArray;
|
25 |
import org.tela_botanica.client.util.UtilString;
|
25 |
import org.tela_botanica.client.util.UtilString;
|
26 |
import org.tela_botanica.client.vues.Formulaire;
|
26 |
import org.tela_botanica.client.vues.Formulaire;
|
27 |
|
27 |
|
28 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
28 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
29 |
import com.extjs.gxt.ui.client.event.Events;
|
29 |
import com.extjs.gxt.ui.client.event.Events;
|
30 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
30 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
31 |
import com.extjs.gxt.ui.client.store.ListStore;
|
31 |
import com.extjs.gxt.ui.client.store.ListStore;
|
32 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
32 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
33 |
import com.extjs.gxt.ui.client.widget.Info;
|
33 |
import com.extjs.gxt.ui.client.widget.Info;
|
34 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
34 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
35 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
35 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
36 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
36 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
37 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
37 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
38 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
38 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
39 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
39 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
40 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
40 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
41 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
41 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
42 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
42 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
43 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
43 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
44 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
44 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
45 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
45 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
46 |
import com.google.gwt.core.client.GWT;
|
46 |
import com.google.gwt.core.client.GWT;
|
47 |
|
47 |
|
48 |
|
48 |
|
49 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
49 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
50 |
|
50 |
|
51 |
private Publication publication;
|
51 |
private Publication publication;
|
52 |
private PersonneListe auteursInitialListe = null;
|
52 |
private PersonneListe auteursInitialListe = null;
|
53 |
private static boolean publicationAPersonneListeChargementOk = false;
|
53 |
private static boolean publicationAPersonneListeChargementOk = false;
|
54 |
private PublicationAPersonneListe auteursAjoutes = null;
|
54 |
private PublicationAPersonneListe auteursAjoutes = null;
|
55 |
private PublicationAPersonneListe auteursSupprimes = null;
|
55 |
private PublicationAPersonneListe auteursSupprimes = null;
|
56 |
|
56 |
|
57 |
private FieldSet auteursFieldset = null;
|
57 |
private FieldSet auteursFieldset = null;
|
58 |
private ComboBox<Projet> projetsCombo = null;
|
58 |
private ComboBox<Projet> projetsCombo = null;
|
59 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
59 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
60 |
private LayoutContainer conteneurChamps;
|
60 |
private LayoutContainer conteneurChamps;
|
61 |
private ListStore<Personne> auteursStorePartage = null;
|
61 |
private ListStore<Personne> auteursStorePartage = null;
|
62 |
private static boolean auteurStorePartageChargementOk = false;
|
62 |
private static boolean auteurStorePartageChargementOk = false;
|
63 |
|
63 |
|
64 |
private FieldSet generalitesFieldset = null;
|
64 |
private FieldSet generalitesFieldset = null;
|
65 |
private TextField<String> titreChp = null;
|
65 |
private TextField<String> titreChp = null;
|
66 |
private TextField<String> collectionChp = null;
|
66 |
private TextField<String> collectionChp = null;
|
67 |
private TextField<String> uriChp = null;
|
67 |
private TextField<String> uriChp = null;
|
68 |
|
68 |
|
69 |
private FieldSet editionFieldset = null;
|
69 |
private FieldSet editionFieldset = null;
|
70 |
private ComboBox<Structure> editeurCombobox = null;
|
70 |
private ComboBox<Structure> editeurCombobox = null;
|
71 |
private TextField<String> datePublicationChp = null;
|
71 |
private TextField<String> datePublicationChp = null;
|
72 |
private TextField<String> tomeChp = null;
|
72 |
private TextField<String> tomeChp = null;
|
73 |
private TextField<String> fasciculeChp = null;
|
73 |
private TextField<String> fasciculeChp = null;
|
74 |
private TextField<String> pagesChp = null;
|
74 |
private TextField<String> pagesChp = null;
|
75 |
|
75 |
|
76 |
private String idStructureEdition = "";
|
76 |
private String idStructureEdition = "";
|
77 |
|
77 |
|
78 |
private static boolean formulaireValideOk = false;
|
78 |
private static boolean formulaireValideOk = false;
|
79 |
private static boolean publicationValideOk = false;
|
79 |
private static boolean publicationValideOk = false;
|
80 |
private static boolean auteursValideOk = false;
|
80 |
private static boolean auteursValideOk = false;
|
81 |
private static boolean publicationOk = false;
|
81 |
private static boolean publicationOk = false;
|
82 |
private static boolean attenteAjoutAuteursOk = true;
|
82 |
private static boolean attenteAjoutAuteursOk = true;
|
83 |
private static boolean attenteSuppressionAuteursOk = true;
|
83 |
private static boolean attenteSuppressionAuteursOk = true;
|
84 |
|
84 |
|
85 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
85 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
86 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
86 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
87 |
}
|
87 |
}
|
88 |
|
88 |
|
89 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
89 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
90 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
90 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
91 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
91 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
92 |
}
|
92 |
}
|
93 |
|
93 |
|
94 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
94 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
95 |
auteursInitialListe = new PersonneListe();
|
95 |
auteursInitialListe = new PersonneListe();
|
96 |
initialiserValidation();
|
96 |
initialiserValidation();
|
97 |
initialiserAffichageAuteurs();
|
97 |
initialiserAffichageAuteurs();
|
98 |
|
98 |
|
99 |
publication = new Publication();
|
99 |
publication = new Publication();
|
100 |
publication.setId(publicationId);
|
100 |
publication.setId(publicationId);
|
101 |
|
101 |
|
102 |
String modeDeCreation = (UtilString.isEmpty(publication.getId()) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
102 |
String modeDeCreation = (UtilString.isEmpty(publication.getId()) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
103 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
103 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
104 |
|
104 |
|
105 |
panneauFormulaire.setLayout(new FlowLayout());
|
105 |
panneauFormulaire.setLayout(new FlowLayout());
|
106 |
genererTitreFormulaire();
|
106 |
genererTitreFormulaire();
|
107 |
|
107 |
|
108 |
creerZoneAuteurs();
|
108 |
creerZoneAuteurs();
|
109 |
panneauFormulaire.add(auteursFieldset);
|
109 |
panneauFormulaire.add(auteursFieldset);
|
110 |
|
110 |
|
111 |
creerZoneGeneralites();
|
111 |
creerZoneGeneralites();
|
112 |
panneauFormulaire.add(generalitesFieldset);
|
112 |
panneauFormulaire.add(generalitesFieldset);
|
113 |
|
113 |
|
114 |
creerZoneEdition();
|
114 |
creerZoneEdition();
|
115 |
panneauFormulaire.add(editionFieldset);
|
115 |
panneauFormulaire.add(editionFieldset);
|
116 |
|
116 |
|
117 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
117 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
118 |
mediateurCourrant.selectionnerPublication(this, publicationId);
|
118 |
mediateurCourrant.selectionnerPublication(this, publicationId);
|
119 |
mediateurCourrant.selectionnerPublicationAPersonne(this, publicationId, null, PublicationAPersonne.ROLE_AUTEUR);
|
119 |
mediateurCourrant.selectionnerPublicationAPersonne(this, publicationId, null, PublicationAPersonne.ROLE_AUTEUR);
|
120 |
}
|
120 |
}
|
121 |
}
|
121 |
}
|
122 |
|
122 |
|
123 |
private void genererTitreFormulaire() {
|
123 |
private void genererTitreFormulaire() {
|
124 |
String titre = i18nC.publicationTitreFormAjout();
|
124 |
String titre = i18nC.publicationTitreFormAjout();
|
125 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
125 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
126 |
titre = i18nC.publicationTitreFormModif();
|
126 |
titre = i18nC.publicationTitreFormModif();
|
127 |
if (publication != null) {
|
127 |
if (publication != null) {
|
128 |
titre += " - "+i18nC.id()+": "+publication.getId();
|
128 |
titre += " - "+i18nC.id()+": "+publication.getId();
|
129 |
}
|
129 |
}
|
130 |
}
|
130 |
}
|
131 |
panneauFormulaire.setHeading(titre);
|
131 |
panneauFormulaire.setHeading(titre);
|
132 |
}
|
132 |
}
|
133 |
|
133 |
|
134 |
private void creerZoneAuteurs() {
|
134 |
private void creerZoneAuteurs() {
|
135 |
FormLayout layout = new FormLayout();
|
135 |
FormLayout layout = new FormLayout();
|
136 |
layout.setLabelWidth(200);
|
136 |
layout.setLabelWidth(200);
|
137 |
|
137 |
|
138 |
// Fieldset Auteur
|
138 |
// Fieldset Auteur
|
139 |
auteursFieldset = new FieldSet();
|
139 |
auteursFieldset = new FieldSet();
|
140 |
auteursFieldset.setHeading(i18nC.publicationAuteursTitre());
|
140 |
auteursFieldset.setHeading(i18nC.publicationAuteursTitre());
|
141 |
auteursFieldset.setCollapsible(true);
|
141 |
auteursFieldset.setCollapsible(true);
|
142 |
auteursFieldset.setLayout(layout);
|
142 |
auteursFieldset.setLayout(layout);
|
143 |
|
143 |
|
144 |
Debug.log("Dans creerZoneAuteurs");
|
144 |
Debug.log("Dans creerZoneAuteurs");
|
145 |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
|
145 |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
|
146 |
auteursStorePartage = new ListStore<Personne>();
|
146 |
auteursStorePartage = new ListStore<Personne>();
|
147 |
mediateur.clicObtenirListeAuteurs(this);
|
147 |
mediateur.clicObtenirListeAuteurs(this);
|
148 |
|
148 |
|
149 |
creerChampsAuteur();
|
149 |
creerChampsAuteur();
|
150 |
}
|
150 |
}
|
151 |
|
151 |
|
152 |
private void creerChampsAuteur() {
|
152 |
private void creerChampsAuteur() {
|
153 |
auteursFieldset.removeAll();
|
153 |
auteursFieldset.removeAll();
|
154 |
conteneurChamps = new LayoutContainer();
|
154 |
conteneurChamps = new LayoutContainer();
|
155 |
|
155 |
|
156 |
Button ajouterAuteurBouton = new Button(i18nC.publicationAuteurBoutonAjouter());
|
156 |
Button ajouterAuteurBouton = new Button(i18nC.publicationAuteurBoutonAjouter());
|
157 |
ajouterAuteurBouton.setIcon(Images.ICONES.ajouter());
|
157 |
ajouterAuteurBouton.setIcon(Images.ICONES.ajouter());
|
158 |
ajouterAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
158 |
ajouterAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
159 |
@Override
|
159 |
@Override
|
160 |
public void componentSelected(ButtonEvent be) {
|
160 |
public void componentSelected(ButtonEvent be) {
|
161 |
creerChampAuteurEtBoutonSupprimer(null);
|
161 |
creerChampAuteurEtBoutonSupprimer(null);
|
162 |
}
|
162 |
}
|
163 |
});
|
163 |
});
|
164 |
|
164 |
|
165 |
auteursFieldset.add(conteneurChamps);
|
165 |
auteursFieldset.add(conteneurChamps);
|
166 |
auteursFieldset.add(ajouterAuteurBouton);
|
166 |
auteursFieldset.add(ajouterAuteurBouton);
|
167 |
auteursFieldset.layout();
|
167 |
auteursFieldset.layout();
|
168 |
|
168 |
|
169 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
169 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
170 |
creerChampAuteurEtBoutonSupprimer(null);
|
170 |
creerChampAuteurEtBoutonSupprimer(null);
|
171 |
}
|
171 |
}
|
172 |
}
|
172 |
}
|
173 |
|
173 |
|
174 |
public void creerChampAuteurEtBoutonSupprimer(Personne auteur) {
|
174 |
public void creerChampAuteurEtBoutonSupprimer(Personne auteur) {
|
175 |
final HorizontalPanel panneauHorizontal = new HorizontalPanel();
|
175 |
final HorizontalPanel panneauHorizontal = new HorizontalPanel();
|
- |
|
176 |
|
- |
|
177 |
LayoutContainer panneauChampTxt = new LayoutContainer();
|
176 |
panneauHorizontal.setLayout(new FormLayout());
|
178 |
panneauChampTxt.setLayout(new FormLayout());
|
177 |
|
179 |
|
178 |
final ComboBox<Personne> auteursSaisisComboBox = creerComboBoxAuteursSaisis();
|
180 |
final ComboBox<Personne> auteursSaisisComboBox = creerComboBoxAuteursSaisis();
|
179 |
if (auteur != null) {
|
181 |
if (auteur != null) {
|
180 |
auteursSaisisComboBox.setValue(auteur);
|
182 |
auteursSaisisComboBox.setValue(auteur);
|
181 |
auteursSaisisComboBox.validate();
|
183 |
auteursSaisisComboBox.validate();
|
182 |
}
|
184 |
}
|
183 |
auteurComboboxListe.add(auteursSaisisComboBox);
|
185 |
auteurComboboxListe.add(auteursSaisisComboBox);
|
184 |
auteursSaisisComboBox.setFieldLabel(i18nC.publicationAuteurSingulier()+" "+auteurComboboxListe.size());
|
186 |
auteursSaisisComboBox.setFieldLabel(i18nC.publicationAuteurSingulier()+" "+auteurComboboxListe.size());
|
185 |
|
- |
|
186 |
LayoutContainer panneauChampTxtEtBouton = new LayoutContainer();
|
- |
|
187 |
panneauChampTxtEtBouton.setLayout(new FormLayout());
|
- |
|
188 |
panneauChampTxtEtBouton.add(auteursSaisisComboBox, new FormData(300, 0));
|
187 |
panneauChampTxt.add(auteursSaisisComboBox, new FormData(300, 0));
|
189 |
panneauHorizontal.add(panneauChampTxtEtBouton);
|
188 |
panneauHorizontal.add(panneauChampTxt);
|
190 |
|
189 |
|
191 |
Button supprimerAuteurBouton = new Button();
|
190 |
Button supprimerAuteurBouton = new Button();
|
192 |
supprimerAuteurBouton.setIcon(Images.ICONES.supprimer());
|
191 |
supprimerAuteurBouton.setIcon(Images.ICONES.supprimer());
|
193 |
supprimerAuteurBouton.setToolTip(i18nC.supprimer());
|
192 |
supprimerAuteurBouton.setToolTip(i18nC.supprimer());
|
194 |
supprimerAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
193 |
supprimerAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
195 |
@Override
|
194 |
@Override
|
196 |
public void componentSelected(ButtonEvent be) {
|
195 |
public void componentSelected(ButtonEvent be) {
|
197 |
auteurComboboxListe.remove(auteursSaisisComboBox);
|
196 |
auteurComboboxListe.remove(auteursSaisisComboBox);
|
198 |
conteneurChamps.remove(panneauHorizontal);
|
197 |
conteneurChamps.remove(panneauHorizontal);
|
199 |
|
198 |
|
200 |
int numeroAuteurs = 1;
|
199 |
int numeroAuteurs = 1;
|
201 |
for (Iterator<ComboBox<Personne>> it = auteurComboboxListe.iterator(); it.hasNext();) {
|
200 |
for (Iterator<ComboBox<Personne>> it = auteurComboboxListe.iterator(); it.hasNext();) {
|
202 |
it.next().setFieldLabel(i18nC.publicationAuteurSingulier()+" "+numeroAuteurs);
|
201 |
it.next().setFieldLabel(i18nC.publicationAuteurSingulier()+" "+numeroAuteurs);
|
203 |
numeroAuteurs++;
|
202 |
numeroAuteurs++;
|
204 |
}
|
203 |
}
|
205 |
|
204 |
|
206 |
auteursFieldset.layout();
|
205 |
auteursFieldset.layout();
|
207 |
}
|
206 |
}
|
208 |
});
|
207 |
});
|
209 |
panneauHorizontal.add(supprimerAuteurBouton);
|
208 |
panneauHorizontal.add(supprimerAuteurBouton);
|
210 |
|
209 |
|
211 |
conteneurChamps.add(panneauHorizontal);
|
210 |
conteneurChamps.add(panneauHorizontal);
|
212 |
auteursFieldset.layout();
|
211 |
auteursFieldset.layout();
|
213 |
}
|
212 |
}
|
214 |
|
213 |
|
215 |
private ComboBox<Personne> creerComboBoxAuteursSaisis() {
|
214 |
private ComboBox<Personne> creerComboBoxAuteursSaisis() {
|
- |
|
215 |
ListStore<Personne> auteursStore = new ListStore<Personne>();
|
- |
|
216 |
auteursStore.add(auteursStorePartage.getModels());
|
- |
|
217 |
|
216 |
ComboBox<Personne> comboBox = new ComboBox<Personne>();
|
218 |
ComboBox<Personne> comboBox = new ComboBox<Personne>();
|
217 |
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
|
219 |
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
|
218 |
comboBox.setEditable(true);
|
220 |
comboBox.setEditable(true);
|
219 |
comboBox.setAllowBlank(false);
|
221 |
comboBox.setAllowBlank(false);
|
220 |
comboBox.setForceSelection(true);
|
222 |
comboBox.setForceSelection(true);
|
221 |
comboBox.setDisplayField("fmt_nom_complet");
|
223 |
comboBox.setDisplayField("fmt_nom_complet");
|
222 |
comboBox.setTriggerAction(TriggerAction.ALL);
|
224 |
comboBox.setTriggerAction(TriggerAction.ALL);
|
223 |
comboBox.setStore(auteursStorePartage);
|
225 |
comboBox.setStore(auteursStore);
|
224 |
comboBox.addStyleName(ComposantClass.OBLIGATOIRE);
|
226 |
comboBox.addStyleName(ComposantClass.OBLIGATOIRE);
|
225 |
comboBox.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
227 |
comboBox.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
226 |
|
228 |
|
227 |
return comboBox;
|
229 |
return comboBox;
|
228 |
}
|
230 |
}
|
229 |
|
231 |
|
230 |
private void creerZoneGeneralites() {
|
232 |
private void creerZoneGeneralites() {
|
231 |
FormLayout layout = new FormLayout();
|
233 |
FormLayout layout = new FormLayout();
|
232 |
layout.setLabelWidth(200);
|
234 |
layout.setLabelWidth(200);
|
233 |
|
235 |
|
234 |
// Fieldset Infos Générales
|
236 |
// Fieldset Infos Générales
|
235 |
generalitesFieldset = new FieldSet();
|
237 |
generalitesFieldset = new FieldSet();
|
236 |
generalitesFieldset.setHeading("Informations générales");
|
238 |
generalitesFieldset.setHeading("Informations générales");
|
237 |
generalitesFieldset.setCollapsible(true);
|
239 |
generalitesFieldset.setCollapsible(true);
|
238 |
generalitesFieldset.setLayout(layout);
|
240 |
generalitesFieldset.setLayout(layout);
|
239 |
|
241 |
|
240 |
projetsCombo = new ComboBox<Projet>();
|
242 |
projetsCombo = new ComboBox<Projet>();
|
241 |
projetsCombo.setTabIndex(tabIndex++);
|
243 |
projetsCombo.setTabIndex(tabIndex++);
|
242 |
projetsCombo.setFieldLabel(i18nC.projetChamp());
|
244 |
projetsCombo.setFieldLabel(i18nC.projetChamp());
|
243 |
projetsCombo.setDisplayField("nom");
|
245 |
projetsCombo.setDisplayField("nom");
|
244 |
projetsCombo.setForceSelection(true);
|
246 |
projetsCombo.setForceSelection(true);
|
245 |
projetsCombo.setValidator(new Validator() {
|
247 |
projetsCombo.setValidator(new Validator() {
|
246 |
@Override
|
248 |
@Override
|
247 |
public String validate(Field<?> field, String value) {
|
249 |
public String validate(Field<?> field, String value) {
|
248 |
String retour = null;
|
250 |
String retour = null;
|
249 |
if (field.getRawValue().equals("")) {
|
251 |
if (field.getRawValue().equals("")) {
|
250 |
field.setValue(null);
|
252 |
field.setValue(null);
|
251 |
} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
|
253 |
} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
|
252 |
String contenuBrut = field.getRawValue();
|
254 |
String contenuBrut = field.getRawValue();
|
253 |
field.setValue(null);
|
255 |
field.setValue(null);
|
254 |
field.setRawValue(contenuBrut);
|
256 |
field.setRawValue(contenuBrut);
|
255 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
257 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
256 |
}
|
258 |
}
|
257 |
return retour;
|
259 |
return retour;
|
258 |
}
|
260 |
}
|
259 |
});
|
261 |
});
|
260 |
projetsCombo.setTriggerAction(TriggerAction.ALL);
|
262 |
projetsCombo.setTriggerAction(TriggerAction.ALL);
|
261 |
projetsCombo.setStore(new ListStore<Projet>());
|
263 |
projetsCombo.setStore(new ListStore<Projet>());
|
262 |
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
|
264 |
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
|
263 |
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
|
265 |
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
|
264 |
generalitesFieldset.add(projetsCombo, new FormData(450, 0));
|
266 |
generalitesFieldset.add(projetsCombo, new FormData(450, 0));
|
265 |
mediateur.selectionnerProjet(this, null);
|
267 |
mediateur.selectionnerProjet(this, null);
|
266 |
|
268 |
|
267 |
titreChp = new TextField<String>();
|
269 |
titreChp = new TextField<String>();
|
268 |
titreChp.setName("cpu");
|
270 |
titreChp.setName("cpu");
|
269 |
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
|
271 |
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
|
270 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
272 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
271 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
273 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
272 |
generalitesFieldset.add(titreChp, new FormData(450, 0));
|
274 |
generalitesFieldset.add(titreChp, new FormData(450, 0));
|
273 |
|
275 |
|
274 |
collectionChp = new TextField<String>();
|
276 |
collectionChp = new TextField<String>();
|
275 |
collectionChp.setFieldLabel("Intitulé de la revue ou de la collection");
|
277 |
collectionChp.setFieldLabel("Intitulé de la revue ou de la collection");
|
276 |
generalitesFieldset.add(collectionChp, new FormData(450, 0));
|
278 |
generalitesFieldset.add(collectionChp, new FormData(450, 0));
|
277 |
|
279 |
|
278 |
uriChp = new TextField<String>();
|
280 |
uriChp = new TextField<String>();
|
279 |
uriChp.setFieldLabel("URL de la publication");
|
281 |
uriChp.setFieldLabel("URL de la publication");
|
280 |
generalitesFieldset.add(uriChp, new FormData(450, 0));
|
282 |
generalitesFieldset.add(uriChp, new FormData(450, 0));
|
281 |
}
|
283 |
}
|
282 |
|
284 |
|
283 |
private void creerZoneEdition() {
|
285 |
private void creerZoneEdition() {
|
284 |
FormLayout layout = new FormLayout();
|
286 |
FormLayout layout = new FormLayout();
|
285 |
layout.setLabelWidth(200);
|
287 |
layout.setLabelWidth(200);
|
286 |
|
288 |
|
287 |
// Fieldset Edition
|
289 |
// Fieldset Edition
|
288 |
editionFieldset = new FieldSet();
|
290 |
editionFieldset = new FieldSet();
|
289 |
editionFieldset.setHeading("Édition");
|
291 |
editionFieldset.setHeading("Édition");
|
290 |
editionFieldset.setCollapsible(true);
|
292 |
editionFieldset.setCollapsible(true);
|
291 |
editionFieldset.setLayout(layout);
|
293 |
editionFieldset.setLayout(layout);
|
292 |
|
294 |
|
293 |
ListStore<Structure> editeurStore = new ListStore<Structure>();
|
295 |
ListStore<Structure> editeurStore = new ListStore<Structure>();
|
294 |
editeurCombobox = new ComboBox<Structure>();
|
296 |
editeurCombobox = new ComboBox<Structure>();
|
295 |
editeurCombobox.setEmptyText("Sélectionner un éditeur...");
|
297 |
editeurCombobox.setEmptyText("Sélectionner un éditeur...");
|
296 |
editeurCombobox.setFieldLabel("Éditeur de la publication");
|
298 |
editeurCombobox.setFieldLabel("Éditeur de la publication");
|
297 |
editeurCombobox.setDisplayField("nom");
|
299 |
editeurCombobox.setDisplayField("nom");
|
298 |
editeurCombobox.setStore(editeurStore);
|
300 |
editeurCombobox.setStore(editeurStore);
|
299 |
editeurCombobox.setEditable(true);
|
301 |
editeurCombobox.setEditable(true);
|
300 |
editeurCombobox.setTriggerAction(TriggerAction.ALL);
|
302 |
editeurCombobox.setTriggerAction(TriggerAction.ALL);
|
301 |
editionFieldset.add(editeurCombobox, new FormData(450, 0));
|
303 |
editionFieldset.add(editeurCombobox, new FormData(450, 0));
|
302 |
mediateur.clicObtenirListeEditeurs(this);
|
304 |
mediateur.clicObtenirListeEditeurs(this);
|
303 |
|
305 |
|
304 |
datePublicationChp = new TextField<String>();
|
306 |
datePublicationChp = new TextField<String>();
|
305 |
datePublicationChp.setMaxLength(4);
|
307 |
datePublicationChp.setMaxLength(4);
|
306 |
datePublicationChp.setMinLength(4);
|
308 |
datePublicationChp.setMinLength(4);
|
307 |
datePublicationChp.setFieldLabel("Année de publication");
|
309 |
datePublicationChp.setFieldLabel("Année de publication");
|
308 |
datePublicationChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
310 |
datePublicationChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
309 |
datePublicationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
311 |
datePublicationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
310 |
editionFieldset.add(datePublicationChp, new FormData(40, 0));
|
312 |
editionFieldset.add(datePublicationChp, new FormData(40, 0));
|
311 |
|
313 |
|
312 |
tomeChp = new TextField<String>();
|
314 |
tomeChp = new TextField<String>();
|
313 |
tomeChp.setFieldLabel("Série de la revue ou tome");
|
315 |
tomeChp.setFieldLabel("Série de la revue ou tome");
|
314 |
editionFieldset.add(tomeChp, new FormData(75, 0));
|
316 |
editionFieldset.add(tomeChp, new FormData(75, 0));
|
315 |
|
317 |
|
316 |
fasciculeChp = new TextField<String>();
|
318 |
fasciculeChp = new TextField<String>();
|
317 |
fasciculeChp.setFieldLabel("Fascicule de la revue");
|
319 |
fasciculeChp.setFieldLabel("Fascicule de la revue");
|
318 |
editionFieldset.add(fasciculeChp, new FormData(75, 0));
|
320 |
editionFieldset.add(fasciculeChp, new FormData(75, 0));
|
319 |
|
321 |
|
320 |
pagesChp = new TextField<String>();
|
322 |
pagesChp = new TextField<String>();
|
321 |
pagesChp.setFieldLabel("Pages");
|
323 |
pagesChp.setFieldLabel("Pages");
|
322 |
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)");
|
324 |
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)");
|
323 |
editionFieldset.add(pagesChp, new FormData(100, 0));
|
325 |
editionFieldset.add(pagesChp, new FormData(100, 0));
|
324 |
}
|
326 |
}
|
325 |
|
327 |
|
326 |
public void rafraichir(Object nouvellesDonnees) {
|
328 |
public void rafraichir(Object nouvellesDonnees) {
|
327 |
if (nouvellesDonnees instanceof Publication) {
|
329 |
if (nouvellesDonnees instanceof Publication) {
|
328 |
// Si on a reçu les details d'une publication
|
330 |
// Si on a reçu les details d'une publication
|
329 |
rafraichirPublication((Publication) nouvellesDonnees);
|
331 |
rafraichirPublication((Publication) nouvellesDonnees);
|
330 |
} else if (nouvellesDonnees instanceof StructureListe) {
|
332 |
} else if (nouvellesDonnees instanceof StructureListe) {
|
331 |
// Si on a reçu une liste des editeurs
|
333 |
// Si on a reçu une liste des editeurs
|
332 |
rafraichirListeEditeurs((StructureListe) nouvellesDonnees);
|
334 |
rafraichirListeEditeurs((StructureListe) nouvellesDonnees);
|
333 |
} else if (nouvellesDonnees instanceof PublicationAPersonneListe) {
|
335 |
} else if (nouvellesDonnees instanceof PublicationAPersonneListe) {
|
334 |
rafraichirListeAuteurs((PublicationAPersonneListe) nouvellesDonnees);
|
336 |
rafraichirListeAuteurs((PublicationAPersonneListe) nouvellesDonnees);
|
335 |
} else if (nouvellesDonnees instanceof Information) {
|
337 |
} else if (nouvellesDonnees instanceof Information) {
|
336 |
rafraichirInformation((Information) nouvellesDonnees);
|
338 |
rafraichirInformation((Information) nouvellesDonnees);
|
337 |
} else if (nouvellesDonnees instanceof ProjetListe) {
|
339 |
} else if (nouvellesDonnees instanceof ProjetListe) {
|
338 |
ProjetListe projets = (ProjetListe) nouvellesDonnees;
|
340 |
ProjetListe projets = (ProjetListe) nouvellesDonnees;
|
339 |
Formulaire.rafraichirComboBox(projets, projetsCombo);
|
341 |
Formulaire.rafraichirComboBox(projets, projetsCombo);
|
340 |
setValeurComboProjets();
|
342 |
setValeurComboProjets();
|
341 |
} else {
|
343 |
} else {
|
342 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
344 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
343 |
}
|
345 |
}
|
344 |
|
346 |
|
345 |
if (etrePretAAfficherAuteurs()) {
|
347 |
if (etrePretAAfficherAuteurs()) {
|
346 |
afficherAuteurs();
|
348 |
afficherAuteurs();
|
347 |
initialiserAffichageAuteurs();
|
349 |
initialiserAffichageAuteurs();
|
348 |
}
|
350 |
}
|
349 |
|
351 |
|
350 |
if (etreValide()) {
|
352 |
if (etreValide()) {
|
351 |
initialiserValidation();
|
353 |
initialiserValidation();
|
352 |
repandreRafraichissement();
|
354 |
repandreRafraichissement();
|
353 |
controlerFermetureApresRafraichissement();
|
355 |
controlerFermetureApresRafraichissement();
|
354 |
}
|
356 |
}
|
355 |
}
|
357 |
}
|
356 |
|
358 |
|
357 |
private void miseAJourAuteursInitialListe() {
|
359 |
private void miseAJourAuteursInitialListe() {
|
358 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
360 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
359 |
while (clesAjoutees.hasNext()) {
|
361 |
while (clesAjoutees.hasNext()) {
|
360 |
Personne auteurAjoute = auteursAjoutes.get(clesAjoutees.next()).getPersonne();
|
362 |
Personne auteurAjoute = auteursAjoutes.get(clesAjoutees.next()).getPersonne();
|
361 |
auteursInitialListe.put(auteurAjoute.getId(), auteurAjoute);
|
363 |
auteursInitialListe.put(auteurAjoute.getId(), auteurAjoute);
|
362 |
}
|
364 |
}
|
363 |
|
365 |
|
364 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
366 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
365 |
while (clesSupprimees.hasNext()) {
|
367 |
while (clesSupprimees.hasNext()) {
|
366 |
Personne auteurSupprime = auteursSupprimes.get(clesSupprimees.next()).getPersonne();
|
368 |
Personne auteurSupprime = auteursSupprimes.get(clesSupprimees.next()).getPersonne();
|
367 |
auteursInitialListe.remove(auteurSupprime.getId());
|
369 |
auteursInitialListe.remove(auteurSupprime.getId());
|
368 |
}
|
370 |
}
|
369 |
}
|
371 |
}
|
370 |
|
372 |
|
371 |
private void rafraichirPublication(Publication publi) {
|
373 |
private void rafraichirPublication(Publication publi) {
|
372 |
publicationOk = true;
|
374 |
publicationOk = true;
|
373 |
publication = publi;
|
375 |
publication = publi;
|
374 |
peuplerFormulaire();
|
376 |
peuplerFormulaire();
|
375 |
genererTitreFormulaire();
|
377 |
genererTitreFormulaire();
|
376 |
}
|
378 |
}
|
377 |
|
379 |
|
378 |
private void rafraichirListeEditeurs(StructureListe editeurs) {
|
380 |
private void rafraichirListeEditeurs(StructureListe editeurs) {
|
379 |
editeurCombobox.getStore().removeAll();
|
381 |
editeurCombobox.getStore().removeAll();
|
380 |
editeurCombobox.getStore().add((List<Structure>) editeurs.toList());
|
382 |
editeurCombobox.getStore().add((List<Structure>) editeurs.toList());
|
381 |
|
383 |
|
382 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
384 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
383 |
editeurCombobox.setValue((Structure) editeurs.get(idStructureEdition));
|
385 |
editeurCombobox.setValue((Structure) editeurs.get(idStructureEdition));
|
384 |
}
|
386 |
}
|
385 |
editeurCombobox.expand();
|
387 |
editeurCombobox.expand();
|
386 |
}
|
388 |
}
|
387 |
|
389 |
|
388 |
private void rafraichirListeAuteurs(PublicationAPersonneListe auteurs) {
|
390 |
private void rafraichirListeAuteurs(PublicationAPersonneListe auteurs) {
|
389 |
Iterator<String> it = auteurs.keySet().iterator();
|
391 |
Iterator<String> it = auteurs.keySet().iterator();
|
390 |
while (it.hasNext()) {
|
392 |
while (it.hasNext()) {
|
391 |
Personne auteur = auteurs.get(it.next()).getPersonne();
|
393 |
Personne auteur = auteurs.get(it.next()).getPersonne();
|
392 |
auteursInitialListe.put(auteur.getId(), auteur);
|
394 |
auteursInitialListe.put(auteur.getId(), auteur);
|
393 |
}
|
395 |
}
|
394 |
publicationAPersonneListeChargementOk = true;
|
396 |
publicationAPersonneListeChargementOk = true;
|
395 |
}
|
397 |
}
|
396 |
|
398 |
|
397 |
private void rafraichirInformation(Information info) {
|
399 |
private void rafraichirInformation(Information info) {
|
398 |
String type = info.getType();
|
400 |
String type = info.getType();
|
399 |
if (type.equals("ajout_publication") || type.equals("modif_publication")) {
|
401 |
if (type.equals("ajout_publication") || type.equals("modif_publication")) {
|
400 |
publicationValideOk = true;
|
402 |
publicationValideOk = true;
|
401 |
if (vueExterneARafraichirApresValidation != null) {
|
403 |
if (vueExterneARafraichirApresValidation != null) {
|
402 |
publication.setId((String) info.getDonnee(0));
|
404 |
publication.setId((String) info.getDonnee(0));
|
403 |
}
|
405 |
}
|
404 |
|
406 |
|
405 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
407 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
406 |
attenteAjoutAuteursOk = true;
|
408 |
attenteAjoutAuteursOk = true;
|
407 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
|
409 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
|
408 |
}
|
410 |
}
|
409 |
}
|
411 |
}
|
410 |
|
412 |
|
411 |
if (info.getType().equals("liste_personne")) {
|
413 |
if (info.getType().equals("liste_personne")) {
|
412 |
PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
|
414 |
PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
|
413 |
|
415 |
|
414 |
List<Personne> liste = listePersonneAuteur.toList();
|
416 |
List<Personne> liste = listePersonneAuteur.toList();
|
415 |
auteursStorePartage.removeAll();
|
417 |
auteursStorePartage.removeAll();
|
416 |
auteursStorePartage.add(liste);
|
418 |
auteursStorePartage.add(liste);
|
417 |
|
- |
|
- |
|
419 |
Debug.log("Reception nouvelle liste auteurs");
|
418 |
auteurStorePartageChargementOk = true;
|
420 |
auteurStorePartageChargementOk = true;
|
419 |
} else if (info.getType().equals("ajout_publication_a_personne")) {
|
421 |
} else if (info.getType().equals("ajout_publication_a_personne")) {
|
420 |
attenteAjoutAuteursOk = false;
|
422 |
attenteAjoutAuteursOk = false;
|
421 |
GWT.log("attenteAjoutAuteursOk", null);
|
423 |
GWT.log("attenteAjoutAuteursOk", null);
|
422 |
} else if (info.getType().equals("suppression_publication_a_personne")) {
|
424 |
} else if (info.getType().equals("suppression_publication_a_personne")) {
|
423 |
attenteSuppressionAuteursOk = false;
|
425 |
attenteSuppressionAuteursOk = false;
|
424 |
GWT.log("attenteSuppressionAuteursOk", null);
|
426 |
GWT.log("attenteSuppressionAuteursOk", null);
|
425 |
} else if (info.getType().equals("modif_publication")) {
|
427 |
} else if (info.getType().equals("modif_publication")) {
|
426 |
Info.display("Modification d'une publication", info.toString());
|
428 |
Info.display("Modification d'une publication", info.toString());
|
427 |
} else if (info.getType().equals("ajout_publication")) {
|
429 |
} else if (info.getType().equals("ajout_publication")) {
|
428 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
|
430 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
|
429 |
String publicationId = (String) info.getDonnee(0);
|
431 |
String publicationId = (String) info.getDonnee(0);
|
430 |
Info.display("Ajout d'une publication", "La publication '"+publicationId+"' a bien été ajoutée");
|
432 |
Info.display("Ajout d'une publication", "La publication '"+publicationId+"' a bien été ajoutée");
|
431 |
if (vueExterneARafraichirApresValidation != null) {
|
433 |
if (vueExterneARafraichirApresValidation != null) {
|
432 |
publication.setId(publicationId);
|
434 |
publication.setId(publicationId);
|
433 |
}
|
435 |
}
|
434 |
} else {
|
436 |
} else {
|
435 |
Info.display("Ajout d'une publication", info.toString());
|
437 |
Info.display("Ajout d'une publication", info.toString());
|
436 |
}
|
438 |
}
|
437 |
}
|
439 |
}
|
438 |
|
440 |
|
439 |
if (avoirAuteursMiseAJourCorrectement()) {
|
441 |
if (avoirAuteursMiseAJourCorrectement()) {
|
440 |
Debug.log("Mise à jour liste auteur");
|
442 |
Debug.log("Mise à jour liste auteur");
|
441 |
miseAJourAuteursInitialListe();
|
443 |
miseAJourAuteursInitialListe();
|
442 |
initialiserAuteurs();
|
444 |
initialiserAuteurs();
|
443 |
auteursValideOk = true;
|
445 |
auteursValideOk = true;
|
444 |
}
|
446 |
}
|
445 |
}
|
447 |
}
|
446 |
|
448 |
|
447 |
private boolean avoirAuteursMiseAJourCorrectement() {
|
449 |
private boolean avoirAuteursMiseAJourCorrectement() {
|
448 |
boolean ok = false;
|
450 |
boolean ok = false;
|
449 |
if (attenteAjoutAuteursOk == false && attenteSuppressionAuteursOk == false) {
|
451 |
if (attenteAjoutAuteursOk == false && attenteSuppressionAuteursOk == false) {
|
450 |
ok = true;
|
452 |
ok = true;
|
451 |
}
|
453 |
}
|
452 |
return ok;
|
454 |
return ok;
|
453 |
}
|
455 |
}
|
454 |
|
456 |
|
455 |
private void afficherAuteurs() {
|
457 |
private void afficherAuteurs() {
|
456 |
Iterator<String> itap = auteursInitialListe.keySet().iterator();
|
458 |
Iterator<String> itap = auteursInitialListe.keySet().iterator();
|
457 |
while (itap.hasNext()) {
|
459 |
while (itap.hasNext()) {
|
458 |
creerChampAuteurEtBoutonSupprimer(auteursInitialListe.get(itap.next()));
|
460 |
creerChampAuteurEtBoutonSupprimer(auteursInitialListe.get(itap.next()));
|
459 |
}
|
461 |
}
|
460 |
}
|
462 |
}
|
461 |
|
463 |
|
462 |
private void initialiserAffichageAuteurs() {
|
464 |
private void initialiserAffichageAuteurs() {
|
463 |
publicationOk = false;
|
465 |
publicationOk = false;
|
464 |
auteurStorePartageChargementOk = false;
|
466 |
auteurStorePartageChargementOk = false;
|
465 |
publicationAPersonneListeChargementOk = false;
|
467 |
publicationAPersonneListeChargementOk = false;
|
466 |
}
|
468 |
}
|
467 |
|
469 |
|
468 |
private boolean etrePretAAfficherAuteurs() {
|
470 |
private boolean etrePretAAfficherAuteurs() {
|
469 |
boolean ok = false;
|
471 |
boolean ok = false;
|
470 |
if (publicationOk && auteurStorePartageChargementOk && publicationAPersonneListeChargementOk) {
|
472 |
if (publicationOk && auteurStorePartageChargementOk && publicationAPersonneListeChargementOk) {
|
471 |
ok = true;
|
473 |
ok = true;
|
472 |
}
|
474 |
}
|
473 |
return ok;
|
475 |
return ok;
|
474 |
}
|
476 |
}
|
475 |
|
477 |
|
476 |
private Boolean etreValide() {
|
478 |
private Boolean etreValide() {
|
477 |
Boolean valide = false;
|
479 |
Boolean valide = false;
|
478 |
//Debug.log("formulaire"+formulaireValideOk+" - Publication :"+publicationValideOk+" - Auteurs :"+auteursValideOk, null);
|
480 |
//Debug.log("formulaire"+formulaireValideOk+" - Publication :"+publicationValideOk+" - Auteurs :"+auteursValideOk, null);
|
479 |
if (formulaireValideOk && publicationValideOk && auteursValideOk) {
|
481 |
if (formulaireValideOk && publicationValideOk && auteursValideOk) {
|
480 |
valide = true;
|
482 |
valide = true;
|
481 |
}
|
483 |
}
|
482 |
return valide;
|
484 |
return valide;
|
483 |
}
|
485 |
}
|
484 |
|
486 |
|
485 |
private void initialiserValidation() {
|
487 |
private void initialiserValidation() {
|
486 |
formulaireValideOk = false;
|
488 |
formulaireValideOk = false;
|
487 |
publicationValideOk = false;
|
489 |
publicationValideOk = false;
|
488 |
initialiserAuteurs();
|
490 |
initialiserAuteurs();
|
489 |
auteursValideOk = false;
|
491 |
auteursValideOk = false;
|
490 |
}
|
492 |
}
|
491 |
|
493 |
|
492 |
private void initialiserAuteurs() {
|
494 |
private void initialiserAuteurs() {
|
493 |
attenteAjoutAuteursOk = true;
|
495 |
attenteAjoutAuteursOk = true;
|
494 |
auteursAjoutes = new PublicationAPersonneListe();
|
496 |
auteursAjoutes = new PublicationAPersonneListe();
|
495 |
attenteSuppressionAuteursOk = true;
|
497 |
attenteSuppressionAuteursOk = true;
|
496 |
auteursSupprimes = new PublicationAPersonneListe();
|
498 |
auteursSupprimes = new PublicationAPersonneListe();
|
497 |
}
|
499 |
}
|
498 |
|
500 |
|
499 |
private void repandreRafraichissement() {
|
501 |
private void repandreRafraichissement() {
|
500 |
if (vueExterneARafraichirApresValidation != null) {
|
502 |
if (vueExterneARafraichirApresValidation != null) {
|
501 |
String type = "publication_modifiee";
|
503 |
String type = "publication_modifiee";
|
502 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
504 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
503 |
type = "publication_ajoutee";
|
505 |
type = "publication_ajoutee";
|
504 |
}
|
506 |
}
|
505 |
Information info = new Information(type);
|
507 |
Information info = new Information(type);
|
506 |
info.setDonnee(0, publication);
|
508 |
info.setDonnee(0, publication);
|
507 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
509 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
508 |
}
|
510 |
}
|
509 |
}
|
511 |
}
|
510 |
|
512 |
|
511 |
public boolean soumettreFormulaire() {
|
513 |
public boolean soumettreFormulaire() {
|
512 |
formulaireValideOk = verifierFormulaire();
|
514 |
formulaireValideOk = verifierFormulaire();
|
513 |
if (formulaireValideOk) {
|
515 |
if (formulaireValideOk) {
|
514 |
soumettrePublication();
|
516 |
soumettrePublication();
|
515 |
soumettreAuteurs();
|
517 |
soumettreAuteurs();
|
516 |
}
|
518 |
}
|
517 |
return formulaireValideOk;
|
519 |
return formulaireValideOk;
|
518 |
}
|
520 |
}
|
519 |
|
521 |
|
520 |
private void soumettrePublication() {
|
522 |
private void soumettrePublication() {
|
521 |
Publication publicationCollectee = collecterPublication();
|
523 |
Publication publicationCollectee = collecterPublication();
|
522 |
if (publicationCollectee != null) {
|
524 |
if (publicationCollectee != null) {
|
523 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
525 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
524 |
mediateur.ajouterPublication(this, publicationCollectee);
|
526 |
mediateur.ajouterPublication(this, publicationCollectee);
|
525 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
527 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
526 |
mediateur.modifierPublication(this, publicationCollectee);
|
528 |
mediateur.modifierPublication(this, publicationCollectee);
|
527 |
}
|
529 |
}
|
528 |
}
|
530 |
}
|
529 |
}
|
531 |
}
|
530 |
|
532 |
|
531 |
private void soumettreAuteurs() {
|
533 |
private void soumettreAuteurs() {
|
532 |
attenteAjoutAuteursOk = false;
|
534 |
attenteAjoutAuteursOk = false;
|
533 |
attenteSuppressionAuteursOk = false;
|
535 |
attenteSuppressionAuteursOk = false;
|
534 |
|
536 |
|
535 |
PersonneListe personnesInitiales = auteursInitialListe;
|
537 |
PersonneListe personnesInitiales = auteursInitialListe;
|
536 |
|
538 |
|
537 |
PersonneListe personnesActuelles = new PersonneListe();
|
539 |
PersonneListe personnesActuelles = new PersonneListe();
|
538 |
if (auteurComboboxListe != null) {
|
540 |
if (auteurComboboxListe != null) {
|
539 |
Iterator<ComboBox<Personne>> itcp = auteurComboboxListe.iterator();
|
541 |
Iterator<ComboBox<Personne>> itcp = auteurComboboxListe.iterator();
|
540 |
while (itcp.hasNext()) {
|
542 |
while (itcp.hasNext()) {
|
541 |
ComboBox<Personne> combobox = itcp.next();
|
543 |
ComboBox<Personne> combobox = itcp.next();
|
542 |
Personne personne = combobox.getValue();
|
544 |
Personne personne = combobox.getValue();
|
543 |
if (personne != null) {
|
545 |
if (personne != null) {
|
544 |
personnesActuelles.put(personne.getId(), personne);
|
546 |
personnesActuelles.put(personne.getId(), personne);
|
545 |
} else {
|
547 |
} else {
|
546 |
Debug.log(combobox.getRawValue());
|
548 |
Debug.log("Etre valide :"+combobox.isValid()+" - "+combobox.getRawValue());
|
547 |
}
|
549 |
}
|
548 |
}
|
550 |
}
|
549 |
}
|
551 |
}
|
550 |
|
552 |
|
551 |
// Auteurs ajoutés
|
553 |
// Auteurs ajoutés
|
552 |
Iterator<String> clesActuelles = personnesActuelles.keySet().iterator();
|
554 |
Iterator<String> clesActuelles = personnesActuelles.keySet().iterator();
|
553 |
while (clesActuelles.hasNext()) {
|
555 |
while (clesActuelles.hasNext()) {
|
554 |
String idActuel = clesActuelles.next();
|
556 |
String idActuel = clesActuelles.next();
|
555 |
if (personnesInitiales.size() == 0 || personnesInitiales.get(idActuel) == null) {
|
557 |
if (personnesInitiales.size() == 0 || personnesInitiales.get(idActuel) == null) {
|
556 |
Personne personne = personnesActuelles.get(idActuel);
|
558 |
Personne personne = personnesActuelles.get(idActuel);
|
557 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
559 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
558 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
560 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
559 |
publicationAAuteur.setIdPublication(publication.getId());
|
561 |
publicationAAuteur.setIdPublication(publication.getId());
|
560 |
}
|
562 |
}
|
561 |
publicationAAuteur.setPersonne(personne);
|
563 |
publicationAAuteur.setPersonne(personne);
|
562 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
564 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
563 |
auteursAjoutes.put(publicationAAuteur.getId(), publicationAAuteur);
|
565 |
auteursAjoutes.put(publicationAAuteur.getId(), publicationAAuteur);
|
564 |
attenteAjoutAuteursOk = true;
|
566 |
attenteAjoutAuteursOk = true;
|
565 |
}
|
567 |
}
|
566 |
}
|
568 |
}
|
567 |
|
569 |
|
568 |
// Auteurs supprimés
|
570 |
// Auteurs supprimés
|
569 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
571 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
570 |
Iterator<String> clesInitiales = personnesInitiales.keySet().iterator();
|
572 |
Iterator<String> clesInitiales = personnesInitiales.keySet().iterator();
|
571 |
while (clesInitiales.hasNext()) {
|
573 |
while (clesInitiales.hasNext()) {
|
572 |
String idInitial = clesInitiales.next();
|
574 |
String idInitial = clesInitiales.next();
|
573 |
if (personnesActuelles.size() == 0 || personnesActuelles.get(idInitial) == null) {
|
575 |
if (personnesActuelles.size() == 0 || personnesActuelles.get(idInitial) == null) {
|
574 |
Personne personne = personnesInitiales.get(idInitial);
|
576 |
Personne personne = personnesInitiales.get(idInitial);
|
575 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
577 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
576 |
publicationAAuteur.setIdPublication(publication.getId());
|
578 |
publicationAAuteur.setIdPublication(publication.getId());
|
577 |
publicationAAuteur.setPersonne(personne);
|
579 |
publicationAAuteur.setPersonne(personne);
|
578 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
580 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
579 |
auteursSupprimes.put(publicationAAuteur.getId(), publicationAAuteur);
|
581 |
auteursSupprimes.put(publicationAAuteur.getId(), publicationAAuteur);
|
580 |
attenteSuppressionAuteursOk = true;
|
582 |
attenteSuppressionAuteursOk = true;
|
581 |
}
|
583 |
}
|
582 |
}
|
584 |
}
|
583 |
}
|
585 |
}
|
584 |
|
586 |
|
585 |
// Execution de les mise à jour pour le mode MODIFICATION
|
587 |
// Execution de les mise à jour pour le mode MODIFICATION
|
586 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
588 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
587 |
if (auteursAjoutes != null && auteursAjoutes.size() != 0) {
|
589 |
if (auteursAjoutes != null && auteursAjoutes.size() != 0) {
|
588 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
|
590 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
|
589 |
}
|
591 |
}
|
590 |
|
592 |
|
591 |
if (auteursSupprimes != null && auteursSupprimes.size() != 0) {
|
593 |
if (auteursSupprimes != null && auteursSupprimes.size() != 0) {
|
592 |
mediateur.supprimerPublicationAPersonne(this, auteursSupprimes);
|
594 |
mediateur.supprimerPublicationAPersonne(this, auteursSupprimes);
|
593 |
}
|
595 |
}
|
594 |
}
|
596 |
}
|
595 |
Debug.log("personnesInitiales:"+personnesInitiales.size()+" - personnesActuelles :"+personnesActuelles.size()+" - auteursSupprimes :"+auteursSupprimes.size()+" - auteursAjoutes :"+auteursAjoutes.size());
|
597 |
Debug.log("personnesInitiales:"+personnesInitiales.size()+" - personnesActuelles :"+personnesActuelles.size()+" - auteursSupprimes :"+auteursSupprimes.size()+" - auteursAjoutes :"+auteursAjoutes.size());
|
596 |
}
|
598 |
}
|
597 |
|
599 |
|
598 |
public boolean verifierFormulaire() {
|
600 |
public boolean verifierFormulaire() {
|
599 |
boolean valide = true;
|
601 |
boolean valide = true;
|
600 |
ArrayList<String> messages = new ArrayList<String>();
|
602 |
ArrayList<String> messages = new ArrayList<String>();
|
601 |
|
603 |
|
602 |
boolean auteurErreur = true;
|
604 |
boolean auteurErreur = true;
|
603 |
for (int i = 0; i < auteurComboboxListe.size(); i++) {
|
605 |
for (int i = 0; i < auteurComboboxListe.size(); i++) {
|
604 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
606 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
605 |
auteurErreur = false;
|
607 |
auteurErreur = false;
|
606 |
break;
|
608 |
break;
|
607 |
}
|
609 |
}
|
608 |
}
|
610 |
}
|
609 |
if (auteurErreur) {
|
611 |
if (auteurErreur) {
|
610 |
messages.add("Veuillez saisir au moins un auteur !");
|
612 |
messages.add("Veuillez saisir au moins un auteur !");
|
611 |
}
|
613 |
}
|
612 |
|
614 |
|
613 |
String titre = titreChp.getValue();
|
615 |
String titre = titreChp.getValue();
|
614 |
if (titre == null || titre.equals("")) {
|
616 |
if (titre == null || titre.equals("")) {
|
615 |
messages.add("Veuillez saisir le titre de la publication !");
|
617 |
messages.add("Veuillez saisir le titre de la publication !");
|
616 |
}
|
618 |
}
|
617 |
|
619 |
|
618 |
String uri = uriChp.getValue();
|
620 |
String uri = uriChp.getValue();
|
619 |
if (uri != null && ! uri.isEmpty() && ! uri.matches(Pattern.url)) {
|
621 |
if (uri != null && ! uri.isEmpty() && ! uri.matches(Pattern.url)) {
|
620 |
messages.add("L'URL saisie n'est pas valide !");
|
622 |
messages.add("L'URL saisie n'est pas valide !");
|
621 |
}
|
623 |
}
|
622 |
|
624 |
|
623 |
String datePublication = datePublicationChp.getRawValue();
|
625 |
String datePublication = datePublicationChp.getRawValue();
|
624 |
if (datePublication == null || datePublication.equals("")) {
|
626 |
if (datePublication == null || datePublication.equals("")) {
|
625 |
messages.add("Veuillez saisir une année de parution !");
|
627 |
messages.add("Veuillez saisir une année de parution !");
|
626 |
} else {
|
628 |
} else {
|
627 |
if (!etreDateValide(datePublication)) {
|
629 |
if (!etreDateValide(datePublication)) {
|
628 |
messages.add("Le format de l'année saisie est incorrect !");
|
630 |
messages.add("Le format de l'année saisie est incorrect !");
|
629 |
}
|
631 |
}
|
630 |
}
|
632 |
}
|
631 |
|
633 |
|
632 |
String pages = pagesChp.getValue();
|
634 |
String pages = pagesChp.getValue();
|
633 |
String valeurPage = "(?:[0-9]+|[IVXLCDM]+|\\?)";
|
635 |
String valeurPage = "(?:[0-9]+|[IVXLCDM]+|\\?)";
|
634 |
if (pages != null && ! pages.matches("^(?:"+valeurPage+"|"+valeurPage+"-"+valeurPage+")$")) {
|
636 |
if (pages != null && ! pages.matches("^(?:"+valeurPage+"|"+valeurPage+"-"+valeurPage+")$")) {
|
635 |
messages.add("Le format des pages est incorrect !");
|
637 |
messages.add("Le format des pages est incorrect !");
|
636 |
}
|
638 |
}
|
637 |
|
639 |
|
638 |
if (messages.size() != 0) {
|
640 |
if (messages.size() != 0) {
|
639 |
String[] tableauDeMessages = {};
|
641 |
String[] tableauDeMessages = {};
|
640 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
642 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
641 |
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
|
643 |
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
|
642 |
valide = false;
|
644 |
valide = false;
|
643 |
}
|
645 |
}
|
644 |
return valide;
|
646 |
return valide;
|
645 |
}
|
647 |
}
|
646 |
|
648 |
|
647 |
private void peuplerFormulaire() {
|
649 |
private void peuplerFormulaire() {
|
648 |
creerChampsAuteur();
|
650 |
creerChampsAuteur();
|
649 |
setValeurComboProjets();
|
651 |
setValeurComboProjets();
|
650 |
titreChp.setValue(publication.getTitre());
|
652 |
titreChp.setValue(publication.getTitre());
|
651 |
collectionChp.setValue(publication.getCollection());
|
653 |
collectionChp.setValue(publication.getCollection());
|
652 |
uriChp.setValue(publication.getURI());
|
654 |
uriChp.setValue(publication.getURI());
|
653 |
datePublicationChp.setValue(reduireDateParAnnee(publication.getDateParution()));
|
655 |
datePublicationChp.setValue(reduireDateParAnnee(publication.getDateParution()));
|
654 |
tomeChp.setValue(publication.getIndicationNvt());
|
656 |
tomeChp.setValue(publication.getIndicationNvt());
|
655 |
fasciculeChp.setValue(publication.getFascicule());
|
657 |
fasciculeChp.setValue(publication.getFascicule());
|
656 |
pagesChp.setValue(publication.getPages());
|
658 |
pagesChp.setValue(publication.getPages());
|
657 |
|
659 |
|
658 |
if (publication.getEditeur().matches("^[0-9]+$")) {
|
660 |
if (publication.getEditeur().matches("^[0-9]+$")) {
|
659 |
editeurCombobox.setValue(editeurCombobox.getStore().findModel("id_structure", publication.getEditeur()));
|
661 |
editeurCombobox.setValue(editeurCombobox.getStore().findModel("id_structure", publication.getEditeur()));
|
660 |
idStructureEdition = publication.getEditeur();
|
662 |
idStructureEdition = publication.getEditeur();
|
661 |
} else {
|
663 |
} else {
|
662 |
editeurCombobox.setRawValue(publication.getEditeur());
|
664 |
editeurCombobox.setRawValue(publication.getEditeur());
|
663 |
}
|
665 |
}
|
664 |
}
|
666 |
}
|
665 |
|
667 |
|
666 |
private Publication collecterPublication() {
|
668 |
private Publication collecterPublication() {
|
667 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
669 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
668 |
|
670 |
|
669 |
publicationCollectee.setIdProjet(getValeurComboProjets());
|
671 |
publicationCollectee.setIdProjet(getValeurComboProjets());
|
670 |
|
672 |
|
671 |
publicationCollectee.setAuteur(construireIntituleAuteur());
|
673 |
publicationCollectee.setAuteur(construireIntituleAuteur());
|
672 |
|
674 |
|
673 |
String titre = titreChp.getValue();
|
675 |
String titre = titreChp.getValue();
|
674 |
publicationCollectee.setTitre(titre);
|
676 |
publicationCollectee.setTitre(titre);
|
675 |
|
677 |
|
676 |
String collection = collectionChp.getValue();
|
678 |
String collection = collectionChp.getValue();
|
677 |
publicationCollectee.setCollection(collection);
|
679 |
publicationCollectee.setCollection(collection);
|
678 |
|
680 |
|
679 |
publicationCollectee.setNomComplet(construireNomComplet());
|
681 |
publicationCollectee.setNomComplet(construireNomComplet());
|
680 |
|
682 |
|
681 |
String uri = uriChp.getValue();
|
683 |
String uri = uriChp.getValue();
|
682 |
publicationCollectee.setUri(uri);
|
684 |
publicationCollectee.setUri(uri);
|
683 |
|
685 |
|
684 |
String editeur = "";
|
686 |
String editeur = "";
|
685 |
if (editeurCombobox.getValue() != null) {
|
687 |
if (editeurCombobox.getValue() != null) {
|
686 |
editeur = editeurCombobox.getValue().getId();
|
688 |
editeur = editeurCombobox.getValue().getId();
|
687 |
publicationCollectee.setStructureEditeur(editeurCombobox.getValue());
|
689 |
publicationCollectee.setStructureEditeur(editeurCombobox.getValue());
|
688 |
} else if (editeurCombobox.getRawValue() != "") {
|
690 |
} else if (editeurCombobox.getRawValue() != "") {
|
689 |
editeur = editeurCombobox.getRawValue();
|
691 |
editeur = editeurCombobox.getRawValue();
|
690 |
}
|
692 |
}
|
691 |
publicationCollectee.setEditeur(editeur);
|
693 |
publicationCollectee.setEditeur(editeur);
|
692 |
|
694 |
|
693 |
String anneePublication = datePublicationChp.getRawValue();
|
695 |
String anneePublication = datePublicationChp.getRawValue();
|
694 |
String datePublication = anneePublication+"-00-00";
|
696 |
String datePublication = anneePublication+"-00-00";
|
695 |
publicationCollectee.setDateParution(datePublication);
|
697 |
publicationCollectee.setDateParution(datePublication);
|
696 |
|
698 |
|
697 |
String tome = tomeChp.getValue();
|
699 |
String tome = tomeChp.getValue();
|
698 |
publicationCollectee.setIndicationNvt(tome);
|
700 |
publicationCollectee.setIndicationNvt(tome);
|
699 |
|
701 |
|
700 |
String fascicule = fasciculeChp.getValue();
|
702 |
String fascicule = fasciculeChp.getValue();
|
701 |
publicationCollectee.setFascicule(fascicule);
|
703 |
publicationCollectee.setFascicule(fascicule);
|
702 |
|
704 |
|
703 |
String pages = pagesChp.getValue();
|
705 |
String pages = pagesChp.getValue();
|
704 |
publicationCollectee.setPages(pages);
|
706 |
publicationCollectee.setPages(pages);
|
705 |
|
707 |
|
706 |
Publication publicationARetourner = null;
|
708 |
Publication publicationARetourner = null;
|
707 |
if (!publicationCollectee.comparer(publication)) {
|
709 |
if (!publicationCollectee.comparer(publication)) {
|
708 |
publicationARetourner = publication = publicationCollectee;
|
710 |
publicationARetourner = publication = publicationCollectee;
|
709 |
}
|
711 |
}
|
710 |
return publicationARetourner;
|
712 |
return publicationARetourner;
|
711 |
}
|
713 |
}
|
712 |
|
714 |
|
713 |
private String construireIntituleEditeur() {
|
715 |
private String construireIntituleEditeur() {
|
714 |
String editeur = "";
|
716 |
String editeur = "";
|
715 |
if (editeurCombobox.getValue() != null) {
|
717 |
if (editeurCombobox.getValue() != null) {
|
716 |
editeur = editeurCombobox.getValue().getNom();
|
718 |
editeur = editeurCombobox.getValue().getNom();
|
717 |
} else if (editeurCombobox.getRawValue() != "") {
|
719 |
} else if (editeurCombobox.getRawValue() != "") {
|
718 |
editeur = editeurCombobox.getRawValue();
|
720 |
editeur = editeurCombobox.getRawValue();
|
719 |
}
|
721 |
}
|
720 |
return editeur;
|
722 |
return editeur;
|
721 |
}
|
723 |
}
|
722 |
|
724 |
|
723 |
private String construireIntituleAuteur() {
|
725 |
private String construireIntituleAuteur() {
|
724 |
String inituleAuteur = "";
|
726 |
String inituleAuteur = "";
|
725 |
int auteursNombre = auteurComboboxListe.size();
|
727 |
int auteursNombre = auteurComboboxListe.size();
|
726 |
for (int i = 0; i < auteursNombre; i++) {
|
728 |
for (int i = 0; i < auteursNombre; i++) {
|
727 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
729 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
728 |
Personne auteur = auteurComboboxListe.get(i).getValue();
|
730 |
Personne auteur = auteurComboboxListe.get(i).getValue();
|
729 |
inituleAuteur += auteur.getNom().toUpperCase()+ " "+auteur.getPrenom();
|
731 |
inituleAuteur += auteur.getNom().toUpperCase()+ " "+auteur.getPrenom();
|
730 |
if (i != (auteursNombre - 1)) {
|
732 |
if (i != (auteursNombre - 1)) {
|
731 |
inituleAuteur += ", ";
|
733 |
inituleAuteur += ", ";
|
732 |
}
|
734 |
}
|
733 |
}
|
735 |
}
|
734 |
}
|
736 |
}
|
735 |
return inituleAuteur;
|
737 |
return inituleAuteur;
|
736 |
}
|
738 |
}
|
737 |
|
739 |
|
738 |
private String construireNomComplet() {
|
740 |
private String construireNomComplet() {
|
739 |
// Intitulé de la publication complet : fmt_auteur, date_parution(année). titre. Editeur (nom), collection, fascicule, indication_nvt. pages.
|
741 |
// Intitulé de la publication complet : fmt_auteur, date_parution(année). titre. Editeur (nom), collection, fascicule, indication_nvt. pages.
|
740 |
String nomComplet = "";
|
742 |
String nomComplet = "";
|
741 |
String auteurs = construireIntituleAuteur();
|
743 |
String auteurs = construireIntituleAuteur();
|
742 |
String annee = datePublicationChp.getRawValue();
|
744 |
String annee = datePublicationChp.getRawValue();
|
743 |
String titre = titreChp.getValue();
|
745 |
String titre = titreChp.getValue();
|
744 |
String editeur = construireIntituleEditeur();
|
746 |
String editeur = construireIntituleEditeur();
|
745 |
|
747 |
|
746 |
nomComplet += auteurs+", "+annee+". "+titre+".";
|
748 |
nomComplet += auteurs+", "+annee+". "+titre+".";
|
747 |
|
749 |
|
748 |
if (!UtilString.isEmpty(editeur)) {
|
750 |
if (!UtilString.isEmpty(editeur)) {
|
749 |
nomComplet += " Éditeur "+editeur+".";
|
751 |
nomComplet += " Éditeur "+editeur+".";
|
750 |
}
|
752 |
}
|
751 |
|
753 |
|
752 |
if (collectionChp.getValue() != null) {
|
754 |
if (collectionChp.getValue() != null) {
|
753 |
String revue = collectionChp.getValue();
|
755 |
String revue = collectionChp.getValue();
|
754 |
nomComplet += ", "+revue;
|
756 |
nomComplet += ", "+revue;
|
755 |
}
|
757 |
}
|
756 |
|
758 |
|
757 |
if (fasciculeChp.getValue() != null) {
|
759 |
if (fasciculeChp.getValue() != null) {
|
758 |
String fascicule = fasciculeChp.getValue();
|
760 |
String fascicule = fasciculeChp.getValue();
|
759 |
nomComplet += ", "+fascicule;
|
761 |
nomComplet += ", "+fascicule;
|
760 |
}
|
762 |
}
|
761 |
|
763 |
|
762 |
if (tomeChp.getValue() != null) {
|
764 |
if (tomeChp.getValue() != null) {
|
763 |
String tomaison = tomeChp.getValue();
|
765 |
String tomaison = tomeChp.getValue();
|
764 |
nomComplet += ", "+tomaison;
|
766 |
nomComplet += ", "+tomaison;
|
765 |
}
|
767 |
}
|
766 |
|
768 |
|
767 |
if (collectionChp.getValue() != null || fasciculeChp.getValue() != null || tomeChp.getValue() != null) {
|
769 |
if (collectionChp.getValue() != null || fasciculeChp.getValue() != null || tomeChp.getValue() != null) {
|
768 |
nomComplet += ".";
|
770 |
nomComplet += ".";
|
769 |
}
|
771 |
}
|
770 |
|
772 |
|
771 |
if (pagesChp.getValue() != null) {
|
773 |
if (pagesChp.getValue() != null) {
|
772 |
String pages = pagesChp.getValue();
|
774 |
String pages = pagesChp.getValue();
|
773 |
nomComplet += pages+".";
|
775 |
nomComplet += pages+".";
|
774 |
}
|
776 |
}
|
775 |
|
777 |
|
776 |
return nomComplet;
|
778 |
return nomComplet;
|
777 |
}
|
779 |
}
|
778 |
|
780 |
|
779 |
public void reinitialiserFormulaire() {
|
781 |
public void reinitialiserFormulaire() {
|
780 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
782 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
781 |
mediateur.afficherFormPublication(publication.getId());
|
783 |
mediateur.afficherFormPublication(publication.getId());
|
782 |
} else {
|
784 |
} else {
|
783 |
mediateur.afficherFormPublication(null);
|
785 |
mediateur.afficherFormPublication(null);
|
784 |
}
|
786 |
}
|
785 |
}
|
787 |
}
|
786 |
|
788 |
|
787 |
private boolean etreDateValide(String anneePublication) {
|
789 |
private boolean etreDateValide(String anneePublication) {
|
788 |
boolean valide = true;
|
790 |
boolean valide = true;
|
789 |
if (!anneePublication.matches("^[0-2][0-9]{3}$")) {
|
791 |
if (!anneePublication.matches("^[0-2][0-9]{3}$")) {
|
790 |
valide = false;
|
792 |
valide = false;
|
791 |
}
|
793 |
}
|
792 |
return valide;
|
794 |
return valide;
|
793 |
}
|
795 |
}
|
794 |
|
796 |
|
795 |
private String reduireDateParAnnee(String datePar) {
|
797 |
private String reduireDateParAnnee(String datePar) {
|
796 |
if (datePar.matches("^[0-2][0-9]{3}(-[0-9]{2}){2}$")) {
|
798 |
if (datePar.matches("^[0-2][0-9]{3}(-[0-9]{2}){2}$")) {
|
797 |
return datePar.split("-")[0];
|
799 |
return datePar.split("-")[0];
|
798 |
} else {
|
800 |
} else {
|
799 |
return "";
|
801 |
return "";
|
800 |
}
|
802 |
}
|
801 |
}
|
803 |
}
|
802 |
|
804 |
|
803 |
private String getValeurComboProjets() {
|
805 |
private String getValeurComboProjets() {
|
804 |
String valeur = "";
|
806 |
String valeur = "";
|
805 |
if (projetsCombo.getValue() != null) {
|
807 |
if (projetsCombo.getValue() != null) {
|
806 |
valeur = projetsCombo.getValue().getId();
|
808 |
valeur = projetsCombo.getValue().getId();
|
807 |
}
|
809 |
}
|
808 |
return valeur;
|
810 |
return valeur;
|
809 |
}
|
811 |
}
|
810 |
private void setValeurComboProjets() {
|
812 |
private void setValeurComboProjets() {
|
811 |
if (projetsCombo.getStore() != null ) {
|
813 |
if (projetsCombo.getStore() != null ) {
|
812 |
if (mode.equals(Formulaire.MODE_MODIFIER) && publication != null) {
|
814 |
if (mode.equals(Formulaire.MODE_MODIFIER) && publication != null) {
|
813 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", publication.getIdProjet()));
|
815 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", publication.getIdProjet()));
|
814 |
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
816 |
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
815 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", mediateur.getProjetId()));
|
817 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", mediateur.getProjetId()));
|
816 |
}
|
818 |
}
|
817 |
}
|
819 |
}
|
818 |
}
|
820 |
}
|
819 |
}
|
821 |
}
|