| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.vues.collection;
|
1 |
package org.tela_botanica.client.vues.collection;
|
| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| - |
|
3 |
import java.util.ArrayList;
|
| 3 |
import java.util.ArrayList;
|
4 |
import java.util.HashMap;
|
| Line 4... |
Line 5... |
| 4 |
import java.util.List;
|
5 |
import java.util.List;
|
| 5 |
|
6 |
|
| 6 |
import org.tela_botanica.client.Mediateur;
|
7 |
import org.tela_botanica.client.Mediateur;
|
| - |
|
8 |
import org.tela_botanica.client.composants.ChampComboBoxMultiSelect;
|
| 7 |
import org.tela_botanica.client.composants.ChampComboBoxMultiSelect;
|
9 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
| - |
|
10 |
import org.tela_botanica.client.composants.GrillePaginable;
|
| - |
|
11 |
import org.tela_botanica.client.composants.InfoLogger;
|
| 8 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
12 |
import org.tela_botanica.client.composants.pagination.ProxyCollectionACommentaire;
|
| 9 |
import org.tela_botanica.client.composants.InfoLogger;
|
13 |
import org.tela_botanica.client.composants.pagination.ProxyCollectionAPersonne;
|
| 10 |
import org.tela_botanica.client.composants.pagination.ProxyCommentaires;
|
14 |
import org.tela_botanica.client.composants.pagination.ProxyCommentaires;
|
| 11 |
import org.tela_botanica.client.composants.pagination.ProxyPublications;
|
15 |
import org.tela_botanica.client.composants.pagination.ProxyPublications;
|
| 12 |
import org.tela_botanica.client.images.Images;
|
16 |
import org.tela_botanica.client.images.Images;
|
| Line 58... |
Line 62... |
| 58 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
62 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
| 59 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
63 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
| 60 |
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
64 |
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
| 61 |
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
65 |
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
| 62 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
66 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
| - |
|
67 |
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
|
| 63 |
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
|
68 |
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
|
| 64 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
69 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
| 65 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
70 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
| 66 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
71 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
| 67 |
import com.google.gwt.core.client.GWT;
|
72 |
import com.google.gwt.core.client.GWT;
|
| Line 72... |
Line 77... |
| 72 |
private Collection collection = null;
|
77 |
private Collection collection = null;
|
| 73 |
private static int idGenere = 1;
|
78 |
private static int idGenere = 1;
|
| Line 74... |
Line 79... |
| 74 |
|
79 |
|
| 75 |
private ContentPanel panneauPrincipal = null;
|
80 |
private ContentPanel panneauPrincipal = null;
|
| 76 |
private ToolBar barreOutils = null;
|
81 |
private ToolBar barreOutils = null;
|
| 77 |
private EditorGrid<CollectionACommentaire> grille;
|
82 |
private GrillePaginable<ModelData> grille = null;
|
| Line 78... |
Line 83... |
| 78 |
private ChampComboBoxMultiSelect<Valeur> typeCombo = null;
|
83 |
private ChampComboBoxMultiSelect<Valeur> typeCombo = null;
|
| 79 |
|
84 |
|
| 80 |
private CollectionACommentaireListe commentairesAjoutes = null;
|
85 |
private CollectionACommentaireListe commentairesAjoutes = null;
|
| Line 89... |
Line 94... |
| 89 |
|
94 |
|
| 90 |
private FenetreForm fenetreFormulaire = null;
|
95 |
private FenetreForm fenetreFormulaire = null;
|
| Line 91... |
Line 96... |
| 91 |
private Sequenceur sequenceur;
|
96 |
private Sequenceur sequenceur;
|
| - |
|
97 |
|
| 92 |
|
98 |
public CollectionFormCommentaire(Formulaire formulaireCourrant) {
|
| - |
|
99 |
|
| 93 |
public CollectionFormCommentaire(Formulaire formulaireCourrant) {
|
100 |
initialiserOnglet(formulaireCourrant);
|
| 94 |
initialiserOnglet(formulaireCourrant);
|
101 |
setLayout(new FitLayout());
|
| 95 |
setId(ID);
|
102 |
setId(ID);
|
| Line -... |
Line 103... |
| - |
|
103 |
setText(Mediateur.i18nC.collectionCommentaire());
|
| - |
|
104 |
setStyleAttribute("padding", "0");
|
| 96 |
setText(Mediateur.i18nC.collectionCommentaire());
|
105 |
|
| 97 |
setStyleAttribute("padding", "0");
|
106 |
initialiser();
|
| 98 |
|
107 |
|
| 99 |
panneauPrincipal = creerPanneauContenantGrille();
|
108 |
panneauPrincipal = creerPanneauContenantGrille();
|
| 100 |
barreOutils = creerBarreOutilsGrille();
|
109 |
barreOutils = creerBarreOutilsGrille();
|
| Line 101... |
Line 110... |
| 101 |
panneauPrincipal.setTopComponent(barreOutils);
|
110 |
panneauPrincipal.setTopComponent(barreOutils);
|
| 102 |
grille = creerGrille();
|
111 |
grille = creerGrille();
|
| 103 |
panneauPrincipal.add(grille);
|
- |
|
| 104 |
|
- |
|
| 105 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeCommentaireCollection", null);
|
112 |
panneauPrincipal.add(grille);
|
| Line 106... |
Line 113... |
| 106 |
add(panneauPrincipal);
|
113 |
|
| 107 |
|
114 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeCommentaireCollection", null);
|
| 108 |
initialiser();
|
115 |
add(panneauPrincipal);
|
| Line 109... |
Line -... |
| 109 |
}
|
- |
|
| 110 |
|
- |
|
| 111 |
private void initialiser() {
|
- |
|
| 112 |
// Remise à zéro des modification dans la liste des commentaires
|
116 |
}
|
| 113 |
initialiserGestionCommentaires();
|
117 |
|
| Line 114... |
Line 118... |
| 114 |
|
118 |
private void initialiser() {
|
| 115 |
// Actualisation de l'état des boutons de la barre d'outils
|
119 |
// Remise à zéro des modification dans la liste des commentaires
|
| Line 187... |
Line 191... |
| 187 |
Button bouton = new Button(i18nC.modifier());
|
191 |
Button bouton = new Button(i18nC.modifier());
|
| 188 |
bouton.setIcon(Images.ICONES.vcardModifier());
|
192 |
bouton.setIcon(Images.ICONES.vcardModifier());
|
| 189 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
193 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| 190 |
@Override
|
194 |
@Override
|
| 191 |
public void componentSelected(ButtonEvent ce) {
|
195 |
public void componentSelected(ButtonEvent ce) {
|
| 192 |
CollectionACommentaire commentaireSaisiSelectionne = grille.getSelectionModel().getSelectedItem();
|
196 |
ModelData commentaireSaisiSelectionne = grille.getGrille().getSelectionModel().getSelectedItem();
|
| 193 |
if (commentaireSaisiSelectionne == null) {
|
197 |
if (commentaireSaisiSelectionne == null) {
|
| 194 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerCommentaire());
|
198 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerCommentaire());
|
| 195 |
} else {
|
199 |
} else {
|
| 196 |
fenetreFormulaire = creerFenetreModaleAvecFormulaireCommentaire(Formulaire.MODE_MODIFIER);
|
200 |
fenetreFormulaire = creerFenetreModaleAvecFormulaireCommentaire(Formulaire.MODE_MODIFIER);
|
| 197 |
fenetreFormulaire.show();
|
201 |
fenetreFormulaire.show();
|
| Line 202... |
Line 206... |
| 202 |
}
|
206 |
}
|
| Line 203... |
Line 207... |
| 203 |
|
207 |
|
| 204 |
private FenetreForm creerFenetreModaleAvecFormulaireCommentaire(String mode) {
|
208 |
private FenetreForm creerFenetreModaleAvecFormulaireCommentaire(String mode) {
|
| 205 |
String commentaireId = null;
|
209 |
String commentaireId = null;
|
| 206 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
210 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| - |
|
211 |
ModelData commentaierSaisieSelectionnee = grille.getGrille().getSelectionModel().getSelectedItem();
|
| 207 |
CollectionACommentaire commentaierSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
|
212 |
CollectionACommentaire cac = new CollectionACommentaire(commentaierSaisieSelectionnee, false);
|
| 208 |
commentaireId = commentaierSaisieSelectionnee.getIdCommentaire();
|
213 |
commentaireId = cac.getIdCommentaire();
|
| Line 209... |
Line 214... |
| 209 |
}
|
214 |
}
|
| 210 |
|
215 |
|
| 211 |
final FenetreForm fenetre = new FenetreForm("");
|
216 |
final FenetreForm fenetre = new FenetreForm("");
|
| Line 257... |
Line 262... |
| 257 |
private Button creerBoutonSupprimer() {
|
262 |
private Button creerBoutonSupprimer() {
|
| 258 |
Button bouton = new Button(i18nC.supprimer());
|
263 |
Button bouton = new Button(i18nC.supprimer());
|
| 259 |
bouton.setIcon(Images.ICONES.vcardSupprimer());
|
264 |
bouton.setIcon(Images.ICONES.vcardSupprimer());
|
| 260 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
265 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
| 261 |
public void componentSelected(ButtonEvent ce) {
|
266 |
public void componentSelected(ButtonEvent ce) {
|
| 262 |
CollectionACommentaire commentaireSaisiSelectionnee = grille.getSelectionModel().getSelectedItem();
|
267 |
ModelData commentaireSaisiSelectionnee = grille.getGrille().getSelectionModel().getSelectedItem();
|
| - |
|
268 |
CollectionACommentaire cac = new CollectionACommentaire(commentaireSaisiSelectionnee, false);
|
| 263 |
if (commentaireSaisiSelectionnee == null) {
|
269 |
if (commentaireSaisiSelectionnee == null) {
|
| 264 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerCommentaire());
|
270 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerCommentaire());
|
| 265 |
} else {
|
271 |
} else {
|
| 266 |
supprimerDansGrille(commentaireSaisiSelectionnee);
|
272 |
supprimerDansGrille(cac);
|
| 267 |
}
|
273 |
}
|
| 268 |
}
|
274 |
}
|
| 269 |
});
|
275 |
});
|
| 270 |
return bouton;
|
276 |
return bouton;
|
| 271 |
}
|
277 |
}
|
| Line 347... |
Line 353... |
| 347 |
}
|
353 |
}
|
| 348 |
relationCollectionACommentaire.set("_etat_", aDonnee.ETAT_AJOUTE);
|
354 |
relationCollectionACommentaire.set("_etat_", aDonnee.ETAT_AJOUTE);
|
| 349 |
corrigerChampsGrille(relationCollectionACommentaire);
|
355 |
corrigerChampsGrille(relationCollectionACommentaire);
|
| Line 350... |
Line 356... |
| 350 |
|
356 |
|
| 351 |
// Ajout à la grille
|
357 |
// Ajout à la grille
|
| 352 |
grille.stopEditing();
|
358 |
grille.getGrille().stopEditing();
|
| 353 |
grille.getStore().insert(relationCollectionACommentaire, index);
|
359 |
grille.getGrille().getStore().insert(relationCollectionACommentaire, index);
|
| 354 |
grille.startEditing(index, 0);
|
360 |
grille.getGrille().startEditing(index, 0);
|
| 355 |
grille.getSelectionModel().select(index, false);
|
361 |
grille.getGrille().getSelectionModel().select(index, false);
|
| 356 |
}
|
362 |
}
|
| Line 357... |
Line 363... |
| 357 |
}
|
363 |
}
|
| 358 |
|
364 |
|
| Line 368... |
Line 374... |
| 368 |
// Suppression de l'enregistrement de la grille
|
374 |
// Suppression de l'enregistrement de la grille
|
| 369 |
grille.getStore().remove(relationCollectionACommentaire);
|
375 |
grille.getStore().remove(relationCollectionACommentaire);
|
| 370 |
}
|
376 |
}
|
| 371 |
}
|
377 |
}
|
| Line 372... |
Line 378... |
| 372 |
|
378 |
|
| 373 |
private EditorGrid<CollectionACommentaire> creerGrille() {
|
- |
|
| 374 |
ListStore<CollectionACommentaire> storeGrille = new ListStore<CollectionACommentaire>();
|
- |
|
| 375 |
storeGrille.addListener(Store.Add, new Listener<StoreEvent<CollectionACommentaire>>() {
|
- |
|
| 376 |
public void handleEvent(StoreEvent<CollectionACommentaire> ce) {
|
- |
|
| 377 |
actualiserEtatBoutonsBarreOutils();
|
- |
|
| 378 |
}
|
- |
|
| 379 |
});
|
- |
|
| 380 |
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<CollectionACommentaire>>() {
|
- |
|
| 381 |
public void handleEvent(StoreEvent<CollectionACommentaire> ce) {
|
- |
|
| 382 |
actualiserEtatBoutonsBarreOutils();
|
- |
|
| 383 |
}
|
- |
|
| 384 |
});
|
- |
|
| 385 |
storeGrille.addListener(Store.Update, new Listener<StoreEvent<CollectionACommentaire>>() {
|
- |
|
| 386 |
public void handleEvent(StoreEvent<CollectionACommentaire> ce) {
|
- |
|
| 387 |
if (ce.getRecord().isModified("_type_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
- |
|
| 388 |
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
|
- |
|
| 389 |
}
|
- |
|
| 390 |
}
|
- |
|
| Line -... |
Line 379... |
| - |
|
379 |
private GrillePaginable<ModelData> creerGrille() {
|
| - |
|
380 |
|
| - |
|
381 |
GrillePaginable<ModelData> grillePaginable = null;
|
| 391 |
});
|
382 |
|
| - |
|
383 |
// ModelType
|
| - |
|
384 |
ModelType modelTypeCollectionACommentaire = new ModelType();
|
| - |
|
385 |
modelTypeCollectionACommentaire.setRoot("collectionsACommentaire");
|
| - |
|
386 |
modelTypeCollectionACommentaire.setTotalName("nbElements");
|
| - |
|
387 |
modelTypeCollectionACommentaire.addField("ccac_id_commentaire");
|
| - |
|
388 |
modelTypeCollectionACommentaire.addField("ccac_id_collection");
|
| - |
|
389 |
modelTypeCollectionACommentaire.addField("ccac_truk_type");
|
| - |
|
390 |
modelTypeCollectionACommentaire.addField("ccm_id_commentaire");
|
| - |
|
391 |
modelTypeCollectionACommentaire.addField("ccm_titre");
|
| - |
|
392 |
modelTypeCollectionACommentaire.addField("ccm_texte");
|
| - |
|
393 |
modelTypeCollectionACommentaire.addField("ccm_ponderation");
|
| - |
|
394 |
modelTypeCollectionACommentaire.addField("ccm_mark_public");
|
| - |
|
395 |
modelTypeCollectionACommentaire.addField("ccm_ce_pere");
|
| - |
|
396 |
modelTypeCollectionACommentaire.addField("ccm_ce_projet");
|
| - |
|
397 |
|
| Line -... |
Line 398... |
| - |
|
398 |
// Proxy
|
| 392 |
|
399 |
ProxyCollectionACommentaire<ModelData> proxyCollectionACommentaire = new ProxyCollectionACommentaire<ModelData>(null, collection.getId());
|
| - |
|
400 |
|
| - |
|
401 |
// Colonnes
|
| 393 |
RowNumberer pluginLigneNumero = new RowNumberer();
|
402 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
| Line 394... |
Line 403... |
| 394 |
|
403 |
|
| 395 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
404 |
RowNumberer pluginLigneNumero = new RowNumberer();
|
| 396 |
colonnes.add(pluginLigneNumero);
|
405 |
colonnes.add(pluginLigneNumero);
|
| 397 |
|
406 |
|
| 398 |
colonnes.add(creerColonneType());
|
407 |
colonnes.add(creerColonneType());
|
| Line 399... |
Line 408... |
| 399 |
colonnes.add(new ColumnConfig("_titre_", i18nC.commentaireTitre(), 150));
|
408 |
colonnes.add(new ColumnConfig("_titre_", i18nC.commentaireTitre(), 150));
|
| 400 |
colonnes.add(new ColumnConfig("_texte_", i18nC.commentaireTexte(), 75));
|
409 |
colonnes.add(new ColumnConfig("_texte_", i18nC.commentaireTexte(), 75));
|
| - |
|
410 |
colonnes.add(new ColumnConfig("_ponderation_", i18nC.commentairePonderation(), 35));
|
| Line 401... |
Line 411... |
| 401 |
colonnes.add(new ColumnConfig("_ponderation_", i18nC.commentairePonderation(), 35));
|
411 |
colonnes.add(creerColonneAcces());
|
| - |
|
412 |
|
| - |
|
413 |
// Modèle de colonnes
|
| - |
|
414 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
| - |
|
415 |
GridSelectionModel<ModelData> modeleDeSelection = new GridSelectionModel<ModelData>();
|
| - |
|
416 |
|
| 402 |
colonnes.add(creerColonneAcces());
|
417 |
HashMap<String, String> virtualFields = new HashMap<String, String>();
|
| - |
|
418 |
virtualFields.put("_titre_", "ccm_titre");
|
| - |
|
419 |
virtualFields.put("_texte_", "ccm_texte");
|
| - |
|
420 |
virtualFields.put("_ponderation_", "ccm_ponderation");
|
| 403 |
|
421 |
virtualFields.put("_type_", "ccac_truk_type");
|
| 404 |
GridSelectionModel<CollectionACommentaire> modeleDeSelection = new GridSelectionModel<CollectionACommentaire>();
|
422 |
virtualFields.put("_public_", "ccm_mark_public");
|
| 405 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
423 |
virtualFields.put("_etat_", "");
|
| 406 |
|
424 |
|
| 407 |
EditorGrid<CollectionACommentaire> grille = new EditorGrid<CollectionACommentaire>(storeGrille, modeleDeColonnes);
|
425 |
// Grille
|
| 408 |
grille.setHeight("100%");
|
426 |
grillePaginable = new GrillePaginable<ModelData>(modelTypeCollectionACommentaire, virtualFields, proxyCollectionACommentaire, colonnes, modeleDeColonnes);
|
| 409 |
grille.setBorders(true);
|
427 |
grillePaginable.getGrille().setBorders(true);
|
| - |
|
428 |
grillePaginable.getGrille().setSelectionModel(modeleDeSelection);
|
| - |
|
429 |
grillePaginable.getGrille().addPlugin(pluginLigneNumero);
|
| - |
|
430 |
grillePaginable.getGrille().getView().setForceFit(true);
|
| - |
|
431 |
grillePaginable.getGrille().setAutoExpandColumn("_titre_");
|
| - |
|
432 |
grillePaginable.getGrille().setStripeRows(true);
|
| - |
|
433 |
grillePaginable.getGrille().setTrackMouseOver(true);
|
| - |
|
434 |
|
| - |
|
435 |
// Rajouter des écouteurs
|
| - |
|
436 |
grillePaginable.getStore().addListener(Store.Update, new Listener<StoreEvent<ModelData>>() {
|
| Line 410... |
Line 437... |
| 410 |
grille.setSelectionModel(modeleDeSelection);
|
437 |
public void handleEvent(StoreEvent<ModelData> ce) {
|
| 411 |
grille.addPlugin(pluginLigneNumero);
|
438 |
if (ce.getRecord().isModified("_type_") && ce.getModel().get("_etat_") == null || !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
| Line 412... |
Line 439... |
| 412 |
grille.getView().setForceFit(true);
|
439 |
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
|
| 413 |
grille.setAutoExpandColumn("_titre_");
|
440 |
}
|
| 414 |
grille.setStripeRows(true);
|
441 |
}
|
| Line 446... |
Line 473... |
| 446 |
}
|
473 |
}
|
| 447 |
return retour;
|
474 |
return retour;
|
| 448 |
}
|
475 |
}
|
| 449 |
};
|
476 |
};
|
| Line 450... |
Line 477... |
| 450 |
|
477 |
|
| 451 |
GridCellRenderer<CollectionACommentaire> typeRendu = new GridCellRenderer<CollectionACommentaire>() {
|
478 |
GridCellRenderer<ModelData> typeRendu = new GridCellRenderer<ModelData>() {
|
| 452 |
public String render(CollectionACommentaire model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<CollectionACommentaire> store, Grid<CollectionACommentaire> grid) {
|
479 |
public String render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store, Grid<ModelData> grid) {
|
| 453 |
String type = model.get("_type_");
|
480 |
String type = model.get("_type_");
|
| 454 |
if (typeCombo.getStore() != null && type != null && (type.matches("[0-9]+") || type.contains(aDonnee.SEPARATEUR_VALEURS))) {
|
481 |
if (typeCombo.getStore() != null && type != null && (type.matches("[0-9]+") || type.contains(aDonnee.SEPARATEUR_VALEURS))) {
|
| 455 |
type = typeCombo.formaterIdentifiantsEnTexte(type);
|
482 |
type = typeCombo.formaterIdentifiantsEnTexte(type);
|
| 456 |
model.set("_type_", type);
|
483 |
model.set("_type_", type);
|
| Line 463... |
Line 490... |
| 463 |
typeColonne.setRenderer(typeRendu);
|
490 |
typeColonne.setRenderer(typeRendu);
|
| 464 |
return typeColonne;
|
491 |
return typeColonne;
|
| 465 |
}
|
492 |
}
|
| Line 466... |
Line 493... |
| 466 |
|
493 |
|
| 467 |
private ColumnConfig creerColonneAcces() {
|
494 |
private ColumnConfig creerColonneAcces() {
|
| 468 |
GridCellRenderer<CollectionACommentaire> accesRendu = new GridCellRenderer<CollectionACommentaire>() {
|
495 |
GridCellRenderer<ModelData> accesRendu = new GridCellRenderer<ModelData>() {
|
| - |
|
496 |
public String render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store, Grid<ModelData> grid) {
|
| 469 |
public String render(CollectionACommentaire model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<CollectionACommentaire> store, Grid<CollectionACommentaire> grid) {
|
497 |
CollectionACommentaire cac = new CollectionACommentaire(model, true);
|
| 470 |
String acces = (model.getCommentaire().etrePublic() ? i18nC.donneePublic() : i18nC.donneePrivee());
|
498 |
String acces = (cac.getCommentaire().etrePublic() ? i18nC.donneePublic() : i18nC.donneePrivee());
|
| 471 |
model.set("_public_", acces);
|
499 |
model.set("_public_", acces);
|
| 472 |
return acces;
|
500 |
return acces;
|
| 473 |
}
|
501 |
}
|
| 474 |
};
|
502 |
};
|
| Line 543... |
Line 571... |
| 543 |
mediateur.ajouterCollectionACommentaire(this, collectionId, commentairesAjoutes);
|
571 |
mediateur.ajouterCollectionACommentaire(this, collectionId, commentairesAjoutes);
|
| 544 |
}
|
572 |
}
|
| 545 |
} else if (type.equals("commentaire_modifiee")) {
|
573 |
} else if (type.equals("commentaire_modifiee")) {
|
| 546 |
if (info.getDonnee(0) != null) {
|
574 |
if (info.getDonnee(0) != null) {
|
| 547 |
Commentaire commentaire = (Commentaire) info.getDonnee(0);
|
575 |
Commentaire commentaire = (Commentaire) info.getDonnee(0);
|
| 548 |
CollectionACommentaire commentaireDansGrille = grille.getStore().findModel("id_commentaire", commentaire.getId());
|
576 |
ModelData commentaireDansGrille = grille.getStore().findModel("ccm_id_commentaire", commentaire.getId());
|
| 549 |
int index = grille.getStore().indexOf(commentaireDansGrille);
|
577 |
int index = grille.getStore().indexOf(commentaireDansGrille);
|
| 550 |
grille.getStore().remove(commentaireDansGrille);
|
578 |
grille.getStore().remove(commentaireDansGrille);
|
| 551 |
String typeCommentaire = (String) commentaireDansGrille.get("_type_");
|
579 |
String typeCommentaire = (String) commentaireDansGrille.get("_type_");
|
| 552 |
ajouterDansGrille(commentaire, typeCommentaire, index);
|
580 |
ajouterDansGrille(commentaire, typeCommentaire, index);
|
| 553 |
}
|
581 |
}
|
| Line 578... |
Line 606... |
| 578 |
|
606 |
|
| 579 |
public void collecter() {
|
607 |
public void collecter() {
|
| 580 |
if (etreAccede()) {
|
608 |
if (etreAccede()) {
|
| 581 |
int nbreCommentaire = grille.getStore().getCount();
|
609 |
int nbreCommentaire = grille.getStore().getCount();
|
| 582 |
for (int i = 0; i < nbreCommentaire; i++) {
|
610 |
for (int i = 0; i < nbreCommentaire; i++) {
|
| - |
|
611 |
ModelData relationCollectionACommentaire = grille.getStore().getAt(i);
|
| 583 |
CollectionACommentaire relationCollectionACommentaire = grille.getStore().getAt(i);
|
612 |
CollectionACommentaire cac = new CollectionACommentaire(relationCollectionACommentaire, false);
|
| 584 |
if (relationCollectionACommentaire.get("_etat_") != null) {
|
613 |
if (relationCollectionACommentaire.get("_etat_") != null) {
|
| 585 |
if (relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) {
|
614 |
if (relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) {
|
| 586 |
corrigerChampsGrille(relationCollectionACommentaire);// Nous modifions l'id_type
|
615 |
corrigerChampsGrille(cac);// Nous modifions l'id_type
|
| 587 |
commentairesModifies.put("id"+idGenere++, relationCollectionACommentaire);
|
616 |
commentairesModifies.put("id"+idGenere++, cac);
|
| 588 |
}
|
617 |
}
|
| 589 |
if (relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
618 |
if (relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
|
| 590 |
corrigerChampsGrille(relationCollectionACommentaire);// Nous modifions l'id_type
|
619 |
corrigerChampsGrille(cac);// Nous modifions l'id_type
|
| 591 |
commentairesAjoutes.put("id"+idGenere++, relationCollectionACommentaire);
|
620 |
commentairesAjoutes.put("id"+idGenere++, cac);
|
| 592 |
}
|
621 |
}
|
| 593 |
// Initialisation de la grille
|
622 |
// Initialisation de la grille
|
| 594 |
relationCollectionACommentaire.set("_etat_", "");
|
623 |
relationCollectionACommentaire.set("_etat_", "");
|
| 595 |
}
|
624 |
}
|
| Line 599... |
Line 628... |
| 599 |
}
|
628 |
}
|
| Line 600... |
Line 629... |
| 600 |
|
629 |
|
| 601 |
private void corrigerChampsGrille(CollectionACommentaire relationCollectionACommentaire) {
|
630 |
private void corrigerChampsGrille(CollectionACommentaire relationCollectionACommentaire) {
|
| 602 |
String type = relationCollectionACommentaire.get("_type_");
|
631 |
String type = relationCollectionACommentaire.get("_type_");
|
| - |
|
632 |
relationCollectionACommentaire.setType(typeCombo.formaterTexteEnIdentifiants(type));
|
| 603 |
relationCollectionACommentaire.setType(typeCombo.formaterTexteEnIdentifiants(type));
|
633 |
relationCollectionACommentaire.setIdCollection(collection.getId());
|
| Line 604... |
Line 634... |
| 604 |
}
|
634 |
}
|
| 605 |
|
635 |
|
| 606 |
public void soumettre() {
|
636 |
public void soumettre() {
|
| 607 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
637 |
if (mode.equals(Formulaire.MODE_MODIFIER)) {
|
| 608 |
if (commentairesAjoutes.size() == 0 && commentairesModifies.size() == 0 && commentairesSupprimes.size() == 0) {
|
638 |
if (commentairesAjoutes.size() == 0 && commentairesModifies.size() == 0 && commentairesSupprimes.size() == 0) {
|
| 609 |
InfoLogger.display("Modification des notes liées", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
|
639 |
InfoLogger.display("Modification des notes liées", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
|
| 610 |
} else {
|
640 |
} else {
|
| 611 |
mediateur.ajouterCollectionACommentaire(this, collection.getId(), commentairesAjoutes);
|
641 |
mediateur.ajouterCollectionACommentaire(this, collection.getId(), commentairesAjoutes);
|
| 612 |
mediateur.modifierCollectionACommentaire(this, commentairesModifies);
|
642 |
mediateur.modifierCollectionACommentaire(this, commentairesModifies);
|
| 613 |
mediateur.supprimerCollectionACommentaire(this, commentairesSupprimes);
|
643 |
mediateur.supprimerCollectionACommentaire(this, commentairesSupprimes);
|
| 614 |
}
|
644 |
}
|