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.HashMap;
|
4 |
import java.util.HashMap;
|
5 |
import java.util.Iterator;
|
5 |
import java.util.Iterator;
|
6 |
import java.util.List;
|
6 |
import java.util.List;
|
7 |
|
7 |
|
8 |
import org.tela_botanica.client.ComposantClass;
|
8 |
import org.tela_botanica.client.ComposantClass;
|
9 |
import org.tela_botanica.client.Mediateur;
|
9 |
import org.tela_botanica.client.Mediateur;
|
10 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
10 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
11 |
import org.tela_botanica.client.composants.GrillePaginable;
|
11 |
import org.tela_botanica.client.composants.GrillePaginable;
|
12 |
import org.tela_botanica.client.composants.InfoLogger;
|
12 |
import org.tela_botanica.client.composants.InfoLogger;
|
13 |
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
|
13 |
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
|
14 |
import org.tela_botanica.client.composants.pagination.ProxyPersonnesAPublication;
|
14 |
import org.tela_botanica.client.composants.pagination.ProxyPersonnesAPublication;
|
15 |
import org.tela_botanica.client.composants.pagination.ProxyProjets;
|
15 |
import org.tela_botanica.client.composants.pagination.ProxyProjets;
|
16 |
import org.tela_botanica.client.composants.pagination.ProxyPublicationsAPersonne;
|
- |
|
17 |
import org.tela_botanica.client.composants.pagination.ProxyStructures;
|
16 |
import org.tela_botanica.client.composants.pagination.ProxyStructures;
|
18 |
import org.tela_botanica.client.images.Images;
|
17 |
import org.tela_botanica.client.images.Images;
|
19 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
18 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
20 |
import org.tela_botanica.client.modeles.Information;
|
19 |
import org.tela_botanica.client.modeles.Information;
|
21 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
20 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
22 |
import org.tela_botanica.client.modeles.aDonnee;
|
21 |
import org.tela_botanica.client.modeles.aDonnee;
|
23 |
import org.tela_botanica.client.modeles.personne.Personne;
|
22 |
import org.tela_botanica.client.modeles.personne.Personne;
|
24 |
import org.tela_botanica.client.modeles.personne.PersonneListe;
|
- |
|
25 |
import org.tela_botanica.client.modeles.projet.Projet;
|
23 |
import org.tela_botanica.client.modeles.projet.Projet;
|
26 |
import org.tela_botanica.client.modeles.publication.Publication;
|
24 |
import org.tela_botanica.client.modeles.publication.Publication;
|
27 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
25 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
|
28 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
26 |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
|
29 |
import org.tela_botanica.client.modeles.structure.Structure;
|
27 |
import org.tela_botanica.client.modeles.structure.Structure;
|
30 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
28 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
31 |
import org.tela_botanica.client.util.Debug;
|
29 |
import org.tela_botanica.client.util.Debug;
|
32 |
import org.tela_botanica.client.util.Pattern;
|
30 |
import org.tela_botanica.client.util.Pattern;
|
33 |
import org.tela_botanica.client.util.UtilArray;
|
31 |
import org.tela_botanica.client.util.UtilArray;
|
34 |
import org.tela_botanica.client.util.UtilString;
|
32 |
import org.tela_botanica.client.util.UtilString;
|
35 |
import org.tela_botanica.client.vues.FenetreForm;
|
33 |
import org.tela_botanica.client.vues.FenetreForm;
|
36 |
import org.tela_botanica.client.vues.Formulaire;
|
34 |
import org.tela_botanica.client.vues.Formulaire;
|
37 |
import org.tela_botanica.client.vues.FormulaireBarreValidation;
|
35 |
import org.tela_botanica.client.vues.FormulaireBarreValidation;
|
38 |
import org.tela_botanica.client.vues.personne.PersonneForm;
|
36 |
import org.tela_botanica.client.vues.personne.PersonneForm;
|
39 |
|
37 |
|
40 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
38 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
41 |
import com.extjs.gxt.ui.client.Style.SortDir;
|
39 |
import com.extjs.gxt.ui.client.Style.SortDir;
|
42 |
import com.extjs.gxt.ui.client.core.XTemplate;
|
- |
|
43 |
import com.extjs.gxt.ui.client.data.ModelData;
|
40 |
import com.extjs.gxt.ui.client.data.ModelData;
|
44 |
import com.extjs.gxt.ui.client.data.ModelType;
|
41 |
import com.extjs.gxt.ui.client.data.ModelType;
|
45 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
42 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
46 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
43 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
47 |
import com.extjs.gxt.ui.client.event.Events;
|
44 |
import com.extjs.gxt.ui.client.event.Events;
|
48 |
import com.extjs.gxt.ui.client.event.Listener;
|
45 |
import com.extjs.gxt.ui.client.event.Listener;
|
49 |
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
46 |
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
50 |
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
47 |
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
51 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
48 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
52 |
import com.extjs.gxt.ui.client.store.ListStore;
|
49 |
import com.extjs.gxt.ui.client.store.ListStore;
|
53 |
import com.extjs.gxt.ui.client.store.Store;
|
50 |
import com.extjs.gxt.ui.client.store.Store;
|
54 |
import com.extjs.gxt.ui.client.store.StoreEvent;
|
51 |
import com.extjs.gxt.ui.client.store.StoreEvent;
|
55 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
52 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
56 |
import com.extjs.gxt.ui.client.widget.Info;
|
53 |
import com.extjs.gxt.ui.client.widget.Info;
|
57 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
54 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
58 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
55 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
59 |
import com.extjs.gxt.ui.client.widget.Text;
|
56 |
import com.extjs.gxt.ui.client.widget.Text;
|
60 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
57 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
61 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
58 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
62 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
- |
|
63 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
59 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
64 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
60 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
65 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
61 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
66 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
62 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
67 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
63 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
68 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
- |
|
69 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
- |
|
70 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
64 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
71 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
65 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
72 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
- |
|
73 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
66 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
74 |
import com.extjs.gxt.ui.client.widget.grid.RowExpander;
|
- |
|
75 |
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
|
- |
|
76 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
67 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
77 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
68 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
78 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
69 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
79 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
70 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
80 |
import com.extjs.gxt.ui.client.widget.layout.RowData;
|
71 |
import com.extjs.gxt.ui.client.widget.layout.RowData;
|
81 |
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
72 |
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
82 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
73 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
83 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
74 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
84 |
import com.google.gwt.core.client.GWT;
|
75 |
import com.google.gwt.core.client.GWT;
|
85 |
|
76 |
|
86 |
|
77 |
|
87 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
78 |
public class PublicationForm extends Formulaire implements Rafraichissable {
|
88 |
|
79 |
|
89 |
//-------------//
|
80 |
//-------------//
|
90 |
// ATTRIBUTS //
|
81 |
// ATTRIBUTS //
|
91 |
//-------------//
|
82 |
//-------------//
|
92 |
|
83 |
|
93 |
/** Publication **/
|
84 |
/** Publication **/
|
94 |
// on se sert d'un objet Publication lorsque l'on est en mode MODIFIER
|
85 |
// on se sert d'un objet Publication lorsque l'on est en mode MODIFIER
|
95 |
private Publication publication;
|
86 |
private Publication publication;
|
96 |
// on se sert de l'identifiant d'une publication lorsque l'on est en mode AJOUTER
|
87 |
// on se sert de l'identifiant d'une publication lorsque l'on est en mode AJOUTER
|
97 |
private String publicationId = null;
|
88 |
private String publicationId = null;
|
98 |
|
89 |
|
99 |
/** Auteurs **/
|
90 |
/** Auteurs **/
|
100 |
private PublicationAPersonneListe auteursInitialListe = null;
|
91 |
private PublicationAPersonneListe auteursInitialListe = null;
|
101 |
private PublicationAPersonneListe auteursAjoutes = null;
|
92 |
private PublicationAPersonneListe auteursAjoutes = null;
|
102 |
private PublicationAPersonneListe auteursSupprimes = null;
|
93 |
private PublicationAPersonneListe auteursSupprimes = null;
|
103 |
private PublicationAPersonneListe auteursModifies = null;
|
94 |
private PublicationAPersonneListe auteursModifies = null;
|
104 |
|
95 |
|
105 |
private ContentPanel auteursFieldset = null;
|
96 |
private ContentPanel auteursFieldset = null;
|
106 |
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
|
97 |
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
|
107 |
|
98 |
|
108 |
private FieldSet generalitesFieldset = null;
|
99 |
private FieldSet generalitesFieldset = null;
|
109 |
private TextField<String> titreChp = null;
|
100 |
private TextField<String> titreChp = null;
|
110 |
private TextField<String> collectionChp = null;
|
101 |
private TextField<String> collectionChp = null;
|
111 |
private TextField<String> uriChp = null;
|
102 |
private TextField<String> uriChp = null;
|
112 |
|
103 |
|
113 |
private FieldSet editionFieldset = null;
|
104 |
private FieldSet editionFieldset = null;
|
114 |
private ChampComboBoxRechercheTempsReelPaginable editeurCombobox = null;
|
105 |
private ChampComboBoxRechercheTempsReelPaginable editeurCombobox = null;
|
115 |
private TextField<String> datePublicationChp = null;
|
106 |
private TextField<String> datePublicationChp = null;
|
116 |
private TextField<String> tomeChp = null;
|
107 |
private TextField<String> tomeChp = null;
|
117 |
private TextField<String> fasciculeChp = null;
|
108 |
private TextField<String> fasciculeChp = null;
|
118 |
private TextField<String> pagesChp = null;
|
109 |
private TextField<String> pagesChp = null;
|
119 |
|
110 |
|
120 |
private LayoutContainer zoneHaut, zoneBas;
|
111 |
private LayoutContainer zoneHaut, zoneBas;
|
121 |
|
112 |
|
122 |
private ToolBar barreOutils = null;
|
113 |
private ToolBar barreOutils = null;
|
123 |
private GrillePaginable<ModelData> grilleAuteurs;
|
114 |
private GrillePaginable<ModelData> grilleAuteurs;
|
124 |
private ChampComboBoxRechercheTempsReelPaginable personnesSaisiesComboBox = null;
|
115 |
private ChampComboBoxRechercheTempsReelPaginable personnesSaisiesComboBox = null;
|
125 |
private Button personnesBoutonSupprimer = null;
|
116 |
private Button personnesBoutonSupprimer = null;
|
126 |
private Button personnesBoutonModifier = null;
|
117 |
private Button personnesBoutonModifier = null;
|
127 |
private Button boutonAuteurUp = null;
|
118 |
private Button boutonAuteurUp = null;
|
128 |
private Button boutonAuteurDown = null;
|
119 |
private Button boutonAuteurDown = null;
|
129 |
|
120 |
|
130 |
private FenetreForm fenetreFormulaire = null;
|
121 |
private FenetreForm fenetreFormulaire = null;
|
131 |
private Sequenceur sequenceur;
|
122 |
private Sequenceur sequenceur;
|
132 |
|
123 |
|
133 |
private String modeDeCreation = null;
|
124 |
private String modeDeCreation = null;
|
134 |
boolean changeOrderMarker = false;
|
125 |
boolean changeOrderMarker = false;
|
135 |
|
126 |
|
136 |
|
- |
|
137 |
//----------------------//
|
127 |
|
- |
|
128 |
//+----------------------------------------------------------------------------------------------------------------+
|
138 |
// Constructeurs //------------------------------------------------------------
|
129 |
// Constructeurs
|
139 |
|
130 |
|
140 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
131 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
141 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
132 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
142 |
}
|
133 |
}
|
143 |
|
134 |
|
144 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
135 |
public PublicationForm(Mediateur mediateurCourrant, String publicationId, Rafraichissable vueARafraichirApresValidation) {
|
145 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
136 |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
|
146 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
137 |
initialiserPublicationForm(mediateurCourrant, publicationId);
|
147 |
}
|
138 |
}
|
148 |
|
139 |
|
149 |
|
- |
|
150 |
//-----------------------//
|
140 |
|
- |
|
141 |
//+----------------------------------------------------------------------------------------------------------------+
|
151 |
// Initialisation //------------------------------------------------------------
|
142 |
// Initialisation
|
152 |
|
143 |
|
153 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
144 |
private void initialiserPublicationForm(Mediateur mediateurCourrant, String publicationId) {
|
154 |
sequenceur = new Sequenceur();
|
145 |
sequenceur = new Sequenceur();
|
155 |
publication = new Publication();
|
146 |
publication = new Publication();
|
156 |
publication.setId(publicationId);
|
147 |
publication.setId(publicationId);
|
157 |
this.publicationId = publicationId;
|
148 |
this.publicationId = publicationId;
|
158 |
auteursInitialListe = new PublicationAPersonneListe();
|
149 |
auteursInitialListe = new PublicationAPersonneListe();
|
159 |
initialiserAuteurs(); // Crée les listes d'auteurs ajoutés et supprimés
|
150 |
initialiserAuteurs(); // Crée les listes d'auteurs ajoutés et supprimés
|
160 |
|
151 |
|
161 |
// Si 'publicationId' est vide alors on est en mode "AJOUTER", sinon on est en mode "MODIFIER"
|
152 |
// Si 'publicationId' est vide alors on est en mode "AJOUTER", sinon on est en mode "MODIFIER"
|
162 |
modeDeCreation = (UtilString.isEmpty(publicationId) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
153 |
modeDeCreation = (UtilString.isEmpty(publicationId) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
|
163 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
154 |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PUBLICATION);
|
164 |
panneauFormulaire.setLayout(new RowLayout());
|
155 |
panneauFormulaire.setLayout(new RowLayout());
|
165 |
panneauFormulaire.setStyleAttribute("padding", "0");
|
156 |
panneauFormulaire.setStyleAttribute("padding", "0");
|
166 |
|
157 |
|
167 |
zoneHaut = new LayoutContainer(new FitLayout());
|
158 |
zoneHaut = new LayoutContainer(new FitLayout());
|
168 |
zoneBas = new LayoutContainer(new FlowLayout());
|
159 |
zoneBas = new LayoutContainer(new FlowLayout());
|
169 |
panneauFormulaire.add(zoneHaut, new RowData(1, 0.3));
|
160 |
panneauFormulaire.add(zoneHaut, new RowData(1, 0.3));
|
170 |
panneauFormulaire.add(zoneBas, new RowData(1, 0.5));
|
161 |
panneauFormulaire.add(zoneBas, new RowData(1, 0.5));
|
171 |
panneauFormulaire.setScrollMode(Scroll.AUTO);
|
162 |
panneauFormulaire.setScrollMode(Scroll.AUTO);
|
172 |
genererTitreFormulaire();
|
163 |
genererTitreFormulaire();
|
173 |
|
164 |
|
174 |
creerZoneAuteurs();
|
165 |
creerZoneAuteurs();
|
175 |
zoneHaut.add(auteursFieldset);
|
166 |
zoneHaut.add(auteursFieldset);
|
176 |
|
167 |
|
177 |
creerZoneGeneralites();
|
168 |
creerZoneGeneralites();
|
178 |
zoneBas.add(generalitesFieldset);
|
169 |
zoneBas.add(generalitesFieldset);
|
179 |
|
170 |
|
180 |
creerZoneEdition();
|
171 |
creerZoneEdition();
|
181 |
zoneBas.add(editionFieldset);
|
172 |
zoneBas.add(editionFieldset);
|
182 |
|
173 |
|
183 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
174 |
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
|
184 |
mediateurCourrant.selectionnerPublication(this, publicationId, sequenceur);
|
175 |
mediateurCourrant.selectionnerPublication(this, publicationId, sequenceur);
|
185 |
sequenceur.enfilerRafraichissement(this, new Information("chargement_modifier_ok"));
|
176 |
sequenceur.enfilerRafraichissement(this, new Information("chargement_modifier_ok"));
|
186 |
}
|
177 |
}
|
187 |
}
|
178 |
}
|
188 |
|
179 |
|
189 |
private void initialiserAuteurs() {
|
180 |
private void initialiserAuteurs() {
|
190 |
auteursAjoutes = new PublicationAPersonneListe();
|
181 |
auteursAjoutes = new PublicationAPersonneListe();
|
191 |
auteursSupprimes = new PublicationAPersonneListe();
|
182 |
auteursSupprimes = new PublicationAPersonneListe();
|
192 |
auteursModifies = new PublicationAPersonneListe();
|
183 |
auteursModifies = new PublicationAPersonneListe();
|
193 |
}
|
184 |
}
|
194 |
|
- |
|
195 |
//-----------------------//
|
185 |
|
- |
|
186 |
//+----------------------------------------------------------------------------------------------------------------+
|
196 |
// User Interface //------------------------------------------------------------
|
187 |
// User Interface
|
197 |
|
188 |
|
198 |
private ToolBar creerBarreOutilsGrille() {
|
189 |
private ToolBar creerBarreOutilsGrille() {
|
199 |
ToolBar barreOutils = new ToolBar();
|
190 |
ToolBar barreOutils = new ToolBar();
|
200 |
|
191 |
|
201 |
Button ajouterBouton = creerBoutonAjouter();
|
192 |
Button ajouterBouton = creerBoutonAjouter();
|
202 |
barreOutils.add(ajouterBouton);
|
193 |
barreOutils.add(ajouterBouton);
|
203 |
|
194 |
|
204 |
barreOutils.add(new Text(" ou "));
|
195 |
barreOutils.add(new Text(" ou "));
|
205 |
|
196 |
|
206 |
creerComboBoxPersonnesSaisies();
|
197 |
creerComboBoxPersonnesSaisies();
|
207 |
barreOutils.add(personnesSaisiesComboBox);
|
198 |
barreOutils.add(personnesSaisiesComboBox);
|
208 |
|
199 |
|
209 |
barreOutils.add(new SeparatorToolItem());
|
200 |
barreOutils.add(new SeparatorToolItem());
|
210 |
|
201 |
|
211 |
personnesBoutonModifier = creerBoutonModifier();
|
202 |
personnesBoutonModifier = creerBoutonModifier();
|
212 |
barreOutils.add(personnesBoutonModifier);
|
203 |
barreOutils.add(personnesBoutonModifier);
|
213 |
|
204 |
|
214 |
barreOutils.add(new SeparatorToolItem());
|
205 |
barreOutils.add(new SeparatorToolItem());
|
215 |
|
206 |
|
216 |
personnesBoutonSupprimer = creerBoutonSupprimer();
|
207 |
personnesBoutonSupprimer = creerBoutonSupprimer();
|
217 |
barreOutils.add(personnesBoutonSupprimer);
|
208 |
barreOutils.add(personnesBoutonSupprimer);
|
218 |
|
209 |
|
219 |
barreOutils.add(new SeparatorToolItem());
|
210 |
barreOutils.add(new SeparatorToolItem());
|
220 |
|
211 |
|
221 |
Button rafraichirBouton = creerBoutonRafraichir();
|
212 |
Button rafraichirBouton = creerBoutonRafraichir();
|
222 |
barreOutils.add(rafraichirBouton);
|
213 |
barreOutils.add(rafraichirBouton);
|
223 |
|
214 |
|
224 |
barreOutils.add(new SeparatorToolItem());
|
215 |
barreOutils.add(new SeparatorToolItem());
|
225 |
|
216 |
|
226 |
barreOutils.add(new Text(i18nC.deplacerAuteur()));
|
217 |
barreOutils.add(new Text(i18nC.deplacerAuteur()));
|
227 |
boutonAuteurUp = creerBoutonAuteurUp();
|
218 |
boutonAuteurUp = creerBoutonAuteurUp();
|
228 |
barreOutils.add(boutonAuteurUp);
|
219 |
barreOutils.add(boutonAuteurUp);
|
229 |
boutonAuteurDown = creerBoutonAuteurDown();
|
220 |
boutonAuteurDown = creerBoutonAuteurDown();
|
230 |
barreOutils.add(boutonAuteurDown);
|
221 |
barreOutils.add(boutonAuteurDown);
|
231 |
|
222 |
|
232 |
return barreOutils;
|
223 |
return barreOutils;
|
233 |
}
|
224 |
}
|
234 |
|
225 |
|
235 |
public void actualiserEtatBoutonsBarreOutils() {
|
226 |
public void actualiserEtatBoutonsBarreOutils() {
|
236 |
// Activation des boutons si la grille contient un élément
|
227 |
// Activation des boutons si la grille contient un élément
|
237 |
if (grilleAuteurs.getStore().getCount() > 0) {
|
228 |
if (grilleAuteurs.getStore().getCount() > 0) {
|
238 |
personnesBoutonSupprimer.enable();
|
229 |
personnesBoutonSupprimer.enable();
|
239 |
personnesBoutonModifier.enable();
|
230 |
personnesBoutonModifier.enable();
|
240 |
}
|
231 |
}
|
241 |
// Désactivation des boutons si la grille ne contient plus d'élément
|
232 |
// Désactivation des boutons si la grille ne contient plus d'élément
|
242 |
if (grilleAuteurs.getStore().getCount() == 0) {
|
233 |
if (grilleAuteurs.getStore().getCount() == 0) {
|
243 |
personnesBoutonSupprimer.disable();
|
234 |
personnesBoutonSupprimer.disable();
|
244 |
personnesBoutonModifier.disable();
|
235 |
personnesBoutonModifier.disable();
|
245 |
}
|
236 |
}
|
246 |
}
|
237 |
}
|
247 |
|
238 |
|
248 |
private Button creerBoutonAuteurUp() {
|
239 |
private Button creerBoutonAuteurUp() {
|
249 |
Button bouton = new Button();
|
240 |
Button bouton = new Button();
|
250 |
bouton.setIcon(Images.ICONES.arrowUp());
|
241 |
bouton.setIcon(Images.ICONES.arrowUp());
|
251 |
bouton.setEnabled(false);
|
242 |
bouton.setEnabled(false);
|
252 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
243 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
253 |
public void componentSelected(ButtonEvent ce) {
|
244 |
public void componentSelected(ButtonEvent ce) {
|
254 |
if (grilleAuteurs.getGrille().getSelectionModel().getSelectedItem() != null) {
|
245 |
if (grilleAuteurs.getGrille().getSelectionModel().getSelectedItem() != null) {
|
255 |
|
246 |
|
256 |
ModelData publiAPersonneSelectionnee = grilleAuteurs.getSelectionModel().getSelectedItem();
|
247 |
ModelData publiAPersonneSelectionnee = grilleAuteurs.getSelectionModel().getSelectedItem();
|
257 |
|
248 |
|
258 |
int index = grilleAuteurs.getStore().indexOf(publiAPersonneSelectionnee);
|
249 |
int index = grilleAuteurs.getStore().indexOf(publiAPersonneSelectionnee);
|
259 |
int newIndex = index - 1; // l'auteur monte dans dans la liste donc son ordre diminue
|
250 |
int newIndex = index - 1; // l'auteur monte dans dans la liste donc son ordre diminue
|
260 |
int newOrdre = newIndex + 1; // parce que index commence à zéro
|
251 |
int newOrdre = newIndex + 1; // parce que index commence à zéro
|
261 |
|
252 |
|
262 |
// le marqueur suivant est obligatoire sinon les évènements liés au magasin se
|
253 |
// le marqueur suivant est obligatoire sinon les évènements liés au magasin se
|
263 |
// déclenchent et posent problème
|
254 |
// déclenchent et posent problème
|
264 |
changeOrderMarker = true;
|
255 |
changeOrderMarker = true;
|
265 |
|
256 |
|
266 |
publiAPersonneSelectionnee.set("_ordre_", String.valueOf(newOrdre));
|
257 |
publiAPersonneSelectionnee.set("_ordre_", String.valueOf(newOrdre));
|
267 |
|
258 |
|
268 |
ModelData publiAPersonneSwitch = grilleAuteurs.getStore().getAt(index-1);
|
259 |
ModelData publiAPersonneSwitch = grilleAuteurs.getStore().getAt(index-1);
|
269 |
int newOrdrePapSwitch = newOrdre + 1;
|
260 |
int newOrdrePapSwitch = newOrdre + 1;
|
270 |
|
261 |
|
271 |
publiAPersonneSwitch.set("_ordre_", String.valueOf(newOrdrePapSwitch));
|
262 |
publiAPersonneSwitch.set("_ordre_", String.valueOf(newOrdrePapSwitch));
|
272 |
|
263 |
|
273 |
grilleAuteurs.getStore().update(publiAPersonneSwitch);
|
264 |
grilleAuteurs.getStore().update(publiAPersonneSwitch);
|
274 |
grilleAuteurs.getStore().remove(publiAPersonneSelectionnee);
|
265 |
grilleAuteurs.getStore().remove(publiAPersonneSelectionnee);
|
275 |
grilleAuteurs.getStore().insert(publiAPersonneSelectionnee, newIndex);
|
266 |
grilleAuteurs.getStore().insert(publiAPersonneSelectionnee, newIndex);
|
276 |
changeOrderMarker = false;
|
267 |
changeOrderMarker = false;
|
277 |
|
268 |
|
278 |
grilleAuteurs.getSelectionModel().select(newIndex, true);
|
269 |
grilleAuteurs.getSelectionModel().select(newIndex, true);
|
279 |
}
|
270 |
}
|
280 |
}
|
271 |
}
|
281 |
});
|
272 |
});
|
282 |
return bouton;
|
273 |
return bouton;
|
283 |
}
|
274 |
}
|
284 |
|
275 |
|
285 |
private Button creerBoutonAuteurDown() {
|
276 |
private Button creerBoutonAuteurDown() {
|
286 |
Button bouton = new Button();
|
277 |
Button bouton = new Button();
|
287 |
bouton.setIcon(Images.ICONES.arrowDown());
|
278 |
bouton.setIcon(Images.ICONES.arrowDown());
|
288 |
bouton.setEnabled(false);
|
279 |
bouton.setEnabled(false);
|
289 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
280 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
290 |
public void componentSelected(ButtonEvent ce) {
|
281 |
public void componentSelected(ButtonEvent ce) {
|
291 |
if (grilleAuteurs.getSelectionModel().getSelectedItem() != null) {
|
282 |
if (grilleAuteurs.getSelectionModel().getSelectedItem() != null) {
|
292 |
|
283 |
|
293 |
ModelData publiAPersonneSelectionnee = grilleAuteurs.getSelectionModel().getSelectedItem();
|
284 |
ModelData publiAPersonneSelectionnee = grilleAuteurs.getSelectionModel().getSelectedItem();
|
294 |
|
285 |
|
295 |
int index = grilleAuteurs.getStore().indexOf(publiAPersonneSelectionnee);
|
286 |
int index = grilleAuteurs.getStore().indexOf(publiAPersonneSelectionnee);
|
296 |
int newIndex = index + 1; // l'auteur monte dans dans la liste donc son ordre diminue
|
287 |
int newIndex = index + 1; // l'auteur monte dans dans la liste donc son ordre diminue
|
297 |
int newOrdre = newIndex + 1; // parce que index commence à zéro
|
288 |
int newOrdre = newIndex + 1; // parce que index commence à zéro
|
298 |
|
289 |
|
299 |
// le marqueur suivant est obligatoire sinon les évènements liés au magasin se
|
290 |
// le marqueur suivant est obligatoire sinon les évènements liés au magasin se
|
300 |
// déclenchent et posent problème
|
291 |
// déclenchent et posent problème
|
301 |
changeOrderMarker = true;
|
292 |
changeOrderMarker = true;
|
302 |
|
293 |
|
303 |
publiAPersonneSelectionnee.set("_ordre_", String.valueOf(newOrdre));
|
294 |
publiAPersonneSelectionnee.set("_ordre_", String.valueOf(newOrdre));
|
304 |
|
295 |
|
305 |
ModelData publiAPersonneSwitch = grilleAuteurs.getStore().getAt(index+1);
|
296 |
ModelData publiAPersonneSwitch = grilleAuteurs.getStore().getAt(index+1);
|
306 |
int newOrdrePapSwitch = index + 1;
|
297 |
int newOrdrePapSwitch = index + 1;
|
307 |
|
298 |
|
308 |
publiAPersonneSwitch.set("_ordre_", String.valueOf(newOrdrePapSwitch));
|
299 |
publiAPersonneSwitch.set("_ordre_", String.valueOf(newOrdrePapSwitch));
|
309 |
|
300 |
|
310 |
grilleAuteurs.getStore().update(publiAPersonneSwitch);
|
301 |
grilleAuteurs.getStore().update(publiAPersonneSwitch);
|
311 |
grilleAuteurs.getStore().remove(publiAPersonneSelectionnee);
|
302 |
grilleAuteurs.getStore().remove(publiAPersonneSelectionnee);
|
312 |
grilleAuteurs.getStore().insert(publiAPersonneSelectionnee, newIndex);
|
303 |
grilleAuteurs.getStore().insert(publiAPersonneSelectionnee, newIndex);
|
313 |
changeOrderMarker = false;
|
304 |
changeOrderMarker = false;
|
314 |
|
305 |
|
315 |
grilleAuteurs.getSelectionModel().select(newIndex, true);
|
306 |
grilleAuteurs.getSelectionModel().select(newIndex, true);
|
316 |
}
|
307 |
}
|
317 |
}
|
308 |
}
|
318 |
});
|
309 |
});
|
319 |
return bouton;
|
310 |
return bouton;
|
320 |
}
|
311 |
}
|
321 |
|
312 |
|
322 |
private Button creerBoutonAjouter() {
|
313 |
private Button creerBoutonAjouter() {
|
323 |
Button bouton = new Button(i18nC.ajouter());
|
314 |
Button bouton = new Button(i18nC.ajouter());
|
324 |
bouton.setIcon(Images.ICONES.vcardAjouter());
|
315 |
bouton.setIcon(Images.ICONES.vcardAjouter());
|
325 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
316 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
326 |
public void componentSelected(ButtonEvent ce) {
|
317 |
public void componentSelected(ButtonEvent ce) {
|
327 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_AJOUTER);
|
318 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_AJOUTER);
|
328 |
fenetreFormulaire.show();
|
319 |
fenetreFormulaire.show();
|
329 |
}
|
320 |
}
|
330 |
});
|
321 |
});
|
331 |
return bouton;
|
322 |
return bouton;
|
332 |
}
|
323 |
}
|
333 |
|
324 |
|
334 |
private Button creerBoutonModifier() {
|
325 |
private Button creerBoutonModifier() {
|
335 |
Button bouton = new Button(i18nC.modifier());
|
326 |
Button bouton = new Button(i18nC.modifier());
|
336 |
bouton.setIcon(Images.ICONES.vcardModifier());
|
327 |
bouton.setIcon(Images.ICONES.vcardModifier());
|
337 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
328 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
338 |
public void componentSelected(ButtonEvent ce) {
|
329 |
public void componentSelected(ButtonEvent ce) {
|
339 |
Personne personneSaisieSelectionnee = new PublicationAPersonne(grilleAuteurs.getSelectionModel().getSelectedItem(), false).getPersonne();
|
330 |
Personne personneSaisieSelectionnee = new PublicationAPersonne(grilleAuteurs.getSelectionModel().getSelectedItem(), false).getPersonne();
|
340 |
|
331 |
|
341 |
if (personneSaisieSelectionnee == null) {
|
332 |
if (personneSaisieSelectionnee == null) {
|
342 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
333 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
343 |
} else {
|
334 |
} else {
|
344 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_MODIFIER);
|
335 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_MODIFIER);
|
345 |
fenetreFormulaire.show();
|
336 |
fenetreFormulaire.show();
|
346 |
}
|
337 |
}
|
347 |
}
|
338 |
}
|
348 |
});
|
339 |
});
|
349 |
return bouton;
|
340 |
return bouton;
|
350 |
}
|
341 |
}
|
351 |
|
342 |
|
352 |
private FenetreForm creerFenetreModaleAvecFormulairePersonne(String mode) {
|
343 |
private FenetreForm creerFenetreModaleAvecFormulairePersonne(String mode) {
|
353 |
String personneId = null;
|
344 |
String personneId = null;
|
354 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
345 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
355 |
Personne personneSaisieSelectionnee = new PublicationAPersonne(grilleAuteurs.getSelectionModel().getSelectedItem(), false).getPersonne();
|
346 |
Personne personneSaisieSelectionnee = new PublicationAPersonne(grilleAuteurs.getSelectionModel().getSelectedItem(), false).getPersonne();
|
356 |
personneId = personneSaisieSelectionnee.getId();
|
347 |
personneId = personneSaisieSelectionnee.getId();
|
357 |
}
|
348 |
}
|
358 |
|
349 |
|
359 |
final FenetreForm fenetre = new FenetreForm("");
|
350 |
final FenetreForm fenetre = new FenetreForm("");
|
360 |
final PersonneForm formulaire = creerFormulairePersonne(fenetre, personneId);
|
351 |
final PersonneForm formulaire = creerFormulairePersonne(fenetre, personneId);
|
361 |
fenetre.add(formulaire);
|
352 |
fenetre.add(formulaire);
|
362 |
return fenetre;
|
353 |
return fenetre;
|
363 |
}
|
354 |
}
|
364 |
|
355 |
|
365 |
private PersonneForm creerFormulairePersonne(final FenetreForm fenetre, final String personneId) {
|
356 |
private PersonneForm creerFormulairePersonne(final FenetreForm fenetre, final String personneId) {
|
366 |
PersonneForm formulairePersonne = new PersonneForm(mediateur, personneId, this);
|
357 |
PersonneForm formulairePersonne = new PersonneForm(mediateur, personneId, this);
|
367 |
FormPanel panneauFormulaire = formulairePersonne.getFormulaire();
|
358 |
FormPanel panneauFormulaire = formulairePersonne.getFormulaire();
|
368 |
fenetre.setHeading(panneauFormulaire.getHeading());
|
359 |
fenetre.setHeading(panneauFormulaire.getHeading());
|
369 |
panneauFormulaire.setHeaderVisible(false);
|
360 |
panneauFormulaire.setHeaderVisible(false);
|
370 |
panneauFormulaire.setTopComponent(null);
|
361 |
panneauFormulaire.setTopComponent(null);
|
371 |
|
362 |
|
372 |
// 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.
|
363 |
// 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.
|
373 |
panneauFormulaire.getBottomComponent().hide();
|
364 |
panneauFormulaire.getBottomComponent().hide();
|
374 |
SelectionListener<ButtonEvent> ecouteur = creerEcouteurValidationFormulairePersonne(fenetre, formulairePersonne);
|
365 |
SelectionListener<ButtonEvent> ecouteur = creerEcouteurValidationFormulairePersonne(fenetre, formulairePersonne);
|
375 |
final ButtonBar barreValidation = new FormulaireBarreValidation(ecouteur);
|
366 |
final ButtonBar barreValidation = new FormulaireBarreValidation(ecouteur);
|
376 |
fenetre.setBottomComponent(barreValidation);
|
367 |
fenetre.setBottomComponent(barreValidation);
|
377 |
|
368 |
|
378 |
return formulairePersonne;
|
369 |
return formulairePersonne;
|
379 |
}
|
370 |
}
|
380 |
|
371 |
|
381 |
private SelectionListener<ButtonEvent> creerEcouteurValidationFormulairePersonne(final FenetreForm fenetre, final PersonneForm formulaire) {
|
372 |
private SelectionListener<ButtonEvent> creerEcouteurValidationFormulairePersonne(final FenetreForm fenetre, final PersonneForm formulaire) {
|
382 |
SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
|
373 |
SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
|
383 |
public void componentSelected(ButtonEvent ce) {
|
374 |
public void componentSelected(ButtonEvent ce) {
|
384 |
String code = ((Button) ce.getComponent()).getData("code");
|
375 |
String code = ((Button) ce.getComponent()).getData("code");
|
385 |
if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
|
376 |
if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
|
386 |
if (formulaire.soumettreFormulaire()) {
|
377 |
if (formulaire.soumettreFormulaire()) {
|
387 |
fenetre.hide();
|
378 |
fenetre.hide();
|
388 |
}
|
379 |
}
|
389 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
|
380 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
|
390 |
formulaire.soumettreFormulaire();
|
381 |
formulaire.soumettreFormulaire();
|
391 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
|
382 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
|
392 |
fenetre.hide();
|
383 |
fenetre.hide();
|
393 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
|
384 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
|
394 |
fenetreFormulaire.hide();
|
385 |
fenetreFormulaire.hide();
|
395 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(formulaire.mode);
|
386 |
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(formulaire.mode);
|
396 |
fenetreFormulaire.show();
|
387 |
fenetreFormulaire.show();
|
397 |
}
|
388 |
}
|
398 |
}
|
389 |
}
|
399 |
};
|
390 |
};
|
400 |
|
391 |
|
401 |
return ecouteur;
|
392 |
return ecouteur;
|
402 |
}
|
393 |
}
|
403 |
|
394 |
|
404 |
private Button creerBoutonSupprimer() {
|
395 |
private Button creerBoutonSupprimer() {
|
405 |
Button bouton = new Button(i18nC.supprimer());
|
396 |
Button bouton = new Button(i18nC.supprimer());
|
406 |
bouton.setIcon(Images.ICONES.vcardSupprimer());
|
397 |
bouton.setIcon(Images.ICONES.vcardSupprimer());
|
407 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
398 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
408 |
public void componentSelected(ButtonEvent ce) {
|
399 |
public void componentSelected(ButtonEvent ce) {
|
409 |
PublicationAPersonne personneSelectionnee = new PublicationAPersonne(grilleAuteurs.getSelectionModel().getSelectedItem(), false);
|
400 |
PublicationAPersonne personneSelectionnee = new PublicationAPersonne(grilleAuteurs.getSelectionModel().getSelectedItem(), false);
|
410 |
if (personneSelectionnee == null) {
|
401 |
if (personneSelectionnee == null) {
|
411 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
402 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
412 |
} else {
|
403 |
} else {
|
413 |
supprimerDansGrille(personneSelectionnee);
|
404 |
supprimerDansGrille(personneSelectionnee);
|
414 |
}
|
405 |
}
|
415 |
}
|
406 |
}
|
416 |
});
|
407 |
});
|
417 |
return bouton;
|
408 |
return bouton;
|
418 |
}
|
409 |
}
|
419 |
|
410 |
|
420 |
private Button creerBoutonRafraichir() {
|
411 |
private Button creerBoutonRafraichir() {
|
421 |
Button bouton = new Button(i18nC.rafraichir());
|
412 |
Button bouton = new Button(i18nC.rafraichir());
|
422 |
bouton.setIcon(Images.ICONES.rafraichir());
|
413 |
bouton.setIcon(Images.ICONES.rafraichir());
|
423 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
414 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
424 |
public void componentSelected(ButtonEvent ce) {
|
415 |
public void componentSelected(ButtonEvent ce) {
|
425 |
actualiserGrille();
|
416 |
actualiserGrille();
|
426 |
}
|
417 |
}
|
427 |
});
|
418 |
});
|
428 |
return bouton;
|
419 |
return bouton;
|
429 |
}
|
420 |
}
|
430 |
|
421 |
|
431 |
private void actualiserGrille() {
|
422 |
private void actualiserGrille() {
|
432 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
423 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
433 |
// FIXME : c'est la merde
|
424 |
// FIXME : c'est la merde
|
434 |
//mediateur.selectionner(this, null, personneSelectionnee.getId(), "%");
|
425 |
//mediateur.selectionner(this, null, personneSelectionnee.getId(), "%");
|
435 |
} else {
|
426 |
} else {
|
436 |
grilleAuteurs.getStore().removeAll();
|
427 |
grilleAuteurs.getStore().removeAll();
|
437 |
layout();
|
428 |
layout();
|
438 |
}
|
429 |
}
|
439 |
}
|
430 |
}
|
440 |
|
431 |
|
441 |
private void creerComboBoxPersonnesSaisies() {
|
432 |
private void creerComboBoxPersonnesSaisies() {
|
442 |
ModelType modelTypePersonnes = new ModelType();
|
433 |
ModelType modelTypePersonnes = new ModelType();
|
443 |
modelTypePersonnes.setRoot("personnes");
|
434 |
modelTypePersonnes.setRoot("personnes");
|
444 |
modelTypePersonnes.setTotalName("nbElements");
|
435 |
modelTypePersonnes.setTotalName("nbElements");
|
445 |
modelTypePersonnes.addField("cp_fmt_nom_complet");
|
436 |
modelTypePersonnes.addField("cp_fmt_nom_complet");
|
446 |
modelTypePersonnes.addField("cp_nom");
|
437 |
modelTypePersonnes.addField("cp_nom");
|
447 |
modelTypePersonnes.addField("cp_prenom");
|
438 |
modelTypePersonnes.addField("cp_prenom");
|
448 |
modelTypePersonnes.addField("cp_id_personne");
|
439 |
modelTypePersonnes.addField("cp_id_personne");
|
449 |
modelTypePersonnes.addField("cp_code_postal");
|
440 |
modelTypePersonnes.addField("cp_code_postal");
|
450 |
modelTypePersonnes.addField("cp_ville");
|
441 |
modelTypePersonnes.addField("cp_ville");
|
451 |
modelTypePersonnes.addField("cp_truk_courriel");
|
442 |
modelTypePersonnes.addField("cp_truk_courriel");
|
452 |
|
443 |
|
453 |
String displayNamePersonnes = "cp_fmt_nom_complet";
|
444 |
String displayNamePersonnes = "cp_fmt_nom_complet";
|
454 |
ProxyPersonnes<ModelData> proxyPersonnes = new ProxyPersonnes<ModelData>(null);
|
445 |
ProxyPersonnes<ModelData> proxyPersonnes = new ProxyPersonnes<ModelData>(null);
|
455 |
|
446 |
|
456 |
personnesSaisiesComboBox = new ChampComboBoxRechercheTempsReelPaginable(proxyPersonnes, modelTypePersonnes, displayNamePersonnes);
|
447 |
personnesSaisiesComboBox = new ChampComboBoxRechercheTempsReelPaginable(proxyPersonnes, modelTypePersonnes, displayNamePersonnes);
|
457 |
|
448 |
|
458 |
personnesSaisiesComboBox.getCombo().addListener(Events.Select, new Listener<BaseEvent>() {
|
449 |
personnesSaisiesComboBox.getCombo().addListener(Events.Select, new Listener<BaseEvent>() {
|
459 |
public void handleEvent(BaseEvent be) {
|
450 |
public void handleEvent(BaseEvent be) {
|
460 |
if (personnesSaisiesComboBox.getValeur() instanceof ModelData) {
|
451 |
if (personnesSaisiesComboBox.getValeur() instanceof ModelData) {
|
461 |
// N'ajouter l'auteur que s'il n'est pas déjà présent dans la grille et dans les valeurs initiales
|
452 |
// N'ajouter l'auteur que s'il n'est pas déjà présent dans la grille et dans les valeurs initiales
|
462 |
Personne personneSaisieSelectionnee = new Personne(personnesSaisiesComboBox.getValeur());
|
453 |
Personne personneSaisieSelectionnee = new Personne(personnesSaisiesComboBox.getValeur());
|
463 |
PublicationAPersonne pap = new PublicationAPersonne(false);
|
454 |
PublicationAPersonne pap = new PublicationAPersonne(false);
|
464 |
pap.setPersonne(personneSaisieSelectionnee, true);
|
455 |
pap.setPersonne(personneSaisieSelectionnee, true);
|
465 |
pap.setOrdreAuteurs(String.valueOf(grilleAuteurs.getStore().getCount()+1));
|
456 |
pap.setOrdreAuteurs(String.valueOf(grilleAuteurs.getStore().getCount()+1));
|
466 |
if (modeDeCreation != Formulaire.MODE_AJOUTER) {
|
457 |
if (modeDeCreation != Formulaire.MODE_AJOUTER) {
|
467 |
pap.setPublicationLiee(publication);
|
458 |
pap.setPublicationLiee(publication);
|
468 |
pap.setIdPublication(publicationId);
|
459 |
pap.setIdPublication(publicationId);
|
469 |
}
|
460 |
}
|
470 |
if (grilleAuteurs.getStore().findModel(pap) != null) {
|
461 |
if (grilleAuteurs.getStore().findModel(pap) != null) {
|
471 |
Info.display("Information", "La personne est déjà présente dans la liste d'auteurs");
|
462 |
Info.display("Information", "La personne est déjà présente dans la liste d'auteurs");
|
472 |
} else {
|
463 |
} else {
|
473 |
ajouterDansGrille(pap);
|
464 |
ajouterDansGrille(pap);
|
474 |
personnesSaisiesComboBox.getCombo().setValue(null);
|
465 |
personnesSaisiesComboBox.getCombo().setValue(null);
|
475 |
}
|
466 |
}
|
476 |
}
|
467 |
}
|
477 |
}
|
468 |
}
|
478 |
});
|
469 |
});
|
479 |
}
|
470 |
}
|
480 |
|
471 |
|
481 |
private void ajouterDansGrille(PublicationAPersonne pap) {
|
472 |
private void ajouterDansGrille(PublicationAPersonne pap) {
|
482 |
ajouterDansGrille(pap, grilleAuteurs.getStore().getCount());
|
473 |
ajouterDansGrille(pap, grilleAuteurs.getStore().getCount());
|
483 |
}
|
474 |
}
|
484 |
|
475 |
|
485 |
private void ajouterDansGrille(PublicationAPersonne pap, int index) {
|
476 |
private void ajouterDansGrille(PublicationAPersonne pap, int index) {
|
486 |
if (pap != null) {
|
477 |
if (pap != null) {
|
487 |
if (!grilleAuteurs.getStore().contains(pap)) {
|
478 |
if (!grilleAuteurs.getStore().contains(pap)) {
|
488 |
//1) si elle ne fait pas partie des initiaux, ajouter à la liste à ajouter
|
479 |
//1) si elle ne fait pas partie des initiaux, ajouter à la liste à ajouter
|
489 |
if (!auteursInitialListe.containsValue(pap)) {
|
480 |
if (!auteursInitialListe.containsValue(pap)) {
|
490 |
auteursAjoutes.put(pap.getId(), pap);
|
481 |
auteursAjoutes.put(pap.getId(), pap);
|
491 |
}
|
482 |
}
|
492 |
|
483 |
|
493 |
// L'enlever de la liste à supprimer
|
484 |
// L'enlever de la liste à supprimer
|
494 |
if (auteursSupprimes.containsValue(pap)) {
|
485 |
if (auteursSupprimes.containsValue(pap)) {
|
495 |
auteursSupprimes.remove(pap);
|
486 |
auteursSupprimes.remove(pap);
|
496 |
}
|
487 |
}
|
497 |
//2) Ajouter a la grille
|
488 |
//2) Ajouter a la grille
|
498 |
grilleAuteurs.getStore().insert(pap, index);
|
489 |
grilleAuteurs.getStore().insert(pap, index);
|
499 |
grilleAuteurs.getSelectionModel().select(index, false);
|
490 |
grilleAuteurs.getSelectionModel().select(index, false);
|
500 |
} else {
|
491 |
} else {
|
501 |
InfoLogger.display("Information", "La personne choisie existe déjà dans la liste.");
|
492 |
InfoLogger.display("Information", "La personne choisie existe déjà dans la liste.");
|
502 |
}
|
493 |
}
|
503 |
}
|
494 |
}
|
504 |
}
|
495 |
}
|
505 |
|
- |
|
506 |
/**
|
- |
|
507 |
* Met à jour la grille avec les informations contenus dans la variable listePublicationsLiees
|
- |
|
508 |
*/
|
- |
|
509 |
/*
|
- |
|
510 |
private void mettreAJourGrille() {
|
- |
|
511 |
grille.getStore().removeAll();
|
- |
|
512 |
grille.getStore().add(listePersonne.toList());
|
- |
|
513 |
}*/
|
- |
|
514 |
|
496 |
|
515 |
private void supprimerDansGrille(PublicationAPersonne pap) {
|
497 |
private void supprimerDansGrille(PublicationAPersonne pap) {
|
516 |
if (pap != null) {
|
498 |
if (pap != null) {
|
517 |
// 1) Ajouter a la liste des personne à supprimer uniquement si est présente dans la liste initiale
|
499 |
// 1) Ajouter a la liste des personne à supprimer uniquement si est présente dans la liste initiale
|
518 |
if (auteursInitialListe.containsValue(pap)) {
|
500 |
if (auteursInitialListe.containsValue(pap)) {
|
519 |
auteursSupprimes.put(pap.getId(), pap);
|
501 |
auteursSupprimes.put(pap.getId(), pap);
|
520 |
}
|
502 |
}
|
521 |
|
503 |
|
522 |
if (auteursAjoutes.containsValue(pap)) {
|
504 |
if (auteursAjoutes.containsValue(pap)) {
|
523 |
auteursAjoutes.remove(pap);
|
505 |
auteursAjoutes.remove(pap);
|
524 |
}
|
506 |
}
|
525 |
|
507 |
|
526 |
if (auteursModifies.containsValue(pap)) {
|
508 |
if (auteursModifies.containsValue(pap)) {
|
527 |
auteursModifies.remove(pap);
|
509 |
auteursModifies.remove(pap);
|
528 |
}
|
510 |
}
|
529 |
|
511 |
|
530 |
// 2) Supprimer la personne de la liste
|
512 |
// 2) Supprimer la personne de la liste
|
531 |
grilleAuteurs.getStore().remove(pap);
|
513 |
grilleAuteurs.getStore().remove(pap);
|
532 |
} else {
|
514 |
} else {
|
533 |
Info.display("Information", "Vous devez sélectionner une personne");
|
515 |
Info.display("Information", "Vous devez sélectionner une personne");
|
534 |
}
|
516 |
}
|
535 |
}
|
517 |
}
|
536 |
|
518 |
|
537 |
private GrillePaginable<ModelData> creerGrilleAuteurs() {
|
519 |
private GrillePaginable<ModelData> creerGrilleAuteurs() {
|
538 |
|
- |
|
539 |
// ModelType
|
520 |
// ModelType
|
540 |
ModelType modelTypePersonnesAPublication = new ModelType();
|
521 |
ModelType modelTypePersonnesAPublication = new ModelType();
|
541 |
modelTypePersonnesAPublication.setRoot("publicationsAPersonne");
|
522 |
modelTypePersonnesAPublication.setRoot("publicationsAPersonne");
|
542 |
modelTypePersonnesAPublication.setTotalName("nbElements");
|
523 |
modelTypePersonnesAPublication.setTotalName("nbElements");
|
543 |
modelTypePersonnesAPublication.addField("cpuap_id_personne");
|
524 |
modelTypePersonnesAPublication.addField("cpuap_id_personne");
|
544 |
modelTypePersonnesAPublication.addField("cpuap_id_publication");
|
525 |
modelTypePersonnesAPublication.addField("cpuap_id_publication");
|
545 |
modelTypePersonnesAPublication.addField("cpuap_id_role");
|
526 |
modelTypePersonnesAPublication.addField("cpuap_id_role");
|
546 |
modelTypePersonnesAPublication.addField("cpuap_ordre");
|
527 |
modelTypePersonnesAPublication.addField("cpuap_ordre");
|
547 |
modelTypePersonnesAPublication.addField("cp_id_personne");
|
528 |
modelTypePersonnesAPublication.addField("cp_id_personne");
|
548 |
modelTypePersonnesAPublication.addField("cp_fmt_nom_complet");
|
529 |
modelTypePersonnesAPublication.addField("cp_fmt_nom_complet");
|
549 |
modelTypePersonnesAPublication.addField("cp_nom");
|
530 |
modelTypePersonnesAPublication.addField("cp_nom");
|
550 |
modelTypePersonnesAPublication.addField("cp_prenom");
|
531 |
modelTypePersonnesAPublication.addField("cp_prenom");
|
551 |
modelTypePersonnesAPublication.addField("cp_id_personne");
|
532 |
modelTypePersonnesAPublication.addField("cp_id_personne");
|
552 |
modelTypePersonnesAPublication.addField("cp_code_postal");
|
533 |
modelTypePersonnesAPublication.addField("cp_code_postal");
|
553 |
modelTypePersonnesAPublication.addField("cp_ville");
|
534 |
modelTypePersonnesAPublication.addField("cp_ville");
|
554 |
modelTypePersonnesAPublication.addField("cp_truk_courriel");
|
535 |
modelTypePersonnesAPublication.addField("cp_truk_courriel");
|
555 |
|
536 |
|
556 |
// Proxy
|
537 |
// Proxy
|
557 |
ProxyPersonnesAPublication<ModelData> proxyPersonnesAPublication = new ProxyPersonnesAPublication<ModelData>(null, publicationId);
|
538 |
ProxyPersonnesAPublication<ModelData> proxyPersonnesAPublication = new ProxyPersonnesAPublication<ModelData>(null, publicationId);
|
558 |
|
539 |
|
559 |
// Colonnes
|
540 |
// Colonnes
|
560 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
541 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
561 |
ColumnConfig columnOrdre = new ColumnConfig("_ordre_", i18nC.ordre(), 15);
|
542 |
ColumnConfig columnOrdre = new ColumnConfig("_ordre_", i18nC.ordre(), 15);
|
562 |
colonnes.add(columnOrdre);
|
543 |
colonnes.add(columnOrdre);
|
563 |
colonnes.add(new ColumnConfig("cp_fmt_nom_complet", i18nC.personneNomComplet(), 150));
|
544 |
colonnes.add(new ColumnConfig("cp_fmt_nom_complet", i18nC.personneNomComplet(), 150));
|
564 |
colonnes.add(new ColumnConfig("cp_code_postal", i18nC.personneCodePostal(), 150));
|
545 |
colonnes.add(new ColumnConfig("cp_code_postal", i18nC.personneCodePostal(), 150));
|
565 |
colonnes.add(new ColumnConfig("cp_ville", i18nC.personneVille(), 75));
|
546 |
colonnes.add(new ColumnConfig("cp_ville", i18nC.personneVille(), 75));
|
566 |
colonnes.add(new ColumnConfig("cp_truk_courriel", i18nC.personneCourriel(), 75));
|
547 |
colonnes.add(new ColumnConfig("cp_truk_courriel", i18nC.personneCourriel(), 75));
|
567 |
|
548 |
|
568 |
// Champs de traitement
|
549 |
// Champs de traitement
|
569 |
HashMap<String, String> virtualFields = new HashMap<String, String>();
|
550 |
HashMap<String, String> virtualFields = new HashMap<String, String>();
|
570 |
virtualFields.put("_ordre_", "cpuap_ordre");
|
551 |
virtualFields.put("_ordre_", "cpuap_ordre");
|
571 |
|
552 |
|
572 |
// Modele de selection
|
553 |
// Modele de selection
|
573 |
GridSelectionModel<ModelData> modeleDeSelection = new GridSelectionModel<ModelData>();
|
554 |
GridSelectionModel<ModelData> modeleDeSelection = new GridSelectionModel<ModelData>();
|
574 |
modeleDeSelection.addListener(Events.SelectionChange, new SelectionChangedListener<ModelData>() {
|
555 |
modeleDeSelection.addListener(Events.SelectionChange, new SelectionChangedListener<ModelData>() {
|
575 |
public void selectionChanged(SelectionChangedEvent<ModelData> se) {
|
556 |
public void selectionChanged(SelectionChangedEvent<ModelData> se) {
|
576 |
ModelData papSelectionnee = grilleAuteurs.getGrille().getSelectionModel().getSelectedItem();
|
557 |
ModelData papSelectionnee = grilleAuteurs.getGrille().getSelectionModel().getSelectedItem();
|
577 |
int index = grilleAuteurs.getStore().indexOf(papSelectionnee);
|
558 |
int index = grilleAuteurs.getStore().indexOf(papSelectionnee);
|
578 |
|
559 |
|
579 |
if (index >= 1) boutonAuteurUp.setEnabled(true);
|
560 |
if (index >= 1) boutonAuteurUp.setEnabled(true);
|
580 |
else boutonAuteurUp.setEnabled(false);
|
561 |
else boutonAuteurUp.setEnabled(false);
|
581 |
if ((index+1) < grilleAuteurs.getStore().getCount()) boutonAuteurDown.setEnabled(true);
|
562 |
if ((index+1) < grilleAuteurs.getStore().getCount()) boutonAuteurDown.setEnabled(true);
|
582 |
else boutonAuteurDown.setEnabled(false);
|
563 |
else boutonAuteurDown.setEnabled(false);
|
583 |
}
|
564 |
}
|
584 |
});
|
565 |
});
|
585 |
|
566 |
|
586 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
567 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
587 |
|
568 |
|
588 |
// Grille
|
569 |
// Grille
|
589 |
// ATTENTION : le constructure de cette grille est à vérifier!
|
570 |
// ATTENTION : le constructure de cette grille est à vérifier!
|
590 |
final GrillePaginable<ModelData> grilleAuteurs = new GrillePaginable<ModelData>(modelTypePersonnesAPublication, virtualFields, proxyPersonnesAPublication, colonnes, modeleDeColonnes);
|
571 |
final GrillePaginable<ModelData> grilleAuteurs = new GrillePaginable<ModelData>(modelTypePersonnesAPublication, virtualFields, proxyPersonnesAPublication, colonnes, modeleDeColonnes);
|
591 |
grilleAuteurs.getGrille().setHeight("100%");
|
572 |
grilleAuteurs.getGrille().setHeight("100%");
|
592 |
grilleAuteurs.getGrille().setBorders(true);
|
573 |
grilleAuteurs.getGrille().setBorders(true);
|
593 |
grilleAuteurs.getGrille().setSelectionModel(modeleDeSelection);
|
574 |
grilleAuteurs.getGrille().setSelectionModel(modeleDeSelection);
|
594 |
grilleAuteurs.getGrille().getView().setForceFit(true);
|
575 |
grilleAuteurs.getGrille().getView().setForceFit(true);
|
595 |
grilleAuteurs.getGrille().setAutoExpandColumn("fmt_nom_complet");
|
576 |
grilleAuteurs.getGrille().setAutoExpandColumn("fmt_nom_complet");
|
596 |
grilleAuteurs.getGrille().setStripeRows(true);
|
577 |
grilleAuteurs.getGrille().setStripeRows(true);
|
597 |
grilleAuteurs.getGrille().setTrackMouseOver(true);
|
578 |
grilleAuteurs.getGrille().setTrackMouseOver(true);
|
598 |
|
579 |
|
599 |
// Rajouter des écouteurs
|
580 |
// Rajouter des écouteurs
|
600 |
grilleAuteurs.getStore().addListener(Store.Add, new Listener<StoreEvent<ModelData>>() {
|
581 |
grilleAuteurs.getStore().addListener(Store.Add, new Listener<StoreEvent<ModelData>>() {
|
601 |
public void handleEvent(StoreEvent<ModelData> ce) {
|
582 |
public void handleEvent(StoreEvent<ModelData> ce) {
|
602 |
if (!changeOrderMarker) {
|
583 |
if (!changeOrderMarker) {
|
603 |
actualiserEtatBoutonsBarreOutils();
|
584 |
actualiserEtatBoutonsBarreOutils();
|
604 |
}
|
585 |
}
|
605 |
}
|
586 |
}
|
606 |
});
|
587 |
});
|
607 |
grilleAuteurs.getStore().addListener(Store.Remove, new Listener<StoreEvent<ModelData>>() {
|
588 |
grilleAuteurs.getStore().addListener(Store.Remove, new Listener<StoreEvent<ModelData>>() {
|
608 |
public void handleEvent(StoreEvent<ModelData> ce) {
|
589 |
public void handleEvent(StoreEvent<ModelData> ce) {
|
609 |
if (!changeOrderMarker) {
|
590 |
if (!changeOrderMarker) {
|
610 |
actualiserEtatBoutonsBarreOutils();
|
591 |
actualiserEtatBoutonsBarreOutils();
|
611 |
}
|
592 |
}
|
612 |
}
|
593 |
}
|
613 |
});
|
594 |
});
|
614 |
grilleAuteurs.getStore().addListener(Store.Update, new Listener<StoreEvent<ModelData>>() {
|
595 |
grilleAuteurs.getStore().addListener(Store.Update, new Listener<StoreEvent<ModelData>>() {
|
615 |
public void handleEvent(StoreEvent<ModelData> ce) {
|
596 |
public void handleEvent(StoreEvent<ModelData> ce) {
|
616 |
if (!changeOrderMarker) {
|
597 |
if (!changeOrderMarker) {
|
617 |
if (ce.getRecord().isModified("_ordre_")) {
|
598 |
if (ce.getRecord().isModified("_ordre_")) {
|
618 |
// s'il s'agit d'un auteur que l'on vient d'ajouter à la liste, alors on a pas besoin
|
599 |
// s'il s'agit d'un auteur que l'on vient d'ajouter à la liste, alors on a pas besoin
|
619 |
// de faire quoique ce soit car l'auteur est déjà dans la liste des auteurs ajoutés
|
600 |
// de faire quoique ce soit car l'auteur est déjà dans la liste des auteurs ajoutés
|
620 |
if (ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
601 |
if (ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
621 |
// ... do nothing
|
602 |
// ... do nothing
|
622 |
// s'il s'agit d'un auteur qui était déjà présent dans la liste initiale, il faut
|
603 |
// s'il s'agit d'un auteur qui était déjà présent dans la liste initiale, il faut
|
623 |
// ajouter cet auteur à la liste des auteurs modifiés
|
604 |
// ajouter cet auteur à la liste des auteurs modifiés
|
624 |
} else {
|
605 |
} else {
|
625 |
PublicationAPersonne pap = new PublicationAPersonne(ce.getModel(), false);
|
606 |
PublicationAPersonne pap = new PublicationAPersonne(ce.getModel(), false);
|
626 |
auteursModifies.put(pap.getId(), pap);
|
607 |
auteursModifies.put(pap.getId(), pap);
|
627 |
}
|
608 |
}
|
628 |
}
|
609 |
}
|
629 |
}
|
610 |
}
|
630 |
}
|
611 |
}
|
631 |
});
|
612 |
});
|
632 |
|
613 |
|
633 |
return grilleAuteurs;
|
614 |
return grilleAuteurs;
|
634 |
}
|
615 |
}
|
635 |
|
616 |
|
636 |
private void genererTitreFormulaire() {
|
617 |
private void genererTitreFormulaire() {
|
637 |
String titre = i18nC.publicationTitreFormAjout();
|
618 |
String titre = i18nC.publicationTitreFormAjout();
|
638 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
619 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
639 |
titre = i18nC.publicationTitreFormModif();
|
620 |
titre = i18nC.publicationTitreFormModif();
|
640 |
if (publication != null) {
|
621 |
if (publication != null) {
|
641 |
titre += " - "+i18nC.id()+": "+publication.getId()+" - "+publication.getTitre();
|
622 |
titre += " - "+i18nC.id()+": "+publication.getId()+" - "+publication.getTitre();
|
642 |
}
|
623 |
}
|
643 |
}
|
624 |
}
|
644 |
panneauFormulaire.setHeading(titre);
|
625 |
panneauFormulaire.setHeading(titre);
|
645 |
}
|
626 |
}
|
646 |
|
627 |
|
647 |
|
628 |
|
648 |
private void creerZoneAuteurs() {
|
629 |
private void creerZoneAuteurs() {
|
649 |
auteursFieldset = new ContentPanel();
|
630 |
auteursFieldset = new ContentPanel();
|
650 |
auteursFieldset.setLayout(new FitLayout());
|
631 |
auteursFieldset.setLayout(new FitLayout());
|
651 |
auteursFieldset.setHeading("Auteurs");
|
632 |
auteursFieldset.setHeading("Auteurs");
|
652 |
|
633 |
|
653 |
creerChampsAuteur();
|
634 |
creerChampsAuteur();
|
654 |
}
|
635 |
}
|
655 |
|
636 |
|
656 |
private void creerChampsAuteur() {
|
637 |
private void creerChampsAuteur() {
|
657 |
auteursFieldset.removeAll();
|
638 |
auteursFieldset.removeAll();
|
658 |
barreOutils = creerBarreOutilsGrille();
|
639 |
barreOutils = creerBarreOutilsGrille();
|
659 |
auteursFieldset.setTopComponent(barreOutils);
|
640 |
auteursFieldset.setTopComponent(barreOutils);
|
660 |
grilleAuteurs = creerGrilleAuteurs();
|
641 |
grilleAuteurs = creerGrilleAuteurs();
|
661 |
auteursFieldset.add(grilleAuteurs);
|
642 |
auteursFieldset.add(grilleAuteurs);
|
662 |
auteursFieldset.layout();
|
643 |
auteursFieldset.layout();
|
663 |
}
|
644 |
}
|
664 |
|
645 |
|
665 |
private void creerZoneGeneralites() {
|
646 |
private void creerZoneGeneralites() {
|
666 |
FormLayout layout = new FormLayout();
|
647 |
FormLayout layout = new FormLayout();
|
667 |
layout.setLabelWidth(200);
|
648 |
layout.setLabelWidth(200);
|
668 |
|
649 |
|
669 |
// Fieldset Infos Générales
|
650 |
// Fieldset Infos Générales
|
670 |
generalitesFieldset = new FieldSet();
|
651 |
generalitesFieldset = new FieldSet();
|
671 |
generalitesFieldset.setHeading("Informations générales");
|
652 |
generalitesFieldset.setHeading("Informations générales");
|
672 |
generalitesFieldset.setCollapsible(true);
|
653 |
generalitesFieldset.setCollapsible(true);
|
673 |
generalitesFieldset.setLayout(layout);
|
654 |
generalitesFieldset.setLayout(layout);
|
674 |
|
655 |
|
675 |
ModelType modelTypeProjets = new ModelType();
|
656 |
ModelType modelTypeProjets = new ModelType();
|
676 |
modelTypeProjets.setRoot("projets");
|
657 |
modelTypeProjets.setRoot("projets");
|
677 |
modelTypeProjets.setTotalName("nbElements");
|
658 |
modelTypeProjets.setTotalName("nbElements");
|
678 |
modelTypeProjets.addField("cpr_nom");
|
659 |
modelTypeProjets.addField("cpr_nom");
|
679 |
modelTypeProjets.addField("cpr_id_projet");
|
660 |
modelTypeProjets.addField("cpr_id_projet");
|
680 |
|
661 |
|
681 |
String displayNameProjets = "cpr_nom";
|
662 |
String displayNameProjets = "cpr_nom";
|
682 |
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>(null);
|
663 |
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>(null);
|
683 |
|
664 |
|
684 |
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
|
665 |
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
|
685 |
projetsCombo.setWidth(200, 600);
|
666 |
projetsCombo.setWidth(200, 600);
|
686 |
projetsCombo.getCombo().setTabIndex(tabIndex++);
|
667 |
projetsCombo.getCombo().setTabIndex(tabIndex++);
|
687 |
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
|
668 |
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
|
688 |
projetsCombo.getCombo().setForceSelection(true);
|
669 |
projetsCombo.getCombo().setForceSelection(true);
|
689 |
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
|
670 |
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
|
690 |
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
|
671 |
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
|
691 |
|
672 |
|
692 |
projetsCombo.getCombo().setValidator(new Validator() {
|
673 |
projetsCombo.getCombo().setValidator(new Validator() {
|
693 |
public String validate(Field<?> field, String value) {
|
674 |
public String validate(Field<?> field, String value) {
|
694 |
String retour = null;
|
675 |
String retour = null;
|
695 |
if (field.getRawValue().equals("")) {
|
676 |
if (field.getRawValue().equals("")) {
|
696 |
field.setValue(null);
|
677 |
field.setValue(null);
|
697 |
} else if (projetsCombo.getStore().findModel("cpr_nom", field.getRawValue()) == null) {
|
678 |
} else if (projetsCombo.getStore().findModel("cpr_nom", field.getRawValue()) == null) {
|
698 |
String contenuBrut = field.getRawValue();
|
679 |
String contenuBrut = field.getRawValue();
|
699 |
field.setValue(null);
|
680 |
field.setValue(null);
|
700 |
field.setRawValue(contenuBrut);
|
681 |
field.setRawValue(contenuBrut);
|
701 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
682 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
702 |
}
|
683 |
}
|
703 |
return retour;
|
684 |
return retour;
|
704 |
}
|
685 |
}
|
705 |
});
|
686 |
});
|
706 |
generalitesFieldset.add(projetsCombo, new FormData(600, 0));
|
687 |
generalitesFieldset.add(projetsCombo, new FormData(600, 0));
|
707 |
|
688 |
|
708 |
titreChp = new TextField<String>();
|
689 |
titreChp = new TextField<String>();
|
709 |
titreChp.setName("cpu");
|
690 |
titreChp.setName("cpu");
|
710 |
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
|
691 |
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
|
711 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
692 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
712 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
693 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
713 |
generalitesFieldset.add(titreChp, new FormData(450, 0));
|
694 |
generalitesFieldset.add(titreChp, new FormData(450, 0));
|
714 |
|
695 |
|
715 |
collectionChp = new TextField<String>();
|
696 |
collectionChp = new TextField<String>();
|
716 |
collectionChp.setFieldLabel("Intitulé de la revue ou de la collection");
|
697 |
collectionChp.setFieldLabel("Intitulé de la revue ou de la collection");
|
717 |
generalitesFieldset.add(collectionChp, new FormData(450, 0));
|
698 |
generalitesFieldset.add(collectionChp, new FormData(450, 0));
|
718 |
|
699 |
|
719 |
uriChp = new TextField<String>();
|
700 |
uriChp = new TextField<String>();
|
720 |
uriChp.setFieldLabel("URL de la publication");
|
701 |
uriChp.setFieldLabel("URL de la publication");
|
721 |
generalitesFieldset.add(uriChp, new FormData(450, 0));
|
702 |
generalitesFieldset.add(uriChp, new FormData(450, 0));
|
722 |
}
|
703 |
}
|
723 |
|
704 |
|
724 |
private void creerZoneEdition() {
|
705 |
private void creerZoneEdition() {
|
725 |
FormLayout layout = new FormLayout();
|
706 |
FormLayout layout = new FormLayout();
|
726 |
layout.setLabelWidth(200);
|
707 |
layout.setLabelWidth(200);
|
727 |
|
708 |
|
728 |
// Fieldset Edition
|
709 |
// Fieldset Edition
|
729 |
editionFieldset = new FieldSet();
|
710 |
editionFieldset = new FieldSet();
|
730 |
editionFieldset.setHeading("Édition");
|
711 |
editionFieldset.setHeading("Édition");
|
731 |
editionFieldset.setCollapsible(true);
|
712 |
editionFieldset.setCollapsible(true);
|
732 |
editionFieldset.setLayout(layout);
|
713 |
editionFieldset.setLayout(layout);
|
733 |
|
714 |
|
734 |
/*****************************************************/
|
715 |
/*****************************************************/
|
735 |
/** Champ 'Editeur de la publication' **/
|
716 |
/** Champ 'Editeur de la publication' **/
|
736 |
/*****************************************************/
|
717 |
/*****************************************************/
|
737 |
ModelType modelTypeStructures = new ModelType();
|
718 |
ModelType modelTypeStructures = new ModelType();
|
738 |
modelTypeStructures.setRoot("structures");
|
719 |
modelTypeStructures.setRoot("structures");
|
739 |
modelTypeStructures.setTotalName("nbElements");
|
720 |
modelTypeStructures.setTotalName("nbElements");
|
740 |
modelTypeStructures.addField("cs_nom");
|
721 |
modelTypeStructures.addField("cs_nom");
|
741 |
modelTypeStructures.addField("cs_id_structure");
|
722 |
modelTypeStructures.addField("cs_id_structure");
|
742 |
|
723 |
|
743 |
String displayNameStructures = "cs_nom";
|
724 |
String displayNameStructures = "cs_nom";
|
744 |
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>(null);
|
725 |
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>(null);
|
745 |
|
726 |
|
746 |
editeurCombobox = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
|
727 |
editeurCombobox = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
|
747 |
editeurCombobox.setWidth(200, 600);
|
728 |
editeurCombobox.setWidth(200, 600);
|
748 |
editeurCombobox.getCombo().setTabIndex(tabIndex++);
|
729 |
editeurCombobox.getCombo().setTabIndex(tabIndex++);
|
749 |
editeurCombobox.getCombo().setEmptyText("Sélectionner un éditeur...");
|
730 |
editeurCombobox.getCombo().setEmptyText("Sélectionner un éditeur...");
|
750 |
editeurCombobox.getCombo().setFieldLabel("Éditeur de la publication");
|
731 |
editeurCombobox.getCombo().setFieldLabel("Éditeur de la publication");
|
751 |
editeurCombobox.getCombo().setEditable(true);
|
732 |
editeurCombobox.getCombo().setEditable(true);
|
752 |
editionFieldset.add(editeurCombobox, new FormData(600, 0));
|
733 |
editionFieldset.add(editeurCombobox, new FormData(600, 0));
|
753 |
|
734 |
|
754 |
/*********************************************/
|
735 |
/*********************************************/
|
755 |
/** Champ 'Date de publication' **/
|
736 |
/** Champ 'Date de publication' **/
|
756 |
/*********************************************/
|
737 |
/*********************************************/
|
757 |
datePublicationChp = new TextField<String>();
|
738 |
datePublicationChp = new TextField<String>();
|
758 |
datePublicationChp.setMaxLength(9);
|
739 |
datePublicationChp.setMaxLength(9);
|
759 |
datePublicationChp.setMinLength(4);
|
740 |
datePublicationChp.setMinLength(4);
|
760 |
datePublicationChp.setFieldLabel("Année de publication");
|
741 |
datePublicationChp.setFieldLabel("Année de publication");
|
761 |
datePublicationChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
742 |
datePublicationChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
762 |
datePublicationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
743 |
datePublicationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
763 |
editionFieldset.add(datePublicationChp, new FormData(80, 0));
|
744 |
editionFieldset.add(datePublicationChp, new FormData(80, 0));
|
764 |
|
745 |
|
765 |
/*********************************/
|
746 |
/*********************************/
|
766 |
/** Champ 'Tome' **/
|
747 |
/** Champ 'Tome' **/
|
767 |
/*********************************/
|
748 |
/*********************************/
|
768 |
tomeChp = new TextField<String>();
|
749 |
tomeChp = new TextField<String>();
|
769 |
tomeChp.setFieldLabel("Série de la revue ou tome");
|
750 |
tomeChp.setFieldLabel("Série de la revue ou tome");
|
770 |
editionFieldset.add(tomeChp, new FormData(75, 0));
|
751 |
editionFieldset.add(tomeChp, new FormData(75, 0));
|
771 |
|
752 |
|
772 |
/*************************************/
|
753 |
/*************************************/
|
773 |
/** Champ 'Fascicule' **/
|
754 |
/** Champ 'Fascicule' **/
|
774 |
/*************************************/
|
755 |
/*************************************/
|
775 |
fasciculeChp = new TextField<String>();
|
756 |
fasciculeChp = new TextField<String>();
|
776 |
fasciculeChp.setFieldLabel("Fascicule de la revue");
|
757 |
fasciculeChp.setFieldLabel("Fascicule de la revue");
|
777 |
editionFieldset.add(fasciculeChp, new FormData(75, 0));
|
758 |
editionFieldset.add(fasciculeChp, new FormData(75, 0));
|
778 |
|
759 |
|
779 |
/*********************************/
|
760 |
/*********************************/
|
780 |
/** Champ 'Pages' **/
|
761 |
/** Champ 'Pages' **/
|
781 |
/*********************************/
|
762 |
/*********************************/
|
782 |
pagesChp = new TextField<String>();
|
763 |
pagesChp = new TextField<String>();
|
783 |
pagesChp.setFieldLabel("Pages");
|
764 |
pagesChp.setFieldLabel("Pages");
|
784 |
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)");
|
765 |
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)");
|
785 |
editionFieldset.add(pagesChp, new FormData(100, 0));
|
766 |
editionFieldset.add(pagesChp, new FormData(100, 0));
|
786 |
}
|
767 |
}
|
787 |
|
768 |
|
788 |
|
- |
|
789 |
//-------------------------//
|
769 |
|
- |
|
770 |
//+----------------------------------------------------------------------------------------------------------------+
|
790 |
// Méthodes privées //------------------------------------------------------------
|
771 |
// Méthodes privées
|
791 |
|
772 |
|
792 |
private void miseAJourAuteursInitialListe() {
|
773 |
private void miseAJourAuteursInitialListe() {
|
793 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
774 |
Iterator<String> clesAjoutees = auteursAjoutes.keySet().iterator();
|
794 |
while (clesAjoutees.hasNext()) {
|
775 |
while (clesAjoutees.hasNext()) {
|
795 |
PublicationAPersonne auteurAjoute = auteursAjoutes.get(clesAjoutees.next());
|
776 |
PublicationAPersonne auteurAjoute = auteursAjoutes.get(clesAjoutees.next());
|
796 |
auteursInitialListe.put(auteurAjoute.getId(), auteurAjoute);
|
777 |
auteursInitialListe.put(auteurAjoute.getId(), auteurAjoute);
|
797 |
}
|
778 |
}
|
798 |
|
779 |
|
799 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
780 |
Iterator<String> clesSupprimees = auteursSupprimes.keySet().iterator();
|
800 |
while (clesSupprimees.hasNext()) {
|
781 |
while (clesSupprimees.hasNext()) {
|
801 |
PublicationAPersonne auteurSupprime = auteursSupprimes.get(clesSupprimees.next());
|
782 |
PublicationAPersonne auteurSupprime = auteursSupprimes.get(clesSupprimees.next());
|
802 |
auteursInitialListe.remove(auteurSupprime.getId());
|
783 |
auteursInitialListe.remove(auteurSupprime.getId());
|
803 |
}
|
784 |
}
|
804 |
}
|
785 |
}
|
805 |
|
786 |
|
806 |
public boolean soumettreFormulaire() {
|
787 |
public boolean soumettreFormulaire() {
|
807 |
boolean formulaireValideOk = verifierFormulaire();
|
788 |
boolean formulaireValideOk = verifierFormulaire();
|
808 |
if (formulaireValideOk) {
|
789 |
if (formulaireValideOk) {
|
809 |
soumettrePublication();
|
790 |
soumettrePublication();
|
810 |
}
|
791 |
}
|
811 |
return formulaireValideOk;
|
792 |
return formulaireValideOk;
|
812 |
}
|
793 |
}
|
813 |
|
794 |
|
814 |
private void soumettrePublication() {
|
795 |
private void soumettrePublication() {
|
815 |
Publication publicationCollectee = collecterPublication();
|
796 |
Publication publicationCollectee = collecterPublication();
|
816 |
if (publicationCollectee != null) {
|
797 |
if (publicationCollectee != null) {
|
817 |
// Pour l'enregistrement des publications, on utilise le séquenceur
|
798 |
// Pour l'enregistrement des publications, on utilise le séquenceur
|
818 |
// Il doit attendre le retour de l'enregistrement pour poursuivre
|
799 |
// Il doit attendre le retour de l'enregistrement pour poursuivre
|
819 |
sequenceur = new Sequenceur();
|
800 |
sequenceur = new Sequenceur();
|
820 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
801 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
821 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
802 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
822 |
mediateur.ajouterPublication(sequenceur, publicationCollectee, seqId);
|
803 |
mediateur.ajouterPublication(sequenceur, publicationCollectee, seqId);
|
823 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
804 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
824 |
mediateur.modifierPublication(sequenceur, publicationCollectee, seqId);
|
805 |
mediateur.modifierPublication(sequenceur, publicationCollectee, seqId);
|
825 |
}
|
806 |
}
|
826 |
|
807 |
|
827 |
// si l'on est en mode MODIFIER, on soumet les auteurs meme si les informations de la publication
|
808 |
// si l'on est en mode MODIFIER, on soumet les auteurs meme si les informations de la publication
|
828 |
// restent inchangées car il se peut que les auteurs aient été modifiés
|
809 |
// restent inchangées car il se peut que les auteurs aient été modifiés
|
829 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
810 |
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
830 |
soumettreAuteurs();
|
811 |
soumettreAuteurs();
|
831 |
}
|
812 |
}
|
832 |
}
|
813 |
}
|
833 |
|
814 |
|
834 |
private void soumettreAuteurs() {
|
815 |
private void soumettreAuteurs() {
|
835 |
|
816 |
|
836 |
formaterOrdreAuteurs();
|
817 |
formaterOrdreAuteurs();
|
837 |
|
818 |
|
838 |
//1) Auteurs ajoutés :
|
819 |
//1) Auteurs ajoutés :
|
839 |
PublicationAPersonneListe listeAuteursAAjouter = new PublicationAPersonneListe();
|
820 |
PublicationAPersonneListe listeAuteursAAjouter = new PublicationAPersonneListe();
|
840 |
Iterator<String> itAuteur = auteursAjoutes.keySet().iterator();
|
821 |
Iterator<String> itAuteur = auteursAjoutes.keySet().iterator();
|
841 |
while (itAuteur.hasNext()) {
|
822 |
while (itAuteur.hasNext()) {
|
842 |
String cle = itAuteur.next();
|
823 |
String cle = itAuteur.next();
|
843 |
PublicationAPersonne publiAPersonne = auteursAjoutes.get(cle);
|
824 |
PublicationAPersonne publiAPersonne = auteursAjoutes.get(cle);
|
844 |
publiAPersonne.setIdPublication(this.publicationId);
|
825 |
publiAPersonne.setIdPublication(this.publicationId);
|
845 |
publiAPersonne.setOrdreAuteurs(publiAPersonne.getOrdreAuteurs());
|
826 |
publiAPersonne.setOrdreAuteurs(publiAPersonne.getOrdreAuteurs());
|
846 |
listeAuteursAAjouter.put(cle, publiAPersonne);
|
827 |
listeAuteursAAjouter.put(cle, publiAPersonne);
|
847 |
}
|
828 |
}
|
848 |
|
829 |
|
849 |
// - envoyer au mediateur SSI personnes à ajouter
|
830 |
// - envoyer au mediateur SSI personnes à ajouter
|
850 |
if (listeAuteursAAjouter.size() > 0) {
|
831 |
if (listeAuteursAAjouter.size() > 0) {
|
851 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
832 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
852 |
mediateur.ajouterPublicationAPersonne(sequenceur, this.publicationId, listeAuteursAAjouter, PublicationAPersonne.ROLE_AUTEUR, seqId);
|
833 |
mediateur.ajouterPublicationAPersonne(sequenceur, this.publicationId, listeAuteursAAjouter, PublicationAPersonne.ROLE_AUTEUR, seqId);
|
853 |
}
|
834 |
}
|
854 |
|
835 |
|
855 |
//2) Auteurs supprimés :
|
836 |
//2) Auteurs supprimés :
|
856 |
PublicationAPersonneListe listeAuteursASupprimer = new PublicationAPersonneListe();
|
837 |
PublicationAPersonneListe listeAuteursASupprimer = new PublicationAPersonneListe();
|
857 |
itAuteur = auteursSupprimes.keySet().iterator();
|
838 |
itAuteur = auteursSupprimes.keySet().iterator();
|
858 |
while (itAuteur.hasNext()) {
|
839 |
while (itAuteur.hasNext()) {
|
859 |
String cle = itAuteur.next();
|
840 |
String cle = itAuteur.next();
|
860 |
PublicationAPersonne publiAPersonne = auteursSupprimes.get(cle);
|
841 |
PublicationAPersonne publiAPersonne = auteursSupprimes.get(cle);
|
861 |
listeAuteursASupprimer.put(cle, publiAPersonne);
|
842 |
listeAuteursASupprimer.put(cle, publiAPersonne);
|
862 |
}
|
843 |
}
|
863 |
|
844 |
|
864 |
// - Envoyer au médiateur SSI personnes à supprimer
|
845 |
// - Envoyer au médiateur SSI personnes à supprimer
|
865 |
if (listeAuteursASupprimer.size() > 0) {
|
846 |
if (listeAuteursASupprimer.size() > 0) {
|
866 |
// Pour une suppression des auteurs, on a pas besoin d'attendre le retour
|
847 |
// Pour une suppression des auteurs, on a pas besoin d'attendre le retour
|
867 |
mediateur.supprimerPublicationAPersonne(this, listeAuteursASupprimer);
|
848 |
mediateur.supprimerPublicationAPersonne(this, listeAuteursASupprimer);
|
868 |
}
|
849 |
}
|
869 |
|
850 |
|
870 |
//3) Auteurs modifiés :
|
851 |
//3) Auteurs modifiés :
|
871 |
PublicationAPersonneListe listeAuteursAModifier = new PublicationAPersonneListe();
|
852 |
PublicationAPersonneListe listeAuteursAModifier = new PublicationAPersonneListe();
|
872 |
itAuteur = auteursModifies.keySet().iterator();
|
853 |
itAuteur = auteursModifies.keySet().iterator();
|
873 |
while (itAuteur.hasNext()) {
|
854 |
while (itAuteur.hasNext()) {
|
874 |
String cle = itAuteur.next();
|
855 |
String cle = itAuteur.next();
|
875 |
PublicationAPersonne publiAPersonne = auteursModifies.get(cle);
|
856 |
PublicationAPersonne publiAPersonne = auteursModifies.get(cle);
|
876 |
listeAuteursAModifier.put(cle, publiAPersonne);
|
857 |
listeAuteursAModifier.put(cle, publiAPersonne);
|
877 |
}
|
858 |
}
|
878 |
|
859 |
|
879 |
// - Envoyer au médiateur SSI personnes à modifier
|
860 |
// - Envoyer au médiateur SSI personnes à modifier
|
880 |
if (listeAuteursAModifier.size() > 0) {
|
861 |
if (listeAuteursAModifier.size() > 0) {
|
881 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
862 |
int seqId = sequenceur.lancerRequeteSynchrone(this);
|
882 |
mediateur.modifierPublicationAPersonne(sequenceur, this.publicationId, listeAuteursAModifier, PublicationAPersonne.ROLE_AUTEUR, seqId);
|
863 |
mediateur.modifierPublicationAPersonne(sequenceur, this.publicationId, listeAuteursAModifier, PublicationAPersonne.ROLE_AUTEUR, seqId);
|
883 |
}
|
864 |
}
|
884 |
|
865 |
|
885 |
sequenceur.enfilerRafraichissement(this, new Information("auteurs_enregistres"));
|
866 |
sequenceur.enfilerRafraichissement(this, new Information("auteurs_enregistres"));
|
886 |
}
|
867 |
}
|
887 |
|
868 |
|
888 |
private void formaterOrdreAuteurs() {
|
869 |
private void formaterOrdreAuteurs() {
|
889 |
ListStore<ModelData> store = grilleAuteurs.getStore();
|
870 |
ListStore<ModelData> store = grilleAuteurs.getStore();
|
890 |
List<ModelData> auteurs = grilleAuteurs.getStore().getModels();
|
871 |
List<ModelData> auteurs = grilleAuteurs.getStore().getModels();
|
891 |
|
872 |
|
892 |
Iterator<ModelData> itAuteurs = auteurs.iterator();
|
873 |
Iterator<ModelData> itAuteurs = auteurs.iterator();
|
893 |
while (itAuteurs.hasNext()) {
|
874 |
while (itAuteurs.hasNext()) {
|
894 |
ModelData selection = itAuteurs.next();
|
875 |
ModelData selection = itAuteurs.next();
|
895 |
|
876 |
|
896 |
PublicationAPersonne pap = new PublicationAPersonne(selection, false);
|
877 |
PublicationAPersonne pap = new PublicationAPersonne(selection, false);
|
897 |
int ordre = store.indexOf(selection) + 1;
|
878 |
int ordre = store.indexOf(selection) + 1;
|
898 |
|
879 |
|
899 |
if (pap.getOrdreAuteurs() != String.valueOf(ordre)) {
|
880 |
if (pap.getOrdreAuteurs() != String.valueOf(ordre)) {
|
900 |
pap.setOrdreAuteurs(String.valueOf(ordre));
|
881 |
pap.setOrdreAuteurs(String.valueOf(ordre));
|
901 |
auteursModifies.put(pap.getId(), pap);
|
882 |
auteursModifies.put(pap.getId(), pap);
|
902 |
}
|
883 |
}
|
903 |
}
|
884 |
}
|
904 |
}
|
885 |
}
|
905 |
|
886 |
|
906 |
private void peuplerFormulaire() {
|
887 |
private void peuplerFormulaire() {
|
907 |
setValeurComboProjets();
|
888 |
setValeurComboProjets();
|
908 |
titreChp.setValue(publication.getTitre());
|
889 |
titreChp.setValue(publication.getTitre());
|
909 |
collectionChp.setValue(publication.getCollection());
|
890 |
collectionChp.setValue(publication.getCollection());
|
910 |
uriChp.setValue(publication.getURI());
|
891 |
uriChp.setValue(publication.getURI());
|
911 |
datePublicationChp.setValue(publication.getAnneeParution());
|
892 |
datePublicationChp.setValue(publication.getAnneeParution());
|
912 |
tomeChp.setValue(publication.getIndicationNvt());
|
893 |
tomeChp.setValue(publication.getIndicationNvt());
|
913 |
fasciculeChp.setValue(publication.getFascicule());
|
894 |
fasciculeChp.setValue(publication.getFascicule());
|
914 |
pagesChp.setValue(publication.getPages());
|
895 |
pagesChp.setValue(publication.getPages());
|
- |
|
896 |
|
915 |
|
897 |
// Éditeur est soit une référence à une structure de la base soit une chaine
|
916 |
if (publication.getEditeur().matches("^[0-9]+$")) {
|
898 |
if (publication.getEditeur().matches("^[0-9]+$")) {
|
- |
|
899 |
//editeurCombobox.getCombo().setValue(editeurCombobox.getStore().findModel("cs_id_structure", publication.getEditeur()));
|
917 |
editeurCombobox.getCombo().setValue(editeurCombobox.getStore().findModel("cs_id_structure", publication.getEditeur()));
|
900 |
editeurCombobox.chargerValeurInitiale(publication.getEditeur(), "cs_id_structure");
|
918 |
} else {
|
901 |
} else {
|
919 |
editeurCombobox.getCombo().setRawValue(publication.getEditeur());
|
902 |
editeurCombobox.getCombo().setRawValue(publication.getEditeur());
|
920 |
}
|
903 |
}
|
921 |
}
|
904 |
}
|
922 |
|
905 |
|
923 |
private Publication collecterPublication() {
|
906 |
private Publication collecterPublication() {
|
924 |
|
907 |
|
925 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
908 |
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
|
926 |
publicationCollectee.setIdProjet(getValeurComboProjets());
|
909 |
publicationCollectee.setIdProjet(getValeurComboProjets());
|
927 |
publicationCollectee.setAuteur(construireIntituleAuteur());
|
910 |
publicationCollectee.setAuteur(construireIntituleAuteur());
|
928 |
|
911 |
|
929 |
String titre = titreChp.getValue();
|
912 |
String titre = titreChp.getValue();
|
930 |
publicationCollectee.setTitre(titre);
|
913 |
publicationCollectee.setTitre(titre);
|
931 |
|
914 |
|
932 |
String collection = collectionChp.getValue();
|
915 |
String collection = collectionChp.getValue();
|
933 |
publicationCollectee.setCollection(collection);
|
916 |
publicationCollectee.setCollection(collection);
|
934 |
|
917 |
|
935 |
publicationCollectee.setNomComplet(construireNomComplet());
|
918 |
publicationCollectee.setNomComplet(construireNomComplet());
|
936 |
|
919 |
|
937 |
String uri = uriChp.getValue();
|
920 |
String uri = uriChp.getValue();
|
938 |
publicationCollectee.setUri(uri);
|
921 |
publicationCollectee.setUri(uri);
|
939 |
|
922 |
|
940 |
String editeur = "";
|
923 |
String editeur = "";
|
941 |
if (editeurCombobox.getValeur() != null) {
|
924 |
if (editeurCombobox.getValeur() != null) {
|
942 |
Structure structure = new Structure(editeurCombobox.getValeur());
|
925 |
Structure structure = new Structure(editeurCombobox.getValeur());
|
943 |
editeur = structure.getId();
|
926 |
editeur = structure.getId();
|
944 |
publicationCollectee.setStructureEditeur(structure);
|
927 |
publicationCollectee.setStructureEditeur(structure);
|
945 |
} else if (!UtilString.isEmpty(editeurCombobox.getCombo().getRawValue())) {
|
928 |
} else if (!UtilString.isEmpty(editeurCombobox.getCombo().getRawValue())) {
|
946 |
editeur = editeurCombobox.getCombo().getRawValue();
|
929 |
editeur = editeurCombobox.getCombo().getRawValue();
|
947 |
}
|
930 |
}
|
948 |
publicationCollectee.setEditeur(editeur);
|
931 |
publicationCollectee.setEditeur(editeur);
|
949 |
|
932 |
|
950 |
String anneePublication = datePublicationChp.getRawValue();
|
933 |
String anneePublication = datePublicationChp.getRawValue();
|
951 |
publicationCollectee.setAnneeParution(anneePublication);
|
934 |
publicationCollectee.setAnneeParution(anneePublication);
|
952 |
|
935 |
|
953 |
String tome = tomeChp.getValue();
|
936 |
String tome = tomeChp.getValue();
|
954 |
publicationCollectee.setIndicationNvt(tome);
|
937 |
publicationCollectee.setIndicationNvt(tome);
|
955 |
|
938 |
|
956 |
String fascicule = fasciculeChp.getValue();
|
939 |
String fascicule = fasciculeChp.getValue();
|
957 |
publicationCollectee.setFascicule(fascicule);
|
940 |
publicationCollectee.setFascicule(fascicule);
|
958 |
|
941 |
|
959 |
String pages = pagesChp.getValue();
|
942 |
String pages = pagesChp.getValue();
|
960 |
publicationCollectee.setPages(pages);
|
943 |
publicationCollectee.setPages(pages);
|
961 |
|
944 |
|
962 |
Publication publicationARetourner = null;
|
945 |
Publication publicationARetourner = null;
|
963 |
if (!publicationCollectee.comparer(publication)) {
|
946 |
if (!publicationCollectee.comparer(publication)) {
|
964 |
publicationARetourner = publication = publicationCollectee;
|
947 |
publicationARetourner = publication = publicationCollectee;
|
965 |
}
|
948 |
}
|
966 |
return publicationARetourner;
|
949 |
return publicationARetourner;
|
967 |
}
|
950 |
}
|
968 |
|
951 |
|
969 |
private String construireIntituleEditeur() {
|
952 |
private String construireIntituleEditeur() {
|
970 |
String editeur = "";
|
953 |
String editeur = "";
|
971 |
if (editeurCombobox.getValeur() != null) {
|
954 |
if (editeurCombobox.getValeur() != null) {
|
972 |
Structure structure = new Structure(editeurCombobox.getValeur());
|
955 |
Structure structure = new Structure(editeurCombobox.getValeur());
|
973 |
if (structure == null) editeur = editeurCombobox.getCombo().getRawValue();
|
- |
|
974 |
else editeur = structure.getNom();
|
956 |
editeur = structure.getNom();
|
975 |
} else if (!UtilString.isEmpty(editeurCombobox.getCombo().getRawValue())) {
|
957 |
} else if (!UtilString.isEmpty(editeurCombobox.getCombo().getRawValue())) {
|
976 |
editeur = editeurCombobox.getCombo().getRawValue();
|
958 |
editeur = editeurCombobox.getCombo().getRawValue();
|
977 |
}
|
959 |
}
|
978 |
return editeur;
|
960 |
return editeur;
|
979 |
}
|
961 |
}
|
980 |
|
962 |
|
981 |
private String construireIntituleAuteur() {
|
963 |
private String construireIntituleAuteur() {
|
982 |
String intituleAuteur = "";
|
964 |
String intituleAuteur = "";
|
983 |
|
965 |
|
984 |
// rangé par ordre désigné par le champ 'cpuap_ordre' de la table PublicationAPersonne
|
966 |
// rangé par ordre désigné par le champ 'cpuap_ordre' de la table PublicationAPersonne
|
985 |
grilleAuteurs.getStore().sort("_ordre_", SortDir.ASC);
|
967 |
grilleAuteurs.getStore().sort("_ordre_", SortDir.ASC);
|
986 |
List<ModelData> auteurs = grilleAuteurs.getStore().getModels();
|
968 |
List<ModelData> auteurs = grilleAuteurs.getStore().getModels();
|
987 |
Iterator<ModelData> itAuteurs = auteurs.iterator();
|
969 |
Iterator<ModelData> itAuteurs = auteurs.iterator();
|
988 |
|
970 |
|
989 |
while (itAuteurs.hasNext()) {
|
971 |
while (itAuteurs.hasNext()) {
|
990 |
Personne personneCourante = new PublicationAPersonne(itAuteurs.next(), false).getPersonne();
|
972 |
Personne personneCourante = new PublicationAPersonne(itAuteurs.next(), false).getPersonne();
|
991 |
intituleAuteur += personneCourante.getNom().toUpperCase() + " " + personneCourante.getPrenom();
|
973 |
intituleAuteur += personneCourante.getNom().toUpperCase() + " " + personneCourante.getPrenom();
|
992 |
if (itAuteurs.hasNext()) {
|
974 |
if (itAuteurs.hasNext()) {
|
993 |
intituleAuteur+=", ";
|
975 |
intituleAuteur+=", ";
|
994 |
}
|
976 |
}
|
995 |
}
|
977 |
}
|
996 |
return intituleAuteur;
|
978 |
return intituleAuteur;
|
997 |
}
|
979 |
}
|
998 |
|
980 |
|
999 |
private String construireNomComplet() {
|
981 |
private String construireNomComplet() {
|
1000 |
// Intitulé de la publication complet : fmt_auteur, date_parution(année). titre. Editeur (nom), collection, fascicule, indication_nvt. pages.
|
982 |
// Intitulé de la publication complet : fmt_auteur, date_parution(année). titre. Editeur (nom), collection, fascicule, indication_nvt. pages.
|
1001 |
String nomComplet = "";
|
983 |
String nomComplet = "";
|
1002 |
String auteurs = construireIntituleAuteur();
|
984 |
String auteurs = construireIntituleAuteur();
|
1003 |
String annee = datePublicationChp.getRawValue();
|
985 |
String annee = datePublicationChp.getRawValue();
|
1004 |
String titre = titreChp.getValue();
|
986 |
String titre = titreChp.getValue();
|
1005 |
String editeur = construireIntituleEditeur();
|
987 |
String editeur = construireIntituleEditeur();
|
1006 |
|
988 |
|
1007 |
nomComplet += auteurs+", "+annee+". "+titre+".";
|
989 |
nomComplet += auteurs+", "+annee+". "+titre+".";
|
1008 |
|
990 |
|
1009 |
if (!UtilString.isEmpty(editeur)) {
|
991 |
if (!UtilString.isEmpty(editeur)) {
|
1010 |
nomComplet += " Éditeur "+editeur+".";
|
992 |
nomComplet += " Éditeur "+editeur+".";
|
1011 |
}
|
993 |
}
|
1012 |
|
994 |
|
1013 |
if (collectionChp.getValue() != null) {
|
995 |
if (collectionChp.getValue() != null) {
|
1014 |
String revue = collectionChp.getValue();
|
996 |
String revue = collectionChp.getValue();
|
1015 |
nomComplet += ", "+revue;
|
997 |
nomComplet += ", "+revue;
|
1016 |
}
|
998 |
}
|
1017 |
|
999 |
|
1018 |
if (fasciculeChp.getValue() != null) {
|
1000 |
if (fasciculeChp.getValue() != null) {
|
1019 |
String fascicule = fasciculeChp.getValue();
|
1001 |
String fascicule = fasciculeChp.getValue();
|
1020 |
nomComplet += ", "+fascicule;
|
1002 |
nomComplet += ", "+fascicule;
|
1021 |
}
|
1003 |
}
|
1022 |
|
1004 |
|
1023 |
if (tomeChp.getValue() != null) {
|
1005 |
if (tomeChp.getValue() != null) {
|
1024 |
String tomaison = tomeChp.getValue();
|
1006 |
String tomaison = tomeChp.getValue();
|
1025 |
nomComplet += ", "+tomaison;
|
1007 |
nomComplet += ", "+tomaison;
|
1026 |
}
|
1008 |
}
|
1027 |
|
1009 |
|
1028 |
if (collectionChp.getValue() != null || fasciculeChp.getValue() != null || tomeChp.getValue() != null) {
|
1010 |
if (collectionChp.getValue() != null || fasciculeChp.getValue() != null || tomeChp.getValue() != null) {
|
1029 |
nomComplet += ".";
|
1011 |
nomComplet += ".";
|
1030 |
}
|
1012 |
}
|
1031 |
|
1013 |
|
1032 |
if (pagesChp.getValue() != null) {
|
1014 |
if (pagesChp.getValue() != null) {
|
1033 |
String pages = pagesChp.getValue();
|
1015 |
String pages = pagesChp.getValue();
|
1034 |
nomComplet += pages+".";
|
1016 |
nomComplet += pages+".";
|
1035 |
}
|
1017 |
}
|
1036 |
|
1018 |
|
1037 |
return nomComplet;
|
1019 |
return nomComplet;
|
1038 |
}
|
1020 |
}
|
1039 |
|
1021 |
|
1040 |
public void reinitialiserFormulaire() {
|
1022 |
public void reinitialiserFormulaire() {
|
1041 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
1023 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
1042 |
mediateur.afficherFormPublication(publication.getId());
|
1024 |
mediateur.afficherFormPublication(publication.getId());
|
1043 |
} else {
|
1025 |
} else {
|
1044 |
mediateur.afficherFormPublication(null);
|
1026 |
mediateur.afficherFormPublication(null);
|
1045 |
}
|
1027 |
}
|
1046 |
}
|
1028 |
}
|
1047 |
|
- |
|
1048 |
//---------------------------//
|
1029 |
|
- |
|
1030 |
//+----------------------------------------------------------------------------------------------------------------+
|
1049 |
// Méthodes publiques //------------------------------------------------------------
|
1031 |
// Méthodes publiques
|
1050 |
|
1032 |
|
1051 |
public boolean verifierFormulaire() {
|
1033 |
public boolean verifierFormulaire() {
|
1052 |
boolean valide = true;
|
1034 |
boolean valide = true;
|
1053 |
ArrayList<String> messages = new ArrayList<String>();
|
1035 |
ArrayList<String> messages = new ArrayList<String>();
|
1054 |
|
1036 |
|
1055 |
// Tester si au moins un auteur est présent
|
1037 |
// Tester si au moins un auteur est présent
|
1056 |
if (grilleAuteurs.getStore().getModels().size() == 0) {
|
1038 |
if (grilleAuteurs.getStore().getModels().size() == 0) {
|
1057 |
messages.add("Veuillez saisir au moins un auteur.");
|
1039 |
messages.add("Veuillez saisir au moins un auteur.");
|
1058 |
}
|
1040 |
}
|
1059 |
|
1041 |
|
1060 |
String titre = titreChp.getValue();
|
1042 |
String titre = titreChp.getValue();
|
1061 |
if (titre == null || titre.equals("")) {
|
1043 |
if (titre == null || titre.equals("")) {
|
1062 |
messages.add("Veuillez saisir le titre de la publication !");
|
1044 |
messages.add("Veuillez saisir le titre de la publication !");
|
1063 |
}
|
1045 |
}
|
1064 |
|
1046 |
|
1065 |
String uri = uriChp.getValue();
|
1047 |
String uri = uriChp.getValue();
|
1066 |
if (uri != null && ! uri.isEmpty() && ! uri.matches(Pattern.url)) {
|
1048 |
if (uri != null && ! uri.isEmpty() && ! uri.matches(Pattern.url)) {
|
1067 |
messages.add("L'URL saisie n'est pas valide !");
|
1049 |
messages.add("L'URL saisie n'est pas valide !");
|
1068 |
}
|
1050 |
}
|
1069 |
|
1051 |
|
1070 |
String datePublication = datePublicationChp.getRawValue();
|
1052 |
String datePublication = datePublicationChp.getRawValue();
|
1071 |
if (datePublication == null || datePublication.equals("")) {
|
1053 |
if (datePublication == null || datePublication.equals("")) {
|
1072 |
messages.add("Veuillez saisir une année de parution !");
|
1054 |
messages.add("Veuillez saisir une année de parution !");
|
1073 |
} else {
|
1055 |
} else {
|
1074 |
if (!Publication.etreAnneeParutionValide(datePublication)) {
|
1056 |
if (!Publication.etreAnneeParutionValide(datePublication)) {
|
1075 |
messages.add("Le format de l'année saisie est incorrect ! Formats acceptés : AAAA ou AAAA-AAAA");
|
1057 |
messages.add("Le format de l'année saisie est incorrect ! Formats acceptés : AAAA ou AAAA-AAAA");
|
1076 |
}
|
1058 |
}
|
1077 |
}
|
1059 |
}
|
1078 |
|
1060 |
|
1079 |
String pages = pagesChp.getValue();
|
1061 |
String pages = pagesChp.getValue();
|
1080 |
String valeurPage = "(?:[0-9]+|[IVXLCDM]+|\\?)";
|
1062 |
String valeurPage = "(?:[0-9]+|[IVXLCDM]+|\\?)";
|
1081 |
if (pages != null && ! pages.matches("^(?:"+valeurPage+"|"+valeurPage+"-"+valeurPage+")$")) {
|
1063 |
if (pages != null && ! pages.matches("^(?:"+valeurPage+"|"+valeurPage+"-"+valeurPage+")$")) {
|
1082 |
messages.add("Le format des pages est incorrect !");
|
1064 |
messages.add("Le format des pages est incorrect !");
|
1083 |
}
|
1065 |
}
|
1084 |
|
1066 |
|
1085 |
if (messages.size() != 0) {
|
1067 |
if (messages.size() != 0) {
|
1086 |
String[] tableauDeMessages = {};
|
1068 |
String[] tableauDeMessages = {};
|
1087 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
1069 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
1088 |
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
|
1070 |
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDeMessages, "<br />"), null);
|
1089 |
valide = false;
|
1071 |
valide = false;
|
1090 |
}
|
1072 |
}
|
1091 |
return valide;
|
1073 |
return valide;
|
1092 |
}
|
1074 |
}
|
1093 |
|
1075 |
|
1094 |
|
- |
|
1095 |
//-------------------//
|
1076 |
|
- |
|
1077 |
//+----------------------------------------------------------------------------------------------------------------+
|
1096 |
// Accesseurs //------------------------------------------------------------
|
1078 |
// Accesseurs
|
1097 |
|
1079 |
|
1098 |
private String getValeurComboProjets() {
|
1080 |
private String getValeurComboProjets() {
|
1099 |
String valeur = "";
|
1081 |
String valeur = "";
|
1100 |
if (projetsCombo.getValeur() != null) {
|
1082 |
if (projetsCombo.getValeur() != null) {
|
1101 |
Projet projet = new Projet(projetsCombo.getValeur());
|
1083 |
Projet projet = new Projet(projetsCombo.getValeur());
|
1102 |
valeur = projet.getId();
|
1084 |
valeur = projet.getId();
|
1103 |
}
|
1085 |
}
|
1104 |
return valeur;
|
1086 |
return valeur;
|
1105 |
}
|
1087 |
}
|
1106 |
private void setValeurComboProjets() {
|
1088 |
private void setValeurComboProjets() {
|
1107 |
if (mode.equals(Formulaire.MODE_MODIFIER) && publication != null) {
|
1089 |
if (mode.equals(Formulaire.MODE_MODIFIER) && publication != null) {
|
1108 |
if (projetsCombo.getCombo().getStore() != null
|
1090 |
if (projetsCombo.getCombo().getStore() != null
|
1109 |
&& publication != null
|
1091 |
&& publication != null
|
1110 |
&& publication.getIdProjet() != null
|
1092 |
&& publication.getIdProjet() != null
|
1111 |
&& !UtilString.isEmpty(publication.getIdProjet())) {
|
1093 |
&& !UtilString.isEmpty(publication.getIdProjet())) {
|
1112 |
projetsCombo.chargerValeurInitiale(publication.getIdProjet(), "cpr_id_projet");
|
1094 |
projetsCombo.chargerValeurInitiale(publication.getIdProjet(), "cpr_id_projet");
|
1113 |
}
|
1095 |
}
|
1114 |
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
1096 |
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
1115 |
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", mediateur.getProjetId()));
|
1097 |
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", mediateur.getProjetId()));
|
1116 |
} else {
|
1098 |
} else {
|
1117 |
projetsCombo.getCombo().setValue(null);
|
1099 |
projetsCombo.getCombo().setValue(null);
|
1118 |
}
|
1100 |
}
|
1119 |
}
|
1101 |
}
|
1120 |
|
- |
|
1121 |
//-------------------//
|
1102 |
|
- |
|
1103 |
//+----------------------------------------------------------------------------------------------------------------+
|
1122 |
// Rafraichir //------------------------------------------------------------
|
1104 |
// Rafraichir
|
1123 |
|
1105 |
|
1124 |
public void rafraichir(Object nouvellesDonnees) {
|
1106 |
public void rafraichir(Object nouvellesDonnees) {
|
1125 |
if (nouvellesDonnees instanceof Publication) {
|
1107 |
if (nouvellesDonnees instanceof Publication) {
|
1126 |
publication = (Publication) nouvellesDonnees;
|
1108 |
publication = (Publication) nouvellesDonnees;
|
1127 |
} else if (nouvellesDonnees instanceof Information) {
|
1109 |
} else if (nouvellesDonnees instanceof Information) {
|
1128 |
rafraichirInformation((Information) nouvellesDonnees);
|
1110 |
rafraichirInformation((Information) nouvellesDonnees);
|
1129 |
} else {
|
1111 |
} else {
|
1130 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
1112 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
1131 |
}
|
1113 |
}
|
1132 |
}
|
1114 |
}
|
1133 |
|
1115 |
|
1134 |
private void rafraichirInformation(Information info) {
|
1116 |
private void rafraichirInformation(Information info) {
|
1135 |
|
1117 |
|
1136 |
String type = info.getType();
|
1118 |
String type = info.getType();
|
1137 |
if (type.equals("auteurs_enregistres")) {
|
1119 |
if (type.equals("auteurs_enregistres")) {
|
1138 |
miseAJourAuteursInitialListe();
|
1120 |
miseAJourAuteursInitialListe();
|
1139 |
initialiserAuteurs();
|
1121 |
initialiserAuteurs();
|
1140 |
repandreRafraichissement();
|
1122 |
repandreRafraichissement();
|
1141 |
controlerFermeture();
|
1123 |
controlerFermeture();
|
1142 |
} else if (type.equals("chargement_modifier_ok")) {
|
1124 |
} else if (type.equals("chargement_modifier_ok")) {
|
- |
|
1125 |
Debug.log("Chargement 1");
|
1143 |
peuplerFormulaire();
|
1126 |
peuplerFormulaire();
|
1144 |
genererTitreFormulaire();
|
1127 |
genererTitreFormulaire();
|
1145 |
}
|
1128 |
}
|
1146 |
|
1129 |
|
1147 |
if (type.equals("personne_ajoutee")) {
|
1130 |
if (type.equals("personne_ajoutee")) {
|
1148 |
if (info.getDonnee(0) != null) {
|
1131 |
if (info.getDonnee(0) != null) {
|
1149 |
Personne personne = (Personne) info.getDonnee(0);
|
1132 |
Personne personne = (Personne) info.getDonnee(0);
|
1150 |
PublicationAPersonne pap = new PublicationAPersonne();
|
1133 |
PublicationAPersonne pap = new PublicationAPersonne();
|
1151 |
pap.setPersonne(personne);
|
1134 |
pap.setPersonne(personne);
|
1152 |
if (modeDeCreation != Formulaire.MODE_AJOUTER) pap.setPublicationLiee(publication);
|
1135 |
if (modeDeCreation != Formulaire.MODE_AJOUTER) pap.setPublicationLiee(publication);
|
1153 |
ajouterDansGrille(pap);
|
1136 |
ajouterDansGrille(pap);
|
1154 |
}
|
1137 |
}
|
1155 |
} else if (type.equals("personne_modifiee")) {
|
1138 |
} else if (type.equals("personne_modifiee")) {
|
1156 |
if (info.getDonnee(0) != null) {
|
1139 |
if (info.getDonnee(0) != null) {
|
1157 |
|
1140 |
|
1158 |
// créer la nouvelle entrée
|
1141 |
// créer la nouvelle entrée
|
1159 |
Personne personne = (Personne) info.getDonnee(0);
|
1142 |
Personne personne = (Personne) info.getDonnee(0);
|
1160 |
PublicationAPersonne pap = new PublicationAPersonne();
|
1143 |
PublicationAPersonne pap = new PublicationAPersonne();
|
1161 |
pap.setPersonne(personne);
|
1144 |
pap.setPersonne(personne);
|
1162 |
if (modeDeCreation != Formulaire.MODE_AJOUTER) pap.setPublicationLiee(publication);
|
1145 |
if (modeDeCreation != Formulaire.MODE_AJOUTER) pap.setPublicationLiee(publication);
|
1163 |
|
1146 |
|
1164 |
// supprimer l'entrée précédente
|
1147 |
// supprimer l'entrée précédente
|
1165 |
PublicationAPersonne personneDansGrille = new PublicationAPersonne(grilleAuteurs.getStore().findModel("cp_id_personne", personne.getId()), false);
|
1148 |
PublicationAPersonne personneDansGrille = new PublicationAPersonne(grilleAuteurs.getStore().findModel("cp_id_personne", personne.getId()), false);
|
1166 |
int index = grilleAuteurs.getStore().indexOf(personneDansGrille);
|
1149 |
int index = grilleAuteurs.getStore().indexOf(personneDansGrille);
|
1167 |
grilleAuteurs.getStore().remove(personneDansGrille);
|
1150 |
grilleAuteurs.getStore().remove(personneDansGrille);
|
1168 |
|
1151 |
|
1169 |
// ajouter la nouvelle entrée dans la grille
|
1152 |
// ajouter la nouvelle entrée dans la grille
|
1170 |
ajouterDansGrille(pap, index);
|
1153 |
ajouterDansGrille(pap, index);
|
1171 |
}
|
1154 |
}
|
1172 |
} else if (info.getType().equals("modif_publication")) {
|
1155 |
} else if (info.getType().equals("modif_publication")) {
|
1173 |
InfoLogger.display("Modification d'une publication", info.toString());
|
1156 |
InfoLogger.display("Modification d'une publication", info.toString());
|
1174 |
soumettreAuteurs();
|
1157 |
soumettreAuteurs();
|
1175 |
} else if (info.getType().equals("ajout_publication")) {
|
1158 |
} else if (info.getType().equals("ajout_publication")) {
|
1176 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String && ((String) info.getDonnee(0)).matches("[0-9]+")) {
|
1159 |
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String && ((String) info.getDonnee(0)).matches("[0-9]+")) {
|
1177 |
String idPublication = (String) info.getDonnee(0);
|
1160 |
String idPublication = (String) info.getDonnee(0);
|
1178 |
this.publicationId = idPublication;
|
1161 |
this.publicationId = idPublication;
|
1179 |
this.publication.setId(idPublication);
|
1162 |
this.publication.setId(idPublication);
|
1180 |
soumettreAuteurs();
|
1163 |
soumettreAuteurs();
|
1181 |
InfoLogger.display("Ajout d'une publication", "La publication '"+publicationId+"' a bien été ajoutée");
|
1164 |
InfoLogger.display("Ajout d'une publication", "La publication '"+publicationId+"' a bien été ajoutée");
|
1182 |
} else {
|
1165 |
} else {
|
1183 |
InfoLogger.display("Ajout d'une publication", info.toString());
|
1166 |
InfoLogger.display("Ajout d'une publication", info.toString());
|
1184 |
}
|
1167 |
}
|
1185 |
}
|
1168 |
}
|
1186 |
}
|
1169 |
}
|
1187 |
|
1170 |
|
1188 |
private void repandreRafraichissement() {
|
1171 |
private void repandreRafraichissement() {
|
1189 |
if (vueExterneARafraichirApresValidation != null) {
|
1172 |
if (vueExterneARafraichirApresValidation != null) {
|
1190 |
String type = "publication_modifiee";
|
1173 |
String type = "publication_modifiee";
|
1191 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
1174 |
if (mode.equals(Formulaire.MODE_AJOUTER)) {
|
1192 |
type = "publication_ajoutee";
|
1175 |
type = "publication_ajoutee";
|
1193 |
}
|
1176 |
}
|
1194 |
Information info = new Information(type);
|
1177 |
Information info = new Information(type);
|
1195 |
info.setDonnee(0, publication);
|
1178 |
info.setDonnee(0, publication);
|
1196 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
1179 |
vueExterneARafraichirApresValidation.rafraichir(info);
|
1197 |
}
|
1180 |
}
|
1198 |
}
|
1181 |
}
|
1199 |
|
1182 |
|
1200 |
}
|
1183 |
}
|