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