Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 210 → Rev 211

/trunk/src/org/tela_botanica/client/vues/FormStructureVue.java
16,7 → 16,10
import org.tela_botanica.client.modeles.InterneValeurListe;
import org.tela_botanica.client.modeles.Personne;
import org.tela_botanica.client.modeles.Structure;
import org.tela_botanica.client.modeles.StructureAPersonne;
import org.tela_botanica.client.modeles.StructureAPersonneListe;
import org.tela_botanica.client.modeles.StructureConservation;
import org.tela_botanica.client.modeles.StructureListe;
import org.tela_botanica.client.modeles.StructureValorisation;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
25,6 → 28,7
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
99,10 → 103,8
 
private HiddenField<String> idStructureChp = null;
private StructureConservation conservation = null;
private StructureValorisation valorisation = null;
// Onglet IDENTIFICATION
private Structure identification;
private ListStore<Valeur> magazinLstpr = null;
private ComboBox<Valeur> comboLstpr = null;
private ListStore<Valeur> magazinLstpu = null;
129,12 → 131,14
private ComboBox<Valeur> comboPays;
 
// Onglet PERSONNEL
private EditorGrid<Personne> grillePersonnel = null;
private ListStore<Personne> personnelGrilleMagazin = null;
private ArrayList<StructureAPersonne> personnel;
private NumberField nbreTotalPersonneStructureChp = null;
private EditorGrid<StructureAPersonne> grillePersonnel = null;
private ListStore<StructureAPersonne> personnelGrilleMagazin = null;
private LabelField nbreTotalPersonnelChp = null;
private NumberField nbreTotalPersonneStructureChp = null;
 
// Onglet CONSERVATION
private StructureConservation conservation = null;
private RadioGroup formationMarkRGrpChp;
private RadioGroup interetFormationMarkRGrpChp;
private RadioGroup collectionCommuneMarkRGrpChp;
189,6 → 193,7
private RadioGroup materielConservationCeRGrpChp = null;
 
// Onglet VALORISATION
private StructureValorisation valorisation = null;
private RadioGroup actionMarkRGrpChp = null;
private ContentPanel actionTrukCp = null;
private CheckBoxGroup actionTrukCacGrpChp = null;
199,6 → 204,8
private TextField<String> publicationChp;
private ContentPanel materielConservationCp;
 
 
 
