| Line 11... |
Line 11... |
| 11 |
import org.tela_botanica.client.modeles.PersonneListe;
|
11 |
import org.tela_botanica.client.modeles.PersonneListe;
|
| 12 |
import org.tela_botanica.client.modeles.Publication;
|
12 |
import org.tela_botanica.client.modeles.Publication;
|
| 13 |
import org.tela_botanica.client.modeles.PublicationListe;
|
13 |
import org.tela_botanica.client.modeles.PublicationListe;
|
| 14 |
import org.tela_botanica.client.modeles.ValeurListe;
|
14 |
import org.tela_botanica.client.modeles.ValeurListe;
|
| Line -... |
Line 15... |
| - |
|
15 |
|
| 15 |
|
16 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
| 16 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
17 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
| - |
|
18 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
| 17 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
19 |
import com.extjs.gxt.ui.client.event.Events;
|
| 18 |
import com.extjs.gxt.ui.client.event.KeyListener;
|
20 |
import com.extjs.gxt.ui.client.event.KeyListener;
|
| 19 |
import com.extjs.gxt.ui.client.event.Listener;
|
21 |
import com.extjs.gxt.ui.client.event.Listener;
|
| 20 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
22 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
| 21 |
import com.extjs.gxt.ui.client.store.ListStore;
|
23 |
import com.extjs.gxt.ui.client.store.ListStore;
|
| 22 |
import com.extjs.gxt.ui.client.store.Store;
|
24 |
import com.extjs.gxt.ui.client.store.Store;
|
| 23 |
import com.extjs.gxt.ui.client.store.StoreEvent;
|
25 |
import com.extjs.gxt.ui.client.store.StoreEvent;
|
| 24 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
26 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
| 25 |
import com.extjs.gxt.ui.client.widget.Info;
|
27 |
import com.extjs.gxt.ui.client.widget.Info;
|
| 26 |
import com.extjs.gxt.ui.client.widget.InfoConfig;
|
28 |
import com.extjs.gxt.ui.client.widget.InfoConfig;
|
| - |
|
29 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
| 27 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
30 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
| - |
|
31 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
| 28 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
32 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
| 29 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
33 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
| 30 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
34 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
| 31 |
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
35 |
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
| 32 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
36 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
| Line 49... |
Line 53... |
| 49 |
private PublicationListe publicationsAjoutees = null;
|
53 |
private PublicationListe publicationsAjoutees = null;
|
| 50 |
private PublicationListe publicationsSupprimees = null;
|
54 |
private PublicationListe publicationsSupprimees = null;
|
| 51 |
private ComboBox<Publication> publicationsSaisiesComboBox = null;
|
55 |
private ComboBox<Publication> publicationsSaisiesComboBox = null;
|
| 52 |
private Button publicationsBoutonSupprimer = null;
|
56 |
private Button publicationsBoutonSupprimer = null;
|
| 53 |
private Button publicationsBoutonModifier = null;
|
57 |
private Button publicationsBoutonModifier = null;
|
| - |
|
58 |
private Button ajouterPublicationSaisieBouton = null;
|
| Line 54... |
Line 59... |
| 54 |
|
59 |
|
| 55 |
private static final String ETAT_AJOUTE = "A";
|
60 |
private static final String ETAT_AJOUTE = "A";
|
| Line 56... |
Line 61... |
| 56 |
private static final String ETAT_SUPPRIME = "S";
|
61 |
private static final String ETAT_SUPPRIME = "S";
|
| Line 115... |
Line 120... |
| 115 |
barreOutils.add(new SeparatorToolItem());
|
120 |
barreOutils.add(new SeparatorToolItem());
|
| Line 116... |
Line 121... |
| 116 |
|
121 |
|
| 117 |
publicationsSaisiesComboBox = creerComboBoxPublicationsSaisis();
|
122 |
publicationsSaisiesComboBox = creerComboBoxPublicationsSaisis();
|
| Line 118... |
Line 123... |
| 118 |
barreOutils.add(publicationsSaisiesComboBox);
|
123 |
barreOutils.add(publicationsSaisiesComboBox);
|
| 119 |
|
124 |
|
| Line 120... |
Line 125... |
| 120 |
Button ajouterPublicationSaisieBouton = creerBoutonAjouterPublicationSaisi();
|
125 |
ajouterPublicationSaisieBouton = creerBoutonAjouterPublicationSaisi();
|
| 121 |
barreOutils.add(ajouterPublicationSaisieBouton);
|
126 |
barreOutils.add(ajouterPublicationSaisieBouton);
|
| Line 127... |
Line 132... |
| 127 |
Button bouton = new Button(i18nC.ajouter());
|
132 |
Button bouton = new Button(i18nC.ajouter());
|
| 128 |
bouton.setIcon(Images.ICONES.vcardAjouter());
|
133 |
bouton.setIcon(Images.ICONES.vcardAjouter());
|
| 129 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
134 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| 130 |
@Override
|
135 |
@Override
|
| 131 |
public void componentSelected(ButtonEvent ce) {
|
136 |
public void componentSelected(ButtonEvent ce) {
|
| 132 |
PublicationForm formulairePublication = new PublicationForm();
|
- |
|
| 133 |
//formulairePersonne.setHeaderVisible(false);
|
- |
|
| 134 |
//formulairePersonne.setTopComponent(null);
|
- |
|
| 135 |
// TODO : gérer la barre d'outil avec des évènements spécifique au contexte de fenêtre modale
|
- |
|
| 136 |
//formulairePersonne.setBottomComponent(null);
|
- |
|
| 137 |
|
- |
|
| 138 |
final FenetreForm fenetre = new FenetreForm(i18nC.publicationTitreFormAjout());
|
137 |
final FenetreForm fenetre = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_AJOUTER);
|
| 139 |
fenetre.add(formulairePublication);
|
- |
|
| 140 |
fenetre.show();
|
138 |
fenetre.show();
|
| 141 |
}
|
139 |
}
|
| 142 |
});
|
140 |
});
|
| 143 |
return bouton;
|
141 |
return bouton;
|
| 144 |
}
|
142 |
}
|
| Line 152... |
Line 150... |
| 152 |
Publication publicationSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
150 |
Publication publicationSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
| Line 153... |
Line 151... |
| 153 |
|
151 |
|
| 154 |
if (publicationSaisieSelectionnee == null) {
|
152 |
if (publicationSaisieSelectionnee == null) {
|
| 155 |
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
153 |
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
|
| 156 |
} else {
|
- |
|
| 157 |
PublicationForm formulairePublication = new PublicationForm();
|
- |
|
| 158 |
//formulairePublication.setHeaderVisible(false);
|
- |
|
| 159 |
//formulairePublication.setTopComponent(null);
|
- |
|
| 160 |
// TODO : gérer la barre d'outil avec des évènements spécifique au contexte de fenêtre modale
|
- |
|
| 161 |
//formulairePersonne.setBottomComponent(null);
|
- |
|
| 162 |
formulairePublication.rafraichir(publicationSaisieSelectionnee);
|
- |
|
| 163 |
|
154 |
} else {
|
| 164 |
final FenetreForm fenetre = new FenetreForm(i18nC.publicationTitreFormModif());
|
- |
|
| 165 |
fenetre.add(formulairePublication);
|
155 |
final FenetreForm fenetre = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_MODIFIER);
|
| 166 |
fenetre.show();
|
156 |
fenetre.show();
|
| 167 |
}
|
157 |
}
|
| 168 |
}
|
158 |
}
|
| 169 |
});
|
159 |
});
|
| 170 |
return bouton;
|
160 |
return bouton;
|
| - |
|
161 |
}
|
| - |
|
162 |
|
| - |
|
163 |
private FenetreForm creerFenetreModaleAvecFormulairePersonne(String mode) {
|
| - |
|
164 |
final FenetreForm fenetre = new FenetreForm("");
|
| - |
|
165 |
final PublicationForm formulaire = creerFormulairePublication(fenetre, mode);
|
| - |
|
166 |
fenetre.add(formulaire);
|
| - |
|
167 |
return fenetre;
|
| - |
|
168 |
}
|
| - |
|
169 |
|
| - |
|
170 |
private PublicationForm creerFormulairePublication(final FenetreForm fenetre, final String mode) {
|
| - |
|
171 |
PublicationForm formulairePublication = new PublicationForm(mediateur, mode);
|
| - |
|
172 |
FormPanel panneauFormulaire = formulairePublication.getFormulaire();
|
| - |
|
173 |
fenetre.setHeading(panneauFormulaire.getHeading());
|
| - |
|
174 |
panneauFormulaire.setHeaderVisible(false);
|
| - |
|
175 |
panneauFormulaire.setTopComponent(null);
|
| - |
|
176 |
|
| - |
|
177 |
// TODO : gérer la barre d'outil avec des évènements spécifique au contexte de fenêtre modale
|
| - |
|
178 |
SelectionListener<ButtonEvent> ecouteur = creerEcouteurValidationFormulairePublication(fenetre, formulairePublication);
|
| - |
|
179 |
final ButtonBar barreValidation = new FormulaireBarreValidation(ecouteur);
|
| - |
|
180 |
panneauFormulaire.setBottomComponent(barreValidation);
|
| - |
|
181 |
|
| - |
|
182 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| - |
|
183 |
Publication publicationSaisiSelectionne = grille.getSelectionModel().getSelectedItem();
|
| - |
|
184 |
formulairePublication.rafraichir(publicationSaisiSelectionne);
|
| - |
|
185 |
}
|
| - |
|
186 |
|
| - |
|
187 |
return formulairePublication;
|
| - |
|
188 |
}
|
| - |
|
189 |
|
| - |
|
190 |
private SelectionListener<ButtonEvent> creerEcouteurValidationFormulairePublication(final FenetreForm fenetre, final PublicationForm formulaire) {
|
| - |
|
191 |
SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
|
| - |
|
192 |
@Override
|
| - |
|
193 |
public void componentSelected(ButtonEvent ce) {
|
| - |
|
194 |
String code = ((Button) ce.getComponent()).getData("code");
|
| - |
|
195 |
if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
|
| - |
|
196 |
formulaire.soumettreFormulaire();
|
| - |
|
197 |
fenetre.hide();
|
| - |
|
198 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
|
| - |
|
199 |
formulaire.soumettreFormulaire();
|
| - |
|
200 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
|
| - |
|
201 |
fenetre.hide();
|
| - |
|
202 |
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
|
| - |
|
203 |
formulaire.reinitialiserFormulaire();
|
| - |
|
204 |
}
|
| - |
|
205 |
}
|
| - |
|
206 |
};
|
| - |
|
207 |
|
| - |
|
208 |
return ecouteur;
|
| Line 171... |
Line 209... |
| 171 |
}
|
209 |
}
|
| 172 |
|
210 |
|
| 173 |
private Button creerBoutonSupprimer() {
|
211 |
private Button creerBoutonSupprimer() {
|
| 174 |
Button bouton = new Button(i18nC.supprimer());
|
212 |
Button bouton = new Button(i18nC.supprimer());
|
| Line 209... |
Line 247... |
| 209 |
comboBox.setEditable(true);
|
247 |
comboBox.setEditable(true);
|
| 210 |
comboBox.setDisplayField("fmt_nom_complet");
|
248 |
comboBox.setDisplayField("fmt_nom_complet");
|
| 211 |
comboBox.setStore(publicationsSaisiesStore);
|
249 |
comboBox.setStore(publicationsSaisiesStore);
|
| 212 |
comboBox.addKeyListener(new KeyListener() {
|
250 |
comboBox.addKeyListener(new KeyListener() {
|
| 213 |
public void componentKeyUp(ComponentEvent ce) {
|
251 |
public void componentKeyUp(ComponentEvent ce) {
|
| - |
|
252 |
if (publicationsSaisiesComboBox.getRawValue() != null && publicationsSaisiesComboBox.getRawValue().length() > 0) {
|
| - |
|
253 |
if (!ce.isNavKeyPress()) {
|
| 214 |
ComboBox<Publication> comboBox = (ComboBox<Publication>) ce.getComponent();
|
254 |
obtenirPublicationsSaisies(publicationsSaisiesComboBox.getRawValue());
|
| - |
|
255 |
}
|
| - |
|
256 |
}
|
| - |
|
257 |
}
|
| - |
|
258 |
});
|
| - |
|
259 |
comboBox.addListener(Events.Select, new Listener<BaseEvent>() {
|
| - |
|
260 |
@Override
|
| - |
|
261 |
public void handleEvent(BaseEvent be) {
|
| 215 |
if (!ce.isNavKeyPress() && comboBox.getRawValue() != null && comboBox.getRawValue().length() > 0) {
|
262 |
if (publicationsSaisiesComboBox.getValue() instanceof Publication) {
|
| 216 |
obtenirPublicationsSaisies(comboBox.getRawValue());
|
263 |
ajouterPublicationSaisieBouton.fireEvent(Events.Select);
|
| 217 |
}
|
264 |
}
|
| 218 |
}
|
265 |
}
|
| 219 |
});
|
266 |
});
|
| 220 |
return comboBox;
|
267 |
return comboBox;
|
| 221 |
}
|
268 |
}
|
| Line 225... |
Line 272... |
| 225 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
272 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| 226 |
@Override
|
273 |
@Override
|
| 227 |
public void componentSelected(ButtonEvent ce) {
|
274 |
public void componentSelected(ButtonEvent ce) {
|
| 228 |
Publication publicationSaisieSelectionne = publicationsSaisiesComboBox.getValue();
|
275 |
Publication publicationSaisieSelectionne = publicationsSaisiesComboBox.getValue();
|
| 229 |
ajouterDansGrille(publicationSaisieSelectionne);
|
276 |
ajouterDansGrille(publicationSaisieSelectionne);
|
| - |
|
277 |
publicationsSaisiesComboBox.setValue(null);
|
| 230 |
}
|
278 |
}
|
| 231 |
});
|
279 |
});
|
| 232 |
return bouton;
|
280 |
return bouton;
|
| 233 |
}
|
281 |
}
|