| 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.ChampComboBoxRechercheTempsReelPaginable;
|
| - |
|
10 |
import org.tela_botanica.client.composants.InfoLogger;
|
| 9 |
import org.tela_botanica.client.composants.InfoLogger;
|
11 |
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
|
| 10 |
import org.tela_botanica.client.images.Images;
|
12 |
import org.tela_botanica.client.images.Images;
|
| 11 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
13 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 12 |
import org.tela_botanica.client.modeles.Information;
|
14 |
import org.tela_botanica.client.modeles.Information;
|
| 13 |
import org.tela_botanica.client.modeles.InterneValeur;
|
15 |
import org.tela_botanica.client.modeles.InterneValeur;
|
| Line 22... |
Line 24... |
| 22 |
import org.tela_botanica.client.modeles.personne.Personne;
|
24 |
import org.tela_botanica.client.modeles.personne.Personne;
|
| 23 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
25 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
| 24 |
import org.tela_botanica.client.modeles.projet.Projet;
|
26 |
import org.tela_botanica.client.modeles.projet.Projet;
|
| 25 |
import org.tela_botanica.client.modeles.publication.Publication;
|
27 |
import org.tela_botanica.client.modeles.publication.Publication;
|
| 26 |
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
|
28 |
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
|
| - |
|
29 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
| 27 |
import org.tela_botanica.client.util.Debug;
|
30 |
import org.tela_botanica.client.util.Debug;
|
| 28 |
import org.tela_botanica.client.util.UtilString;
|
31 |
import org.tela_botanica.client.util.UtilString;
|
| 29 |
import org.tela_botanica.client.vues.FenetreForm;
|
32 |
import org.tela_botanica.client.vues.FenetreForm;
|
| 30 |
import org.tela_botanica.client.vues.Formulaire;
|
33 |
import org.tela_botanica.client.vues.Formulaire;
|
| 31 |
import org.tela_botanica.client.vues.FormulaireBarreValidation;
|
34 |
import org.tela_botanica.client.vues.FormulaireBarreValidation;
|
| 32 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
35 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
| 33 |
import org.tela_botanica.client.vues.personne.PersonneForm;
|
36 |
import org.tela_botanica.client.vues.personne.PersonneForm;
|
| Line 34... |
Line 37... |
| 34 |
|
37 |
|
| - |
|
38 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
| - |
|
39 |
import com.extjs.gxt.ui.client.data.ModelData;
|
| 35 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
40 |
import com.extjs.gxt.ui.client.data.ModelType;
|
| 36 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
41 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
| 37 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
42 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
| 38 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
43 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
| 39 |
import com.extjs.gxt.ui.client.event.EventType;
|
44 |
import com.extjs.gxt.ui.client.event.EventType;
|
| Line 49... |
Line 54... |
| 49 |
import com.extjs.gxt.ui.client.widget.Info;
|
54 |
import com.extjs.gxt.ui.client.widget.Info;
|
| 50 |
import com.extjs.gxt.ui.client.widget.Text;
|
55 |
import com.extjs.gxt.ui.client.widget.Text;
|
| 51 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
56 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
| 52 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
57 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
| 53 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
58 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
| - |
|
59 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
| 54 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
60 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
| - |
|
61 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
| 55 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
62 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
| 56 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
63 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
| 57 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
64 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
| 58 |
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
65 |
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
| 59 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
66 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
| Line 83... |
Line 90... |
| 83 |
private EditorGrid<CollectionAPersonne> grille;
|
90 |
private EditorGrid<CollectionAPersonne> grille;
|
| 84 |
private ComboBox<Valeur> typeRelationCombo = null;
|
91 |
private ComboBox<Valeur> typeRelationCombo = null;
|
| Line 85... |
Line 92... |
| 85 |
|
92 |
|
| 86 |
private CollectionAPersonneListe personnesAjoutees = null;
|
93 |
private CollectionAPersonneListe personnesAjoutees = null;
|
| 87 |
private CollectionAPersonneListe personnesSupprimees = null;
|
94 |
private CollectionAPersonneListe personnesSupprimees = null;
|
| - |
|
95 |
private ChampComboBoxRechercheTempsReelPaginable personnesSaisisComboBox = null;
|
| 88 |
private ComboBox<Personne> personnesSaisisComboBox = null;
|
96 |
private ChampComboBoxRechercheTempsReelPaginable recherchePersonnesCombo = null;
|
| 89 |
private Button personnesBoutonSupprimer = null;
|
97 |
private Button personnesBoutonSupprimer = null;
|
| 90 |
private Button personnesBoutonModifier = null;
|
98 |
private Button personnesBoutonModifier = null;
|
| Line 91... |
Line 99... |
| 91 |
private ListStore<Valeur> listeIon = null;
|
99 |
private ListStore<Valeur> listeIon = null;
|
| Line -... |
Line 100... |
| - |
|
100 |
|
| - |
|
101 |
private FenetreForm fenetreFormulaire = null;
|
| 92 |
|
102 |
|
| Line 93... |
Line 103... |
| 93 |
private FenetreForm fenetreFormulaire = null;
|
103 |
private Sequenceur sequenceur = new Sequenceur();
|
| 94 |
|
104 |
|
| 95 |
public CollectionFormPersonne(Formulaire formulaireCourrant) {
|
105 |
public CollectionFormPersonne(Formulaire formulaireCourrant) {
|
| Line 274... |
Line 284... |
| 274 |
}
|
284 |
}
|
| 275 |
});
|
285 |
});
|
| 276 |
return bouton;
|
286 |
return bouton;
|
| 277 |
}
|
287 |
}
|
| Line 278... |
Line 288... |
| 278 |
|
288 |
|
| 279 |
private ComboBox<Personne> creerComboBoxPersonnesSaisies() {
|
- |
|
| 280 |
ListStore<Personne> personnesSaisiesStore = new ListStore<Personne>();
|
- |
|
| 281 |
personnesSaisiesStore.add(new ArrayList<Personne>());
|
289 |
private ChampComboBoxRechercheTempsReelPaginable creerComboBoxPersonnesSaisies() {
|
| 282 |
|
290 |
|
| 283 |
ComboBox<Personne> comboBox = new ComboBox<Personne>();
|
291 |
ModelType modelTypePersonnes = new ModelType();
|
| - |
|
292 |
modelTypePersonnes.setRoot("personnes");
|
| - |
|
293 |
modelTypePersonnes.setTotalName("nbElements");
|
| 284 |
comboBox.setWidth(200);
|
294 |
modelTypePersonnes.addField("cp_fmt_nom_complet");
|
| 285 |
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
|
295 |
modelTypePersonnes.addField("cp_id_personne");
|
| 286 |
comboBox.setTriggerAction(TriggerAction.ALL);
|
296 |
modelTypePersonnes.addField("cp_nom");
|
| 287 |
comboBox.setEditable(true);
|
297 |
modelTypePersonnes.addField("cp_prenom");
|
| - |
|
298 |
modelTypePersonnes.addField("cp_code_postal");
|
| - |
|
299 |
modelTypePersonnes.addField("cp_naissance_date");
|
| 288 |
comboBox.setDisplayField("fmt_nom_complet");
|
300 |
modelTypePersonnes.addField("cp_naissance_lieu");
|
| - |
|
301 |
modelTypePersonnes.addField("cp_ce_deces");
|
| 289 |
comboBox.setStore(personnesSaisiesStore);
|
302 |
modelTypePersonnes.addField("cp_deces_date");
|
| - |
|
303 |
modelTypePersonnes.addField("cp_deces_lieu");
|
| 290 |
comboBox.addKeyListener(new KeyListener() {
|
304 |
|
| 291 |
public void componentKeyUp(ComponentEvent ce) {
|
305 |
String displayNamePersonnes = "cp_fmt_nom_complet";
|
| - |
|
306 |
ProxyPersonnes<ModelData> proxyPersonnes = new ProxyPersonnes<ModelData>(sequenceur);
|
| - |
|
307 |
|
| - |
|
308 |
recherchePersonnesCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyPersonnes, modelTypePersonnes, displayNamePersonnes);
|
| - |
|
309 |
recherchePersonnesCombo.getCombo().setForceSelection(true);
|
| - |
|
310 |
|
| - |
|
311 |
recherchePersonnesCombo.getCombo().setValidator(new Validator() {
|
| - |
|
312 |
public String validate(Field<?> field, String value) {
|
| 292 |
if (personnesSaisisComboBox.getRawValue() != null && personnesSaisisComboBox.getRawValue().length() > 0) {
|
313 |
String retour = null;
|
| - |
|
314 |
if (field.getRawValue().equals("")) {
|
| - |
|
315 |
field.setValue(null);
|
| 293 |
if (!ce.isNavKeyPress()) {
|
316 |
} else if (recherchePersonnesCombo.getStore().findModel("cp_fmt_nom_complet", field.getRawValue()) == null) {
|
| 294 |
obtenirPersonnesSaisis(personnesSaisisComboBox.getRawValue());
|
317 |
String contenuBrut = field.getRawValue();
|
| - |
|
318 |
field.setValue(null);
|
| - |
|
319 |
field.setRawValue(contenuBrut);
|
| 295 |
}
|
320 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
| - |
|
321 |
}
|
| 296 |
}
|
322 |
return retour;
|
| 297 |
}
|
323 |
}
|
| - |
|
324 |
});
|
| 298 |
});
|
325 |
|
| 299 |
comboBox.addListener(Events.Select, new Listener<BaseEvent>() {
|
326 |
recherchePersonnesCombo.getCombo().addListener(Events.Select, new Listener<BaseEvent>() {
|
| 300 |
public void handleEvent(BaseEvent be) {
|
327 |
public void handleEvent(BaseEvent be) {
|
| 301 |
if (personnesSaisisComboBox.getValue() instanceof Personne) {
|
328 |
if (personnesSaisisComboBox.getValeur() instanceof ModelData) {
|
| 302 |
Personne personneSaisiSelectionnee = personnesSaisisComboBox.getValue();
|
329 |
Personne personneSaisiSelectionnee = new Personne(personnesSaisisComboBox.getValeur());
|
| 303 |
ajouterDansGrille(personneSaisiSelectionnee);
|
330 |
ajouterDansGrille(personneSaisiSelectionnee);
|
| 304 |
personnesSaisisComboBox.setValue(null);
|
331 |
personnesSaisisComboBox.getCombo().setValue(null);
|
| 305 |
}
|
332 |
}
|
| 306 |
}
|
333 |
}
|
| - |
|
334 |
});
|
| 307 |
});
|
335 |
|
| 308 |
return comboBox;
|
336 |
return recherchePersonnesCombo;
|
| Line 309... |
Line 337... |
| 309 |
}
|
337 |
}
|
| 310 |
|
338 |
|
| 311 |
private void ajouterDansGrille(Personne personne) {
|
339 |
private void ajouterDansGrille(Personne personne) {
|
| Line 515... |
Line 543... |
| 515 |
public void rafraichirInformation(Information info) {
|
543 |
public void rafraichirInformation(Information info) {
|
| 516 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
544 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
| 517 |
GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
|
545 |
GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
|
| 518 |
}
|
546 |
}
|
| 519 |
String type = info.getType();
|
547 |
String type = info.getType();
|
| 520 |
if (type.equals("liste_personne")) {
|
- |
|
| 521 |
if (info.getDonnee(0) != null) {
|
- |
|
| 522 |
PersonneListe personnes = (PersonneListe) info.getDonnee(0);
|
- |
|
| 523 |
List<Personne> liste = personnes.toList();
|
- |
|
| 524 |
|
- |
|
| 525 |
personnesSaisisComboBox.getStore().removeAll();
|
- |
|
| 526 |
personnesSaisisComboBox.getStore().add(liste);
|
- |
|
| 527 |
personnesSaisisComboBox.expand();
|
- |
|
| 528 |
}
|
- |
|
| 529 |
} else if (info.getType().equals("liste_collection_a_personne")) {
|
548 |
if (info.getType().equals("liste_collection_a_personne")) {
|
| 530 |
if (info.getDonnee(0) != null) {
|
549 |
if (info.getDonnee(0) != null) {
|
| 531 |
initialiser();
|
550 |
initialiser();
|
| 532 |
collection.setPersonnesLiees((CollectionAPersonneListe) info.getDonnee(0));
|
551 |
collection.setPersonnesLiees((CollectionAPersonneListe) info.getDonnee(0));
|
| 533 |
peupler();
|
552 |
peupler();
|
| 534 |
}
|
553 |
}
|