1 |
package org.tela_botanica.client.vues.publication;
|
1 |
package org.tela_botanica.client.vues.publication;
|
2 |
|
2 |
|
3 |
import java.util.ArrayList;
|
3 |
import java.util.ArrayList;
|
4 |
import java.util.Iterator;
|
4 |
import java.util.Iterator;
|
5 |
import java.util.List;
|
5 |
import java.util.List;
|
6 |
|
6 |
|
7 |
import org.tela_botanica.client.ComposantClass;
|
7 |
import org.tela_botanica.client.ComposantClass;
|
8 |
import org.tela_botanica.client.Mediateur;
|
8 |
import org.tela_botanica.client.Mediateur;
|
- |
|
9 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
9 |
import org.tela_botanica.client.composants.InfoLogger;
|
10 |
import org.tela_botanica.client.composants.InfoLogger;
|
- |
|
11 |
import org.tela_botanica.client.composants.pagination.ProxyProjets;
|
- |
|
12 |
import org.tela_botanica.client.composants.pagination.ProxyStructures;
|
10 |
import org.tela_botanica.client.images.Images;
|
13 |
import org.tela_botanica.client.images.Images;
|
11 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
14 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
12 |
import org.tela_botanica.client.modeles.Information;
|
15 |
import org.tela_botanica.client.modeles.Information;
|
13 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
16 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
- |
|
17 |
import org.tela_botanica.client.modeles.Valeur;
|
14 |
import org.tela_botanica.client.modeles.aDonnee;
|
18 |
import org.tela_botanica.client.modeles.aDonnee;
|
15 |
import org.tela_botanica.client.modeles.personne.Personne;
|
19 |
import org.tela_botanica.client.modeles.personne.Personne;
|
16 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
20 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
17 |
import org.tela_botanica.client.modeles.projet.Projet;
|
21 |
import org.tela_botanica.client.modeles.projet.Projet;
|
18 |
import org.tela_botanica.client.modeles.projet.ProjetListe;
|
22 |
import org.tela_botanica.client.modeles.projet.ProjetListe;
|
19 |
import org.tela_botanica.client.modeles.publication.Publication;
|
23 |
import org.tela_botanica.client.modeles.publication.Publication;
|
20 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
24 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
21 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
25 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
22 |
import org.tela_botanica.client.modeles.structure.Structure;
|
26 |
import org.tela_botanica.client.modeles.structure.Structure;
|
23 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
27 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
24 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
28 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
- |
|
29 |
import org.tela_botanica.client.util.Debug;
|
25 |
import org.tela_botanica.client.util.Pattern;
|
30 |
import org.tela_botanica.client.util.Pattern;
|
26 |
import org.tela_botanica.client.util.UtilArray;
|
31 |
import org.tela_botanica.client.util.UtilArray;
|
27 |
import org.tela_botanica.client.util.UtilString;
|
32 |
import org.tela_botanica.client.util.UtilString;
|
28 |
import org.tela_botanica.client.vues.FenetreForm;
|
33 |
import org.tela_botanica.client.vues.FenetreForm;
|
29 |
import org.tela_botanica.client.vues.Formulaire;
|
34 |
import org.tela_botanica.client.vues.Formulaire;
|
30 |
import org.tela_botanica.client.vues.FormulaireBarreValidation;
|
35 |
import org.tela_botanica.client.vues.FormulaireBarreValidation;
|
31 |
import org.tela_botanica.client.vues.personne.PersonneForm;
|
36 |
import org.tela_botanica.client.vues.personne.PersonneForm;
|
32 |
|
37 |
|
33 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
38 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
34 |
import com.extjs.gxt.ui.client.Style.SortDir;
|
39 |
import com.extjs.gxt.ui.client.Style.SortDir;
|
- |
|
40 |
import com.extjs.gxt.ui.client.core.XTemplate;
|
- |
|
41 |
import com.extjs.gxt.ui.client.data.ModelData;
|
- |
|
42 |
import com.extjs.gxt.ui.client.data.ModelType;
|
35 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
43 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
36 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
44 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
37 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
45 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
38 |
import com.extjs.gxt.ui.client.event.Events;
|
46 |
import com.extjs.gxt.ui.client.event.Events;
|
39 |
import com.extjs.gxt.ui.client.event.KeyListener;
|
47 |
import com.extjs.gxt.ui.client.event.KeyListener;
|
40 |
import com.extjs.gxt.ui.client.event.Listener;
|
48 |
import com.extjs.gxt.ui.client.event.Listener;
|
41 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
49 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
42 |
import com.extjs.gxt.ui.client.store.ListStore;
|
50 |
import com.extjs.gxt.ui.client.store.ListStore;
|
43 |
import com.extjs.gxt.ui.client.store.Store;
|
51 |
import com.extjs.gxt.ui.client.store.Store;
|
44 |
import com.extjs.gxt.ui.client.store.StoreEvent;
|
52 |
import com.extjs.gxt.ui.client.store.StoreEvent;
|
- |
|
53 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
- |
|
54 |
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
45 |
import com.extjs.gxt.ui.client.widget.Info;
|
55 |
import com.extjs.gxt.ui.client.widget.Info;
|
46 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
56 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
47 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
57 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
48 |
import com.extjs.gxt.ui.client.widget.Text;
|
58 |
import com.extjs.gxt.ui.client.widget.Text;
|
49 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
59 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
50 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
60 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
51 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
61 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
52 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
62 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
53 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
63 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
54 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
64 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
55 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
65 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
56 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
66 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
57 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
67 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
- |
|
68 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
58 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
69 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
- |
|
70 |
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
59 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
71 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
60 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
72 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
- |
|
73 |
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
- |
|
74 |
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
61 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
75 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
- |
|
76 |
import com.extjs.gxt.ui.client.widget.grid.RowExpander;
|
- |
|
77 |
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
|
62 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
78 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
63 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
79 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
64 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
80 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
65 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
81 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
66 |
import com.extjs.gxt.ui.client.widget.layout.RowData;
|
82 |
import com.extjs.gxt.ui.client.widget.layout.RowData;
|
67 |
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
83 |
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
68 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
84 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
69 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
85 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
70 |
import com.google.gwt.core.client.GWT;
|
86 |
import com.google.gwt.core.client.GWT;
|
71 |
|
87 |
|
72 |
|
88 |
|
73 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
89 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
74 |
|
90 |
|
75 |
//Variables de classe:
|
91 |
//Variables de classe:
|
76 |
// Relatives à la publication
|
92 |
// Relatives à la publication
|
77 |
private Publication publication;
|
93 |
private Publication publication;
|
78 |
|
94 |
|
79 |
// Relatives aux auteurs
|
95 |
// Relatives aux auteurs
|
80 |
private LayoutContainer auteursFieldset = null;
|
- |
|
81 |
private PersonneListe auteursInitialListe = null;
|
96 |
private PersonneListe auteursInitialListe = null;
|
82 |
private PersonneListe auteursAjoutes = null;
|
97 |
private PersonneListe auteursAjoutes = null;
|
83 |
private PersonneListe auteursSupprimes = null;
|
98 |
private PersonneListe auteursSupprimes = null;
|
- |
|
99 |
|
84 |
|
100 |
private ContentPanel auteursFieldset = null;
|
85 |
private ComboBox<Projet> projetsCombo = null;
|
101 |
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
|
86 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
102 |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
|
87 |
private ListStore<Personne> auteursStorePartage = null;
|
103 |
private ListStore<Personne> auteursStorePartage = null;
|
88 |
|
104 |
|
89 |
private FieldSet generalitesFieldset = null;
|
105 |
private FieldSet generalitesFieldset = null;
|
90 |
private TextField<String> titreChp = null;
|
106 |
private TextField<String> titreChp = null;
|
91 |
private TextField<String> collectionChp = null;
|
107 |
private TextField<String> collectionChp = null;
|
92 |
private TextField<String> uriChp = null;
|
108 |
private TextField<String> uriChp = null;
|
93 |
|
109 |
|
94 |
private FieldSet editionFieldset = null;
|
110 |
private FieldSet editionFieldset = null;
|
95 |
private ComboBox<Structure> editeurCombobox = null;
|
111 |
private ChampComboBoxRechercheTempsReelPaginable editeurCombobox = null;
|
96 |
private TextField<String> datePublicationChp = null;
|
112 |
private TextField<String> datePublicationChp = null;
|
97 |
private TextField<String> tomeChp = null;
|
113 |
private TextField<String> tomeChp = null;
|
98 |
private TextField<String> fasciculeChp = null;
|
114 |
private TextField<String> fasciculeChp = null;
|
99 |
private TextField<String> pagesChp = null;
|
115 |
private TextField<String> pagesChp = null;
|
100 |
|
116 |
|
101 |
private LayoutContainer zoneHaut, zoneBas;
|
117 |
private LayoutContainer zoneHaut, zoneBas;
|
102 |
|
118 |
|
103 |
private ToolBar barreOutils = null;
|
119 |
private ToolBar barreOutils = null;
|
104 |
private EditorGrid<Personne> grille;
|
120 |
private EditorGrid<Personne> grille;
|
105 |
private ComboBox<Personne> personnesSaisiesComboBox = null;
|
121 |
private ComboBox<Personne> personnesSaisiesComboBox = null;
|
106 |
private Button personnesBoutonSupprimer = null;
|
122 |
private Button personnesBoutonSupprimer = null;
|
107 |
private Button personnesBoutonModifier = null;
|
123 |
private Button personnesBoutonModifier = null;
|
108 |
private PersonneListe listePersonne = new PersonneListe();
|
124 |
private PersonneListe listePersonne = new PersonneListe();
|
109 |
|
125 |
|
110 |
private FenetreForm fenetreFormulaire = null;
|
126 |
private FenetreForm fenetreFormulaire = null;
|
111 |
private Sequenceur sequenceur;
|
127 |
private Sequenceur sequenceur;
|
112 |
|
128 |
|
113 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
129 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
114 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
130 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
115 |
}
|
131 |
}
|
116 |
|
132 |
|
117 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
133 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
118 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
134 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
119 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
135 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
120 |
}
|
136 |
}
|
121 |
|
137 |
|
122 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
138 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
123 |
sequenceur = new Sequenceur();
|
139 |
sequenceur = new Sequenceur();
|
124 |
publication = new Publication();
|
140 |
publication = new Publication();
|
125 |
publication.setId(publicationId);
|
141 |
publication.setId(publicationId);
|
126 |
auteursInitialListe = new PersonneListe();
|
142 |
auteursInitialListe = new PersonneListe();
|
127 |
initialiserAuteurs(); // Crée les listes d'auteurs ajoutés et supprimés
|
143 |
initialiserAuteurs(); // Crée les listes d'auteurs ajoutés et supprimés
|
128 |
|
144 |
|
129 |
String modeDeCreation = (UtilString.isEmpty(publicationId) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
145 |
String modeDeCreation = (UtilString.isEmpty(publicationId) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
130 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
146 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
131 |
panneauFormulaire.setLayout(new RowLayout());
|
147 |
panneauFormulaire.setLayout(new RowLayout());
|
132 |
panneauFormulaire.setStyleAttribute("padding", "0");
|
148 |
panneauFormulaire.setStyleAttribute("padding", "0");
|
133 |
|
149 |
|
134 |
zoneHaut = new LayoutContainer(new FitLayout());
|
150 |
zoneHaut = new LayoutContainer(new FitLayout());
|
135 |
zoneBas = new LayoutContainer(new FlowLayout());
|
151 |
zoneBas = new LayoutContainer(new FlowLayout());
|
136 |
panneauFormulaire.add(zoneHaut, new RowData(1, 0.3));
|
152 |
panneauFormulaire.add(zoneHaut, new RowData(1, 0.3));
|
137 |
panneauFormulaire.add(zoneBas, new RowData(1, 0.5));
|
153 |
panneauFormulaire.add(zoneBas, new RowData(1, 0.5));
|
138 |
panneauFormulaire.setScrollMode(Scroll.AUTO);
|
154 |
panneauFormulaire.setScrollMode(Scroll.AUTO);
|
139 |
genererTitreFormulaire();
|
155 |
genererTitreFormulaire();
|
140 |
|
156 |
|
141 |
creerZoneAuteurs();
|
157 |
creerZoneAuteurs();
|
142 |
zoneHaut.add(auteursFieldset);
|
158 |
zoneHaut.add(auteursFieldset);
|
143 |
|
159 |
|
144 |
creerZoneGeneralites();
|
160 |
creerZoneGeneralites();
|
145 |
zoneBas.add(generalitesFieldset);
|
161 |
zoneBas.add(generalitesFieldset);
|
146 |
|
162 |
|
147 |
creerZoneEdition();
|
163 |
creerZoneEdition();
|
148 |
zoneBas.add(editionFieldset);
|
164 |
zoneBas.add(editionFieldset);
|
149 |
|
165 |
|
150 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
166 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
151 |
mediateurCourrant.selectionnerPublication(this, publicationId, sequenceur);
|
167 |
mediateurCourrant.selectionnerPublication(this, publicationId, sequenceur);
|
152 |
mediateurCourrant.selectionnerPublicationAPersonne(this, publicationId, null, PublicationAPersonne.ROLE_AUTEUR, sequenceur);
|
168 |
mediateurCourrant.selectionnerPublicationAPersonne(this, publicationId, null, PublicationAPersonne.ROLE_AUTEUR, sequenceur);
|
153 |
sequenceur.empilerRafraichissement(this, new Information("chargement_modifier_ok"));
|
169 |
sequenceur.empilerRafraichissement(this, new Information("chargement_modifier_ok"));
|
154 |
}
|
170 |
}
|
155 |
}
|
171 |
}
|
156 |
|
172 |
|
157 |
public void actualiserEtatBoutonsBarreOutils() {
|
173 |
public void actualiserEtatBoutonsBarreOutils() {
|
158 |
// Activation des boutons si la grille contient un élément
|
174 |
// Activation des boutons si la grille contient un élément
|
159 |
if (grille.getStore().getCount() > 0) {
|
175 |
if (grille.getStore().getCount() > 0) {
|
160 |
personnesBoutonSupprimer.enable();
|
176 |
personnesBoutonSupprimer.enable();
|
161 |
personnesBoutonModifier.enable();
|
177 |
personnesBoutonModifier.enable();
|
162 |
}
|
178 |
}
|
163 |
// Désactivation des boutons si la grille ne contient plus d'élément
|
179 |
// Désactivation des boutons si la grille ne contient plus d'élément
|
164 |
if (grille.getStore().getCount() == 0) {
|
180 |
if (grille.getStore().getCount() == 0) {
|
165 |
personnesBoutonSupprimer.disable();
|
181 |
personnesBoutonSupprimer.disable();
|
166 |
personnesBoutonModifier.disable();
|
182 |
personnesBoutonModifier.disable();
|
167 |
}
|
183 |
}
|
168 |
}
|
184 |
}
|
169 |
|
185 |
|
170 |
private ToolBar creerBarreOutilsGrille() {
|
186 |
private ToolBar creerBarreOutilsGrille() {
|
171 |
ToolBar barreOutils = new ToolBar();
|
187 |
ToolBar barreOutils = new ToolBar();
|
172 |
|
188 |
|
173 |
Button ajouterBouton = creerBoutonAjouter();
|
189 |
Button ajouterBouton = creerBoutonAjouter();
|
174 |
barreOutils.add(ajouterBouton);
|
190 |
barreOutils.add(ajouterBouton);
|
175 |
|
191 |
|
176 |
barreOutils.add(new Text(" ou "));
|
192 |
barreOutils.add(new Text(" ou "));
|
177 |
|
193 |
|
178 |
personnesSaisiesComboBox = creerComboBoxPersonnesSaisies();
|
194 |
personnesSaisiesComboBox = creerComboBoxPersonnesSaisies();
|
179 |
barreOutils.add(personnesSaisiesComboBox);
|
195 |
barreOutils.add(personnesSaisiesComboBox);
|
180 |
|
196 |
|
181 |
barreOutils.add(new SeparatorToolItem());
|
197 |
barreOutils.add(new SeparatorToolItem());
|
182 |
|
198 |
|
183 |
personnesBoutonModifier = creerBoutonModifier();
|
199 |
personnesBoutonModifier = creerBoutonModifier();
|
184 |
barreOutils.add(personnesBoutonModifier);
|
200 |
barreOutils.add(personnesBoutonModifier);
|
185 |
|
201 |
|
186 |
barreOutils.add(new SeparatorToolItem());
|
202 |
barreOutils.add(new SeparatorToolItem());
|
187 |
|
203 |
|
188 |
personnesBoutonSupprimer = creerBoutonSupprimer();
|
204 |
personnesBoutonSupprimer = creerBoutonSupprimer();
|
189 |
barreOutils.add(personnesBoutonSupprimer);
|
205 |
barreOutils.add(personnesBoutonSupprimer);
|
190 |
|
206 |
|
191 |
barreOutils.add(new SeparatorToolItem());
|
207 |
barreOutils.add(new SeparatorToolItem());
|
192 |
|
208 |
|
193 |
Button rafraichirBouton = creerBoutonRafraichir();
|
209 |
Button rafraichirBouton = creerBoutonRafraichir();
|
194 |
barreOutils.add(rafraichirBouton);
|
210 |
barreOutils.add(rafraichirBouton);
|
195 |
|
211 |
|
196 |
return barreOutils;
|
212 |
return barreOutils;
|
197 |
}
|
213 |
}
|
198 |
|
214 |
|
199 |
private Button creerBoutonAjouter() {
|
215 |
private Button creerBoutonAjouter() {
|
200 |
Button bouton = new Button(i18nC.ajouter());
|
216 |
Button bouton = new Button(i18nC.ajouter());
|
201 |
bouton.setIcon(Images.ICONES.vcardAjouter());
|
217 |
bouton.setIcon(Images.ICONES.vcardAjouter());
|
202 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
218 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
203 |
public void componentSelected(ButtonEvent ce) {
|
219 |
public void componentSelected(ButtonEvent ce) {
|
204 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_AJOUTER);
|
220 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_AJOUTER);
|
205 |
fenetreFormulaire.show();
|
221 |
fenetreFormulaire.show();
|
206 |
}
|
222 |
}
|
207 |
});
|
223 |
});
|
208 |
return bouton;
|
224 |
return bouton;
|
209 |
}
|
225 |
}
|
210 |
|
226 |
|
211 |
private Button creerBoutonModifier() {
|
227 |
private Button creerBoutonModifier() {
|
212 |
Button bouton = new Button(i18nC.modifier());
|
228 |
Button bouton = new Button(i18nC.modifier());
|
213 |
bouton.setIcon(Images.ICONES.vcardModifier());
|
229 |
bouton.setIcon(Images.ICONES.vcardModifier());
|
214 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
230 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
215 |
public void componentSelected(ButtonEvent ce) {
|
231 |
public void componentSelected(ButtonEvent ce) {
|
216 |
Personne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
232 |
Personne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
217 |
|
233 |
|
218 |
if (personneSaisieSelectionnee == null) {
|
234 |
if (personneSaisieSelectionnee == null) {
|
219 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
235 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
220 |
} else {
|
236 |
} else {
|
221 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_MODIFIER);
|
237 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_MODIFIER);
|
222 |
fenetreFormulaire.show();
|
238 |
fenetreFormulaire.show();
|
223 |
}
|
239 |
}
|
224 |
}
|
240 |
}
|
225 |
});
|
241 |
});
|
226 |
return bouton;
|
242 |
return bouton;
|
227 |
}
|
243 |
}
|
228 |
|
244 |
|
229 |
private FenetreForm creerFenetreModaleAvecFormulairePersonne(String mode) {
|
245 |
private FenetreForm creerFenetreModaleAvecFormulairePersonne(String mode) {
|
230 |
String personneId = null;
|
246 |
String personneId = null;
|
231 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
247 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
232 |
Personne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
248 |
Personne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
233 |
personneId = personneSaisieSelectionnee.getId();
|
249 |
personneId = personneSaisieSelectionnee.getId();
|
234 |
}
|
250 |
}
|
235 |
|
251 |
|
236 |
final FenetreForm fenetre = new FenetreForm("");
|
252 |
final FenetreForm fenetre = new FenetreForm("");
|
237 |
final PersonneForm formulaire = creerFormulairePersonne(fenetre, personneId);
|
253 |
final PersonneForm formulaire = creerFormulairePersonne(fenetre, personneId);
|
238 |
fenetre.add(formulaire);
|
254 |
fenetre.add(formulaire);
|
239 |
return fenetre;
|
255 |
return fenetre;
|
240 |
}
|
256 |
}
|
241 |
|
257 |
|
242 |
private PersonneForm creerFormulairePersonne(final FenetreForm fenetre, final String personneId) {
|
258 |
private PersonneForm creerFormulairePersonne(final FenetreForm fenetre, final String personneId) {
|
243 |
PersonneForm formulairePersonne = new PersonneForm(mediateur, personneId, this);
|
259 |
PersonneForm formulairePersonne = new PersonneForm(mediateur, personneId, this);
|
244 |
FormPanel panneauFormulaire = formulairePersonne.getFormulaire();
|
260 |
FormPanel panneauFormulaire = formulairePersonne.getFormulaire();
|
245 |
fenetre.setHeading(panneauFormulaire.getHeading());
|
261 |
fenetre.setHeading(panneauFormulaire.getHeading());
|
246 |
panneauFormulaire.setHeaderVisible(false);
|
262 |
panneauFormulaire.setHeaderVisible(false);
|
247 |
panneauFormulaire.setTopComponent(null);
|
263 |
panneauFormulaire.setTopComponent(null);
|
248 |
|
264 |
|
249 |
// 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.
|
265 |
// 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.
|
250 |
panneauFormulaire.getBottomComponent().hide();
|
266 |
panneauFormulaire.getBottomComponent().hide();
|
251 |
SelectionListener<ButtonEvent> ecouteur = creerEcouteurValidationFormulairePersonne(fenetre, formulairePersonne);
|
267 |
SelectionListener<ButtonEvent> ecouteur = creerEcouteurValidationFormulairePersonne(fenetre, formulairePersonne);
|
252 |
final ButtonBar barreValidation = new FormulaireBarreValidation(ecouteur);
|
268 |
final ButtonBar barreValidation = new FormulaireBarreValidation(ecouteur);
|
253 |
fenetre.setBottomComponent(barreValidation);
|
269 |
fenetre.setBottomComponent(barreValidation);
|
254 |
|
270 |
|
255 |
return formulairePersonne;
|
271 |
return formulairePersonne;
|
256 |
}
|
272 |
}
|
257 |
|
273 |
|
258 |
private SelectionListener<ButtonEvent> creerEcouteurValidationFormulairePersonne(final FenetreForm fenetre, final PersonneForm formulaire) {
|
274 |
private SelectionListener<ButtonEvent> creerEcouteurValidationFormulairePersonne(final FenetreForm fenetre, final PersonneForm formulaire) {
|
259 |
SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
|
275 |
SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
|
260 |
public void componentSelected(ButtonEvent ce) {
|
276 |
public void componentSelected(ButtonEvent ce) {
|
261 |
String code = ((Button) ce.getComponent()).getData("code");
|
277 |
String code = ((Button) ce.getComponent()).getData("code");
|
262 |
if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
|
278 |
if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
|
263 |
if (formulaire.soumettreFormulaire()) {
|
279 |
if (formulaire.soumettreFormulaire()) {
|
264 |
fenetre.hide();
|
280 |
fenetre.hide();
|
265 |
}
|
281 |
}
|
266 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
|
282 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
|
267 |
formulaire.soumettreFormulaire();
|
283 |
formulaire.soumettreFormulaire();
|
268 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
|
284 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
|
269 |
fenetre.hide();
|
285 |
fenetre.hide();
|
270 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
|
286 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
|
271 |
fenetreFormulaire.hide();
|
287 |
fenetreFormulaire.hide();
|
272 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(formulaire.mode);
|
288 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(formulaire.mode);
|
273 |
fenetreFormulaire.show();
|
289 |
fenetreFormulaire.show();
|
274 |
}
|
290 |
}
|
275 |
}
|
291 |
}
|
276 |
};
|
292 |
};
|
277 |
|
293 |
|
278 |
return ecouteur;
|
294 |
return ecouteur;
|
279 |
}
|
295 |
}
|
280 |
|
296 |
|
281 |
private Button creerBoutonSupprimer() {
|
297 |
private Button creerBoutonSupprimer() {
|
282 |
Button bouton = new Button(i18nC.supprimer());
|
298 |
Button bouton = new Button(i18nC.supprimer());
|
283 |
bouton.setIcon(Images.ICONES.vcardSupprimer());
|
299 |
bouton.setIcon(Images.ICONES.vcardSupprimer());
|
284 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
300 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
285 |
public void componentSelected(ButtonEvent ce) {
|
301 |
public void componentSelected(ButtonEvent ce) {
|
286 |
Personne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
302 |
Personne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
287 |
if (personneSaisieSelectionnee == null) {
|
303 |
if (personneSaisieSelectionnee == null) {
|
288 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
304 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
289 |
} else {
|
305 |
} else {
|
290 |
supprimerDansGrille(personneSaisieSelectionnee);
|
306 |
supprimerDansGrille(personneSaisieSelectionnee);
|
291 |
}
|
307 |
}
|
292 |
}
|
308 |
}
|
293 |
});
|
309 |
});
|
294 |
return bouton;
|
310 |
return bouton;
|
295 |
}
|
311 |
}
|
296 |
|
312 |
|
297 |
private Button creerBoutonRafraichir() {
|
313 |
private Button creerBoutonRafraichir() {
|
298 |
Button bouton = new Button(i18nC.rafraichir());
|
314 |
Button bouton = new Button(i18nC.rafraichir());
|
299 |
bouton.setIcon(Images.ICONES.rafraichir());
|
315 |
bouton.setIcon(Images.ICONES.rafraichir());
|
300 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
316 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
301 |
public void componentSelected(ButtonEvent ce) {
|
317 |
public void componentSelected(ButtonEvent ce) {
|
302 |
actualiserGrille();
|
318 |
actualiserGrille();
|
303 |
}
|
319 |
}
|
304 |
});
|
320 |
});
|
305 |
return bouton;
|
321 |
return bouton;
|
306 |
}
|
322 |
}
|
307 |
|
323 |
|
308 |
private void actualiserGrille() {
|
324 |
private void actualiserGrille() {
|
309 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
325 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
310 |
// FIXME : c'est la merde
|
326 |
// FIXME : c'est la merde
|
311 |
//mediateur.selectionner(this, null, personneSelectionnee.getId(), "%");
|
327 |
//mediateur.selectionner(this, null, personneSelectionnee.getId(), "%");
|
312 |
} else {
|
328 |
} else {
|
313 |
grille.getStore().removeAll();
|
329 |
grille.getStore().removeAll();
|
314 |
layout();
|
330 |
layout();
|
315 |
}
|
331 |
}
|
316 |
}
|
332 |
}
|
317 |
|
333 |
|
318 |
private ComboBox<Personne> creerComboBoxPersonnesSaisies() {
|
334 |
private ComboBox<Personne> creerComboBoxPersonnesSaisies() {
|
319 |
ListStore<Personne> personnesSaisiesStore = new ListStore<Personne>();
|
335 |
ListStore<Personne> personnesSaisiesStore = new ListStore<Personne>();
|
320 |
|
336 |
|
321 |
ComboBox<Personne> comboBox = new ComboBox<Personne>();
|
337 |
ComboBox<Personne> comboBox = new ComboBox<Personne>();
|
322 |
comboBox.setWidth(400);
|
338 |
comboBox.setWidth(400);
|
323 |
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
|
339 |
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
|
324 |
comboBox.setTriggerAction(TriggerAction.ALL);
|
340 |
comboBox.setTriggerAction(TriggerAction.ALL);
|
325 |
comboBox.setEditable(true);
|
341 |
comboBox.setEditable(true);
|
326 |
comboBox.setDisplayField("fmt_nom_complet");
|
342 |
comboBox.setDisplayField("fmt_nom_complet");
|
327 |
comboBox.setStore(personnesSaisiesStore);
|
343 |
comboBox.setStore(personnesSaisiesStore);
|
328 |
comboBox.addKeyListener(new KeyListener() {
|
344 |
comboBox.addKeyListener(new KeyListener() {
|
329 |
public void componentKeyUp(ComponentEvent ce) {
|
345 |
public void componentKeyUp(ComponentEvent ce) {
|
330 |
if (personnesSaisiesComboBox.getRawValue() != null && personnesSaisiesComboBox.getRawValue().length() > 0) {
|
346 |
if (personnesSaisiesComboBox.getRawValue() != null && personnesSaisiesComboBox.getRawValue().length() > 0) {
|
331 |
if (!ce.isNavKeyPress()) {
|
347 |
if (!ce.isNavKeyPress()) {
|
332 |
obtenirPersonnesSaisies(personnesSaisiesComboBox.getRawValue());
|
348 |
obtenirPersonnesSaisies(personnesSaisiesComboBox.getRawValue());
|
333 |
}
|
349 |
}
|
334 |
}
|
350 |
}
|
335 |
}
|
351 |
}
|
336 |
});
|
352 |
});
|
337 |
comboBox.addListener(Events.Select, new Listener<BaseEvent>() {
|
353 |
comboBox.addListener(Events.Select, new Listener<BaseEvent>() {
|
338 |
public void handleEvent(BaseEvent be) {
|
354 |
public void handleEvent(BaseEvent be) {
|
339 |
if (personnesSaisiesComboBox.getValue() instanceof Personne) {
|
355 |
if (personnesSaisiesComboBox.getValue() instanceof Personne) {
|
340 |
// N'ajouter l'auteur que s'il n'est pas déjà présent dans la grille et dans les valeurs initiales
|
356 |
// N'ajouter l'auteur que s'il n'est pas déjà présent dans la grille et dans les valeurs initiales
|
341 |
Personne personneSaisieSelectionne = personnesSaisiesComboBox.getValue();
|
357 |
Personne personneSaisieSelectionne = personnesSaisiesComboBox.getValue();
|
342 |
if (grille.getStore().findModel(personneSaisieSelectionne) != null) {
|
358 |
if (grille.getStore().findModel(personneSaisieSelectionne) != null) {
|
343 |
Info.display("Information", "La personne est déjà présente dans la liste d'auteurs");
|
359 |
Info.display("Information", "La personne est déjà présente dans la liste d'auteurs");
|
344 |
} else {
|
360 |
} else {
|
345 |
if (!auteursInitialListe.containsValue(personneSaisieSelectionne)) {
|
361 |
if (!auteursInitialListe.containsValue(personneSaisieSelectionne)) {
|
346 |
auteursAjoutes.put(personneSaisieSelectionne.getId(), personneSaisieSelectionne);
|
362 |
auteursAjoutes.put(personneSaisieSelectionne.getId(), personneSaisieSelectionne);
|
347 |
}
|
363 |
}
|
348 |
ajouterDansGrille(personneSaisieSelectionne);
|
364 |
ajouterDansGrille(personneSaisieSelectionne);
|
349 |
personnesSaisiesComboBox.setValue(null);
|
365 |
personnesSaisiesComboBox.setValue(null);
|
350 |
}
|
366 |
}
|
351 |
}
|
367 |
}
|
352 |
}
|
368 |
}
|
353 |
});
|
369 |
});
|
354 |
return comboBox;
|
370 |
return comboBox;
|
355 |
}
|
371 |
}
|
356 |
|
372 |
|
357 |
private void obtenirPersonnesSaisies(String nom) {
|
373 |
private void obtenirPersonnesSaisies(String nom) {
|
358 |
mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%");
|
374 |
mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%");
|
359 |
}
|
375 |
}
|
360 |
|
376 |
|
361 |
private void ajouterDansGrille(Personne personne) {
|
377 |
private void ajouterDansGrille(Personne personne) {
|
362 |
ajouterDansGrille(personne, 0);
|
378 |
ajouterDansGrille(personne, 0);
|
363 |
}
|
379 |
}
|
364 |
|
380 |
|
365 |
private void ajouterDansGrille(Personne personne, int index) {
|
381 |
private void ajouterDansGrille(Personne personne, int index) {
|
366 |
if (personne != null) {
|
382 |
if (personne != null) {
|
367 |
if (!grille.getStore().contains(personne)) {
|
383 |
if (!grille.getStore().contains(personne)) {
|
368 |
//1) si elle ne fait pas partie des initiaux, ajouter à la liste à ajouter
|
384 |
//1) si elle ne fait pas partie des initiaux, ajouter à la liste à ajouter
|
369 |
if (!auteursInitialListe.containsValue(personne)) {
|
385 |
if (!auteursInitialListe.containsValue(personne)) {
|
370 |
auteursAjoutes.put(personne.getId(), personne);
|
386 |
auteursAjoutes.put(personne.getId(), personne);
|
371 |
}
|
387 |
}
|
372 |
|
388 |
|
373 |
// L'enlever de la liste à supprimer
|
389 |
// L'enlever de la liste à supprimer
|
374 |
if (auteursSupprimes.containsValue(personne)) {
|
390 |
if (auteursSupprimes.containsValue(personne)) {
|
375 |
auteursSupprimes.remove(personne);
|
391 |
auteursSupprimes.remove(personne);
|
376 |
}
|
392 |
}
|
377 |
//2) Ajouter a la grille
|
393 |
//2) Ajouter a la grille
|
378 |
grille.getStore().insert(personne, index);
|
394 |
grille.getStore().insert(personne, index);
|
379 |
grille.getSelectionModel().select(index, false);
|
395 |
grille.getSelectionModel().select(index, false);
|
380 |
} else {
|
396 |
} else {
|
381 |
InfoLogger.display("Information", "La personne choisie existe déjà dans la liste.");
|
397 |
InfoLogger.display("Information", "La personne choisie existe déjà dans la liste.");
|
382 |
}
|
398 |
}
|
383 |
}
|
399 |
}
|
384 |
}
|
400 |
}
|
385 |
|
401 |
|
386 |
/**
|
402 |
/**
|
387 |
* Met à jour la grille avec les informations contenus dans la variable listePublicationsLiees
|
403 |
* Met à jour la grille avec les informations contenus dans la variable listePublicationsLiees
|
388 |
*/
|
404 |
*/
|
389 |
private void mettreAJourGrille() {
|
405 |
private void mettreAJourGrille() {
|
390 |
|
406 |
|
391 |
grille.getStore().removeAll();
|
407 |
grille.getStore().removeAll();
|
392 |
grille.getStore().add(listePersonne.toList());
|
408 |
grille.getStore().add(listePersonne.toList());
|
393 |
}
|
409 |
}
|
394 |
|
410 |
|
395 |
private void supprimerDansGrille(Personne personne) {
|
411 |
private void supprimerDansGrille(Personne personne) {
|
396 |
if (personne != null) {
|
412 |
if (personne != null) {
|
397 |
//1) Ajouter a la liste des personne à supprimer uniquement si est présente dans la liste initiale
|
413 |
//1) Ajouter a la liste des personne à supprimer uniquement si est présente dans la liste initiale
|
398 |
if (auteursInitialListe.containsValue(personne)) {
|
414 |
if (auteursInitialListe.containsValue(personne)) {
|
399 |
auteursSupprimes.put(personne.getId(), personne);
|
415 |
auteursSupprimes.put(personne.getId(), personne);
|
400 |
}
|
416 |
}
|
401 |
|
417 |
|
402 |
if (auteursAjoutes.containsValue(personne)) {
|
418 |
if (auteursAjoutes.containsValue(personne)) {
|
403 |
auteursAjoutes.remove(personne);
|
419 |
auteursAjoutes.remove(personne);
|
404 |
}
|
420 |
}
|
405 |
|
421 |
|
406 |
//2) Supprimer la personne de la liste
|
422 |
//2) Supprimer la personne de la liste
|
407 |
grille.getStore().remove(personne);
|
423 |
grille.getStore().remove(personne);
|
408 |
} else {
|
424 |
} else {
|
409 |
Info.display("Information", "Vous devez sélectionner une personne");
|
425 |
Info.display("Information", "Vous devez sélectionner une personne");
|
410 |
}
|
426 |
}
|
411 |
}
|
427 |
}
|
412 |
|
428 |
|
413 |
private EditorGrid<Personne> creerGrille() {
|
429 |
private EditorGrid<Personne> creerGrille() {
|
414 |
|
430 |
|
415 |
ListStore<Personne> storeGrille = new ListStore<Personne>();
|
431 |
ListStore<Personne> storeGrille = new ListStore<Personne>();
|
416 |
storeGrille.addListener(Store.Add, new Listener<StoreEvent<Personne>>() {
|
432 |
storeGrille.addListener(Store.Add, new Listener<StoreEvent<Personne>>() {
|
417 |
public void handleEvent(StoreEvent<Personne> ce) {
|
433 |
public void handleEvent(StoreEvent<Personne> ce) {
|
418 |
actualiserEtatBoutonsBarreOutils();
|
434 |
actualiserEtatBoutonsBarreOutils();
|
419 |
}
|
435 |
}
|
420 |
});
|
436 |
});
|
421 |
|
437 |
|
422 |
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<Personne>>() {
|
438 |
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<Personne>>() {
|
423 |
public void handleEvent(StoreEvent<Personne> ce) {
|
439 |
public void handleEvent(StoreEvent<Personne> ce) {
|
424 |
actualiserEtatBoutonsBarreOutils();
|
440 |
actualiserEtatBoutonsBarreOutils();
|
425 |
}
|
441 |
}
|
426 |
});
|
442 |
});
|
427 |
|
443 |
|
428 |
storeGrille.addListener(Store.Update, new Listener<StoreEvent<Personne>>() {
|
444 |
storeGrille.addListener(Store.Update, new Listener<StoreEvent<Personne>>() {
|
429 |
public void handleEvent(StoreEvent<Personne> ce) {
|
445 |
public void handleEvent(StoreEvent<Personne> ce) {
|
430 |
if (ce.getRecord().isModified("_role_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
446 |
if (ce.getRecord().isModified("_role_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
431 |
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
|
447 |
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
|
432 |
}
|
448 |
}
|
433 |
}
|
449 |
}
|
434 |
});
|
450 |
});
|
435 |
|
451 |
|
436 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
452 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
437 |
colonnes.add(new ColumnConfig("fmt_nom_complet", i18nC.personneNomComplet(), 150));
|
453 |
colonnes.add(new ColumnConfig("fmt_nom_complet", i18nC.personneNomComplet(), 150));
|
438 |
colonnes.add(new ColumnConfig("code_postal", i18nC.personneCodePostal(), 150));
|
454 |
colonnes.add(new ColumnConfig("code_postal", i18nC.personneCodePostal(), 150));
|
439 |
colonnes.add(new ColumnConfig("ville", i18nC.personneVille(), 75));
|
455 |
colonnes.add(new ColumnConfig("ville", i18nC.personneVille(), 75));
|
440 |
colonnes.add(new ColumnConfig("truk_courriel", i18nC.personneCourriel(), 75));
|
456 |
colonnes.add(new ColumnConfig("truk_courriel", i18nC.personneCourriel(), 75));
|
441 |
|
457 |
|
442 |
GridSelectionModel<Personne> modeleDeSelection = new GridSelectionModel<Personne>();
|
458 |
GridSelectionModel<Personne> modeleDeSelection = new GridSelectionModel<Personne>();
|
443 |
|
459 |
|
444 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
460 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
445 |
|
461 |
|
446 |
EditorGrid<Personne> grillePublications = new EditorGrid<Personne>(storeGrille, modeleDeColonnes);
|
462 |
EditorGrid<Personne> grillePublications = new EditorGrid<Personne>(storeGrille, modeleDeColonnes);
|
447 |
grillePublications.setHeight("100%");
|
463 |
grillePublications.setHeight("100%");
|
448 |
grillePublications.setBorders(true);
|
464 |
grillePublications.setBorders(true);
|
449 |
grillePublications.setSelectionModel(modeleDeSelection);
|
465 |
grillePublications.setSelectionModel(modeleDeSelection);
|
450 |
grillePublications.getView().setForceFit(true);
|
466 |
grillePublications.getView().setForceFit(true);
|
451 |
grillePublications.setAutoExpandColumn("fmt_nom_complet");
|
467 |
grillePublications.setAutoExpandColumn("fmt_nom_complet");
|
452 |
grillePublications.setStripeRows(true);
|
468 |
grillePublications.setStripeRows(true);
|
453 |
grillePublications.setTrackMouseOver(true);
|
469 |
grillePublications.setTrackMouseOver(true);
|
454 |
|
470 |
|
455 |
return grillePublications;
|
471 |
return grillePublications;
|
456 |
}
|
472 |
}
|
457 |
|
473 |
|
458 |
private void genererTitreFormulaire() {
|
474 |
private void genererTitreFormulaire() {
|
459 |
String titre = i18nC.publicationTitreFormAjout();
|
475 |
String titre = i18nC.publicationTitreFormAjout();
|
460 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
476 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
461 |
titre = i18nC.publicationTitreFormModif();
|
477 |
titre = i18nC.publicationTitreFormModif();
|
462 |
if (publication != null) {
|
478 |
if (publication != null) {
|
463 |
titre += " - "+i18nC.id()+": "+publication.getId()+" - "+publication.getTitre();
|
479 |
titre += " - "+i18nC.id()+": "+publication.getId()+" - "+publication.getTitre();
|
464 |
}
|
480 |
}
|
465 |
}
|
481 |
}
|
466 |
panneauFormulaire.setHeading(titre);
|
482 |
panneauFormulaire.setHeading(titre);
|
467 |
}
|
483 |
}
|
468 |
|
484 |
|
469 |
|
485 |
|
470 |
private void creerZoneAuteurs() {
|
486 |
private void creerZoneAuteurs() {
|
471 |
// Fieldset Auteur
|
487 |
auteursFieldset = new ContentPanel();
|
472 |
auteursFieldset = new LayoutContainer(new FitLayout());
|
488 |
auteursFieldset.setLayout(new FitLayout());
|
- |
|
489 |
auteursFieldset.setHeading("Auteurs");
|
- |
|
490 |
|
473 |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
|
491 |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0);
|
474 |
mediateur.clicObtenirListeAuteurs(this);
|
492 |
mediateur.clicObtenirListeAuteurs(this);
|
475 |
|
493 |
|
476 |
creerChampsAuteur();
|
494 |
creerChampsAuteur();
|
477 |
}
|
495 |
}
|
478 |
|
496 |
|
479 |
private void creerChampsAuteur() {
|
497 |
private void creerChampsAuteur() {
|
480 |
auteursFieldset.removeAll();
|
498 |
auteursFieldset.removeAll();
|
481 |
barreOutils = creerBarreOutilsGrille();
|
499 |
barreOutils = creerBarreOutilsGrille();
|
482 |
panneauFormulaire.setTopComponent(barreOutils);
|
500 |
auteursFieldset.setTopComponent(barreOutils);
|
483 |
grille = creerGrille();
|
501 |
grille = creerGrille();
|
484 |
auteursFieldset.add(grille);
|
502 |
auteursFieldset.add(grille);
|
485 |
auteursFieldset.layout();
|
503 |
auteursFieldset.layout();
|
486 |
}
|
504 |
}
|
487 |
|
505 |
|
488 |
private ComboBox<Personne> creerComboBoxAuteursSaisis() {
|
506 |
private ComboBox<Personne> creerComboBoxAuteursSaisis() {
|
489 |
ListStore<Personne> auteursStore = new ListStore<Personne>();
|
507 |
ListStore<Personne> auteursStore = new ListStore<Personne>();
|
490 |
auteursStore.add(auteursStorePartage.getModels());
|
508 |
auteursStore.add(auteursStorePartage.getModels());
|
491 |
|
509 |
|
492 |
ComboBox<Personne> comboBox = new ComboBox<Personne>();
|
510 |
ComboBox<Personne> comboBox = new ComboBox<Personne>();
|
493 |
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
|
511 |
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
|
494 |
comboBox.setEditable(true);
|
512 |
comboBox.setEditable(true);
|
495 |
comboBox.setAllowBlank(false);
|
513 |
comboBox.setAllowBlank(false);
|
496 |
comboBox.setForceSelection(true);
|
514 |
comboBox.setForceSelection(true);
|
497 |
comboBox.setDisplayField("fmt_nom_complet");
|
515 |
comboBox.setDisplayField("fmt_nom_complet");
|
498 |
comboBox.setTriggerAction(TriggerAction.ALL);
|
516 |
comboBox.setTriggerAction(TriggerAction.ALL);
|
499 |
comboBox.setStore(auteursStore);
|
517 |
comboBox.setStore(auteursStore);
|
500 |
comboBox.setMessageTarget("tooltip");
|
518 |
comboBox.setMessageTarget("tooltip");
|
501 |
comboBox.addStyleName(ComposantClass.OBLIGATOIRE);
|
519 |
comboBox.addStyleName(ComposantClass.OBLIGATOIRE);
|
502 |
comboBox.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
520 |
comboBox.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
503 |
|
521 |
|
504 |
return comboBox;
|
522 |
return comboBox;
|
505 |
}
|
523 |
}
|
506 |
|
524 |
|
507 |
private void creerZoneGeneralites() {
|
525 |
private void creerZoneGeneralites() {
|
508 |
FormLayout layout = new FormLayout();
|
526 |
FormLayout layout = new FormLayout();
|
509 |
layout.setLabelWidth(200);
|
527 |
layout.setLabelWidth(200);
|
510 |
|
528 |
|
511 |
// Fieldset Infos Générales
|
529 |
// Fieldset Infos Générales
|
512 |
generalitesFieldset = new FieldSet();
|
530 |
generalitesFieldset = new FieldSet();
|
513 |
generalitesFieldset.setHeading("Informations générales");
|
531 |
generalitesFieldset.setHeading("Informations générales");
|
514 |
generalitesFieldset.setCollapsible(true);
|
532 |
generalitesFieldset.setCollapsible(true);
|
515 |
generalitesFieldset.setLayout(layout);
|
533 |
generalitesFieldset.setLayout(layout);
|
- |
|
534 |
|
- |
|
535 |
ModelType modelTypeProjets = new ModelType();
|
- |
|
536 |
modelTypeProjets.setRoot("projets");
|
- |
|
537 |
modelTypeProjets.setTotalName("nbElements");
|
- |
|
538 |
modelTypeProjets.addField("cpr_nom");
|
- |
|
539 |
modelTypeProjets.addField("cpr_id_projet");
|
- |
|
540 |
|
- |
|
541 |
String displayNameProjets = "cpr_nom";
|
- |
|
542 |
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>();
|
- |
|
543 |
|
- |
|
544 |
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
|
- |
|
545 |
projetsCombo.setWidth(200, 600);
|
- |
|
546 |
projetsCombo.getCombo().setTabIndex(tabIndex++);
|
- |
|
547 |
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
|
- |
|
548 |
projetsCombo.getCombo().setForceSelection(true);
|
- |
|
549 |
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
|
- |
|
550 |
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
|
516 |
|
- |
|
517 |
projetsCombo = new ComboBox<Projet>();
|
- |
|
518 |
projetsCombo.setTabIndex(tabIndex++);
|
- |
|
519 |
projetsCombo.setFieldLabel(i18nC.projetChamp());
|
- |
|
520 |
projetsCombo.setDisplayField("nom");
|
- |
|
521 |
projetsCombo.setForceSelection(true);
|
551 |
|
522 |
projetsCombo.setValidator(new Validator() {
|
552 |
projetsCombo.getCombo().setValidator(new Validator() {
|
523 |
public String validate(Field<?> field, String value) {
|
553 |
public String validate(Field<?> field, String value) {
|
524 |
String retour = null;
|
554 |
String retour = null;
|
525 |
if (field.getRawValue().equals("")) {
|
555 |
if (field.getRawValue().equals("")) {
|
526 |
field.setValue(null);
|
556 |
field.setValue(null);
|
527 |
} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
|
557 |
} else if (projetsCombo.getStore().findModel("cpr_nom", field.getRawValue()) == null) {
|
528 |
String contenuBrut = field.getRawValue();
|
558 |
String contenuBrut = field.getRawValue();
|
529 |
field.setValue(null);
|
559 |
field.setValue(null);
|
530 |
field.setRawValue(contenuBrut);
|
560 |
field.setRawValue(contenuBrut);
|
531 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
561 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
532 |
}
|
562 |
}
|
533 |
return retour;
|
563 |
return retour;
|
534 |
}
|
564 |
}
|
535 |
});
|
565 |
});
|
536 |
projetsCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
537 |
projetsCombo.setStore(new ListStore<Projet>());
|
- |
|
538 |
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
|
- |
|
539 |
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
|
- |
|
540 |
generalitesFieldset.add(projetsCombo, new FormData(450, 0));
|
566 |
generalitesFieldset.add(projetsCombo, new FormData(600, 0));
|
541 |
mediateur.selectionnerProjet(this, null, null);
|
- |
|
542 |
|
567 |
|
543 |
titreChp = new TextField<String>();
|
568 |
titreChp = new TextField<String>();
|
544 |
titreChp.setName("cpu");
|
569 |
titreChp.setName("cpu");
|
545 |
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
|
570 |
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
|
546 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
571 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
547 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
572 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
548 |
generalitesFieldset.add(titreChp, new FormData(450, 0));
|
573 |
generalitesFieldset.add(titreChp, new FormData(450, 0));
|
549 |
|
574 |
|
550 |
collectionChp = new TextField<String>();
|
575 |
collectionChp = new TextField<String>();
|
551 |
collectionChp.setFieldLabel("Intitulé de la revue ou de la collection");
|
576 |
collectionChp.setFieldLabel("Intitulé de la revue ou de la collection");
|
552 |
generalitesFieldset.add(collectionChp, new FormData(450, 0));
|
577 |
generalitesFieldset.add(collectionChp, new FormData(450, 0));
|
553 |
|
578 |
|
554 |
uriChp = new TextField<String>();
|
579 |
uriChp = new TextField<String>();
|
555 |
uriChp.setFieldLabel("URL de la publication");
|
580 |
uriChp.setFieldLabel("URL de la publication");
|
556 |
generalitesFieldset.add(uriChp, new FormData(450, 0));
|
581 |
generalitesFieldset.add(uriChp, new FormData(450, 0));
|
557 |
}
|
582 |
}
|
558 |
|
583 |
|
559 |
private void creerZoneEdition() {
|
584 |
private void creerZoneEdition() {
|
560 |
FormLayout layout = new FormLayout();
|
585 |
FormLayout layout = new FormLayout();
|
561 |
layout.setLabelWidth(200);
|
586 |
layout.setLabelWidth(200);
|
562 |
|
587 |
|
563 |
// Fieldset Edition
|
588 |
// Fieldset Edition
|
564 |
editionFieldset = new FieldSet();
|
589 |
editionFieldset = new FieldSet();
|
565 |
editionFieldset.setHeading("Édition");
|
590 |
editionFieldset.setHeading("Édition");
|
566 |
editionFieldset.setCollapsible(true);
|
591 |
editionFieldset.setCollapsible(true);
|
567 |
editionFieldset.setLayout(layout);
|
592 |
editionFieldset.setLayout(layout);
|
- |
|
593 |
|
- |
|
594 |
|
- |
|
595 |
/*****************************************************/
|
- |
|
596 |
/** Champ 'Editeur de la publication' **/
|
568 |
|
597 |
/*****************************************************/
|
569 |
ListStore<Structure> editeurStore = new ListStore<Structure>();
|
598 |
ModelType modelTypeStructures = new ModelType();
|
570 |
editeurCombobox = new ComboBox<Structure>();
|
599 |
modelTypeStructures.setRoot("structures");
|
- |
|
600 |
modelTypeStructures.setTotalName("nbElements");
|
571 |
editeurCombobox.setEmptyText("Sélectionner un éditeur...");
|
601 |
modelTypeStructures.addField("cs_nom");
|
- |
|
602 |
modelTypeStructures.addField("cs_id_structure");
|
572 |
editeurCombobox.setFieldLabel("Éditeur de la publication");
|
603 |
|
- |
|
604 |
String displayNameStructures = "cs_nom";
|
- |
|
605 |
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>();
|
- |
|
606 |
|
573 |
editeurCombobox.setDisplayField("nom");
|
607 |
editeurCombobox = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
|
574 |
editeurCombobox.setStore(editeurStore);
|
608 |
editeurCombobox.setWidth(200, 600);
|
575 |
editeurCombobox.setEditable(true);
|
609 |
editeurCombobox.getCombo().setTabIndex(tabIndex++);
|
576 |
editeurCombobox.setTriggerAction(TriggerAction.ALL);
|
610 |
editeurCombobox.getCombo().setEmptyText("Sélectionner un éditeur...");
|
577 |
editionFieldset.add(editeurCombobox, new FormData(450, 0));
|
611 |
editeurCombobox.getCombo().setFieldLabel("Éditeur de la publication");
|
- |
|
612 |
editeurCombobox.getCombo().setEditable(true);
|
578 |
mediateur.clicObtenirListeEditeurs(this);
|
613 |
editionFieldset.add(editeurCombobox, new FormData(600, 0));
|
- |
|
614 |
|
- |
|
615 |
/*********************************************/
|
- |
|
616 |
/** Champ 'Date de publication' **/
|
579 |
|
617 |
/*********************************************/
|
580 |
datePublicationChp = new TextField<String>();
|
618 |
datePublicationChp = new TextField<String>();
|
581 |
datePublicationChp.setMaxLength(4);
|
619 |
datePublicationChp.setMaxLength(4);
|
582 |
datePublicationChp.setMinLength(4);
|
620 |
datePublicationChp.setMinLength(4);
|
583 |
datePublicationChp.setFieldLabel("Année de publication");
|
621 |
datePublicationChp.setFieldLabel("Année de publication");
|
584 |
datePublicationChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
622 |
datePublicationChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
585 |
datePublicationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
623 |
datePublicationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
586 |
editionFieldset.add(datePublicationChp, new FormData(40, 0));
|
624 |
editionFieldset.add(datePublicationChp, new FormData(40, 0));
|
- |
|
625 |
|
- |
|
626 |
/*****************************/
|
- |
|
627 |
/** Champ '' **/
|
587 |
|
628 |
/*****************************/
|
588 |
tomeChp = new TextField<String>();
|
629 |
tomeChp = new TextField<String>();
|
589 |
tomeChp.setFieldLabel("Série de la revue ou tome");
|
630 |
tomeChp.setFieldLabel("Série de la revue ou tome");
|
590 |
editionFieldset.add(tomeChp, new FormData(75, 0));
|
631 |
editionFieldset.add(tomeChp, new FormData(75, 0));
|
591 |
|
632 |
|
- |
|
633 |
/*****************************/
|
- |
|
634 |
/** Champ '' **/
|
- |
|
635 |
/*****************************/
|
592 |
fasciculeChp = new TextField<String>();
|
636 |
fasciculeChp = new TextField<String>();
|
593 |
fasciculeChp.setFieldLabel("Fascicule de la revue");
|
637 |
fasciculeChp.setFieldLabel("Fascicule de la revue");
|
594 |
editionFieldset.add(fasciculeChp, new FormData(75, 0));
|
638 |
editionFieldset.add(fasciculeChp, new FormData(75, 0));
|
595 |
|
639 |
|
- |
|
640 |
/*****************************/
|
- |
|
641 |
/** Champ '' **/
|
- |
|
642 |
/*****************************/
|
596 |
pagesChp = new TextField<String>();
|
643 |
pagesChp = new TextField<String>();
|
597 |
pagesChp.setFieldLabel("Pages");
|
644 |
pagesChp.setFieldLabel("Pages");
|
598 |
pagesChp.setToolTip("Fomat : NBRE ou NBRE-NBRE. ('NBRE' correspond à une suite de chiffres arabes ou romains ou à un point d'interrogation '?' dans le cas d'une donnée inconnue)");
|
645 |
pagesChp.setToolTip("Fomat : NBRE ou NBRE-NBRE. ('NBRE' correspond à une suite de chiffres arabes ou romains ou à un point d'interrogation '?' dans le cas d'une donnée inconnue)");
|
599 |
editionFieldset.add(pagesChp, new FormData(100, 0));
|
646 |
editionFieldset.add(pagesChp, new FormData(100, 0));
|
600 |
}
|
647 |
}
|
601 |
|
648 |
|
602 |
public void rafraichir(Object nouvellesDonnees) {
|
649 |
public void rafraichir(Object nouvellesDonnees) {
|
603 |
if (nouvellesDonnees instanceof Publication) {
|
650 |
if (nouvellesDonnees instanceof Publication) {
|
604 |
// Si on a reçu les details d'une publication
|
651 |
// Si on a reçu les details d'une publication
|
605 |
publication = (Publication) nouvellesDonnees;
|
652 |
publication = (Publication) nouvellesDonnees;
|
606 |
//rafraichirPublication((Publication) nouvellesDonnees);
|
653 |
//rafraichirPublication((Publication) nouvellesDonnees);
|
607 |
} else if (nouvellesDonnees instanceof StructureListe) {
|
- |
|
608 |
// Si on a reçu une liste des editeurs
|
- |
|
609 |
rafraichirListeEditeurs((StructureListe) nouvellesDonnees);
|
- |
|
610 |
} else if (nouvellesDonnees instanceof PublicationAPersonneListe) {
|
654 |
} else if (nouvellesDonnees instanceof PublicationAPersonneListe) {
|
611 |
rafraichirListeAuteurs((PublicationAPersonneListe) nouvellesDonnees);
|
655 |
rafraichirListeAuteurs((PublicationAPersonneListe) nouvellesDonnees);
|
612 |
} else if (nouvellesDonnees instanceof Information) {
|
656 |
} else if (nouvellesDonnees instanceof Information) {
|
613 |
rafraichirInformation((Information) nouvellesDonnees);
|
657 |
rafraichirInformation((Information) nouvellesDonnees);
|
614 |
} else if (nouvellesDonnees instanceof ProjetListe) {
|
- |
|
615 |
ProjetListe projets = (ProjetListe) nouvellesDonnees;
|
- |
|
616 |
Formulaire.rafraichirComboBox(projets, projetsCombo);
|
- |
|
617 |
setValeurComboProjets();
|
- |
|
618 |
} else {
|
658 |
} else {
|
619 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
659 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
620 |
}
|
660 |
}
|
621 |
}
|
661 |
}
|
622 |
|
662 |
|
623 |
private void synchronisation() {
|
663 |
private void synchronisation() {
|
624 |
|
664 |
|
625 |
}
|
665 |
}
|
626 |
|
666 |
|
627 |
private void miseAJourAuteursInitialListe() {
|
667 |
private void miseAJourAuteursInitialListe() {
|
628 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
668 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
629 |
while (clesAjoutees.hasNext()) {
|
669 |
while (clesAjoutees.hasNext()) {
|
630 |
Personne auteurAjoute = auteursAjoutes.get(clesAjoutees.next());
|
670 |
Personne auteurAjoute = auteursAjoutes.get(clesAjoutees.next());
|
631 |
auteursInitialListe.put(auteurAjoute.getId(), auteurAjoute);
|
671 |
auteursInitialListe.put(auteurAjoute.getId(), auteurAjoute);
|
632 |
}
|
672 |
}
|
633 |
|
673 |
|
634 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
674 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
635 |
while (clesSupprimees.hasNext()) {
|
675 |
while (clesSupprimees.hasNext()) {
|
636 |
Personne auteurSupprime = auteursSupprimes.get(clesSupprimees.next());
|
676 |
Personne auteurSupprime = auteursSupprimes.get(clesSupprimees.next());
|
637 |
auteursInitialListe.remove(auteurSupprime.getId());
|
677 |
auteursInitialListe.remove(auteurSupprime.getId());
|
638 |
}
|
678 |
}
|
639 |
}
|
679 |
}
|
640 |
|
- |
|
641 |
private void rafraichirListeEditeurs(StructureListe editeurs) {
|
- |
|
642 |
editeurCombobox.getStore().removeAll();
|
- |
|
643 |
editeurCombobox.getStore().add((List<Structure>) editeurs.toList());
|
- |
|
644 |
}
|
- |
|
645 |
|
680 |
|
646 |
private void rafraichirListeAuteurs(PublicationAPersonneListe auteurs) {
|
681 |
private void rafraichirListeAuteurs(PublicationAPersonneListe auteurs) {
|
647 |
Iterator<String> it = auteurs.keySet().iterator();
|
682 |
Iterator<String> it = auteurs.keySet().iterator();
|
648 |
while (it.hasNext()) {
|
683 |
while (it.hasNext()) {
|
649 |
Personne auteur = auteurs.get(it.next()).getPersonne();
|
684 |
Personne auteur = auteurs.get(it.next()).getPersonne();
|
650 |
auteursInitialListe.put(auteur.getId(), auteur);
|
685 |
auteursInitialListe.put(auteur.getId(), auteur);
|
651 |
}
|
686 |
}
|
652 |
|
687 |
|
653 |
grille.getStore().removeAll();
|
688 |
grille.getStore().removeAll();
|
654 |
grille.getStore().add(auteursInitialListe.toList());
|
689 |
grille.getStore().add(auteursInitialListe.toList());
|
655 |
layout();
|
690 |
layout();
|
656 |
}
|
691 |
}
|
657 |
|
692 |
|
658 |
private void rafraichirInformation(Information info) {
|
693 |
private void rafraichirInformation(Information info) {
|
659 |
String type = info.getType();
|
694 |
String type = info.getType();
|
660 |
if (type.equals("publication_enregistree")) {
|
695 |
if (type.equals("publication_enregistree")) {
|
661 |
// la publication vien d'etre enregistrée, on soumet les auteurs
|
696 |
// la publication vien d'etre enregistrée, on soumet les auteurs
|
662 |
soumettreAuteurs();
|
697 |
soumettreAuteurs();
|
663 |
//System.out.println("pub enregistrée");
|
698 |
//System.out.println("pub enregistrée");
|
664 |
} else if (type.equals("auteurs_enregistres")) {
|
699 |
} else if (type.equals("auteurs_enregistres")) {
|
665 |
miseAJourAuteursInitialListe();
|
700 |
miseAJourAuteursInitialListe();
|
666 |
initialiserAuteurs();
|
701 |
initialiserAuteurs();
|
667 |
repandreRafraichissement();
|
702 |
repandreRafraichissement();
|
668 |
controlerFermeture();
|
703 |
controlerFermeture();
|
669 |
} else if (type.equals("chargement_modifier_ok")) {
|
704 |
} else if (type.equals("chargement_modifier_ok")) {
|
670 |
peuplerFormulaire();
|
705 |
peuplerFormulaire();
|
671 |
genererTitreFormulaire();
|
706 |
genererTitreFormulaire();
|
672 |
}
|
707 |
}
|
673 |
|
708 |
|
674 |
if (info.getType().equals("liste_personne")) {
|
709 |
if (info.getType().equals("liste_personne")) {
|
675 |
PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
|
710 |
PersonneListe listePersonneAuteur = (PersonneListe) info.getDonnee(0);
|
676 |
ListStore store = personnesSaisiesComboBox.getStore();
|
711 |
ListStore store = personnesSaisiesComboBox.getStore();
|
677 |
store.removeAll();
|
712 |
store.removeAll();
|
678 |
store.add(listePersonneAuteur.toList());
|
713 |
store.add(listePersonneAuteur.toList());
|
679 |
|
714 |
|
680 |
} else if (info.getType().equals("modif_publication")) {
|
715 |
} else if (info.getType().equals("modif_publication")) {
|
681 |
InfoLogger.display("Modification d'une publication", info.toString());
|
716 |
InfoLogger.display("Modification d'une publication", info.toString());
|
682 |
} else if (info.getType().equals("ajout_publication")) {
|
717 |
} else if (info.getType().equals("ajout_publication")) {
|
683 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String && ((String) info.getDonnee(0)).matches("[0-9]+")) {
|
718 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String && ((String) info.getDonnee(0)).matches("[0-9]+")) {
|
684 |
String publicationId = (String) info.getDonnee(0);
|
719 |
String publicationId = (String) info.getDonnee(0);
|
685 |
InfoLogger.display("Ajout d'une publication", "La publication '"+publicationId+"' a bien été ajoutée");
|
720 |
InfoLogger.display("Ajout d'une publication", "La publication '"+publicationId+"' a bien été ajoutée");
|
686 |
} else {
|
721 |
} else {
|
687 |
InfoLogger.display("Ajout d'une publication", info.toString());
|
722 |
InfoLogger.display("Ajout d'une publication", info.toString());
|
688 |
}
|
723 |
}
|
689 |
}
|
724 |
}
|
690 |
}
|
725 |
}
|
691 |
|
726 |
|
692 |
|
727 |
|
693 |
private void initialiserAuteurs() {
|
728 |
private void initialiserAuteurs() {
|
694 |
auteursAjoutes = new PersonneListe();
|
729 |
auteursAjoutes = new PersonneListe();
|
695 |
auteursSupprimes = new PersonneListe();
|
730 |
auteursSupprimes = new PersonneListe();
|
696 |
}
|
731 |
}
|
697 |
|
732 |
|
698 |
private void repandreRafraichissement() {
|
733 |
private void repandreRafraichissement() {
|
699 |
if (vueExterneARafraichirApresValidation != null) {
|
734 |
if (vueExterneARafraichirApresValidation != null) {
|
700 |
String type = "publication_modifiee";
|
735 |
String type = "publication_modifiee";
|
701 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
736 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
702 |
type = "publication_ajoutee";
|
737 |
type = "publication_ajoutee";
|
703 |
}
|
738 |
}
|
704 |
Information info = new Information(type);
|
739 |
Information info = new Information(type);
|
705 |
info.setDonnee(0, publication);
|
740 |
info.setDonnee(0, publication);
|
706 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
741 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
707 |
}
|
742 |
}
|
708 |
}
|
743 |
}
|
709 |
|
744 |
|
710 |
public boolean soumettreFormulaire() {
|
745 |
public boolean soumettreFormulaire() {
|
711 |
boolean formulaireValideOk = verifierFormulaire();
|
746 |
boolean formulaireValideOk = verifierFormulaire();
|
712 |
if (formulaireValideOk) {
|
747 |
if (formulaireValideOk) {
|
713 |
soumettrePublication();
|
748 |
soumettrePublication();
|
714 |
}
|
749 |
}
|
715 |
|
750 |
|
716 |
|
751 |
|
717 |
return formulaireValideOk;
|
752 |
return formulaireValideOk;
|
718 |
}
|
753 |
}
|
719 |
|
754 |
|
720 |
private void soumettrePublication() {
|
755 |
private void soumettrePublication() {
|
721 |
Publication publicationCollectee = collecterPublication();
|
756 |
Publication publicationCollectee = collecterPublication();
|
722 |
if (publicationCollectee != null) {
|
757 |
if (publicationCollectee != null) {
|
723 |
|
758 |
|
724 |
// Pour l'enregistrement des collections, on utilise le séquenceur
|
759 |
// Pour l'enregistrement des collections, on utilise le séquenceur
|
725 |
// Il doit attendre le retour de l'enregistrement pour poursuivre
|
760 |
// Il doit attendre le retour de l'enregistrement pour poursuivre
|
726 |
sequenceur = new Sequenceur();
|
761 |
sequenceur = new Sequenceur();
|
727 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
762 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
728 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
763 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
729 |
mediateur.ajouterPublication(sequenceur, publicationCollectee, seqId);
|
764 |
mediateur.ajouterPublication(sequenceur, publicationCollectee, seqId);
|
730 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
765 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
731 |
mediateur.modifierPublication(sequenceur, publicationCollectee, seqId);
|
766 |
mediateur.modifierPublication(sequenceur, publicationCollectee, seqId);
|
732 |
}
|
767 |
}
|
733 |
sequenceur.empilerRafraichissement(this, new Information("publication_enregistree"));
|
768 |
sequenceur.empilerRafraichissement(this, new Information("publication_enregistree"));
|
734 |
}
|
769 |
}
|
735 |
}
|
770 |
}
|
736 |
|
771 |
|
737 |
private void soumettreAuteurs() {
|
772 |
private void soumettreAuteurs() {
|
738 |
|
773 |
|
739 |
//attenteAjoutAuteursOk = false;
|
774 |
//attenteAjoutAuteursOk = false;
|
740 |
//attenteSuppressionAuteursOk = false;
|
775 |
//attenteSuppressionAuteursOk = false;
|
741 |
|
776 |
|
742 |
//1) Auteurs ajoutés :
|
777 |
//1) Auteurs ajoutés :
|
743 |
// - Créer une PublicationAAuteurListe
|
778 |
// - Créer une PublicationAAuteurListe
|
744 |
PublicationAPersonneListe listeDesAuteurs = new PublicationAPersonneListe();
|
779 |
PublicationAPersonneListe listeDesAuteurs = new PublicationAPersonneListe();
|
745 |
Iterator<String> itAuteur = auteursAjoutes.keySet().iterator();
|
780 |
Iterator<String> itAuteur = auteursAjoutes.keySet().iterator();
|
746 |
while (itAuteur.hasNext()) {
|
781 |
while (itAuteur.hasNext()) {
|
747 |
PublicationAPersonne publiAPersonne = new PublicationAPersonne();
|
782 |
PublicationAPersonne publiAPersonne = new PublicationAPersonne();
|
748 |
String cle = itAuteur.next();
|
783 |
String cle = itAuteur.next();
|
749 |
publiAPersonne.setIdPersonne(cle);
|
784 |
publiAPersonne.setIdPersonne(cle);
|
750 |
publiAPersonne.setIdPublication(publication.getId());
|
785 |
publiAPersonne.setIdPublication(publication.getId());
|
751 |
listeDesAuteurs.put(cle, publiAPersonne);
|
786 |
listeDesAuteurs.put(cle, publiAPersonne);
|
752 |
}
|
787 |
}
|
753 |
|
788 |
|
754 |
// - envoyer au mediateur SSI personnes à ajouter
|
789 |
// - envoyer au mediateur SSI personnes à ajouter
|
755 |
if (listeDesAuteurs.size() > 0) {
|
790 |
if (listeDesAuteurs.size() > 0) {
|
756 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
791 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
757 |
mediateur.ajouterPublicationAPersonne(sequenceur, publication.getId(), listeDesAuteurs, PublicationAPersonne.ROLE_AUTEUR, seqId);
|
792 |
mediateur.ajouterPublicationAPersonne(sequenceur, publication.getId(), listeDesAuteurs, PublicationAPersonne.ROLE_AUTEUR, seqId);
|
758 |
//attenteAjoutAuteursOk = true;
|
793 |
//attenteAjoutAuteursOk = true;
|
759 |
}
|
794 |
}
|
760 |
|
795 |
|
761 |
//2) Auteurs supprimés :
|
796 |
//2) Auteurs supprimés :
|
762 |
// - Créer une PublicationAPersonneListe
|
797 |
// - Créer une PublicationAPersonneListe
|
763 |
listeDesAuteurs = new PublicationAPersonneListe();
|
798 |
listeDesAuteurs = new PublicationAPersonneListe();
|
764 |
itAuteur = auteursSupprimes.keySet().iterator();
|
799 |
itAuteur = auteursSupprimes.keySet().iterator();
|
765 |
while (itAuteur.hasNext()) {
|
800 |
while (itAuteur.hasNext()) {
|
766 |
PublicationAPersonne publiAPersonne = new PublicationAPersonne();
|
801 |
PublicationAPersonne publiAPersonne = new PublicationAPersonne();
|
767 |
String cle = itAuteur.next();
|
802 |
String cle = itAuteur.next();
|
768 |
publiAPersonne.setIdPersonne(cle);
|
803 |
publiAPersonne.setIdPersonne(cle);
|
769 |
publiAPersonne.setIdPublication(publication.getId());
|
804 |
publiAPersonne.setIdPublication(publication.getId());
|
770 |
listeDesAuteurs.put(cle, publiAPersonne);
|
805 |
listeDesAuteurs.put(cle, publiAPersonne);
|
771 |
}
|
806 |
}
|
772 |
|
807 |
|
773 |
// - Envoyer au médiateur SSI personnes à supprimer
|
808 |
// - Envoyer au médiateur SSI personnes à supprimer
|
774 |
if (listeDesAuteurs.size() > 0) {
|
809 |
if (listeDesAuteurs.size() > 0) {
|
775 |
// Pour une suppression des auteurs, on a pas besoin d'attendre le retour
|
810 |
// Pour une suppression des auteurs, on a pas besoin d'attendre le retour
|
776 |
mediateur.supprimerPublicationAPersonne(this, listeDesAuteurs);
|
811 |
mediateur.supprimerPublicationAPersonne(this, listeDesAuteurs);
|
777 |
//attenteSuppressionAuteursOk = true;
|
812 |
//attenteSuppressionAuteursOk = true;
|
778 |
}
|
813 |
}
|
779 |
|
814 |
|
780 |
sequenceur.empilerRafraichissement(this, new Information("auteurs_enregistres"));
|
815 |
sequenceur.empilerRafraichissement(this, new Information("auteurs_enregistres"));
|
781 |
}
|
816 |
}
|
782 |
|
817 |
|
783 |
public boolean verifierFormulaire() {
|
818 |
public boolean verifierFormulaire() {
|
784 |
boolean valide = true;
|
819 |
boolean valide = true;
|
785 |
ArrayList<String> messages = new ArrayList<String>();
|
820 |
ArrayList<String> messages = new ArrayList<String>();
|
786 |
|
821 |
|
787 |
// Tester si au moins un auteur est présent
|
822 |
// Tester si au moins un auteur est présent
|
788 |
if (grille.getStore().getModels().size() == 0) {
|
823 |
if (grille.getStore().getModels().size() == 0) {
|
789 |
messages.add("Veuillez saisir au moins un auteur.");
|
824 |
messages.add("Veuillez saisir au moins un auteur.");
|
790 |
}
|
825 |
}
|
791 |
|
826 |
|
792 |
String titre = titreChp.getValue();
|
827 |
String titre = titreChp.getValue();
|
793 |
if (titre == null || titre.equals("")) {
|
828 |
if (titre == null || titre.equals("")) {
|
794 |
messages.add("Veuillez saisir le titre de la publication !");
|
829 |
messages.add("Veuillez saisir le titre de la publication !");
|
795 |
}
|
830 |
}
|
796 |
|
831 |
|
797 |
String uri = uriChp.getValue();
|
832 |
String uri = uriChp.getValue();
|
798 |
if (uri != null && ! uri.isEmpty() && ! uri.matches(Pattern.url)) {
|
833 |
if (uri != null && ! uri.isEmpty() && ! uri.matches(Pattern.url)) {
|
799 |
messages.add("L'URL saisie n'est pas valide !");
|
834 |
messages.add("L'URL saisie n'est pas valide !");
|
800 |
}
|
835 |
}
|
801 |
|
836 |
|
802 |
String datePublication = datePublicationChp.getRawValue();
|
837 |
String datePublication = datePublicationChp.getRawValue();
|
803 |
if (datePublication == null || datePublication.equals("")) {
|
838 |
if (datePublication == null || datePublication.equals("")) {
|
804 |
messages.add("Veuillez saisir une année de parution !");
|
839 |
messages.add("Veuillez saisir une année de parution !");
|
805 |
} else {
|
840 |
} else {
|
806 |
if (!etreDateValide(datePublication)) {
|
841 |
if (!etreDateValide(datePublication)) {
|
807 |
messages.add("Le format de l'année saisie est incorrect !");
|
842 |
messages.add("Le format de l'année saisie est incorrect !");
|
808 |
}
|
843 |
}
|
809 |
}
|
844 |
}
|
810 |
|
845 |
|
811 |
String pages = pagesChp.getValue();
|
846 |
String pages = pagesChp.getValue();
|
812 |
String valeurPage = "(?:[0-9]+|[IVXLCDM]+|\\?)";
|
847 |
String valeurPage = "(?:[0-9]+|[IVXLCDM]+|\\?)";
|
813 |
if (pages != null && ! pages.matches("^(?:"+valeurPage+"|"+valeurPage+"-"+valeurPage+")$")) {
|
848 |
if (pages != null && ! pages.matches("^(?:"+valeurPage+"|"+valeurPage+"-"+valeurPage+")$")) {
|
814 |
messages.add("Le format des pages est incorrect !");
|
849 |
messages.add("Le format des pages est incorrect !");
|
815 |
}
|
850 |
}
|
816 |
|
851 |
|
817 |
if (messages.size() != 0) {
|
852 |
if (messages.size() != 0) {
|
818 |
String[] tableauDeMessages = {};
|
853 |
String[] tableauDeMessages = {};
|
819 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
854 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
820 |
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
|
855 |
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
|
821 |
valide = false;
|
856 |
valide = false;
|
822 |
}
|
857 |
}
|
823 |
return valide;
|
858 |
return valide;
|
824 |
}
|
859 |
}
|
825 |
|
860 |
|
826 |
private void peuplerFormulaire() {
|
861 |
private void peuplerFormulaire() {
|
827 |
setValeurComboProjets();
|
862 |
setValeurComboProjets();
|
828 |
titreChp.setValue(publication.getTitre());
|
863 |
titreChp.setValue(publication.getTitre());
|
829 |
collectionChp.setValue(publication.getCollection());
|
864 |
collectionChp.setValue(publication.getCollection());
|
830 |
uriChp.setValue(publication.getURI());
|
865 |
uriChp.setValue(publication.getURI());
|
831 |
datePublicationChp.setValue(reduireDateParAnnee(publication.getDateParution()));
|
866 |
datePublicationChp.setValue(reduireDateParAnnee(publication.getDateParution()));
|
832 |
tomeChp.setValue(publication.getIndicationNvt());
|
867 |
tomeChp.setValue(publication.getIndicationNvt());
|
833 |
fasciculeChp.setValue(publication.getFascicule());
|
868 |
fasciculeChp.setValue(publication.getFascicule());
|
834 |
pagesChp.setValue(publication.getPages());
|
869 |
pagesChp.setValue(publication.getPages());
|
835 |
|
870 |
|
836 |
if (publication.getEditeur().matches("^[0-9]+$")) {
|
871 |
if (publication.getEditeur().matches("^[0-9]+$")) {
|
837 |
editeurCombobox.setValue(editeurCombobox.getStore().findModel("id_structure", publication.getEditeur()));
|
872 |
editeurCombobox.getCombo().setValue(editeurCombobox.getStore().findModel("cs_id_structure", publication.getEditeur()));
|
838 |
} else {
|
873 |
} else {
|
839 |
editeurCombobox.setRawValue(publication.getEditeur());
|
874 |
editeurCombobox.getCombo().setRawValue(publication.getEditeur());
|
840 |
}
|
875 |
}
|
841 |
}
|
876 |
}
|
842 |
|
877 |
|
843 |
private Publication collecterPublication() {
|
878 |
private Publication collecterPublication() {
|
844 |
|
879 |
|
845 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
880 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
846 |
publicationCollectee.setIdProjet(getValeurComboProjets());
|
881 |
publicationCollectee.setIdProjet(getValeurComboProjets());
|
847 |
publicationCollectee.setAuteur(construireIntituleAuteur());
|
882 |
publicationCollectee.setAuteur(construireIntituleAuteur());
|
848 |
|
883 |
|
849 |
String titre = titreChp.getValue();
|
884 |
String titre = titreChp.getValue();
|
850 |
publicationCollectee.setTitre(titre);
|
885 |
publicationCollectee.setTitre(titre);
|
851 |
|
886 |
|
852 |
String collection = collectionChp.getValue();
|
887 |
String collection = collectionChp.getValue();
|
853 |
publicationCollectee.setCollection(collection);
|
888 |
publicationCollectee.setCollection(collection);
|
854 |
|
889 |
|
855 |
publicationCollectee.setNomComplet(construireNomComplet());
|
890 |
publicationCollectee.setNomComplet(construireNomComplet());
|
856 |
|
891 |
|
857 |
String uri = uriChp.getValue();
|
892 |
String uri = uriChp.getValue();
|
858 |
publicationCollectee.setUri(uri);
|
893 |
publicationCollectee.setUri(uri);
|
859 |
|
894 |
|
860 |
String editeur = "";
|
895 |
String editeur = "";
|
861 |
if (editeurCombobox.getValue() != null) {
|
896 |
if (editeurCombobox.getValeur() != null) {
|
- |
|
897 |
Structure structure = new Structure(editeurCombobox.getValeur());
|
862 |
editeur = editeurCombobox.getValue().getId();
|
898 |
editeur = structure.getId();
|
863 |
publicationCollectee.setStructureEditeur(editeurCombobox.getValue());
|
899 |
publicationCollectee.setStructureEditeur(structure);
|
864 |
} else if (editeurCombobox.getRawValue() != "") {
|
900 |
} else if (!UtilString.isEmpty(editeurCombobox.getCombo().getRawValue())) {
|
865 |
editeur = editeurCombobox.getRawValue();
|
901 |
editeur = editeurCombobox.getCombo().getRawValue();
|
866 |
}
|
902 |
}
|
867 |
publicationCollectee.setEditeur(editeur);
|
903 |
publicationCollectee.setEditeur(editeur);
|
868 |
|
904 |
|
869 |
String anneePublication = datePublicationChp.getRawValue();
|
905 |
String anneePublication = datePublicationChp.getRawValue();
|
870 |
String datePublication = anneePublication+"-00-00";
|
906 |
String datePublication = anneePublication+"-00-00";
|
871 |
publicationCollectee.setDateParution(datePublication);
|
907 |
publicationCollectee.setDateParution(datePublication);
|
872 |
|
908 |
|
873 |
String tome = tomeChp.getValue();
|
909 |
String tome = tomeChp.getValue();
|
874 |
publicationCollectee.setIndicationNvt(tome);
|
910 |
publicationCollectee.setIndicationNvt(tome);
|
875 |
|
911 |
|
876 |
String fascicule = fasciculeChp.getValue();
|
912 |
String fascicule = fasciculeChp.getValue();
|
877 |
publicationCollectee.setFascicule(fascicule);
|
913 |
publicationCollectee.setFascicule(fascicule);
|
878 |
|
914 |
|
879 |
String pages = pagesChp.getValue();
|
915 |
String pages = pagesChp.getValue();
|
880 |
publicationCollectee.setPages(pages);
|
916 |
publicationCollectee.setPages(pages);
|
881 |
|
917 |
|
882 |
Publication publicationARetourner = null;
|
918 |
Publication publicationARetourner = null;
|
883 |
if (!publicationCollectee.comparer(publication)) {
|
919 |
if (!publicationCollectee.comparer(publication)) {
|
884 |
publicationARetourner = publication = publicationCollectee;
|
920 |
publicationARetourner = publication = publicationCollectee;
|
885 |
}
|
921 |
}
|
886 |
return publicationARetourner;
|
922 |
return publicationARetourner;
|
887 |
}
|
923 |
}
|
888 |
|
924 |
|
889 |
private String construireIntituleEditeur() {
|
925 |
private String construireIntituleEditeur() {
|
890 |
String editeur = "";
|
926 |
String editeur = "";
|
891 |
if (editeurCombobox.getValue() != null) {
|
927 |
if (editeurCombobox.getValeur() != null) {
|
- |
|
928 |
Structure structure = new Structure(editeurCombobox.getValeur());
|
892 |
editeur = editeurCombobox.getValue().getNom();
|
929 |
editeur = structure.getNom();
|
893 |
} else if (editeurCombobox.getRawValue() != "") {
|
930 |
} else if (!UtilString.isEmpty(editeurCombobox.getCombo().getRawValue())) {
|
894 |
editeur = editeurCombobox.getRawValue();
|
931 |
editeur = editeurCombobox.getCombo().getRawValue();
|
895 |
}
|
932 |
}
|
896 |
return editeur;
|
933 |
return editeur;
|
897 |
}
|
934 |
}
|
898 |
|
935 |
|
899 |
private String construireIntituleAuteur() {
|
936 |
private String construireIntituleAuteur() {
|
900 |
String intituleAuteur = "";
|
937 |
String intituleAuteur = "";
|
901 |
|
938 |
|
902 |
// TODO : ranger par ordre non-alphabétique
|
939 |
// TODO : ranger par ordre non-alphabétique
|
903 |
grille.getStore().sort("nom", SortDir.ASC);
|
940 |
grille.getStore().sort("nom", SortDir.ASC);
|
904 |
List<Personne> auteurs = grille.getStore().getModels();
|
941 |
List<Personne> auteurs = grille.getStore().getModels();
|
905 |
|
942 |
|
906 |
Iterator<Personne> itAuteurs = auteurs.iterator();
|
943 |
Iterator<Personne> itAuteurs = auteurs.iterator();
|
907 |
while (itAuteurs.hasNext()) {
|
944 |
while (itAuteurs.hasNext()) {
|
908 |
Personne personneCourante = itAuteurs.next();
|
945 |
Personne personneCourante = itAuteurs.next();
|
909 |
intituleAuteur += personneCourante.getNom().toUpperCase() + " " + personneCourante.getPrenom();
|
946 |
intituleAuteur += personneCourante.getNom().toUpperCase() + " " + personneCourante.getPrenom();
|
910 |
if (itAuteurs.hasNext()) {
|
947 |
if (itAuteurs.hasNext()) {
|
911 |
intituleAuteur+=", ";
|
948 |
intituleAuteur+=", ";
|
912 |
}
|
949 |
}
|
913 |
}
|
950 |
}
|
914 |
return intituleAuteur;
|
951 |
return intituleAuteur;
|
915 |
}
|
952 |
}
|
916 |
|
953 |
|
917 |
private String construireNomComplet() {
|
954 |
private String construireNomComplet() {
|
918 |
// Intitulé de la publication complet : fmt_auteur, date_parution(année). titre. Editeur (nom), collection, fascicule, indication_nvt. pages.
|
955 |
// Intitulé de la publication complet : fmt_auteur, date_parution(année). titre. Editeur (nom), collection, fascicule, indication_nvt. pages.
|
919 |
String nomComplet = "";
|
956 |
String nomComplet = "";
|
920 |
String auteurs = construireIntituleAuteur();
|
957 |
String auteurs = construireIntituleAuteur();
|
921 |
String annee = datePublicationChp.getRawValue();
|
958 |
String annee = datePublicationChp.getRawValue();
|
922 |
String titre = titreChp.getValue();
|
959 |
String titre = titreChp.getValue();
|
923 |
String editeur = construireIntituleEditeur();
|
960 |
String editeur = construireIntituleEditeur();
|
924 |
|
961 |
|
925 |
nomComplet += auteurs+", "+annee+". "+titre+".";
|
962 |
nomComplet += auteurs+", "+annee+". "+titre+".";
|
926 |
|
963 |
|
927 |
if (!UtilString.isEmpty(editeur)) {
|
964 |
if (!UtilString.isEmpty(editeur)) {
|
928 |
nomComplet += " Éditeur "+editeur+".";
|
965 |
nomComplet += " Éditeur "+editeur+".";
|
929 |
}
|
966 |
}
|
930 |
|
967 |
|
931 |
if (collectionChp.getValue() != null) {
|
968 |
if (collectionChp.getValue() != null) {
|
932 |
String revue = collectionChp.getValue();
|
969 |
String revue = collectionChp.getValue();
|
933 |
nomComplet += ", "+revue;
|
970 |
nomComplet += ", "+revue;
|
934 |
}
|
971 |
}
|
935 |
|
972 |
|
936 |
if (fasciculeChp.getValue() != null) {
|
973 |
if (fasciculeChp.getValue() != null) {
|
937 |
String fascicule = fasciculeChp.getValue();
|
974 |
String fascicule = fasciculeChp.getValue();
|
938 |
nomComplet += ", "+fascicule;
|
975 |
nomComplet += ", "+fascicule;
|
939 |
}
|
976 |
}
|
940 |
|
977 |
|
941 |
if (tomeChp.getValue() != null) {
|
978 |
if (tomeChp.getValue() != null) {
|
942 |
String tomaison = tomeChp.getValue();
|
979 |
String tomaison = tomeChp.getValue();
|
943 |
nomComplet += ", "+tomaison;
|
980 |
nomComplet += ", "+tomaison;
|
944 |
}
|
981 |
}
|
945 |
|
982 |
|
946 |
if (collectionChp.getValue() != null || fasciculeChp.getValue() != null || tomeChp.getValue() != null) {
|
983 |
if (collectionChp.getValue() != null || fasciculeChp.getValue() != null || tomeChp.getValue() != null) {
|
947 |
nomComplet += ".";
|
984 |
nomComplet += ".";
|
948 |
}
|
985 |
}
|
949 |
|
986 |
|
950 |
if (pagesChp.getValue() != null) {
|
987 |
if (pagesChp.getValue() != null) {
|
951 |
String pages = pagesChp.getValue();
|
988 |
String pages = pagesChp.getValue();
|
952 |
nomComplet += pages+".";
|
989 |
nomComplet += pages+".";
|
953 |
}
|
990 |
}
|
954 |
|
991 |
|
955 |
return nomComplet;
|
992 |
return nomComplet;
|
956 |
}
|
993 |
}
|
957 |
|
994 |
|
958 |
public void reinitialiserFormulaire() {
|
995 |
public void reinitialiserFormulaire() {
|
959 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
996 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
960 |
mediateur.afficherFormPublication(publication.getId());
|
997 |
mediateur.afficherFormPublication(publication.getId());
|
961 |
} else {
|
998 |
} else {
|
962 |
mediateur.afficherFormPublication(null);
|
999 |
mediateur.afficherFormPublication(null);
|
963 |
}
|
1000 |
}
|
964 |
}
|
1001 |
}
|
965 |
|
1002 |
|
966 |
private boolean etreDateValide(String anneePublication) {
|
1003 |
private boolean etreDateValide(String anneePublication) {
|
967 |
boolean valide = true;
|
1004 |
boolean valide = true;
|
968 |
if (!anneePublication.matches("^[0-2][0-9]{3}$")) {
|
1005 |
if (!anneePublication.matches("^[0-2][0-9]{3}$")) {
|
969 |
valide = false;
|
1006 |
valide = false;
|
970 |
}
|
1007 |
}
|
971 |
return valide;
|
1008 |
return valide;
|
972 |
}
|
1009 |
}
|
973 |
|
1010 |
|
974 |
private String reduireDateParAnnee(String datePar) {
|
1011 |
private String reduireDateParAnnee(String datePar) {
|
975 |
if (datePar.matches("^[0-2][0-9]{3}(-[0-9]{2}){2}$")) {
|
1012 |
if (datePar.matches("^[0-2][0-9]{3}(-[0-9]{2}){2}$")) {
|
976 |
return datePar.split("-")[0];
|
1013 |
return datePar.split("-")[0];
|
977 |
} else {
|
1014 |
} else {
|
978 |
return "";
|
1015 |
return "";
|
979 |
}
|
1016 |
}
|
980 |
}
|
1017 |
}
|
981 |
|
1018 |
|
982 |
private String getValeurComboProjets() {
|
1019 |
private String getValeurComboProjets() {
|
983 |
String valeur = "";
|
1020 |
String valeur = "";
|
984 |
if (projetsCombo.getValue() != null) {
|
1021 |
if (projetsCombo.getValeur() != null) {
|
- |
|
1022 |
Projet projet = new Projet(projetsCombo.getValeur());
|
985 |
valeur = projetsCombo.getValue().getId();
|
1023 |
valeur = projet.getId();
|
986 |
}
|
1024 |
}
|
987 |
return valeur;
|
1025 |
return valeur;
|
988 |
}
|
1026 |
}
|
989 |
private void setValeurComboProjets() {
|
1027 |
private void setValeurComboProjets() {
|
990 |
if (projetsCombo.getStore() != null ) {
|
1028 |
if (projetsCombo.getStore() != null ) {
|
- |
|
1029 |
Debug.log(projetsCombo.getStore().getModels().toArray().toString());
|
991 |
if (mode.equals(Formulaire.MODE_MODIFIER) && publication != null) {
|
1030 |
if (mode.equals(Formulaire.MODE_MODIFIER) && publication != null) {
|
992 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", publication.getIdProjet()));
|
1031 |
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", publication.getIdProjet()));
|
993 |
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
1032 |
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
994 |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", mediateur.getProjetId()));
|
1033 |
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", mediateur.getProjetId()));
|
995 |
}
|
1034 |
}
|
996 |
}
|
1035 |
}
|
997 |
}
|
1036 |
}
|
998 |
}
|
1037 |
}
|