| Line 9... |
Line 9... |
| 9 |
import org.tela_botanica.client.composants.InfoLogger;
|
9 |
import org.tela_botanica.client.composants.InfoLogger;
|
| 10 |
import org.tela_botanica.client.images.Images;
|
10 |
import org.tela_botanica.client.images.Images;
|
| 11 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
11 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 12 |
import org.tela_botanica.client.modeles.Information;
|
12 |
import org.tela_botanica.client.modeles.Information;
|
| 13 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
13 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
| - |
|
14 |
import org.tela_botanica.client.modeles.Valeur;
|
| - |
|
15 |
import org.tela_botanica.client.modeles.aDonnee;
|
| 14 |
import org.tela_botanica.client.modeles.personne.Personne;
|
16 |
import org.tela_botanica.client.modeles.personne.Personne;
|
| 15 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
17 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
| 16 |
import org.tela_botanica.client.modeles.projet.Projet;
|
18 |
import org.tela_botanica.client.modeles.projet.Projet;
|
| 17 |
import org.tela_botanica.client.modeles.projet.ProjetListe;
|
19 |
import org.tela_botanica.client.modeles.projet.ProjetListe;
|
| 18 |
import org.tela_botanica.client.modeles.publication.Publication;
|
20 |
import org.tela_botanica.client.modeles.publication.Publication;
|
| Line 22... |
Line 24... |
| 22 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
24 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
| 23 |
import org.tela_botanica.client.util.Debug;
|
25 |
import org.tela_botanica.client.util.Debug;
|
| 24 |
import org.tela_botanica.client.util.Pattern;
|
26 |
import org.tela_botanica.client.util.Pattern;
|
| 25 |
import org.tela_botanica.client.util.UtilArray;
|
27 |
import org.tela_botanica.client.util.UtilArray;
|
| 26 |
import org.tela_botanica.client.util.UtilString;
|
28 |
import org.tela_botanica.client.util.UtilString;
|
| - |
|
29 |
import org.tela_botanica.client.vues.FenetreForm;
|
| 27 |
import org.tela_botanica.client.vues.Formulaire;
|
30 |
import org.tela_botanica.client.vues.Formulaire;
|
| - |
|
31 |
import org.tela_botanica.client.vues.FormulaireBarreValidation;
|
| - |
|
32 |
import org.tela_botanica.client.vues.personne.PersonneForm;
|
| Line -... |
Line 33... |
| - |
|
33 |
|
| - |
|
34 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
| - |
|
35 |
import com.extjs.gxt.ui.client.core.XTemplate;
|
| 28 |
|
36 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
| - |
|
37 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
| 29 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
38 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
| - |
|
39 |
import com.extjs.gxt.ui.client.event.Events;
|
| - |
|
40 |
import com.extjs.gxt.ui.client.event.KeyListener;
|
| 30 |
import com.extjs.gxt.ui.client.event.Events;
|
41 |
import com.extjs.gxt.ui.client.event.Listener;
|
| 31 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
42 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
| - |
|
43 |
import com.extjs.gxt.ui.client.store.ListStore;
|
| - |
|
44 |
import com.extjs.gxt.ui.client.store.Store;
|
| 32 |
import com.extjs.gxt.ui.client.store.ListStore;
|
45 |
import com.extjs.gxt.ui.client.store.StoreEvent;
|
| 33 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
46 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
| 34 |
import com.extjs.gxt.ui.client.widget.Info;
|
47 |
import com.extjs.gxt.ui.client.widget.Info;
|
| 35 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
48 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
| - |
|
49 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
| 36 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
50 |
import com.extjs.gxt.ui.client.widget.Text;
|
| - |
|
51 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
| 37 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
52 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
| 38 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
53 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
| 39 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
54 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
| - |
|
55 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
| 40 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
56 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
| 41 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
57 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
| 42 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
58 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
| - |
|
59 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
| - |
|
60 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
| - |
|
61 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
| - |
|
62 |
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
| - |
|
63 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
| - |
|
64 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
| - |
|
65 |
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
| - |
|
66 |
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
| - |
|
67 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
| - |
|
68 |
import com.extjs.gxt.ui.client.widget.grid.RowExpander;
|
| - |
|
69 |
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
|
| 43 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
70 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
| 44 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
71 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
| 45 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
72 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
| - |
|
73 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
| - |
|
74 |
import com.extjs.gxt.ui.client.widget.layout.RowData;
|
| - |
|
75 |
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
| - |
|
76 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
| 46 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
77 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
| - |
|
78 |
import com.google.gwt.core.client.GWT;
|
| Line 47... |
Line 79... |
| 47 |
import com.google.gwt.core.client.GWT;
|
79 |
import com.google.gwt.user.client.Window;
|
| Line 48... |
Line 80... |
| 48 |
|
80 |
|
| 49 |
|
81 |
|
| 50 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
82 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
| 51 |
|
83 |
|
| 52 |
private Publication publication;
|
84 |
private Publication publication;
|
| Line 53... |
Line 85... |
| 53 |
private PersonneListe auteursInitialListe = null;
|
85 |
private PersonneListe auteursInitialListe = null;
|
| 54 |
private static boolean publicationAPersonneListeChargementOk = false;
|
86 |
private static boolean publicationAPersonneListeChargementOk = false;
|
| 55 |
private PublicationAPersonneListe auteursAjoutes = null;
|
87 |
private PersonneListe auteursAjoutes = null;
|
| 56 |
private PublicationAPersonneListe auteursSupprimes = null;
|
- |
|
| 57 |
|
88 |
private PersonneListe auteursSupprimes = null;
|
| 58 |
private FieldSet auteursFieldset = null;
|
89 |
|
| Line 59... |
Line 90... |
| 59 |
private ComboBox<Projet> projetsCombo = null;
|
90 |
private LayoutContainer auteursFieldset = null;
|
| 60 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
91 |
private ComboBox<Projet> projetsCombo = null;
|
| Line 80... |
Line 111... |
| 80 |
private static boolean publicationValideOk = false;
|
111 |
private static boolean publicationValideOk = false;
|
| 81 |
private static boolean auteursValideOk = false;
|
112 |
private static boolean auteursValideOk = false;
|
| 82 |
private static boolean publicationOk = false;
|
113 |
private static boolean publicationOk = false;
|
| 83 |
private static boolean attenteAjoutAuteursOk = true;
|
114 |
private static boolean attenteAjoutAuteursOk = true;
|
| 84 |
private static boolean attenteSuppressionAuteursOk = true;
|
115 |
private static boolean attenteSuppressionAuteursOk = true;
|
| 85 |
|
116 |
|
| - |
|
117 |
private LayoutContainer zoneHaut, zoneBas;
|
| - |
|
118 |
|
| - |
|
119 |
private static int idGenere = 1;
|
| - |
|
120 |
private ToolBar barreOutils = null;
|
| - |
|
121 |
private EditorGrid<Personne> grille;
|
| - |
|
122 |
private PersonneListe personnesAjoutees = null;
|
| - |
|
123 |
private PersonneListe personnesSupprimees = null;
|
| - |
|
124 |
private ComboBox<Personne> personnesSaisiesComboBox = null;
|
| - |
|
125 |
private Button personnesBoutonSupprimer = null;
|
| - |
|
126 |
private Button personnesBoutonModifier = null;
|
| - |
|
127 |
private ComboBox<Valeur> typeRelationCombo = null;
|
| - |
|
128 |
private List<Valeur> roles = null;
|
| - |
|
129 |
private PersonneListe listePersonne = new PersonneListe();
|
| - |
|
130 |
|
| - |
|
131 |
private FenetreForm fenetreFormulaire = null;
|
| - |
|
132 |
|
| 86 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
133 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
| 87 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
134 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
| 88 |
}
|
135 |
}
|
| Line 89... |
Line 136... |
| 89 |
|
136 |
|
| 90 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
137 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
| 91 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
138 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
| 92 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
139 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
| Line 93... |
Line 140... |
| 93 |
}
|
140 |
}
|
| - |
|
141 |
|
| 94 |
|
142 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
| 95 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
143 |
|
| 96 |
auteursInitialListe = new PersonneListe();
|
144 |
auteursInitialListe = new PersonneListe();
|
| Line 97... |
Line 145... |
| 97 |
initialiserValidation();
|
145 |
initialiserValidation();
|
| 98 |
initialiserAffichageAuteurs();
|
146 |
initialiserAffichageAuteurs();
|
| Line 99... |
Line 147... |
| 99 |
|
147 |
|
| 100 |
publication = new Publication();
|
148 |
publication = new Publication();
|
| - |
|
149 |
publication.setId(publicationId);
|
| - |
|
150 |
|
| - |
|
151 |
String modeDeCreation = (UtilString.isEmpty(publication.getId()) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
| - |
|
152 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
| - |
|
153 |
panneauFormulaire.setLayout(new RowLayout());
|
| - |
|
154 |
panneauFormulaire.setStyleAttribute("padding", "0");
|
| - |
|
155 |
zoneHaut = new LayoutContainer(new FitLayout());
|
| Line 101... |
Line -... |
| 101 |
publication.setId(publicationId);
|
- |
|
| 102 |
|
156 |
zoneBas = new LayoutContainer(new FlowLayout());
|
| Line 103... |
Line 157... |
| 103 |
String modeDeCreation = (UtilString.isEmpty(publication.getId()) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
157 |
|
| 104 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
158 |
panneauFormulaire.add(zoneHaut, new RowData(1, 0.3));
|
| Line 105... |
Line 159... |
| 105 |
|
159 |
panneauFormulaire.add(zoneBas, new RowData(1, 0.5));
|
| 106 |
panneauFormulaire.setLayout(new FlowLayout());
|
160 |
|
| Line 107... |
Line 161... |
| 107 |
genererTitreFormulaire();
|
161 |
genererTitreFormulaire();
|
| 108 |
|
162 |
|
| Line 109... |
Line 163... |
| 109 |
creerZoneAuteurs();
|
163 |
creerZoneAuteurs();
|
| 110 |
panneauFormulaire.add(auteursFieldset);
|
164 |
zoneHaut.add(auteursFieldset);
|
| 111 |
|
165 |
|
| 112 |
creerZoneGeneralites();
|
166 |
creerZoneGeneralites();
|
| 113 |
panneauFormulaire.add(generalitesFieldset);
|
167 |
zoneBas.add(generalitesFieldset);
|
| Line -... |
Line 168... |
| - |
|
168 |
|
| - |
|
169 |
creerZoneEdition();
|
| - |
|
170 |
zoneBas.add(editionFieldset);
|
| - |
|
171 |
|
| - |
|
172 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
| - |
|
173 |
mediateurCourrant.selectionnerPublication(this, publicationId);
|
| - |
|
174 |
mediateurCourrant.selectionnerPublicationAPersonne(this, publicationId, null, PublicationAPersonne.ROLE_AUTEUR);
|
| - |
|
175 |
}
|
| - |
|
176 |
}
|
| - |
|
177 |
|
| - |
|
178 |
public void actualiserEtatBoutonsBarreOutils() {
|
| - |
|
179 |
// Activation des boutons si la grille contient un élément
|
| - |
|
180 |
if (grille.getStore().getCount() > 0) {
|
| - |
|
181 |
personnesBoutonSupprimer.enable();
|
| - |
|
182 |
personnesBoutonModifier.enable();
|
| - |
|
183 |
}
|
| - |
|
184 |
// Désactivation des boutons si la grille ne contient plus d'élément
|
| - |
|
185 |
if (grille.getStore().getCount() == 0) {
|
| - |
|
186 |
personnesBoutonSupprimer.disable();
|
| - |
|
187 |
personnesBoutonModifier.disable();
|
| - |
|
188 |
}
|
| - |
|
189 |
}
|
| - |
|
190 |
|
| - |
|
191 |
private ToolBar creerBarreOutilsGrille() {
|
| - |
|
192 |
ToolBar barreOutils = new ToolBar();
|
| - |
|
193 |
|
| - |
|
194 |
Button ajouterBouton = creerBoutonAjouter();
|
| - |
|
195 |
barreOutils.add(ajouterBouton);
|
| - |
|
196 |
|
| - |
|
197 |
barreOutils.add(new Text(" ou "));
|
| - |
|
198 |
|
| - |
|
199 |
personnesSaisiesComboBox = creerComboBoxPersonnesSaisies();
|
| - |
|
200 |
barreOutils.add(personnesSaisiesComboBox);
|
| - |
|
201 |
|
| - |
|
202 |
barreOutils.add(new SeparatorToolItem());
|
| - |
|
203 |
|
| - |
|
204 |
personnesBoutonModifier = creerBoutonModifier();
|
| - |
|
205 |
barreOutils.add(personnesBoutonModifier);
|
| - |
|
206 |
|
| - |
|
207 |
barreOutils.add(new SeparatorToolItem());
|
| - |
|
208 |
|
| - |
|
209 |
personnesBoutonSupprimer = creerBoutonSupprimer();
|
| - |
|
210 |
barreOutils.add(personnesBoutonSupprimer);
|
| - |
|
211 |
|
| - |
|
212 |
barreOutils.add(new SeparatorToolItem());
|
| - |
|
213 |
|
| - |
|
214 |
Button rafraichirBouton = creerBoutonRafraichir();
|
| - |
|
215 |
barreOutils.add(rafraichirBouton);
|
| - |
|
216 |
|
| - |
|
217 |
return barreOutils;
|
| - |
|
218 |
}
|
| - |
|
219 |
|
| - |
|
220 |
private Button creerBoutonAjouter() {
|
| - |
|
221 |
Button bouton = new Button(i18nC.ajouter());
|
| - |
|
222 |
bouton.setIcon(Images.ICONES.vcardAjouter());
|
| - |
|
223 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| - |
|
224 |
public void componentSelected(ButtonEvent ce) {
|
| - |
|
225 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_AJOUTER);
|
| - |
|
226 |
fenetreFormulaire.show();
|
| - |
|
227 |
}
|
| - |
|
228 |
});
|
| - |
|
229 |
return bouton;
|
| - |
|
230 |
}
|
| - |
|
231 |
|
| - |
|
232 |
private Button creerBoutonModifier() {
|
| - |
|
233 |
Button bouton = new Button(i18nC.modifier());
|
| - |
|
234 |
bouton.setIcon(Images.ICONES.vcardModifier());
|
| - |
|
235 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| - |
|
236 |
public void componentSelected(ButtonEvent ce) {
|
| - |
|
237 |
Personne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
| - |
|
238 |
|
| - |
|
239 |
if (personneSaisieSelectionnee == null) {
|
| - |
|
240 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
| - |
|
241 |
} else {
|
| - |
|
242 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_MODIFIER);
|
| - |
|
243 |
fenetreFormulaire.show();
|
| - |
|
244 |
}
|
| - |
|
245 |
}
|
| - |
|
246 |
});
|
| - |
|
247 |
return bouton;
|
| - |
|
248 |
}
|
| - |
|
249 |
|
| - |
|
250 |
private FenetreForm creerFenetreModaleAvecFormulairePersonne(String mode) {
|
| - |
|
251 |
String personneId = null;
|
| - |
|
252 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| - |
|
253 |
Personne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
| - |
|
254 |
personneId = personneSaisieSelectionnee.getId();
|
| - |
|
255 |
}
|
| - |
|
256 |
|
| - |
|
257 |
final FenetreForm fenetre = new FenetreForm("");
|
| - |
|
258 |
final PersonneForm formulaire = creerFormulairePersonne(fenetre, personneId);
|
| - |
|
259 |
fenetre.add(formulaire);
|
| - |
|
260 |
return fenetre;
|
| - |
|
261 |
}
|
| - |
|
262 |
|
| - |
|
263 |
private PersonneForm creerFormulairePersonne(final FenetreForm fenetre, final String personneId) {
|
| - |
|
264 |
PersonneForm formulairePersonne = new PersonneForm(mediateur, personneId, this);
|
| - |
|
265 |
FormPanel panneauFormulaire = formulairePersonne.getFormulaire();
|
| - |
|
266 |
fenetre.setHeading(panneauFormulaire.getHeading());
|
| - |
|
267 |
panneauFormulaire.setHeaderVisible(false);
|
| - |
|
268 |
panneauFormulaire.setTopComponent(null);
|
| - |
|
269 |
|
| - |
|
270 |
// FIXME : avec GXT-2.1.0 la redéfinition du bottom component ne marche plus. Nous le cachons et en créeons un dans la fenêtre.
|
| - |
|
271 |
panneauFormulaire.getBottomComponent().hide();
|
| - |
|
272 |
SelectionListener<ButtonEvent> ecouteur = creerEcouteurValidationFormulairePersonne(fenetre, formulairePersonne);
|
| - |
|
273 |
final ButtonBar barreValidation = new FormulaireBarreValidation(ecouteur);
|
| - |
|
274 |
fenetre.setBottomComponent(barreValidation);
|
| - |
|
275 |
|
| - |
|
276 |
return formulairePersonne;
|
| - |
|
277 |
}
|
| - |
|
278 |
|
| - |
|
279 |
private SelectionListener<ButtonEvent> creerEcouteurValidationFormulairePersonne(final FenetreForm fenetre, final PersonneForm formulaire) {
|
| - |
|
280 |
SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
|
| - |
|
281 |
public void componentSelected(ButtonEvent ce) {
|
| - |
|
282 |
String code = ((Button) ce.getComponent()).getData("code");
|
| - |
|
283 |
if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
|
| - |
|
284 |
if (formulaire.soumettreFormulaire()) {
|
| - |
|
285 |
fenetre.hide();
|
| - |
|
286 |
}
|
| - |
|
287 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
|
| - |
|
288 |
formulaire.soumettreFormulaire();
|
| - |
|
289 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
|
| - |
|
290 |
fenetre.hide();
|
| - |
|
291 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
|
| - |
|
292 |
fenetreFormulaire.hide();
|
| - |
|
293 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(formulaire.mode);
|
| - |
|
294 |
fenetreFormulaire.show();
|
| - |
|
295 |
}
|
| - |
|
296 |
}
|
| - |
|
297 |
};
|
| - |
|
298 |
|
| - |
|
299 |
return ecouteur;
|
| - |
|
300 |
}
|
| - |
|
301 |
|
| - |
|
302 |
private Button creerBoutonSupprimer() {
|
| - |
|
303 |
Button bouton = new Button(i18nC.supprimer());
|
| - |
|
304 |
bouton.setIcon(Images.ICONES.vcardSupprimer());
|
| - |
|
305 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| - |
|
306 |
public void componentSelected(ButtonEvent ce) {
|
| - |
|
307 |
Personne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
| - |
|
308 |
if (personneSaisieSelectionnee == null) {
|
| - |
|
309 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
| - |
|
310 |
} else {
|
| - |
|
311 |
supprimerDansGrille(personneSaisieSelectionnee);
|
| - |
|
312 |
}
|
| - |
|
313 |
}
|
| - |
|
314 |
});
|
| - |
|
315 |
return bouton;
|
| - |
|
316 |
}
|
| - |
|
317 |
|
| - |
|
318 |
private Button creerBoutonRafraichir() {
|
| - |
|
319 |
Button bouton = new Button(i18nC.rafraichir());
|
| - |
|
320 |
bouton.setIcon(Images.ICONES.rafraichir());
|
| - |
|
321 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| - |
|
322 |
public void componentSelected(ButtonEvent ce) {
|
| - |
|
323 |
actualiserGrille();
|
| - |
|
324 |
}
|
| - |
|
325 |
});
|
| - |
|
326 |
return bouton;
|
| - |
|
327 |
}
|
| - |
|
328 |
|
| - |
|
329 |
private void actualiserGrille() {
|
| - |
|
330 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| - |
|
331 |
// FIXME : c'est la merde
|
| - |
|
332 |
//mediateur.selectionner(this, null, personneSelectionnee.getId(), "%");
|
| - |
|
333 |
} else {
|
| - |
|
334 |
grille.getStore().removeAll();
|
| - |
|
335 |
layout();
|
| - |
|
336 |
}
|
| - |
|
337 |
}
|
| - |
|
338 |
|
| - |
|
339 |
private ComboBox<Personne> creerComboBoxPersonnesSaisies() {
|
| - |
|
340 |
ListStore<Personne> personnesSaisiesStore = new ListStore<Personne>();
|
| - |
|
341 |
|
| - |
|
342 |
ComboBox<Personne> comboBox = new ComboBox<Personne>();
|
| - |
|
343 |
comboBox.setWidth(400);
|
| - |
|
344 |
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
|
| - |
|
345 |
comboBox.setTriggerAction(TriggerAction.ALL);
|
| - |
|
346 |
comboBox.setEditable(true);
|
| - |
|
347 |
comboBox.setDisplayField("fmt_nom_complet");
|
| - |
|
348 |
comboBox.setStore(personnesSaisiesStore);
|
| - |
|
349 |
comboBox.addKeyListener(new KeyListener() {
|
| - |
|
350 |
public void componentKeyUp(ComponentEvent ce) {
|
| - |
|
351 |
if (personnesSaisiesComboBox.getRawValue() != null && personnesSaisiesComboBox.getRawValue().length() > 0) {
|
| - |
|
352 |
if (!ce.isNavKeyPress()) {
|
| - |
|
353 |
obtenirPersonnesSaisies(personnesSaisiesComboBox.getRawValue());
|
| - |
|
354 |
}
|
| - |
|
355 |
}
|
| - |
|
356 |
}
|
| - |
|
357 |
});
|
| - |
|
358 |
comboBox.addListener(Events.Select, new Listener<BaseEvent>() {
|
| - |
|
359 |
public void handleEvent(BaseEvent be) {
|
| - |
|
360 |
if (personnesSaisiesComboBox.getValue() instanceof Personne) {
|
| - |
|
361 |
// N'ajouter l'auteur que s'il n'est pas déjà présent dans la grille et dans les valeurs initiales
|
| - |
|
362 |
Personne personneSaisieSelectionne = personnesSaisiesComboBox.getValue();
|
| - |
|
363 |
if (grille.getStore().findModel(personneSaisieSelectionne) != null) {
|
| - |
|
364 |
Info.display("Information", "La personne est déjà présente dans la liste d'auteurs");
|
| - |
|
365 |
} else {
|
| - |
|
366 |
if (!auteursInitialListe.containsValue(personneSaisieSelectionne)) {
|
| - |
|
367 |
auteursAjoutes.put(personneSaisieSelectionne.getId(), personneSaisieSelectionne);
|
| - |
|
368 |
}
|
| - |
|
369 |
ajouterDansGrille(personneSaisieSelectionne);
|
| - |
|
370 |
personnesSaisiesComboBox.setValue(null);
|
| - |
|
371 |
}
|
| - |
|
372 |
}
|
| - |
|
373 |
}
|
| - |
|
374 |
});
|
| - |
|
375 |
return comboBox;
|
| - |
|
376 |
}
|
| - |
|
377 |
|
| - |
|
378 |
private void obtenirPersonnesSaisies(String nom) {
|
| - |
|
379 |
mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%");
|
| - |
|
380 |
}
|
| - |
|
381 |
|
| - |
|
382 |
private void ajouterDansGrille(Personne personne) {
|
| - |
|
383 |
ajouterDansGrille(personne, 0);
|
| - |
|
384 |
}
|
| - |
|
385 |
|
| - |
|
386 |
private void ajouterDansGrille(Personne personne, int index) {
|
| - |
|
387 |
if (personne != null) {
|
| - |
|
388 |
if (!grille.getStore().contains(personne)) {
|
| - |
|
389 |
//1) si elle ne fait pas partie des initiaux, ajouter à la liste à ajouter
|
| - |
|
390 |
if (!auteursInitialListe.containsValue(personne)) {
|
| - |
|
391 |
auteursAjoutes.put(personne.getId(), personne);
|
| - |
|
392 |
}
|
| - |
|
393 |
|
| - |
|
394 |
// L'enlever de la liste à supprimer
|
| - |
|
395 |
if (auteursSupprimes.containsValue(personne)) {
|
| - |
|
396 |
auteursSupprimes.remove(personne);
|
| - |
|
397 |
}
|
| - |
|
398 |
//2) Ajouter a la grille
|
| - |
|
399 |
grille.getStore().insert(personne, index);
|
| - |
|
400 |
grille.getSelectionModel().select(index, false);
|
| - |
|
401 |
} else {
|
| - |
|
402 |
InfoLogger.display("Information", "La personne choisie existe déjà dans la liste.");
|
| - |
|
403 |
}
|
| - |
|
404 |
}
|
| - |
|
405 |
}
|
| - |
|
406 |
|
| - |
|
407 |
/**
|
| - |
|
408 |
* Met à jour la grille avec les informations contenus dans la variable listePublicationsLiees
|
| - |
|
409 |
*/
|
| - |
|
410 |
private void mettreAJourGrille() {
|
| - |
|
411 |
|
| - |
|
412 |
grille.getStore().removeAll();
|
| - |
|
413 |
grille.getStore().add(listePersonne.toList());
|
| - |
|
414 |
}
|
| - |
|
415 |
|
| - |
|
416 |
private void supprimerDansGrille(Personne personne) {
|
| - |
|
417 |
if (personne != null) {
|
| - |
|
418 |
//1) Ajouter a la liste des personne à supprimer uniquement si est présente dans la liste initiale
|
| - |
|
419 |
if (auteursInitialListe.containsValue(personne)) {
|
| - |
|
420 |
auteursSupprimes.put(personne.getId(), personne);
|
| - |
|
421 |
}
|
| - |
|
422 |
|
| - |
|
423 |
if (auteursAjoutes.containsValue(personne)) {
|
| - |
|
424 |
auteursAjoutes.remove(personne);
|
| - |
|
425 |
}
|
| - |
|
426 |
|
| - |
|
427 |
//2) Supprimer la personne de la liste
|
| - |
|
428 |
grille.getStore().remove(personne);
|
| - |
|
429 |
} else {
|
| - |
|
430 |
Info.display("Information", "Vous devez sélectionner une personne");
|
| - |
|
431 |
}
|
| - |
|
432 |
}
|
| - |
|
433 |
|
| - |
|
434 |
private EditorGrid<Personne> creerGrille() {
|
| - |
|
435 |
|
| - |
|
436 |
ListStore<Personne> storeGrille = new ListStore<Personne>();
|
| - |
|
437 |
storeGrille.addListener(Store.Add, new Listener<StoreEvent<Personne>>() {
|
| - |
|
438 |
public void handleEvent(StoreEvent<Personne> ce) {
|
| - |
|
439 |
actualiserEtatBoutonsBarreOutils();
|
| - |
|
440 |
}
|
| - |
|
441 |
});
|
| - |
|
442 |
|
| - |
|
443 |
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<Personne>>() {
|
| - |
|
444 |
public void handleEvent(StoreEvent<Personne> ce) {
|
| - |
|
445 |
actualiserEtatBoutonsBarreOutils();
|
| - |
|
446 |
}
|
| - |
|
447 |
});
|
| - |
|
448 |
|
| - |
|
449 |
storeGrille.addListener(Store.Update, new Listener<StoreEvent<Personne>>() {
|
| - |
|
450 |
public void handleEvent(StoreEvent<Personne> ce) {
|
| - |
|
451 |
if (ce.getRecord().isModified("_role_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
| - |
|
452 |
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
|
| - |
|
453 |
}
|
| - |
|
454 |
}
|
| - |
|
455 |
});
|
| - |
|
456 |
|
| - |
|
457 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
| - |
|
458 |
colonnes.add(new ColumnConfig("fmt_nom_complet", i18nC.personneNomComplet(), 150));
|
| - |
|
459 |
colonnes.add(new ColumnConfig("code_postal", i18nC.personneCodePostal(), 150));
|
| - |
|
460 |
colonnes.add(new ColumnConfig("ville", i18nC.personneVille(), 75));
|
| - |
|
461 |
colonnes.add(new ColumnConfig("truk_courriel", i18nC.personneCourriel(), 75));
|
| - |
|
462 |
|
| - |
|
463 |
GridSelectionModel<Personne> modeleDeSelection = new GridSelectionModel<Personne>();
|
| - |
|
464 |
|
| - |
|
465 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
| - |
|
466 |
|
| - |
|
467 |
EditorGrid<Personne> grillePublications = new EditorGrid<Personne>(storeGrille, modeleDeColonnes);
|
| - |
|
468 |
grillePublications.setHeight("100%");
|
| 114 |
|
469 |
grillePublications.setBorders(true);
|
| 115 |
creerZoneEdition();
|
470 |
grillePublications.setSelectionModel(modeleDeSelection);
|
| 116 |
panneauFormulaire.add(editionFieldset);
|
471 |
grillePublications.getView().setForceFit(true);
|
| 117 |
|
472 |
grillePublications.setAutoExpandColumn("fmt_nom_complet");
|
| 118 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
473 |
grillePublications.setStripeRows(true);
|
| Line 132... |
Line 487... |
| 132 |
panneauFormulaire.setHeading(titre);
|
487 |
panneauFormulaire.setHeading(titre);
|
| 133 |
}
|
488 |
}
|
| Line 134... |
Line 489... |
| 134 |
|
489 |
|
| 135 |
|
- |
|
| 136 |
private void creerZoneAuteurs() {
|
- |
|
| 137 |
FormLayout layout = new FormLayout();
|
- |
|
| 138 |
layout.setLabelWidth(200);
|
490 |
|
| 139 |
|
- |
|
| 140 |
// Fieldset Auteur
|
- |
|
| 141 |
auteursFieldset = new FieldSet();
|
- |
|
| 142 |
auteursFieldset.setHeading(i18nC.publicationAuteursTitre());
|
491 |
private void creerZoneAuteurs() {
|
| 143 |
auteursFieldset.setCollapsible(true);
|
- |
|
| 144 |
auteursFieldset.setLayout(layout);
|
492 |
// Fieldset Auteur
|
| 145 |
|
- |
|
| 146 |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
|
493 |
auteursFieldset = new LayoutContainer(new FitLayout());
|
| Line 147... |
Line 494... |
| 147 |
auteursStorePartage = new ListStore<Personne>();
|
494 |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
|
| 148 |
mediateur.clicObtenirListeAuteurs(this);
|
495 |
mediateur.clicObtenirListeAuteurs(this);
|
| Line 149... |
Line 496... |
| 149 |
|
496 |
|
| 150 |
creerChampsAuteur();
|
497 |
creerChampsAuteur();
|
| 151 |
}
|
498 |
}
|
| 152 |
|
- |
|
| 153 |
private void creerChampsAuteur() {
|
- |
|
| 154 |
auteursFieldset.removeAll();
|
- |
|
| 155 |
conteneurChamps = new LayoutContainer();
|
- |
|
| 156 |
|
- |
|
| 157 |
Button ajouterAuteurBouton = new Button(i18nC.publicationAuteurBoutonAjouter());
|
499 |
|
| 158 |
ajouterAuteurBouton.setIcon(Images.ICONES.ajouter());
|
- |
|
| 159 |
ajouterAuteurBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
| 160 |
public void componentSelected(ButtonEvent be) {
|
- |
|
| 161 |
creerChampAuteurEtBoutonSupprimer(null);
|
500 |
private void creerChampsAuteur() {
|
| 162 |
}
|
501 |
auteursFieldset.removeAll();
|
| 163 |
});
|
502 |
barreOutils = creerBarreOutilsGrille();
|
| 164 |
|
503 |
panneauFormulaire.setTopComponent(barreOutils);
|
| Line 165... |
Line 504... |
| 165 |
auteursFieldset.add(conteneurChamps);
|
504 |
grille = creerGrille();
|
| 166 |
auteursFieldset.add(ajouterAuteurBouton);
|
505 |
auteursFieldset.add(grille);
|
| Line 167... |
Line 506... |
| 167 |
auteursFieldset.layout();
|
506 |
auteursFieldset.layout();
|
| 168 |
}
|
507 |
}
|
| Line 169... |
Line 508... |
| 169 |
|
508 |
|
| Line 202... |
Line 541... |
| 202 |
}
|
541 |
}
|
| 203 |
});
|
542 |
});
|
| 204 |
panneauHorizontal.add(supprimerAuteurBouton);
|
543 |
panneauHorizontal.add(supprimerAuteurBouton);
|
| Line 205... |
Line 544... |
| 205 |
|
544 |
|
| 206 |
conteneurChamps.add(panneauHorizontal);
|
545 |
conteneurChamps.add(panneauHorizontal);
|
| 207 |
auteursFieldset.layout();
|
546 |
auteursFieldset.layout();*/
|
| Line 208... |
Line 547... |
| 208 |
}
|
547 |
}
|
| 209 |
|
548 |
|
| 210 |
private ComboBox<Personne> creerComboBoxAuteursSaisis() {
|
549 |
private ComboBox<Personne> creerComboBoxAuteursSaisis() {
|
| Line 375... |
Line 714... |
| 375 |
}
|
714 |
}
|
| Line 376... |
Line 715... |
| 376 |
|
715 |
|
| 377 |
private void miseAJourAuteursInitialListe() {
|
716 |
private void miseAJourAuteursInitialListe() {
|
| 378 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
717 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
| 379 |
while (clesAjoutees.hasNext()) {
|
718 |
while (clesAjoutees.hasNext()) {
|
| 380 |
Personne auteurAjoute = auteursAjoutes.get(clesAjoutees.next()).getPersonne();
|
719 |
Personne auteurAjoute = auteursAjoutes.get(clesAjoutees.next());
|
| 381 |
auteursInitialListe.put(auteurAjoute.getId(), auteurAjoute);
|
720 |
auteursInitialListe.put(auteurAjoute.getId(), auteurAjoute);
|
| Line 382... |
Line 721... |
| 382 |
}
|
721 |
}
|
| 383 |
|
722 |
|
| 384 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
723 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
| 385 |
while (clesSupprimees.hasNext()) {
|
724 |
while (clesSupprimees.hasNext()) {
|
| 386 |
Personne auteurSupprime = auteursSupprimes.get(clesSupprimees.next()).getPersonne();
|
725 |
Personne auteurSupprime = auteursSupprimes.get(clesSupprimees.next());
|
| 387 |
auteursInitialListe.remove(auteurSupprime.getId());
|
726 |
auteursInitialListe.remove(auteurSupprime.getId());
|
| Line 388... |
Line 727... |
| 388 |
}
|
727 |
}
|
| Line 403... |
Line 742... |
| 403 |
Iterator<String> it = auteurs.keySet().iterator();
|
742 |
Iterator<String> it = auteurs.keySet().iterator();
|
| 404 |
while (it.hasNext()) {
|
743 |
while (it.hasNext()) {
|
| 405 |
Personne auteur = auteurs.get(it.next()).getPersonne();
|
744 |
Personne auteur = auteurs.get(it.next()).getPersonne();
|
| 406 |
auteursInitialListe.put(auteur.getId(), auteur);
|
745 |
auteursInitialListe.put(auteur.getId(), auteur);
|
| 407 |
}
|
746 |
}
|
| - |
|
747 |
|
| - |
|
748 |
grille.getStore().removeAll();
|
| - |
|
749 |
grille.getStore().add(auteursInitialListe.toList());
|
| - |
|
750 |
|
| 408 |
publicationAPersonneListeChargementOk = true;
|
751 |
publicationAPersonneListeChargementOk = true;
|
| 409 |
}
|
752 |
}
|
| Line 410... |
Line 753... |
| 410 |
|
753 |
|
| 411 |
private void rafraichirInformation(Information info) {
|
754 |
private void rafraichirInformation(Information info) {
|
| 412 |
String type = info.getType();
|
755 |
String type = info.getType();
|
| - |
|
756 |
if (type.equals("ajout_publication") || type.equals("modif_publication")) {
|
| - |
|
757 |
// On vient de soumettre le formulaire, on doit passer à l'étape suivante:
|
| 413 |
if (type.equals("ajout_publication") || type.equals("modif_publication")) {
|
758 |
// Validation des auteurs ou fermeture du formulaire
|
| 414 |
publicationValideOk = true;
|
759 |
publicationValideOk = true;
|
| 415 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
760 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
| 416 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
|
761 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
|
| 417 |
String publicationId = (String) info.getDonnee(0);
|
762 |
String publicationId = (String) info.getDonnee(0);
|
| 418 |
if (publicationId.matches("[0-9]+")) {
|
763 |
if (publicationId.matches("[0-9]+")) {
|
| 419 |
publication.setId(publicationId);
|
764 |
publication.setId(publicationId);
|
| 420 |
}
|
765 |
}
|
| 421 |
}
|
766 |
}
|
| 422 |
attenteAjoutAuteursOk = true;
|
- |
|
| 423 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
|
767 |
attenteAjoutAuteursOk = true;
|
| - |
|
768 |
}
|
| 424 |
}
|
769 |
soumettreAuteurs();
|
| Line -... |
Line 770... |
| - |
|
770 |
}
|
| 425 |
}
|
771 |
|
| 426 |
|
772 |
|
| Line 427... |
Line 773... |
| 427 |
if (info.getType().equals("liste_personne")) {
|
773 |
if (info.getType().equals("liste_personne")) {
|
| 428 |
PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
|
774 |
PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
|
| 429 |
|
775 |
|
| 430 |
List<Personne> liste = listePersonneAuteur.toList();
|
776 |
/*List<Personne> liste = listePersonneAuteur.toList();
|
| - |
|
777 |
auteursStorePartage.removeAll();
|
| - |
|
778 |
auteursStorePartage.add(liste);
|
| - |
|
779 |
auteurStorePartageChargementOk = true;*/
|
| - |
|
780 |
|
| - |
|
781 |
ListStore store = personnesSaisiesComboBox.getStore();
|
| 431 |
auteursStorePartage.removeAll();
|
782 |
store.removeAll();
|
| 432 |
auteursStorePartage.add(liste);
|
783 |
store.add(listePersonneAuteur.toList());
|
| 433 |
auteurStorePartageChargementOk = true;
|
784 |
|
| 434 |
} else if (info.getType().equals("ajout_publication_a_personne")) {
|
785 |
} else if (info.getType().equals("ajout_publication_a_personne")) {
|
| 435 |
attenteAjoutAuteursOk = false;
|
786 |
attenteAjoutAuteursOk = false;
|
| Line 446... |
Line 797... |
| 446 |
}
|
797 |
}
|
| 447 |
}
|
798 |
}
|
| 448 |
}
|
799 |
}
|
| Line 449... |
Line 800... |
| 449 |
|
800 |
|
| - |
|
801 |
private boolean avoirAuteursMiseAJourCorrectement() {
|
| 450 |
private boolean avoirAuteursMiseAJourCorrectement() {
|
802 |
|
| 451 |
boolean ok = false;
|
803 |
boolean ok = false;
|
| 452 |
if (attenteAjoutAuteursOk == false && attenteSuppressionAuteursOk == false) {
|
804 |
if (attenteAjoutAuteursOk == false && attenteSuppressionAuteursOk == false) {
|
| 453 |
ok = true;
|
805 |
ok = true;
|
| 454 |
}
|
806 |
}
|
| Line 488... |
Line 840... |
| 488 |
return ok;
|
840 |
return ok;
|
| 489 |
}
|
841 |
}
|
| Line 490... |
Line 842... |
| 490 |
|
842 |
|
| 491 |
private boolean etrePretAPeupler() {
|
843 |
private boolean etrePretAPeupler() {
|
| 492 |
boolean ok = false;
|
844 |
boolean ok = false;
|
| 493 |
if (mode.equals(Formulaire.MODE_MODIFIER) && publicationOk && auteursAffiches && editeursOk) {
|
845 |
if (mode.equals(Formulaire.MODE_MODIFIER) && publicationOk && editeursOk) {
|
| 494 |
ok = true;
|
846 |
ok = true;
|
| 495 |
}
|
847 |
}
|
| 496 |
return ok;
|
848 |
return ok;
|
| Line 497... |
Line 849... |
| 497 |
}
|
849 |
}
|
| 498 |
|
850 |
|
| 499 |
private Boolean etreValide() {
|
851 |
private Boolean etreValide() {
|
| 500 |
Boolean valide = false;
|
852 |
Boolean valide = false;
|
| 501 |
if (formulaireValideOk && publicationValideOk && auteursValideOk) {
|
853 |
if (formulaireValideOk && auteursValideOk) {
|
| 502 |
valide = true;
|
854 |
valide = true;
|
| 503 |
}
|
855 |
}
|
| Line 511... |
Line 863... |
| 511 |
auteursValideOk = false;
|
863 |
auteursValideOk = false;
|
| 512 |
}
|
864 |
}
|
| Line 513... |
Line 865... |
| 513 |
|
865 |
|
| 514 |
private void initialiserAuteurs() {
|
866 |
private void initialiserAuteurs() {
|
| 515 |
attenteAjoutAuteursOk = true;
|
867 |
attenteAjoutAuteursOk = true;
|
| 516 |
auteursAjoutes = new PublicationAPersonneListe();
|
868 |
auteursAjoutes = new PersonneListe();
|
| 517 |
attenteSuppressionAuteursOk = true;
|
869 |
attenteSuppressionAuteursOk = true;
|
| 518 |
auteursSupprimes = new PublicationAPersonneListe();
|
870 |
auteursSupprimes = new PersonneListe();
|
| Line 519... |
Line 871... |
| 519 |
}
|
871 |
}
|
| 520 |
|
872 |
|
| 521 |
private void repandreRafraichissement() {
|
873 |
private void repandreRafraichissement() {
|
| Line 532... |
Line 884... |
| 532 |
|
884 |
|
| 533 |
public boolean soumettreFormulaire() {
|
885 |
public boolean soumettreFormulaire() {
|
| 534 |
formulaireValideOk = verifierFormulaire();
|
886 |
formulaireValideOk = verifierFormulaire();
|
| 535 |
if (formulaireValideOk) {
|
887 |
if (formulaireValideOk) {
|
| 536 |
soumettrePublication();
|
888 |
soumettrePublication();
|
| 537 |
soumettreAuteurs();
|
889 |
//Les auteurs seront mis à jour lors du rafraichissement
|
| 538 |
}
|
890 |
}
|
| 539 |
return formulaireValideOk;
|
891 |
return formulaireValideOk;
|
| Line 540... |
Line 892... |
| 540 |
}
|
892 |
}
|
| Line 552... |
Line 904... |
| 552 |
|
904 |
|
| 553 |
private void soumettreAuteurs() {
|
905 |
private void soumettreAuteurs() {
|
| 554 |
attenteAjoutAuteursOk = false;
|
906 |
attenteAjoutAuteursOk = false;
|
| Line -... |
Line 907... |
| - |
|
907 |
attenteSuppressionAuteursOk = false;
|
| - |
|
908 |
|
| - |
|
909 |
//1) Auteurs ajoutés :
|
| - |
|
910 |
// - Créer une PublicationAAuteurListe
|
| - |
|
911 |
PublicationAPersonneListe listeDesAuteurs = new PublicationAPersonneListe();
|
| - |
|
912 |
Iterator<String> itAuteur = auteursAjoutes.keySet().iterator();
|
| - |
|
913 |
while (itAuteur.hasNext()) {
|
| - |
|
914 |
PublicationAPersonne publiAPersonne = new PublicationAPersonne();
|
| - |
|
915 |
String cle = itAuteur.next();
|
| - |
|
916 |
publiAPersonne.setIdPersonne(cle);
|
| - |
|
917 |
publiAPersonne.setIdPublication(publication.getId());
|
| - |
|
918 |
listeDesAuteurs.put(cle, publiAPersonne);
|
| - |
|
919 |
}
|
| - |
|
920 |
|
| - |
|
921 |
// - envoyer au mediateur SSI personnes à ajouter
|
| - |
|
922 |
if (listeDesAuteurs.size() > 0) {
|
| - |
|
923 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), listeDesAuteurs, PublicationAPersonne.ROLE_AUTEUR);
|
| - |
|
924 |
attenteAjoutAuteursOk = true;
|
| - |
|
925 |
}
|
| - |
|
926 |
|
| - |
|
927 |
//2) Auteurs supprimés :
|
| - |
|
928 |
// - Créer une PublicationAPersonneListe
|
| - |
|
929 |
listeDesAuteurs = new PublicationAPersonneListe();
|
| - |
|
930 |
itAuteur = auteursSupprimes.keySet().iterator();
|
| - |
|
931 |
while (itAuteur.hasNext()) {
|
| - |
|
932 |
PublicationAPersonne publiAPersonne = new PublicationAPersonne();
|
| - |
|
933 |
String cle = itAuteur.next();
|
| - |
|
934 |
publiAPersonne.setIdPersonne(cle);
|
| - |
|
935 |
publiAPersonne.setIdPublication(publication.getId());
|
| - |
|
936 |
listeDesAuteurs.put(cle, publiAPersonne);
|
| - |
|
937 |
}
|
| - |
|
938 |
|
| - |
|
939 |
// - Envoyer au médiateur SSI personnes à supprimer
|
| - |
|
940 |
if (listeDesAuteurs.size() > 0) {
|
| - |
|
941 |
mediateur.supprimerPublicationAPersonne(this, listeDesAuteurs);
|
| - |
|
942 |
attenteSuppressionAuteursOk = true;
|
| - |
|
943 |
}
|
| - |
|
944 |
|
| - |
|
945 |
/*
|
| - |
|
946 |
attenteAjoutAuteursOk = false;
|
| 555 |
attenteSuppressionAuteursOk = false;
|
947 |
attenteSuppressionAuteursOk = false;
|
| Line 556... |
Line 948... |
| 556 |
|
948 |
|
| 557 |
PersonneListe personnesInitiales = auteursInitialListe;
|
949 |
PersonneListe personnesInitiales = auteursInitialListe;
|
| 558 |
|
950 |
|
| Line 580... |
Line 972... |
| 580 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
972 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 581 |
publicationAAuteur.setIdPublication(publication.getId());
|
973 |
publicationAAuteur.setIdPublication(publication.getId());
|
| 582 |
}
|
974 |
}
|
| 583 |
publicationAAuteur.setPersonne(personne);
|
975 |
publicationAAuteur.setPersonne(personne);
|
| 584 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
976 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
| 585 |
auteursAjoutes.put(publicationAAuteur.getId(), publicationAAuteur);
|
977 |
//FIXME : auteursAjoutes.put(publicationAAuteur.getId(), publicationAAuteur);
|
| 586 |
attenteAjoutAuteursOk = true;
|
978 |
attenteAjoutAuteursOk = true;
|
| 587 |
}
|
979 |
}
|
| 588 |
}
|
980 |
}
|
| Line 589... |
Line 981... |
| 589 |
|
981 |
|
| Line 596... |
Line 988... |
| 596 |
Personne personne = personnesInitiales.get(idInitial);
|
988 |
Personne personne = personnesInitiales.get(idInitial);
|
| 597 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
989 |
PublicationAPersonne publicationAAuteur = new PublicationAPersonne();
|
| 598 |
publicationAAuteur.setIdPublication(publication.getId());
|
990 |
publicationAAuteur.setIdPublication(publication.getId());
|
| 599 |
publicationAAuteur.setPersonne(personne);
|
991 |
publicationAAuteur.setPersonne(personne);
|
| 600 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
992 |
publicationAAuteur.setIdRole(PublicationAPersonne.ROLE_AUTEUR);
|
| 601 |
auteursSupprimes.put(publicationAAuteur.getId(), publicationAAuteur);
|
993 |
//FIXME : auteursSupprimes.put(publicationAAuteur.getId(), publicationAAuteur);
|
| 602 |
attenteSuppressionAuteursOk = true;
|
994 |
attenteSuppressionAuteursOk = true;
|
| 603 |
}
|
995 |
}
|
| 604 |
}
|
996 |
}
|
| 605 |
}
|
997 |
}
|
| Line 606... |
Line 998... |
| 606 |
|
998 |
|
| 607 |
// Execution de les mise à jour pour le mode MODIFICATION
|
999 |
// Execution de les mise à jour pour le mode MODIFICATION
|
| 608 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
1000 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 609 |
if (auteursAjoutes != null && auteursAjoutes.size() != 0) {
|
1001 |
if (auteursAjoutes != null && auteursAjoutes.size() != 0) {
|
| 610 |
mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
|
1002 |
//FIXME : mediateur.ajouterPublicationAPersonne(this, publication.getId(), auteursAjoutes, PublicationAPersonne.ROLE_AUTEUR);
|
| Line 611... |
Line 1003... |
| 611 |
}
|
1003 |
}
|
| 612 |
|
1004 |
|
| 613 |
if (auteursSupprimes != null && auteursSupprimes.size() != 0) {
|
1005 |
if (auteursSupprimes != null && auteursSupprimes.size() != 0) {
|
| 614 |
mediateur.supprimerPublicationAPersonne(this, auteursSupprimes);
|
1006 |
//FIXME : mediateur.supprimerPublicationAPersonne(this, auteursSupprimes);
|
| 615 |
}
|
1007 |
}
|
| Line 616... |
Line 1008... |
| 616 |
}
|
1008 |
}*/
|
| 617 |
}
|
1009 |
}
|
| 618 |
|
1010 |
|
| Line 619... |
Line 1011... |
| 619 |
public boolean verifierFormulaire() {
|
1011 |
public boolean verifierFormulaire() {
|
| 620 |
boolean valide = true;
|
- |
|
| 621 |
ArrayList<String> messages = new ArrayList<String>();
|
1012 |
boolean valide = true;
|
| 622 |
|
- |
|
| 623 |
boolean auteurErreur = true;
|
- |
|
| 624 |
for (int i = 0; i < auteurComboboxListe.size(); i++) {
|
- |
|
| 625 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
- |
|
| 626 |
auteurErreur = false;
|
- |
|
| 627 |
break;
|
1013 |
ArrayList<String> messages = new ArrayList<String>();
|
| 628 |
}
|
1014 |
|
| Line 629... |
Line 1015... |
| 629 |
}
|
1015 |
// Tester si au moins un auteur est présent
|
| 630 |
if (auteurErreur) {
|
1016 |
if (grille.getStore().getModels().size() == 0) {
|
| 631 |
messages.add("Veuillez saisir au moins un auteur !");
|
1017 |
messages.add("Veuillez saisir au moins un auteur.");
|
| Line 681... |
Line 1067... |
| 681 |
editeurCombobox.setRawValue(publication.getEditeur());
|
1067 |
editeurCombobox.setRawValue(publication.getEditeur());
|
| 682 |
}
|
1068 |
}
|
| 683 |
}
|
1069 |
}
|
| Line 684... |
Line 1070... |
| 684 |
|
1070 |
|
| 685 |
private Publication collecterPublication() {
|
- |
|
| Line -... |
Line 1071... |
| - |
|
1071 |
private Publication collecterPublication() {
|
| 686 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
1072 |
|
| 687 |
|
- |
|
| 688 |
publicationCollectee.setIdProjet(getValeurComboProjets());
|
1073 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
| Line 689... |
Line 1074... |
| 689 |
|
1074 |
publicationCollectee.setIdProjet(getValeurComboProjets());
|
| 690 |
publicationCollectee.setAuteur(construireIntituleAuteur());
|
1075 |
publicationCollectee.setAuteur(construireIntituleAuteur());
|
| Line 738... |
Line 1123... |
| 738 |
}
|
1123 |
}
|
| 739 |
return editeur;
|
1124 |
return editeur;
|
| 740 |
}
|
1125 |
}
|
| Line 741... |
Line 1126... |
| 741 |
|
1126 |
|
| 742 |
private String construireIntituleAuteur() {
|
1127 |
private String construireIntituleAuteur() {
|
| - |
|
1128 |
String intituleAuteur = "";
|
| - |
|
1129 |
List<Personne> auteurs = grille.getStore().getModels();
|
| - |
|
1130 |
Iterator<Personne> itAuteurs = auteurs.iterator();
|
| - |
|
1131 |
while (itAuteurs.hasNext()) {
|
| - |
|
1132 |
Personne personneCourante = itAuteurs.next();
|
| - |
|
1133 |
intituleAuteur += personneCourante.getNom().toUpperCase() + " " + personneCourante.getPrenom();
|
| - |
|
1134 |
if (itAuteurs.hasNext()) {
|
| - |
|
1135 |
intituleAuteur+=", ";
|
| - |
|
1136 |
}
|
| - |
|
1137 |
}
|
| 743 |
String inituleAuteur = "";
|
1138 |
/*
|
| - |
|
1139 |
* TO DELETE:int auteursNombre = auteurComboboxListe.size();
|
| 744 |
int auteursNombre = auteurComboboxListe.size();
|
1140 |
*
|
| 745 |
for (int i = 0; i < auteursNombre; i++) {
|
1141 |
for (int i = 0; i < auteursNombre; i++) {
|
| 746 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
1142 |
if (auteurComboboxListe.get(i).getValue() != null) {
|
| 747 |
Personne auteur = auteurComboboxListe.get(i).getValue();
|
1143 |
Personne auteur = auteurComboboxListe.get(i).getValue();
|
| 748 |
inituleAuteur += auteur.getNom().toUpperCase()+ " "+auteur.getPrenom();
|
1144 |
inituleAuteur += auteur.getNom().toUpperCase()+ " "+auteur.getPrenom();
|
| 749 |
if (i != (auteursNombre - 1)) {
|
1145 |
if (i != (auteursNombre - 1)) {
|
| 750 |
inituleAuteur += ", ";
|
1146 |
inituleAuteur += ", ";
|
| 751 |
}
|
1147 |
}
|
| 752 |
}
|
1148 |
}
|
| 753 |
}
|
1149 |
}*/
|
| 754 |
return inituleAuteur;
|
1150 |
return intituleAuteur;
|
| Line 755... |
Line 1151... |
| 755 |
}
|
1151 |
}
|
| 756 |
|
1152 |
|
| 757 |
private String construireNomComplet() {
|
1153 |
private String construireNomComplet() {
|