public FormStructureVue() {
//+-----------------------------------------------------------------------------------------------------------+
// Initialisation de variables
243,7 → 250,7
// Gestion du FORMULAIRE GÉNÉRAL
// Sélection de l'onglet par défaut
onglets.setSelection(valorisationOnglet);
onglets.setSelection(personnelOnglet);
// Ajout des onglets au formulaire général
structureFormPanneau.add(onglets);
284,7 → 291,7
} else if (mode == "MODIF") {
mediateur.modifierStructure(this, structure, conservation, valorisation);
}
GWT.log("Info Structure envoyées :\n"+valorisation.toString(), null);
GWT.log("Info Structure envoyées :\n"+conservation.toString(), null);
}
private StructureValorisation collecterStructureValorisation() {
351,7 → 358,7
private void peuplerStructureValorisation() {
if (valorisation != null) {
// ACTION
actionMarkRGrpChp.get((valorisation.getAction().equals("1") ? 0 : 1)).setValue((valorisation.getAction().equals("1") ? true : false));
actionMarkRGrpChp.get((valorisation.getAction().equals("1") ? 0 : 1)).setValue(true);
// ACTION INFO
peuplerCasesACocher(valorisation.getActionInfo(), actionTrukCacGrpChp, actionAutreChp);
363,13 → 370,13
peuplerCasesACocher(valorisation.getCollectionAutre(), autreCollectionTrukCacGrpChp, autreCollectionAutreChp);
// ACTION FUTURE
futureActionMarkRGrpChp.get((valorisation.getActionFuture().equals("1") ? 0 : 1)).setValue((valorisation.getActionFuture().equals("1") ? true : false));
futureActionMarkRGrpChp.get((valorisation.getActionFuture().equals("1") ? 0 : 1)).setValue(true);
// ACTION FUTURE INFO
futureActionChp.setValue(valorisation.getActionFutureInfo());
// RECHERCHE
rechercheMarkRGrpChp.get((valorisation.getRecherche().equals("1") ? 0 : 1)).setValue((valorisation.getRecherche().equals("1") ? true : false));
rechercheMarkRGrpChp.get((valorisation.getRecherche().equals("1") ? 0 : 1)).setValue(true);
// RECHERCHE PROVENANCE
peuplerCasesACocher(valorisation.getRechercheProvenance(), provenanceRechercheTrukCacGrpChp, provenanceRechercheAutreChp);
// RECHERCHE TYPE
376,14 → 383,16
peuplerCasesACocher(valorisation.getRechercheType(), typeRechercheTrukCacGrpChp, typeRechercheAutreChp);
 
// ACCÈS SANS MOTIF
sansMotifAccesMarkRGrpChp.get((valorisation.getAccesSansMotif().equals("1") ? 0 : 1)).setValue((valorisation.getAccesSansMotif().equals("1") ? true : false));
sansMotifAccesMarkRGrpChp.get((valorisation.getAccesSansMotif().equals("1") ? 0 : 1)).setValue(true);
// ACCÈS SANS MOTIF INFO
sansMotifAccesChp.setValue(valorisation.getAccesSansMotifInfo());
// VISITE AVEC MOTIF
avecMotifAccesMarkRGrpChp.get((valorisation.getVisiteAvecMotif().equals("1") ? 0 : 1)).setValue((valorisation.getVisiteAvecMotif().equals("1") ? true : false));
avecMotifAccesMarkRGrpChp.get((valorisation.getVisiteAvecMotif().equals("1") ? 0 : 1)).setValue(true);
// VISITE AVEC MOTIF INFO
avecMotifAccesChp.setValue(valorisation.getVisiteAvecMotifInfo());
valorisationOnglet.layout();
}
}
486,11 → 495,11
if (conservation != null) {
// FORMATION
// Bouton oui, à toujours l'index 0 donc on teste en fonction...
formationMarkRGrpChp.get((conservation.getFormation().equals("1") ? 0 : 1)).setValue((conservation.getFormation().equals("1") ? true : false));
formationMarkRGrpChp.get((conservation.getFormation().equals("1") ? 0 : 1)).setValue(true);
// FORMATION INFO
formationChp.setValue(conservation.getFormationInfo());
// FORMATION INTERET
interetFormationMarkRGrpChp.get((conservation.getFormationInteret().equals("1") ? 0 : 1)).setValue((conservation.getFormationInteret().equals("1") ? true : false));
interetFormationMarkRGrpChp.get((conservation.getFormationInteret().equals("1") ? 0 : 1)).setValue(true);
// STOCKAGE LOCAL
peuplerCasesACocher(conservation.getStockageLocal(), localStockageTrukCacGrpChp,localStockageAutreChp);
502,15 → 511,15
peuplerCasesACocher(conservation.getStockageParametre(), parametreStockageTrukCacGrpChp, parametreStockageAutreChp);
// COLLECTION COMMUNE
collectionCommuneMarkRGrpChp.get((conservation.getCollectionCommune().equals("1") ? 0 : 1)).setValue((conservation.getCollectionCommune().equals("1") ? true : false));
collectionCommuneMarkRGrpChp.get((conservation.getCollectionCommune().equals("1") ? 0 : 1)).setValue(true);
// COLLECTION AUTRE
peuplerCasesACocher(conservation.getCollectionAutre(), collectionAutreTrukCacGrpChp, collectionAutreAutreChp);
// ACCÈS CONTROLÉ
accesControleMarkRGrpChp.get((conservation.getAccesControle().equals("1") ? 0 : 1)).setValue((conservation.getAccesControle().equals("1") ? true : false));
accesControleMarkRGrpChp.get((conservation.getAccesControle().equals("1") ? 0 : 1)).setValue(true);
// RESTAURATION
restaurationMarkRGrpChp.get((conservation.getRestauration().equals("1") ? 0 : 1)).setValue((conservation.getRestauration().equals("1") ? true : false));
restaurationMarkRGrpChp.get((conservation.getRestauration().equals("1") ? 0 : 1)).setValue(true);
// RESTAURATION OPÉRATION
peuplerCasesACocher(conservation.getRestaurationOperation(), opRestauTrukCacGrpChp, opRestauAutreChp);
521,115 → 530,122
peuplerCasesACocher(conservation.getMaterielAutre(), autreMaterielTrukCacGrpChp, autreMaterielAutreChp);
// TRAITEMENT
traitementMarkRGrpChp.get((conservation.getTraitement().equals("1") ? 0 : 1)).setValue((conservation.getTraitement().equals("1") ? true : false));
traitementMarkRGrpChp.get((conservation.getTraitement().equals("1") ? 0 : 1)).setValue(true);
// TRAITEMENTS
peuplerCasesACocher(conservation.getTraitements(), traitementTrukCacGrpChp, traitementAutreChp);
// ACQUISITION COLLECTION
collectionAcquisitionMarkRGrpChp.get((conservation.getAcquisitionCollection().equals("1") ? 0 : 1)).setValue((conservation.getAcquisitionCollection().equals("1") ? true : false));
collectionAcquisitionMarkRGrpChp.get((conservation.getAcquisitionCollection().equals("1") ? 0 : 1)).setValue(true);
// ACQUISITION ECHANTILLON
echantillonAcquisitionMarkRGrpChp.get((conservation.getAcquisitionEchantillon().equals("1") ? 0 : 1)).setValue((conservation.getAcquisitionEchantillon().equals("1") ? true : false));
echantillonAcquisitionMarkRGrpChp.get((conservation.getAcquisitionEchantillon().equals("1") ? 0 : 1)).setValue(true);
// ACQUISITION TRAITEMENT
traitementAcquisitionMarkRGrpChp.get((conservation.getAcquisitionTraitement().equals("1") ? 0 : 1)).setValue((conservation.getAcquisitionTraitement().equals("1") ? true : false));
traitementAcquisitionMarkRGrpChp.get((conservation.getAcquisitionTraitement().equals("1") ? 0 : 1)).setValue(true);
// ACQUISITION TRAITEMENT POISON
peuplerCasesACocher(conservation.getAcquisitionTraitementPoison(), poisonTraitementTrukCacGrpChp, poisonTraitementAutreChp);
// ACQUISITION TRAITEMENT INSECTE
peuplerCasesACocher(conservation.getAcquisitionTraitementInsecte(), insecteTraitementTrukCacGrpChp, insecteTraitementAutreChp);
conservationOnglet.layout();
}
}
private Structure collecterStructureIdentification() {
// IDENTIFICATION
Structure structure = new Structure();
structure.setId(idStructureChp.getValue());
structure.setNom(nomStructureChp.getValue());
// Récupération de l'acronyme (= identifiant alternatif)
structure.setIdAlternatif(null);
if (comboAcronyme.getValue() != null) {
String typeAcronyme = comboAcronyme.getValue().getAbr();
if (typeAcronyme == "IH") {
structure.setIdAlternatif(typeAcronyme+"##"+ihChp.getValue());
} else if (typeAcronyme == "MNHN") {
structure.setIdAlternatif(typeAcronyme+"##"+mnhnChp.getValue());
if (identificationOnglet.getData("acces").equals(false)) {
return identification;
} else {
Structure structure = new Structure();
structure.setId(idStructureChp.getValue());
structure.setNom(nomStructureChp.getValue());
// Récupération de l'acronyme (= identifiant alternatif)
structure.setIdAlternatif(null);
if (comboAcronyme.getValue() != null) {
String typeAcronyme = comboAcronyme.getValue().getAbr();
if (typeAcronyme == "IH") {
structure.setIdAlternatif(typeAcronyme+"##"+ihChp.getValue());
} else if (typeAcronyme == "MNHN") {
structure.setIdAlternatif(typeAcronyme+"##"+mnhnChp.getValue());
}
}
}
// Récupération statut de la structure
structure.setTypePublic(null);
structure.setTypePrive(null);
if (comboTypeStructure.getValue() != null) {
String typeStructure = comboTypeStructure.getValue().getAbr();
if (typeStructure == "stpu" && comboLstpu.getValue() != null) {
structure.setTypePublic(comboLstpu.getValue().getId());
} else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
structure.setTypePrive(comboLstpr.getValue().getId());
// Récupération statut de la structure
structure.setTypePublic(null);
structure.setTypePrive(null);
if (comboTypeStructure.getValue() != null) {
String typeStructure = comboTypeStructure.getValue().getAbr();
if (typeStructure == "stpu" && comboLstpu.getValue() != null) {
structure.setTypePublic(comboLstpu.getValue().getId());
} else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
structure.setTypePrive(comboLstpr.getValue().getId());
}
}
structure.setDateFondation(dateFondationChp.getValue());
structure.setAdresse(adrChp.getValue());
structure.setCodePostal(cpChp.getValue());
structure.setVille(villeChp.getValue());
structure.setRegion(regionChp.getValue());
structure.setPays(null);
if (comboPays.getValue() != null) {
structure.setPays(comboPays.getValue().getAbreviation());
} else if (comboPays.getRawValue() != "") {
structure.setPays(comboPays.getRawValue());
}
structure.setTelephone(telChp.getValue());
structure.setFax(faxChp.getValue());
structure.setCourriel(emailChp.getValue());
structure.setUrl(Structure.URL_SITE, urlChp.getValue());
return structure;
}
structure.setDateFondation(dateFondationChp.getValue());
structure.setAdresse(adrChp.getValue());
structure.setCodePostal(cpChp.getValue());
structure.setVille(villeChp.getValue());
structure.setRegion(regionChp.getValue());
structure.setPays(null);
if (comboPays.getValue() != null) {
structure.setPays(comboPays.getValue().getAbreviation());
} else if (comboPays.getRawValue() != "") {
structure.setPays(comboPays.getRawValue());
}
structure.setTelephone(telChp.getValue());
structure.setFax(faxChp.getValue());
structure.setCourriel(emailChp.getValue());
structure.setUrl(Structure.URL_SITE, urlChp.getValue());
// CONSERVATION
return structure;
}
private void peuplerStructureIdentification(Structure str) {
idStructureChp.setValue(str.getId());
nomStructureChp.setValue(str.getNom());
if (!str.getIdAlternatif().isEmpty()) {
String[] acronyme = str.getIdAlternatif().split("##");
if (acronyme[0].matches("^IH$")) {
comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeIH());
ihChp.setValue(acronyme[1]);
} else if (acronyme[0].matches("^MNHN$")) {
comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeMNHN());
mnhnChp.setValue(acronyme[1]);
private void peuplerStructureIdentification() {
if (identification != null) {
idStructureChp.setValue(identification.getId());
nomStructureChp.setValue(identification.getNom());
if (!identification.getIdAlternatif().isEmpty()) {
String[] acronyme = identification.getIdAlternatif().split("##");
if (acronyme[0].matches("^IH$")) {
comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeIH());
ihChp.setValue(acronyme[1]);
} else if (acronyme[0].matches("^MNHN$")) {
comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeMNHN());
mnhnChp.setValue(acronyme[1]);
}
}
}
if (!str.getTypePrive().isEmpty()) {
if (str.getTypePrive().matches("^[0-9]+$")) {
comboTypeStructure.setValue(InterneValeurListe.getTypePrivee());
comboLstpr.setValue(comboLstpr.getStore().findModel("id_valeur", str.getTypePrive()));
if (!identification.getTypePrive().isEmpty()) {
if (identification.getTypePrive().matches("^[0-9]+$")) {
comboTypeStructure.setValue(InterneValeurListe.getTypePrivee());
comboLstpr.setValue(comboLstpr.getStore().findModel("id_valeur", identification.getTypePrive()));
}
} else if (!identification.getTypePublic().isEmpty()) {
if (identification.getTypePublic().matches("^[0-9]+$")) {
comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
}
}
} else if (!str.getTypePublic().isEmpty()) {
if (str.getTypePublic().matches("^[0-9]+$")) {
comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", str.getTypePublic()));
dateFondationChp.setValue(identification.getDateFondation());
adrChp.setValue(identification.getAdresse());
cpChp.setValue(identification.getCodePostal());
villeChp.setValue(identification.getVille());
regionChp.setValue(identification.getRegion());
if (identification.getPays().matches("^[A-Z]{2}$")) {
comboPays.setValue(comboPays.getStore().findModel("abreviation", identification.getPays()));
} else {
comboPays.setRawValue(identification.getPays());
}
telChp.setValue(identification.getTelephone());
faxChp.setValue(identification.getFax());
emailChp.setValue(identification.getCourriel());
urlChp.setValue(identification.getUrl("WEB"));
identificationOnglet.layout();
}
dateFondationChp.setValue(str.getDateFondation());
adrChp.setValue(str.getAdresse());
cpChp.setValue(str.getCodePostal());
villeChp.setValue(str.getVille());
regionChp.setValue(str.getRegion());
if (str.getPays().matches("^[A-Z]{2}$")) {
comboPays.setValue(comboPays.getStore().findModel("abreviation", str.getPays()));
} else {
comboPays.setRawValue(str.getPays());
}
telChp.setValue(str.getTelephone());
faxChp.setValue(str.getFax());
emailChp.setValue(str.getCourriel());
urlChp.setValue(str.getUrl("WEB"));
}
private TabItem creerOngletValorisation() {
837,11 → 853,43
return conservationOnglet;
}
private void peuplerStructurePersonnel() {
if (identification != null) {
// NBRE PERSONNE
nbreTotalPersonneStructureChp.setValue(identification.getNbrePersonne());
}
if (personnel != null) {
personnelGrilleMagazin.removeAll();
personnelGrilleMagazin.add(personnel);
grillePersonnel.getColumnModel().getColumn(1).getEditor().fireEvent(Events.StateSave);
/*
int nbreLigne = personnelGrilleMagazin.getCount();
for (int i = 0; i < nbreLigne; i++) {
}
*/
personnelOnglet.layout();
}
}
private TabItem creerOngletPersonnel() {
personnelOnglet = new TabItem();
personnelOnglet.setText("Personnel");
personnelOnglet.setScrollMode(Scroll.AUTO);
personnelOnglet.setLayout(creerFormLayout(400, LabelAlign.LEFT, null));
personnelOnglet.setData("acces", false); // Permet de savoir si l'onblet a été accédé par l'utilisateur
personnelOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
personnelOnglet.setData("acces", true);
peuplerStructurePersonnel();
}
 
});
nbreTotalPersonneStructureChp = new NumberField();
nbreTotalPersonneStructureChp.setFieldLabel("Nombre de personne travaillant dans l'institution");
856,22 → 904,23
nbreTotalPersonnelChp.setLabelSeparator(":");
nbreTotalPersonnelChp.setValue(""+grillePersonnel.getStore().getCount());
personnelOnglet.add(nbreTotalPersonnelChp);
 
