Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 191 → Rev 192

/trunk/src/org/tela_botanica/client/vues/FormStructureVue.java
17,6 → 17,7
import org.tela_botanica.client.modeles.Personne;
import org.tela_botanica.client.modeles.Structure;
import org.tela_botanica.client.modeles.StructureConservation;
import org.tela_botanica.client.modeles.StructureValorisation;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
 
75,6 → 76,7
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
88,6 → 90,12
private String mode = "AJOUT";
private FormPanel structureFormPanneau;
private int tabIndex = 100;
private TabPanel onglets;
 
private TabItem identificationOnglet;
private TabItem personnelOnglet = null;
private TabItem conservationOnglet = null;
private TabItem valorisationOnglet = null;
private ListStore<Valeur> magazinLstpr = null;
private ComboBox<Valeur> comboLstpr = null;
101,11 → 109,10
private TextField<String> ihChp = null;
private TextField<String> mnhnChp = null;
private ComboBox<InterneValeur> comboTypeStructure = null;
private TabItem personnelOnglet = null;
 
private EditorGrid<Personne> grillePersonnel = null;
private ListStore<Personne> personnelGrilleMagazin = null;
private LabelField nbreTotalPersonnelChp = null;
private TabItem conservationOnglet = null;
private CheckBoxGroup localStockageTrukCacGrpChp = null;
private ContentPanel localStockageTrukCp = null;
private CheckBoxGroup meubleStockageTrukCacGrpChp = null;
124,7 → 131,7
private ContentPanel insecteTraitementTrukCp = null;
private CheckBoxGroup insecteTraitementTrukCacGrpChp = null;
private CheckBoxGroup poisonTraitementTrukCacGrpChp = null;
private TabItem valorisationOnglet = null;
 
