Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1310 → Rev 1327

/branches/v1.0-syrah/src/org/tela_botanica/client/vues/structure/StructureForm.java
8,7 → 8,10
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyValeur;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
35,6 → 38,8
import org.tela_botanica.client.vues.Formulaire;
 
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.event.BaseEvent;
72,6 → 77,7
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.Validator;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
131,7 → 137,7
private ListStore<Valeur> magazinRegion = null;
private ComboBox<Valeur> comboRegion = null;
private ListStore<Valeur> magazinPays = null;
private ComboBox<Valeur> comboPays = null;
private ChampComboBoxRechercheTempsReelPaginable comboPays = null;
private TextField<String> latitudeChp = null;
private TextField<String> longitudeChp = null;
private TextField<String> telChp = null;
218,7 → 224,7
private ComboBox<Personne> personneExistanteCombo = null;
private Button supprimerPersonnelBtn = null;
private ListStore<Projet> projetsMagazin = null;
private ComboBox<Projet> projetsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private CellEditor fonctionEditor = null;
private List<Valeur> fonctionsListe = null;
 
323,8 → 329,8
}
// Vérification des infos sur le projet de la structure
if ( (identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue() == null) ||
(identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue().equals("")) ||
if ( (identificationOnglet.getData("acces").equals(true) && projetsCombo.getCombo().getValue() == null) ||
(identificationOnglet.getData("acces").equals(true) && projetsCombo.getCombo().getValue().equals("")) ||
(identificationOnglet.getData("acces").equals(false) && identification.getIdProjet().equals(""))) {
messages.add("Veuillez sélectionner un projet pour l'institution.");
}
648,8 → 654,8
structureCollectee.setId(idStructureChp.getValue());
structureCollectee.setNom(nomStructureChp.getValue());
// Récupération de l'identifiant du projet
if (projetsCombo.getValue() != null) {
structureCollectee.setIdProjet(projetsCombo.getValue().getId());
if (projetsCombo.getCombo().getValue() != null) {
structureCollectee.setIdProjet(new Projet(projetsCombo.getValeur()).getId());
}
// Récupération de l'acronyme (= identifiant alternatif)
structureCollectee.setIdAlternatif(null);
702,10 → 708,10
structureCollectee.setRegion(strRegion);
structureCollectee.setPays(null);
if (comboPays.getValue() != null) {
structureCollectee.setPays(comboPays.getValue().getId());
} else if (comboPays.getRawValue() != "") {
structureCollectee.setPays(comboPays.getRawValue());
if (comboPays.getCombo().getValue() != null) {
structureCollectee.setPays(new Valeur(comboPays.getValeur()).getId());
} else if (comboPays.getCombo().getRawValue() != "") {
structureCollectee.setPays(comboPays.getCombo().getRawValue());
}
structureCollectee.setLatitude(latitudeChp.getValue());
structureCollectee.setLongitude(longitudeChp.getValue());
737,7 → 743,7
// Indication du projet sélectionné par défaut
String projetCourantId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getProjetId();
if (projetCourantId != null && !projetCourantId.equals("0")) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", projetCourantId));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", projetCourantId));
}
}
if (mode.equals(MODE_MODIFIER) && identification != null && identificationOnglet.getData("acces").equals(false)) {
744,7 → 750,7
idStructureChp.setValue(identification.getId());
nomStructureChp.setValue(identification.getNom());
if (!identification.getIdProjet().equals("0")) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", identification.getIdProjet()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", identification.getIdProjet()));
}
if (!identification.getIdAlternatif().isEmpty()) {
795,9 → 801,9
mettreAJourRegion();
//(identification.getRegion());
if (identification.getPays().matches("^[0-9]+$")) {
comboPays.setValue(comboPays.getStore().findModel("id_valeur", identification.getPays()));
comboPays.getCombo().setValue(comboPays.getStore().findModel("cmlv_id_valeur", identification.getPays()));
} else {
comboPays.setRawValue(identification.getPays());
comboPays.getCombo().setRawValue(identification.getPays());
}
latitudeChp.setValue(identification.getLatitude());
longitudeChp.setValue(identification.getLongitude());
1075,8 → 1081,8
}
// Récupération de l'id du projet de la structure qui servira aussi pour les Personnes crées dans ce formulaire
if (personne.getIdPersonne().equals("") && projetsCombo.getValue() != null) {
personne.setIdProjetPersonne(projetsCombo.getValue().getId());
if (personne.getIdPersonne().equals("") && projetsCombo.getCombo().getValue() != null) {
personne.setIdProjetPersonne(new Projet(projetsCombo.getValeur()).getId());
}
// Gestion de la fonction
1562,19 → 1568,22
nomStructureChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
fieldSetIdentite.add(nomStructureChp, new FormData(450, 0));
ModelType modelTypeProjets = new ModelType();
modelTypeProjets.setRoot("projets");
modelTypeProjets.setTotalName("nbElements");
modelTypeProjets.addField("cpr_nom");
modelTypeProjets.addField("cpr_id_projet");
projetsMagazin = new ListStore<Projet>();
mediateur.selectionnerProjet(this, null);
projetsCombo = new ComboBox<Projet>();
projetsCombo.setTabIndex(tabIndex++);
projetsCombo.setFieldLabel("Projet");
projetsCombo.setLabelSeparator("");
projetsCombo.setDisplayField("nom");
projetsCombo.setEditable(false);
projetsCombo.setTriggerAction(TriggerAction.ALL);
projetsCombo.setStore(projetsMagazin);
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
String displayNameProjets = "cpr_nom";
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>();
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.getCombo().setTabIndex(tabIndex++);
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
projetsCombo.getCombo().setForceSelection(true);
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
projetsCombo.setWidth(120, 450);
fieldSetIdentite.add(projetsCombo, new FormData(450, 0));
// Création du sous-formulaire : Acronyme
1749,13 → 1758,14
// Fieldset ADRESSE
LayoutContainer principalFdAdresse = new LayoutContainer();
principalFdAdresse.setLayout(new ColumnLayout());
principalFdAdresse.setSize(600, -1);
principalFdAdresse.setSize(700, -1);
LayoutContainer gaucheFdAdresse = new LayoutContainer();
gaucheFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
LayoutContainer droiteFdAdresse = new LayoutContainer();
droiteFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
droiteFdAdresse.setLayout(creerFormLayout(100, LabelAlign.LEFT));
droiteFdAdresse.setWidth(300);
FieldSet fieldSetAdresse = new FieldSet();
fieldSetAdresse.setHeading("Adresse");
1783,31 → 1793,35
villeChp.setFieldLabel("Ville");
gaucheFdAdresse.add(villeChp, new FormData("95%"));
magazinPays = new ListStore<Valeur>();
comboPays = new ComboBox<Valeur>();
comboPays.setTabIndex(tabIndex++);
comboPays.setFieldLabel("Pays");
comboPays.setEmptyText("Sélectionner un pays...");
comboPays.setEditable(true);
comboPays.setLabelSeparator("");
comboPays.setDisplayField("nom");
comboPays.setTemplate(getTemplatePays());
comboPays.setTypeAhead(true);
comboPays.setTriggerAction(TriggerAction.ALL);
comboPays.setStore(magazinPays);
ModelType modelTypesPays = new ModelType();
modelTypesPays.setRoot("valeurs");
modelTypesPays.setTotalName("nbElements");
modelTypesPays.addField("cmlv_nom");
modelTypesPays.addField("cmlv_id_valeur");
modelTypesPays.addField("cmlv_abreviation");
modelTypesPays.addField("cmlv_description");
SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
String displayNamePays = "cmlv_nom";
String nomListeTypes = "pays";
ProxyValeur<ModelData> proxyPays = new ProxyValeur<ModelData>(nomListeTypes);
comboPays = new ChampComboBoxRechercheTempsReelPaginable(proxyPays, modelTypesPays, displayNamePays);
comboPays.setWidth(100,300);
comboPays.getCombo().setTabIndex(tabIndex++);
comboPays.getCombo().setFieldLabel("Pays");
comboPays.getCombo().setForceSelection(true);
comboPays.getCombo().setTemplate(getTemplatePays());
SelectionChangedListener<ModelData> selectionChange = new SelectionChangedListener<ModelData>() {
public void selectionChanged(SelectionChangedEvent se) {
// Rafraichir avec le pays sélectionné
obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
comboRegion.clear();
obtenirListeRegionParPays((new Valeur(se.getSelectedItem())).getAbreviation().toString());
}
};
comboPays.getCombo().addSelectionChangedListener(selectionChange);
comboPays.addSelectionChangedListener(selectionChange);
droiteFdAdresse.add(comboPays, new FormData("95%"));
mediateur.obtenirListeValeurEtRafraichir(this, "pays");
magazinRegion = new ListStore<Valeur>();
comboRegion = new ComboBox<Valeur>();
1818,7 → 1832,6
comboRegion.setTypeAhead(true);
comboRegion.setTriggerAction(TriggerAction.ALL);
comboRegion.setStore(magazinRegion);
droiteFdAdresse.add(comboRegion, new FormData("95%"));
latitudeChp = new TextField<String>();
1910,7 → 1923,7
private native String getTemplatePays() /*-{
return [
'<tpl for=".">',
'<div class="x-combo-list-item">{nom} ({abreviation})</div>',
'<div class="x-combo-list-item">{cmlv_nom} ({cmlv_abreviation})</div>',
'</tpl>'
].join("");
}-*/;
2152,11 → 2165,12
fonctionsMagazin.add(liste);
fonctionsCombo.setStore(fonctionsMagazin);
}
/*
if (listeValeurs.getId().equals(config.getListeId("pays"))) {
magazinPays.removeAll();
magazinPays.add(liste);
comboPays.setStore(magazinPays);
}
}*/
if (listeValeurs.getId().equals(config.getListeId("region"))) {
magazinRegion.removeAll();
2239,10 → 2253,12
}
private void rafraichirProjetListe(ProjetListe projets) {
Debug.log("PASSE ICI");
/*
List<Projet> liste = projets.toList();
projetsMagazin.removeAll();
projetsMagazin.add(liste);
projetsCombo.setStore(projetsMagazin);
projetsCombo.setStore(projetsMagazin);*/
}
private void testerLancementRafraichirPersonnel() {