return personnelOnglet;
}
private ContentPanel creerGrillePersonnel() {
ContentPanel cp = new ContentPanel();
List<Personne> personnes = new ArrayList<Personne>();
personnes.add(new Personne(Valeur.FONCTION_DIRECTEUR));
personnes.add(new Personne(Valeur.FONCTION_CONSERVATEUR));
List<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
personnes.add(new StructureAPersonne(Valeur.FONCTION_DIRECTEUR));
personnes.add(new StructureAPersonne(Valeur.FONCTION_CONSERVATEUR));
personnelGrilleMagazin = new ListStore<Personne>();
personnelGrilleMagazin = new ListStore<StructureAPersonne>();
personnelGrilleMagazin.add(personnes);
 
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
 
CheckBoxSelectionModel<Personne> sm = new CheckBoxSelectionModel<Personne>();
CheckBoxSelectionModel<StructureAPersonne> sm = new CheckBoxSelectionModel<StructureAPersonne>();
configs.add(sm.getColumn());
ColumnConfig column = new ColumnConfig("ce_truk_fonction", "Fonction", 100);
885,25 → 934,52
comboLiFonction.setDisplayField("nom");
//comboLiStatut.setEmptyText("Sélectionez une fonction...");
comboLiFonction.setStore(magazinLiFonction);
/*
comboLiFonction.addListener(Events.Blur, new Listener<BaseEvent>() {
 
@Override
public void handleEvent(BaseEvent be) {
//grillePersonnel..comboLiFonction.getRawValue();
}
});*/
CellEditor fonctionEditor = new CellEditor(comboLiFonction) {
@Override
public Object preProcessValue(Object value) {
if (value == null) {
return value;
public Object preProcessValue(Object valeur) {
if (valeur == null) {
return valeur;
}
//GWT.log("pre : "+value.toString(), null);
return comboLiFonction.getStore().findModel("nom", (String) value);
GWT.log("pre : "+valeur.toString(), null);
Object retour = null;
if (((String) valeur).matches("^[0-9]+$")) {
retour = comboLiFonction.getStore().findModel("id_valeur", (String) valeur);
} else {
retour = comboLiFonction.getStore().findModel("nom", (String) valeur);
}
GWT.log("pre - retour : \n"+retour.toString(), null);
return retour;
}
@Override
public Object postProcessValue(Object value) {
if (value == null) {
return value;
public Object postProcessValue(Object valeur) {
if (valeur == null) {
// Si la combobox n'a pas été utilisé, nous renvoyons la valeur brute saisie par l'utilisateur
return this.getField().getRawValue();
} else {
this.setUpdateEl(false);
GWT.log("post : \n"+valeur.toString(), null);
if (valeur instanceof String && ((String) valeur).matches("^[0-9]+$")) {
GWT.log("ici", null);
return (comboLiFonction.getStore().findModel("id_valeur", (String) valeur)).getNom();
} else {
String nom = (((Valeur) valeur).getNom());
GWT.log("la "+nom, null);
return nom;
}
}
//GWT.log("post : "+value.toString(), null);
return ((Valeur) value).get("nom");
}
}
};
column.setEditor(fonctionEditor);
configs.add(column);
930,7 → 1006,7
column.setEditor(new CellEditor(nomChp));
configs.add(column);
 
column = new ColumnConfig("tel", "Téléphone", 100);
column = new ColumnConfig("telephone", "Téléphone fixe", 100);
TextField<String> telChp = new TextField<String>();
column.setEditor(new CellEditor(telChp));
configs.add(column);
979,7 → 1055,7
column.setEditor(statutEditor);
configs.add(column);
column = new ColumnConfig("tps_w", "Temps travail", 100);
column = new ColumnConfig("travail", "Temps travail", 100);
column.setNumberFormat(NumberFormat.getFormat("##"));
NumberField tpsWChp = new NumberField();
tpsWChp.setFormat(NumberFormat.getFormat("##"));
987,15 → 1063,15
column.setEditor(new CellEditor(tpsWChp));
configs.add(column);
column = new ColumnConfig("specialites", "Spécialités botaniques", 150);
column = new ColumnConfig("specialite", "Spécialité principale", 150);
TextField<String> speChp = new TextField<String>();
column.setEditor(new CellEditor(speChp));
configs.add(column);
CheckColumnConfig checkColumn = new CheckColumnConfig("mark_contact", "Contact ?", 60);
CheckColumnConfig checkColumn = new CheckColumnConfig("contact", "Contact ?", 60);
configs.add(checkColumn);
ContentPanel cp = new ContentPanel();
cp.setHeading("Personnes travaillant sur les collections");
cp.setIconStyle("icone-table");
cp.setScrollMode(Scroll.AUTO);
1009,7 → 1085,7
ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
@Override
public void componentSelected(ToolBarEvent ce) {
Personne personne = new Personne();
StructureAPersonne personne = new StructureAPersonne();
grillePersonnel.stopEditing();
personnelGrilleMagazin.insert(personne, 0);
grillePersonnel.startEditing(0, 0);
1041,15 → 1117,17
 
ColumnModel cm = new ColumnModel(configs);
grillePersonnel = new EditorGrid<Personne>(personnelGrilleMagazin, cm);
grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
grillePersonnel.setBorders(true);
grillePersonnel.setSelectionModel(sm);
grillePersonnel.addPlugin(sm);
grillePersonnel.addPlugin(checkColumn);
grillePersonnel.setAutoExpandColumn("specialites");
grillePersonnel.setAutoExpandColumn("specialite");
grillePersonnel.setStripeRows(true);
grillePersonnel.setTrackMouseOver(true);
cp.add(grillePersonnel);
return cp;
return cp;
}
private TabItem creerOngletIdentification() {
1059,7 → 1137,15
identificationOnglet.setId("identification");
identificationOnglet.setText("Identification");
identificationOnglet.setLayout(new FormLayout());
 
identificationOnglet.setData("acces", false);
identificationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
identificationOnglet.setData("acces", true);
peuplerStructureIdentification();
}
});
//+-----------------------------------------------------------------------------------------------------------+
// Champs cachés
idStructureChp = new HiddenField<String>();
1480,10 → 1566,10
}
// Nous affichons/cachons les composant de la liste
final int tailleMax = composants.size();
final int nbreComposants = composants.size();
//GWT.log("Id : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax, null);
//Window.alert("Radio grp nom : "+radioGroupeNom+" - Id btn : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax);
for (int i = 0; i < tailleMax; i++) {
for (int i = 0; i < nbreComposants; i++) {
// En fonction du type de bouton cliquer, on affiche ou cache les champs
String type = radioBtn.getBoxLabel().toLowerCase();
//GWT.log(type, null);
1559,146 → 1645,167
}
public void rafraichir(Object nouvelleDonnees) {
if (nouvelleDonnees instanceof Information) {
Information info = (Information) nouvelleDonnees;
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
GWT.log(info.getMessages().toString(), null);
}
if (info.getType().equals("modif_structure")) {
Info.display("Modification d'une institution", info.toString());
} else if (info.getType().equals("ajout_structure")) {
Info.display("Ajout d'une Institution", info.toString());
} else if (info.getType().equals("selection_structure")) {
Info.display("Modification d'une institution", info.toString());
mode = "MODIF";
GWT.log("Mode du formulaire : "+mode, null);
String titre = i18nC.titreModifFormStructurePanneau();
if (info.getDonnee(0) != null) {
Structure str = (Structure) info.getDonnee(0);
titre += " - ID : "+str.getId();
peuplerStructureIdentification(str);
try {
if (nouvelleDonnees instanceof Information) {
Information info = (Information) nouvelleDonnees;
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
GWT.log(info.getMessages().toString(), null);
}
if (info.getDonnee(1) != null) {
conservation = (StructureConservation) info.getDonnee(1);
if (onglets.getSelectedItem().equals(conservationOnglet)) {
peuplerStructureConservation();
if (info.getType().equals("modif_structure")) {
Info.display("Modification d'une institution", info.toString());
} else if (info.getType().equals("ajout_structure")) {
Info.display("Ajout d'une Institution", info.toString());
} else if (info.getType().equals("selection_structure")) {
Info.display("Modification d'une institution", info.toString());
mode = "MODIF";
GWT.log("Mode du formulaire : "+mode, null);
String titre = i18nC.titreModifFormStructurePanneau();
if (info.getDonnee(0) != null) {
identification = (Structure) info.getDonnee(0);
if (onglets.getSelectedItem().equals(identificationOnglet)) {
peuplerStructureIdentification();
}
// Composition du titre
titre += " - ID : "+identification.getId();
}
}
if (info.getDonnee(2) != null) {
valorisation = (StructureValorisation) info.getDonnee(2);
if (valorisation != null) {
GWT.log(valorisation.toString(), null);
if (onglets.getSelectedItem().equals(valorisationOnglet)) {
peuplerStructureValorisation();
if (info.getDonnee(1) != null) {
conservation = (StructureConservation) info.getDonnee(1);
if (onglets.getSelectedItem().equals(conservationOnglet)) {
peuplerStructureConservation();
}
}
}
structureFormPanneau.setHeading(titre);
}
} else if (nouvelleDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvelleDonnees;
List<Valeur> liste = new ArrayList<Valeur>();
for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
liste.add(listeValeurs.get(it.next()));
}
// Test pour savoir si la liste contient des éléments
if (liste.size() > 0) {
Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
if (listeValeurs.getId().equals(config.getListeId("stpr"))) {
magazinLstpr.removeAll();
magazinLstpr.add(liste);
comboLstpr.setStore(magazinLstpr);
}
if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
magazinLstpu.removeAll();
magazinLstpu.add(liste);
comboLstpu.setStore(magazinLstpu);
}
if (listeValeurs.getId().equals(config.getListeId("statut"))) {
magazinLiStatut.removeAll();
magazinLiStatut.add(liste);
comboLiStatut.setStore(magazinLiStatut);
}
if (listeValeurs.getId().equals(config.getListeId("fonction"))) {
magazinLiFonction.removeAll();
magazinLiFonction.add(liste);
comboLiFonction.setStore(magazinLiFonction);
}
if (listeValeurs.getId().equals(config.getListeId("pays"))) {
magazinPays.removeAll();
magazinPays.add(liste);
comboPays.setStore(magazinPays);
}
if (listeValeurs.getId().equals(config.getListeId("localStockage"))) {
localStockageAutreChp = new TextField<String>();
creerChoixMultipleCac(localStockageTrukCp, localStockageTrukCacGrpChp, listeValeurs, localStockageAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("meubleStockage"))) {
meubleStockageAutreChp = new TextField<String>();
creerChoixMultipleCac(meubleStockageTrukCp, meubleStockageTrukCacGrpChp, listeValeurs, meubleStockageAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("parametreStockage"))) {
parametreStockageAutreChp = new TextField<String>();
creerChoixMultipleCac(parametreStockageTrukCp, parametreStockageTrukCacGrpChp, listeValeurs, parametreStockageAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("autreCollection"))) {
if (collectionAutreTrukCp.getItemByItemId("collectionAutreTrukCacGrpChp") == null) {
collectionAutreTrukCacGrpChp.setId("collectionAutreTrukCacGrpChp");
collectionAutreAutreChp = new TextField<String>();
creerChoixMultipleCac(collectionAutreTrukCp, collectionAutreTrukCacGrpChp, listeValeurs, collectionAutreAutreChp);
if (info.getDonnee(2) != null) {
valorisation = (StructureValorisation) info.getDonnee(2);
if (valorisation != null) {
if (onglets.getSelectedItem().equals(valorisationOnglet)) {
peuplerStructureValorisation();
}
}
}
if (autreCollectionTrukCp.getItemByItemId("autreCollectionTrukCacGrpChp") == null) {
autreCollectionTrukCacGrpChp.setId("autreCollectionTrukCacGrpChp");
autreCollectionAutreChp = new TextField<String>();
creerChoixMultipleCac(autreCollectionTrukCp, autreCollectionTrukCacGrpChp, listeValeurs, autreCollectionAutreChp);
structureFormPanneau.setHeading(titre);
} else if (info.getType().equals("liste_structure_a_personne")) {
if (info.getDonnee(0) != null) {
StructureAPersonneListe personnes = (StructureAPersonneListe) info.getDonnee(0);
personnel = new ArrayList<StructureAPersonne>();
for (Iterator<String> it = personnes.keySet().iterator(); it.hasNext();) {
String index = it.next();
personnes.get(index).set("fonction", magazinLiFonction.findModel("id_valeur", personnes.get(index).getFonction()).getNom());
personnel.add(personnes.get(index));
}
//GWT.log(personnel.toString(), null);
if (onglets.getSelectedItem().equals(personnelOnglet)) {
peuplerStructurePersonnel();
}
}
}
if (listeValeurs.getId().equals(config.getListeId("opRestau"))) {
opRestauAutreChp = new TextField<String>();
creerChoixMultipleCac(opRestauTrukCp, opRestauTrukCacGrpChp, listeValeurs, opRestauAutreChp);
} else if (nouvelleDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvelleDonnees;
List<Valeur> liste = new ArrayList<Valeur>();
for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
liste.add(listeValeurs.get(it.next()));
}
if (listeValeurs.getId().equals(config.getListeId("onep"))) {
creerChoixUniqueBoutonRadio(materielConservationCeRGrpChp, listeValeurs);
materielConservationCp.add(materielConservationCeRGrpChp);
materielConservationCp.layout();
}
if (listeValeurs.getId().equals(config.getListeId("autreMateriel"))) {
autreMaterielAutreChp = new TextField<String>();
creerChoixMultipleCac(autreMaterielTrukCp, autreMaterielTrukCacGrpChp, listeValeurs, autreMaterielAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("poisonTraitement"))) {
poisonTraitementAutreChp = new TextField<String>();
creerChoixMultipleCac(poisonTraitementTrukCp, poisonTraitementTrukCacGrpChp, listeValeurs, poisonTraitementAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("insecteTraitement"))) {
if (traitementTrukCp.getItemByItemId("traitementTrukCacGrpChp") == null) {
traitementTrukCacGrpChp.setId("traitementTrukCacGrpChp");
traitementAutreChp = new TextField<String>();
creerChoixMultipleCac(traitementTrukCp, traitementTrukCacGrpChp, listeValeurs, traitementAutreChp);
// Test pour savoir si la liste contient des éléments
if (liste.size() > 0) {
Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
if (listeValeurs.getId().equals(config.getListeId("stpr"))) {
magazinLstpr.removeAll();
magazinLstpr.add(liste);
comboLstpr.setStore(magazinLstpr);
}
if (insecteTraitementTrukCp.getItemByItemId("insecteTraitementTrukCacGrpChp") == null) {
insecteTraitementTrukCacGrpChp.setId("insecteTraitementTrukCacGrpChp");
insecteTraitementAutreChp = new TextField<String>();
creerChoixMultipleCac(insecteTraitementTrukCp, insecteTraitementTrukCacGrpChp, listeValeurs, insecteTraitementAutreChp);
if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
magazinLstpu.removeAll();
magazinLstpu.add(liste);
comboLstpu.setStore(magazinLstpu);
}
if (listeValeurs.getId().equals(config.getListeId("statut"))) {
magazinLiStatut.removeAll();
magazinLiStatut.add(liste);
comboLiStatut.setStore(magazinLiStatut);
}
if (listeValeurs.getId().equals(config.getListeId("fonction"))) {
magazinLiFonction.removeAll();
magazinLiFonction.add(liste);
comboLiFonction.setStore(magazinLiFonction);
}
if (listeValeurs.getId().equals(config.getListeId("pays"))) {
magazinPays.removeAll();
magazinPays.add(liste);
comboPays.setStore(magazinPays);
}
if (listeValeurs.getId().equals(config.getListeId("localStockage"))) {
localStockageAutreChp = new TextField<String>();
creerChoixMultipleCac(localStockageTrukCp, localStockageTrukCacGrpChp, listeValeurs, localStockageAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("meubleStockage"))) {
meubleStockageAutreChp = new TextField<String>();
creerChoixMultipleCac(meubleStockageTrukCp, meubleStockageTrukCacGrpChp, listeValeurs, meubleStockageAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("parametreStockage"))) {
parametreStockageAutreChp = new TextField<String>();
creerChoixMultipleCac(parametreStockageTrukCp, parametreStockageTrukCacGrpChp, listeValeurs, parametreStockageAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("autreCollection"))) {
if (collectionAutreTrukCp.getItemByItemId("collectionAutreTrukCacGrpChp") == null) {
collectionAutreTrukCacGrpChp.setId("collectionAutreTrukCacGrpChp");
collectionAutreAutreChp = new TextField<String>();
creerChoixMultipleCac(collectionAutreTrukCp, collectionAutreTrukCacGrpChp, listeValeurs, collectionAutreAutreChp);
}
if (autreCollectionTrukCp.getItemByItemId("autreCollectionTrukCacGrpChp") == null) {
autreCollectionTrukCacGrpChp.setId("autreCollectionTrukCacGrpChp");
autreCollectionAutreChp = new TextField<String>();
creerChoixMultipleCac(autreCollectionTrukCp, autreCollectionTrukCacGrpChp, listeValeurs, autreCollectionAutreChp);
}
}
if (listeValeurs.getId().equals(config.getListeId("opRestau"))) {
opRestauAutreChp = new TextField<String>();
creerChoixMultipleCac(opRestauTrukCp, opRestauTrukCacGrpChp, listeValeurs, opRestauAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("onep"))) {
creerChoixUniqueBoutonRadio(materielConservationCeRGrpChp, listeValeurs);
materielConservationCp.add(materielConservationCeRGrpChp);
materielConservationCp.layout();
}
if (listeValeurs.getId().equals(config.getListeId("autreMateriel"))) {
autreMaterielAutreChp = new TextField<String>();
creerChoixMultipleCac(autreMaterielTrukCp, autreMaterielTrukCacGrpChp, listeValeurs, autreMaterielAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("poisonTraitement"))) {
poisonTraitementAutreChp = new TextField<String>();
creerChoixMultipleCac(poisonTraitementTrukCp, poisonTraitementTrukCacGrpChp, listeValeurs, poisonTraitementAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("insecteTraitement"))) {
if (traitementTrukCp.getItemByItemId("traitementTrukCacGrpChp") == null) {
traitementTrukCacGrpChp.setId("traitementTrukCacGrpChp");
traitementAutreChp = new TextField<String>();
creerChoixMultipleCac(traitementTrukCp, traitementTrukCacGrpChp, listeValeurs, traitementAutreChp);
}
if (insecteTraitementTrukCp.getItemByItemId("insecteTraitementTrukCacGrpChp") == null) {
insecteTraitementTrukCacGrpChp.setId("insecteTraitementTrukCacGrpChp");
insecteTraitementAutreChp = new TextField<String>();
creerChoixMultipleCac(insecteTraitementTrukCp, insecteTraitementTrukCacGrpChp, listeValeurs, insecteTraitementAutreChp);
}
}
if (listeValeurs.getId().equals(config.getListeId("actionValorisation"))) {
actionAutreChp = new TextField<String>();
creerChoixMultipleCac(actionTrukCp, actionTrukCacGrpChp, listeValeurs, actionAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("continentEtFr"))) {
provenanceRechercheAutreChp = new TextField<String>();
creerChoixMultipleCac(provenanceRechercheTrukCp, provenanceRechercheTrukCacGrpChp, listeValeurs, provenanceRechercheAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("typeRecherche"))) {
typeRechercheAutreChp = new TextField<String>();
creerChoixMultipleCac(typeRechercheTrukCp, typeRechercheTrukCacGrpChp, listeValeurs, typeRechercheAutreChp);
}
//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
} else {
GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
}
if (listeValeurs.getId().equals(config.getListeId("actionValorisation"))) {
actionAutreChp = new TextField<String>();
creerChoixMultipleCac(actionTrukCp, actionTrukCacGrpChp, listeValeurs, actionAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("continentEtFr"))) {
provenanceRechercheAutreChp = new TextField<String>();
creerChoixMultipleCac(provenanceRechercheTrukCp, provenanceRechercheTrukCacGrpChp, listeValeurs, provenanceRechercheAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("typeRecherche"))) {
typeRechercheAutreChp = new TextField<String>();
creerChoixMultipleCac(typeRechercheTrukCp, typeRechercheTrukCacGrpChp, listeValeurs, typeRechercheAutreChp);
}
//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
} else {
GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
}
} catch (Exception e) {
GWT.log("rafraichir()", e);
}
}