private ContentPanel actionTrukCp = null;
private CheckBoxGroup actionTrukCacGrpChp = null;
private ContentPanel autreCollectionTrukCp = null;
183,6 → 190,10
private RadioGroup avecMotifAccesMarkRGrpChp;
private TextField<String> publicationChp;
private ContentPanel materielConservationCp;
private StructureConservation conservation;
private StructureValorisation valorisation;
 
 
public FormStructureVue() {
//+-----------------------------------------------------------------------------------------------------------+
204,7 → 215,7
 
//+-----------------------------------------------------------------------------------------------------------+
// Création des onglets
TabPanel onglets = new TabPanel();
onglets = new TabPanel();
// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner)
onglets.setHeight("100%");
228,7 → 239,8
// Gestion du FORMULAIRE GÉNÉRAL
// Sélection de l'onglet par défaut
onglets.setSelection(conservationOnglet);
onglets.setSelection(valorisationOnglet);
// Ajout des onglets au formulaire général
structureFormPanneau.add(onglets);
260,45 → 272,207
private void soumettreFormulaire() {
GWT.log("Soumission du formulaire", null);
Structure structure = collecterDonneesIdentification();
StructureConservation conservation = collecterDonneesConservation();
Structure structure = collecterStructureIdentification();
StructureConservation conservation = collecterStructureConservation();
StructureValorisation valorisation = collecterStructureValorisation();
if (mode == "AJOUT") {
//mediateur.ajouterStructure(this, structure);
} else if (mode == "MODIF") {
mediateur.modifierStructure(this, structure, conservation);
mediateur.modifierStructure(this, structure, conservation, valorisation);
}
//GWT.log("Info Structure envoyées :\n"+structure.toString(), null);
}
private StructureConservation collecterDonneesConservation() {
private StructureValorisation collecterStructureValorisation() {
// Création de l'objet
StructureValorisation valorisation = new StructureValorisation();
// ACTION
if (actionMarkRGrpChp.getValue() != null) {
valorisation.setAction(actionMarkRGrpChp.getValue().getValueAttribute());
}
// ACTION INFO
valorisation.setActionInfo(creerChaineDenormalisee(actionTrukCacGrpChp.getValues()));
valorisation.setActionInfo("AUTRE", actionAutreChp.getValue());
// PUBLICATION
// COLLECTION AUTRE
// ACTION FUTURE
// ACTION FUTURE INFO
return valorisation;
}
private void peuplerStructureValorisation() {
// ACTION
actionMarkRGrpChp.get((valorisation.getAction().equals("1") ? 0 : 1)).setValue((valorisation.getAction().equals("1") ? true : false));
// ACTION INFO
peuplerCasesACocher(valorisation.getActionInfo(), actionTrukCacGrpChp, actionAutreChp);
// PUBLICATION
// COLLECTION AUTRE
// ACTION FUTURE
// ACTION FUTURE INFO
}
private StructureConservation collecterStructureConservation() {
// Création de l'objet
StructureConservation conservation = new StructureConservation();
// FORMATION
if (formationMarkRGrpChp.getValue() != null) {
conservation.setFormationMark(formationMarkRGrpChp.getValue().getValueAttribute());
conservation.setFormation(formationMarkRGrpChp.getValue().getValueAttribute());
}
conservation.setFormation(formationChp.getValue());
// FORMATION INFO
conservation.setFormationInfo(formationChp.getValue());
// FORMATION INTERET
if (interetFormationMarkRGrpChp.getValue() != null) {
conservation.setFormationInteret(interetFormationMarkRGrpChp.getValue().getValueAttribute());
}
conservation.setStockageLocal(creerTruk(localStockageTrukCacGrpChp.getValues()));
if (localStockageAutreChp.getValue() != null) {
conservation.setStockageLocal("AUTRE", localStockageAutreChp.getValue());
// STOCKAGE LOCAL
conservation.setStockageLocal(creerChaineDenormalisee(localStockageTrukCacGrpChp.getValues()));
conservation.setStockageLocal("AUTRE", localStockageAutreChp.getValue());
 
// STOCKAGE MEUBLE
conservation.setStockageMeuble(creerChaineDenormalisee(meubleStockageTrukCacGrpChp.getValues()));
conservation.setStockageMeuble("AUTRE", meubleStockageAutreChp.getValue());
// STOCKAGE PAREMETRE
conservation.setStockageParametre(creerChaineDenormalisee(parametreStockageTrukCacGrpChp.getValues()));
conservation.setStockageParametre("AUTRE", parametreStockageAutreChp.getValue());
// COLLECTION COMMUNE
if (collectionCommuneMarkRGrpChp.getValue() != null) {
conservation.setCollectionCommune(collectionCommuneMarkRGrpChp.getValue().getValueAttribute());
}
 
// COLLECTION AUTRE
conservation.setCollectionAutre(creerChaineDenormalisee(collectionAutreTrukCacGrpChp.getValues()));
conservation.setCollectionAutre("AUTRE", collectionAutreAutreChp.getValue());
// ACCÈS CONTROLÉ
if (accesControleMarkRGrpChp.getValue() != null) {
conservation.setAccesControle(accesControleMarkRGrpChp.getValue().getValueAttribute());
}
// RESTAURATION
if (restaurationMarkRGrpChp.getValue() != null) {
conservation.setRestauration(restaurationMarkRGrpChp.getValue().getValueAttribute());
}
// RESTAURATION OPÉRATION
conservation.setRestaurationOperation(creerChaineDenormalisee(opRestauTrukCacGrpChp.getValues()));
conservation.setRestaurationOperation("AUTRE", opRestauAutreChp.getValue());
// MATERIEL CONSERVATION
if (materielConservationCeRGrpChp.getValue() != null) {
conservation.setMaterielConservation(materielConservationCeRGrpChp.getValue().getValueAttribute());
}
// MATERIEL AUTRE
conservation.setMaterielAutre(creerChaineDenormalisee(autreMaterielTrukCacGrpChp.getValues()));
conservation.setMaterielAutre("AUTRE", autreMaterielAutreChp.getValue());
// TRAITEMENT
if (traitementMarkRGrpChp.getValue() != null) {
conservation.setTraitement(traitementMarkRGrpChp.getValue().getValueAttribute());
}
// TRAIEMENTS
conservation.setTraitements(creerChaineDenormalisee(traitementTrukCacGrpChp.getValues()));
conservation.setTraitements("AUTRE", traitementAutreChp.getValue());
// ACQUISITION COLLECTION
if (collectionAcquisitionMarkRGrpChp.getValue() != null) {
conservation.setAcquisitionCollection(collectionAcquisitionMarkRGrpChp.getValue().getValueAttribute());
}
// ACQUISITION ECHANTILLON
if (echantillonAcquisitionMarkRGrpChp.getValue() != null) {
conservation.setAcquisitionEchantillon(echantillonAcquisitionMarkRGrpChp.getValue().getValueAttribute());
}
// ACQUISITION TRAITEMENT
if (traitementAcquisitionMarkRGrpChp.getValue() != null) {
conservation.setAcquisitionTraitement(traitementAcquisitionMarkRGrpChp.getValue().getValueAttribute());
}
// ACQUISITION TRAITEMENT POISON
conservation.setAcquisitionTraitementPoison(creerChaineDenormalisee(poisonTraitementTrukCacGrpChp.getValues()));
conservation.setAcquisitionTraitementPoison("AUTRE", poisonTraitementAutreChp.getValue());
// ACQUISITION TRAITEMENT INSECTE
conservation.setAcquisitionTraitementInsecte(creerChaineDenormalisee(insecteTraitementTrukCacGrpChp.getValues()));
conservation.setAcquisitionTraitementInsecte("AUTRE", insecteTraitementAutreChp.getValue());
// Retour de l'objet
GWT.log(conservation.toString(), null);
return conservation;
}
private void peuplerStructureConservation(StructureConservation strCons) {
Radio radioBtn = new Radio();
radioBtn.setId(strCons.getFormationMark()+"_"+formationMarkRGrpChp.getName());
formationMarkRGrpChp.get(formationMarkRGrpChp.getAll().indexOf(radioBtn)).setValue((strCons.getFormationMark().equals("1") ? true : false));
private void peuplerStructureConservation() {
// 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));
// FORMATION INFO
formationChp.setValue(conservation.getFormationInfo());
// FORMATION INTERET
interetFormationMarkRGrpChp.get((conservation.getFormationInteret().equals("1") ? 0 : 1)).setValue((conservation.getFormationInteret().equals("1") ? true : false));
 
// STOCKAGE LOCAL
peuplerCasesACocher(conservation.getStockageLocal(), localStockageTrukCacGrpChp,localStockageAutreChp);
 
// STOCKAGE MEUBLE
peuplerCasesACocher(conservation.getStockageMeuble(), meubleStockageTrukCacGrpChp, meubleStockageAutreChp);
 
// STOCKAGE PAREMETRE
peuplerCasesACocher(conservation.getStockageParametre(), parametreStockageTrukCacGrpChp, parametreStockageAutreChp);
// COLLECTION COMMUNE
collectionCommuneMarkRGrpChp.get((conservation.getCollectionCommune().equals("1") ? 0 : 1)).setValue((conservation.getCollectionCommune().equals("1") ? true : false));
// 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));
// RESTAURATION
restaurationMarkRGrpChp.get((conservation.getRestauration().equals("1") ? 0 : 1)).setValue((conservation.getRestauration().equals("1") ? true : false));
// RESTAURATION OPÉRATION
peuplerCasesACocher(conservation.getRestaurationOperation(), opRestauTrukCacGrpChp, opRestauAutreChp);
// MATERIEL CONSERVATION
peuplerBoutonsRadio(conservation.getMaterielConservation(), materielConservationCeRGrpChp);
// MATERIEL AUTRE
peuplerCasesACocher(conservation.getMaterielAutre(), autreMaterielTrukCacGrpChp, autreMaterielAutreChp);
// TRAITEMENT
traitementMarkRGrpChp.get((conservation.getTraitement().equals("1") ? 0 : 1)).setValue((conservation.getTraitement().equals("1") ? true : false));
// TRAITEMENTS
peuplerCasesACocher(conservation.getTraitements(), traitementTrukCacGrpChp, traitementAutreChp);
// ACQUISITION COLLECTION
collectionAcquisitionMarkRGrpChp.get((conservation.getAcquisitionCollection().equals("1") ? 0 : 1)).setValue((conservation.getAcquisitionCollection().equals("1") ? true : false));
// ACQUISITION ECHANTILLON
echantillonAcquisitionMarkRGrpChp.get((conservation.getAcquisitionEchantillon().equals("1") ? 0 : 1)).setValue((conservation.getAcquisitionEchantillon().equals("1") ? true : false));
// ACQUISITION TRAITEMENT
traitementAcquisitionMarkRGrpChp.get((conservation.getAcquisitionTraitement().equals("1") ? 0 : 1)).setValue((conservation.getAcquisitionTraitement().equals("1") ? true : false));
// ACQUISITION TRAITEMENT POISON
peuplerCasesACocher(conservation.getAcquisitionTraitementPoison(), poisonTraitementTrukCacGrpChp, poisonTraitementAutreChp);
// ACQUISITION TRAITEMENT INSECTE
peuplerCasesACocher(conservation.getAcquisitionTraitementInsecte(), insecteTraitementTrukCacGrpChp, insecteTraitementAutreChp);
}
private Structure collecterDonneesIdentification() {
private Structure collecterStructureIdentification() {
// IDENTIFICATION
Structure structure = new Structure();
structure.setId(idStructureChp.getValue());
349,7 → 523,8
return structure;
}
private void peuplerStructure(Structure str) {
private void peuplerStructureIdentification(Structure str) {
idStructureChp.setValue(str.getId());
nomStructureChp.setValue(str.getNom());
if (!str.getIdAlternatif().isEmpty()) {
391,18 → 566,6
emailChp.setValue(str.getCourriel());
urlChp.setValue(str.getUrl("WEB"));
}
 
private String creerTruk(List<CheckBox> liste) {
String identifiants = "";
int taille = liste.size();
for (int i = 0; i < taille; i++) {
CheckBox cac = liste.get(i);
if (cac.isEnabled()) {
identifiants = identifiants.concat(";"+cac.getData("id"));
}
}
return identifiants.replaceFirst("^;", "");
}
private TabItem creerOngletValorisation() {
valorisationOnglet = new TabItem();
409,6 → 572,11
valorisationOnglet.setText("Valorisation");
valorisationOnglet.setScrollMode(Scroll.AUTO);
valorisationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP, null));
valorisationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
peuplerStructureValorisation();
}
});
actionMarkRGrpChp = creerChoixUniqueRadioGroupe("action_mark", "ouiNon");
actionMarkRGrpChp.setFieldLabel("Avez-vous réalisé des actions de valorisation de vos collections botaniques ou avez-vous été sollicités pour la valorisation de ces collections ?");
475,11 → 643,17
return valorisationOnglet;
}
private TabItem creerOngletConservation() {
conservationOnglet = new TabItem();
conservationOnglet.setText("Conservation");
conservationOnglet.setScrollMode(Scroll.AUTO);
conservationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP, null));
conservationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
peuplerStructureConservation();
}
});
formationMarkRGrpChp = creerChoixUniqueRadioGroupe("formation_mark", "ouiNon");
formationMarkRGrpChp.setFieldLabel("Le personnel s'occupant des collections a-t-il suivi des formations en conservations ?");
812,8 → 986,9
private TabItem creerOngletIdentification() {
//+-----------------------------------------------------------------------------------------------------------+
// Onlget formulaire IDENTIFICATION
TabItem identificationOnglet = new TabItem();
identificationOnglet.setText("Identification");
identificationOnglet = new TabItem();
identificationOnglet.setId("identification");
identificationOnglet.setText("Identification");
identificationOnglet.setLayout(new FormLayout());
 
//+-----------------------------------------------------------------------------------------------------------+
1091,6 → 1266,46
].join("");
}-*/;
private void peuplerCasesACocher(String donnees, CheckBoxGroup groupeCac, TextField<String> champAutre) {
String[] valeurs = donnees.split(";;");
for (int i = 0; i < valeurs.length; i++) {
if (valeurs[i].startsWith("AUTRE##")) {
champAutre.setValue(valeurs[i].replaceFirst("^AUTRE##", ""));
} else {
List<CheckBox> cases = groupeCac.getAll();
for (int j = 0; j < cases.size(); j++) {
if (cases.get(j).getId().equals("val-"+valeurs[i])) {
cases.get(j).setValue(true);
}
}
}
}
}
private void peuplerBoutonsRadio(String valeur, RadioGroup groupeBr) {
List<Radio> boutons = groupeBr.getAll();
String id = valeur+"_"+groupeBr.getName().replace("_grp", "");
for (int i = 0; i < boutons.size(); i++) {
if (boutons.get(i).getId().equals(id)) {
boutons.get(i).setValue(true);
}
}
}
private String creerChaineDenormalisee(List<CheckBox> liste) {
String identifiants = "";
int taille = liste.size();
for (int i = 0; i < taille; i++) {
CheckBox cac = liste.get(i);
if (cac.isEnabled()) {
identifiants = identifiants.concat(";;"+cac.getData("id"));
}
}
return identifiants.replaceFirst("^;;", "");
}
/** Méthode simplifiant la création de FormLayout.
* Chacun des paramètres peut prendre la valeur null pour utiliser la valeur par défaut.
*
1125,8 → 1340,6
radioGroup.setName(groupeNom);
 
if (listeNom.equals("ouiNon")) {
// modele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(listeNom));
//} else {
ValeurListe ouiNonListe = new ValeurListe();
ouiNonListe.ajouter(new Valeur("1", "Oui", "NULL", "NULL"));
ouiNonListe.ajouter(new Valeur("0", "Non", "NULL", "NULL"));
1278,6 → 1491,7
cp.layout();
}
 
public void rafraichir(Object nouvelleDonnees) {
if (nouvelleDonnees instanceof Information) {
Information info = (Information) nouvelleDonnees;
1296,12 → 1510,18
if (info.getDonnee(0) != null) {
Structure str = (Structure) info.getDonnee(0);
titre += " - ID : "+str.getId();
peuplerStructure(str);
peuplerStructureIdentification(str);
}
if (info.getDonnee(1) != null) {
StructureConservation strConservation = (StructureConservation) info.getDonnee(1);
peuplerStructureConservation(strConservation);
conservation = (StructureConservation) info.getDonnee(1);
if (onglets.getSelectedItem().equals(conservationOnglet)) {
peuplerStructureConservation();
}
}
if (info.getDonnee(2) != null) {
valorisation = (StructureValorisation) info.getDonnee(2);
peuplerStructureValorisation();
}
structureFormPanneau.setHeading(titre);
}
} else if (nouvelleDonnees instanceof ValeurListe) {