Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 857 → Rev 858

/trunk/src/org/tela_botanica/client/vues/Formulaire.java
24,6 → 24,7
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Slider;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
34,6 → 35,7
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.Radio;
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
import com.extjs.gxt.ui.client.widget.form.SliderField;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
270,5 → 272,4
combo.setStore(store);
}
}
}
/trunk/src/org/tela_botanica/client/vues/CollectionFormContenu.java
New file
0,0 → 1,221
package org.tela_botanica.client.vues;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampCaseACocher;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.composants.ChampSliderPourcentage;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
 
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.LabelField;
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.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
import com.google.gwt.core.client.GWT;
 
public class CollectionFormContenu extends FormulaireOnglet implements Rafraichissable {
private ChampCaseACocher natureChp = null;
private TextArea specialiteChp = null;
private ChampCaseACocher periodeConstitutionChp = null;
private ChampComboBoxListeValeurs dateDebutCombo = null;
private ChampComboBoxListeValeurs dateFinCombo = null;
private DateField dateDebutChp = null;
private DateField dateFinChp = null;
private TextArea annotationClassementChp = null;
private ChampComboBoxListeValeurs etatClassementCombo = null;
private ChampComboBoxListeValeurs precisionDateCombo = null;
private ChampComboBoxListeValeurs precisionLocaliteCombo = null;
private TextArea etiquetteAnnotationChp = null;
private ChampComboBoxListeValeurs integreCollectionCombo = null;
private ChampComboBoxListeValeurs infoIntegreCollectionCombo = null;
private ChampSliderPourcentage auteurTitrePourcentChp;
private ChampSliderPourcentage famillePourcentChp;
private ChampSliderPourcentage genrePourcentChp;
private ChampSliderPourcentage spPourcentChp;
private ChampSliderPourcentage auteurSpPourcentChp;
private ChampSliderPourcentage localitePourcentChp;
private ChampSliderPourcentage datePourcentChp;
 
public CollectionFormContenu(Formulaire formulaireCourrant) {
initialiserOnglet(formulaireCourrant);
setId("contenu");
setText(Mediateur.i18nC.collectionContenu());
creerFieldsetNature();
// TODO : réaliser un champ couverture géographique détaillé
creerFieldsetPeriode();
creerFieldsetClassement();
creerFieldsetEtiquette();
creerFieldsetIntegration();
}
private void creerFieldsetNature() {
FieldSet natureFieldSet = new FieldSet();
natureFieldSet.setHeading("Nature");
natureFieldSet.setCollapsible(true);
natureFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
natureChp = new ChampCaseACocher(i18nC.natureVegetaleContenu(), "natureVegetale", false);
natureFieldSet.add(natureChp);
specialiteChp = new TextArea();
specialiteChp.setFieldLabel(i18nC.specialiteCollection());
specialiteChp.setToolTip(i18nC.specialiteCollectionInfo());
natureFieldSet.add(specialiteChp, new FormData(550, 0));
add(natureFieldSet);
}
private void creerFieldsetPeriode() {
FieldSet periodeFieldSet = new FieldSet();
periodeFieldSet.setHeading("Période de constitution");
periodeFieldSet.setCollapsible(true);
periodeFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
periodeConstitutionChp = new ChampCaseACocher(i18nC.periodeConstitution(), "siecleNaturaliste", false);
periodeFieldSet.add(periodeConstitutionChp);
 
LayoutContainer dateDebutConteneurGeneral = new LayoutContainer();
dateDebutConteneurGeneral.setLayout(new RowLayout());
LabelField dateDebutLabel = new LabelField(i18nC.dateDebutCollection()+":");
dateDebutConteneurGeneral.add(dateDebutLabel);
LayoutContainer dateDebutConteneur = new LayoutContainer();
dateDebutConteneur.setLayout(new ColumnLayout());
dateDebutChp = new DateField();
dateDebutConteneur.add(dateDebutChp, new ColumnData(220));
dateDebutCombo = new ChampComboBoxListeValeurs(null, "dateDebut");
dateDebutCombo.setTrie("id_valeur");
dateDebutConteneur.add(dateDebutCombo, new ColumnData(160));
dateDebutConteneurGeneral.add(dateDebutConteneur);
periodeFieldSet.add(dateDebutConteneurGeneral);
LayoutContainer dateFinConteneurGeneral = new LayoutContainer();
dateFinConteneurGeneral.setLayout(new RowLayout());
LabelField dateFinLabel = new LabelField(i18nC.dateFinCollection()+":");
dateFinConteneurGeneral.add(dateFinLabel);
LayoutContainer dateFinConteneur = new LayoutContainer();
dateFinConteneur.setLayout(new ColumnLayout());
dateFinChp = new DateField();
dateFinConteneur.add(dateFinChp, new ColumnData(220));
dateFinCombo = new ChampComboBoxListeValeurs(null, "dateFin");
dateFinCombo.setTrie("id_valeur");
dateFinConteneur.add(dateFinCombo, new ColumnData(160));
dateFinConteneurGeneral.add(dateFinConteneur);
periodeFieldSet.add(dateFinConteneurGeneral);
add(periodeFieldSet);
}
private void creerFieldsetClassement() {
FieldSet classementFieldSet = new FieldSet();
classementFieldSet.setHeading("Classement");
classementFieldSet.setCollapsible(true);
classementFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
annotationClassementChp = new TextArea();
annotationClassementChp.setFieldLabel(i18nC.annotationClassementCollection());
annotationClassementChp.setToolTip(i18nC.annotationClassementCollectionInfo());
classementFieldSet.add(annotationClassementChp, new FormData(550, 0));
etatClassementCombo = new ChampComboBoxListeValeurs(i18nC.etatClassementCollection(), "etat", tabIndex++);
classementFieldSet.add(etatClassementCombo);
add(classementFieldSet);
}
private void creerFieldsetEtiquette() {
FieldSet etiquetteFieldSet = new FieldSet();
etiquetteFieldSet.setHeading("Étiquette");
etiquetteFieldSet.setCollapsible(true);
etiquetteFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
Text renseignementPoucentLabel = new Text(i18nC.renseignementEtiquetteCollection());
renseignementPoucentLabel.setTagName("label");
renseignementPoucentLabel.setStyleName("x-form-item-label");
etiquetteFieldSet.add(renseignementPoucentLabel);
auteurTitrePourcentChp = new ChampSliderPourcentage(i18nC.auteurTitrePourcentCollection());
etiquetteFieldSet.add(auteurTitrePourcentChp, new FormData(200, 0));
famillePourcentChp = new ChampSliderPourcentage(i18nC.famillePourcentCollection());
etiquetteFieldSet.add(famillePourcentChp, new FormData(200, 0));
genrePourcentChp = new ChampSliderPourcentage(i18nC.genrePourcentCollection());
etiquetteFieldSet.add(genrePourcentChp, new FormData(200, 0));
spPourcentChp = new ChampSliderPourcentage(i18nC.spPourcentCollection());
etiquetteFieldSet.add(spPourcentChp, new FormData(200, 0));
auteurSpPourcentChp = new ChampSliderPourcentage(i18nC.auteurSpPourcentCollection());
etiquetteFieldSet.add(auteurSpPourcentChp, new FormData(200, 0));
localitePourcentChp = new ChampSliderPourcentage(i18nC.localitePourcentCollection());
etiquetteFieldSet.add(localitePourcentChp, new FormData(200, 0));
datePourcentChp = new ChampSliderPourcentage(i18nC.datePourcentCollection());
etiquetteFieldSet.add(datePourcentChp, new FormData(200, 0));
precisionLocaliteCombo = new ChampComboBoxListeValeurs(i18nC.precisionLocaliteCollection(), "onep", tabIndex++);
etiquetteFieldSet.add(precisionLocaliteCombo);
precisionDateCombo = new ChampComboBoxListeValeurs(i18nC.precisionDateCollection(), "onep", tabIndex++);
etiquetteFieldSet.add(precisionDateCombo);
 
etiquetteAnnotationChp = new TextArea();
etiquetteAnnotationChp.setFieldLabel(i18nC.etiquetteAnnotationCollection());
etiquetteAnnotationChp.setToolTip(i18nC.etiquetteAnnotationCollectionInfo());
etiquetteFieldSet.add(etiquetteAnnotationChp, new FormData(550, 0));
add(etiquetteFieldSet);
}
private void creerFieldsetIntegration() {
FieldSet integrationFieldSet = new FieldSet();
integrationFieldSet.setHeading("Collections intégrées");
integrationFieldSet.setCollapsible(true);
integrationFieldSet.setLayout(Formulaire.creerFormLayout(350, alignementLabelDefaut));
integreCollectionCombo = new ChampComboBoxListeValeurs(i18nC.integreCollection(), "onpi", tabIndex++);
integrationFieldSet.add(integreCollectionCombo);
infoIntegreCollectionCombo = new ChampComboBoxListeValeurs(i18nC.infoIntegreCollection(), "onp", tabIndex++);
integrationFieldSet.add(infoIntegreCollectionCombo);
Text infoIntegration = new Text(i18nC.infoIntegrationCollection());
integrationFieldSet.add(infoIntegration);
add(integrationFieldSet);
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
rafraichirValeurListe(listeValeurs);
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
}
private void rafraichirValeurListe(ValeurListe listeValeurs) {
if (listeValeurs.getId().equals(config.getListeId(""))) {
} else {
GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
}
}
}
/trunk/src/org/tela_botanica/client/vues/CollectionFormDescription.java
8,6 → 8,7
import org.tela_botanica.client.composants.ChampCaseACocher;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
import org.tela_botanica.client.composants.ChampSliderPourcentage;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.InterneValeur;
54,13 → 55,16
 
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
private ChampComboBoxListeValeurs typesCollectionBotaCombo = null;
private TextField<String> coteChp = null;
private NumberField nbreEchantillonChp = null;
private Grid<UniteRangement> uniteRangementGrille = null;
private ChampComboBoxListeValeurs etatUniteRangementCombo = null;
private Grid<UniteBase> uniteBaseGrille = null;
private ChampCaseACocher typePapierConservationChp = null;
private ChampCaseACocher methodeConservationChp = null;
private SliderField specimenFixationPourcentChp = null;
private SliderField etiquetteFixationPourcentChp = null;
private ChampSliderPourcentage specimenFixationPourcentChp = null;
private ChampSliderPourcentage etiquetteFixationPourcentChp = null;
private ChampCaseACocher specimentMethodeFixationChp = null;
private ChampCaseACocher etiquetteMethodeFixationSurSupportChp = null;
private ChampCaseACocher etiquetteMethodeFixationSurSpecimenChp = null;
82,6 → 86,22
formulaireLayout.setLabelAlign(LabelAlign.LEFT);
formulaireLayout.setLabelWidth(300);
typesCollectionBotaCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionBotanique(), "typeCollectionBota");
typesCollectionBotaCombo.setTabIndex(tabIndex++);
add(typesCollectionBotaCombo, new FormData(250, 0));
coteChp = new TextField<String>();
coteChp.setTabIndex(tabIndex++);
coteChp.setFieldLabel(i18nC.cote());
add(coteChp, new FormData(450, 0));
nbreEchantillonChp = new NumberField();
nbreEchantillonChp.setFieldLabel(i18nC.nbreEchantillon());
nbreEchantillonChp.setToolTip(i18nC.nbreEchantillonInfo());
nbreEchantillonChp.setFormat(NumberFormat.getFormat("#"));
nbreEchantillonChp.setToolTip(i18nC.champNumerique());
add(nbreEchantillonChp);
creerUniteRangement();
creerUniteBase();
94,26 → 114,10
Text fixationPoucentLabel = new Text(i18nC.fixationPourcent());
add(fixationPoucentLabel);
Slider specimenFixationPourcentSlider = creerSliderPoucentage(i18nC.specimenFixationPourcent(), specimenFixationPourcentChp);
specimenFixationPourcentSlider.addListener(Events.Change, new Listener<SliderEvent>() {
public void handleEvent(SliderEvent be) {
int pourcent = ((Slider) be.getComponent()).getValue();
specimenFixationPourcentChp.setFieldLabel(i18nC.specimenFixationPourcent()+" ("+pourcent+"%) ");
}
});
specimenFixationPourcentChp = new SliderField(specimenFixationPourcentSlider);
specimenFixationPourcentChp.setFieldLabel(i18nC.specimenFixationPourcent());
specimenFixationPourcentChp = new ChampSliderPourcentage(i18nC.specimenFixationPourcent());
add(specimenFixationPourcentChp, new FormData(200, 0));
Slider etiquetteFixationPourcentSlider = creerSliderPoucentage(i18nC.etiquetteFixationPourcent(), etiquetteFixationPourcentChp);
etiquetteFixationPourcentSlider.addListener(Events.Change, new Listener<SliderEvent>() {
public void handleEvent(SliderEvent be) {
int pourcent = ((Slider) be.getComponent()).getValue();
etiquetteFixationPourcentChp.setFieldLabel(i18nC.etiquetteFixationPourcent()+" ("+pourcent+"%) ");
}
});
etiquetteFixationPourcentChp = new SliderField(etiquetteFixationPourcentSlider);
etiquetteFixationPourcentChp.setFieldLabel(i18nC.etiquetteFixationPourcent());
etiquetteFixationPourcentChp = new ChampSliderPourcentage(i18nC.etiquetteFixationPourcent());
add(etiquetteFixationPourcentChp, new FormData(200, 0));
specimentMethodeFixationChp = new ChampCaseACocher(i18nC.specimenMethodeFixation(), "methodeFixation", true);
164,6 → 168,7
private void creerUniteRangement() {
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
uniteRangementGrille = creerGrilleUniteRangement();
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
panneauGrille.add(uniteRangementGrille);
ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
panneauGrille.setTopComponent(barreOutils);
261,8 → 266,6
grilleUniteRangement.setStripeRows(true);
grilleUniteRangement.setTrackMouseOver(true);
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
return grilleUniteRangement;
}
322,6 → 325,7
private void creerUniteBase() {
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteBaseTitre());
uniteBaseGrille = creerGrilleUniteBase();
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteBase");
panneauGrille.add(uniteBaseGrille);
ToolBar barreOutils = creerBarreOutilsGrilleUniteBase();
panneauGrille.setTopComponent(barreOutils);
433,8 → 437,6
grilleUniteBase.setStripeRows(true);
grilleUniteBase.setTrackMouseOver(true);
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteBase");
return grilleUniteBase;
}
491,16 → 493,6
return bouton;
}
private Slider creerSliderPoucentage(final String message, final SliderField champSlider) {
Slider slider = new Slider();
slider.setMinValue(0);
slider.setMaxValue(100);
slider.setValue(0);
slider.setIncrement(1);
slider.setMessage("{0} "+message);
return slider;
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
511,7 → 503,9
}
private void rafraichirValeurListe(ValeurListe listeValeurs) {
if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
if (listeValeurs.getId().equals(config.getListeId("typeCollectionBota"))) {
Formulaire.rafraichirComboBox(listeValeurs, typesCollectionBotaCombo);
} else if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
Iterator<String> it = listeValeurs.keySet().iterator();
while (it.hasNext()) {
Valeur valeur = listeValeurs.get(it.next());
/trunk/src/org/tela_botanica/client/vues/CollectionFormGeneral.java
11,44 → 11,36
import org.tela_botanica.client.modeles.StructureListe;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
 
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.HiddenField;
import com.extjs.gxt.ui.client.widget.form.NumberField;
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.layout.FormData;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
 
public class CollectionFormGeneral extends FormulaireOnglet implements Rafraichissable {
private HiddenField<String> idCollectionChp;
private FieldSet descriptionFieldSet;
private ListStore<Valeur> typesCollectionStore;
private ListStore<Valeur> typeCollectionBotaStore;
private ListStore<Valeur> typeDepotStore;
private ComboBox<Valeur> typeDepotCombo;
private ComboBox<Valeur> typesCollectionBotaCombo;
private ComboBox<Valeur> typesCollectionCombo;
private ListStore<Projet> projetsStore;
private ComboBox<Projet> projetsCombo;
 
private ComboBox<Structure> structuresCombo;
 
private ListStore<Structure> structuresStore;
 
private ComboBox<Collection> collectionsCombo;
 
private ListStore<Collection> collectionsStore;
private FieldSet descriptionFieldSet;
private ListStore<Valeur> typeDepotStore;
private ComboBox<Valeur> typeDepotCombo;
 
private TextArea lieuCouvertureChp;
public CollectionFormGeneral(Formulaire formulaireCourrant) {
initialiserOnglet(formulaireCourrant);
setId("general");
58,6 → 50,7
creerFieldsetLiaison();
creerFieldsetAdministratif();
creerFieldsetDescription();
creerFieldsetCouverture();
}
 
private void creerChampsCache() {
67,11 → 60,10
}
private void creerFieldsetLiaison() {
// Fieldset LIAISON
FieldSet liaisonFieldSet = new FieldSet();
liaisonFieldSet.setHeading(i18nC.liaisonTitreCollection());
liaisonFieldSet.setCollapsible(true);
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(150, LabelAlign.LEFT));
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
projetsStore = new ListStore<Projet>();
projetsCombo = new ComboBox<Projet>();
160,60 → 152,8
FieldSet administratifFieldSet = new FieldSet();
administratifFieldSet.setHeading(i18nC.collectionGeneralTitre());
administratifFieldSet.setCollapsible(true);
administratifFieldSet.setLayout(Formulaire.creerFormLayout(150, LabelAlign.LEFT));
administratifFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
typesCollectionStore = new ListStore<Valeur>();
typesCollectionCombo = new ComboBox<Valeur>();
typesCollectionCombo.setTabIndex(tabIndex++);
typesCollectionCombo.setFieldLabel(i18nC.typeCollectionNcd());
typesCollectionCombo.setDisplayField("nom");
typesCollectionCombo.setForceSelection(true);
typesCollectionCombo.setValidator(new Validator() {
@Override
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (typesCollectionStore.findModel("nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
}
return retour;
}
});
typesCollectionCombo.setTriggerAction(TriggerAction.ALL);
typesCollectionCombo.setStore(typesCollectionStore);
administratifFieldSet.add(typesCollectionCombo, new FormData(250, 0));
mediateur.obtenirListeValeurEtRafraichir(this, "typeCollectionNcd");
typeCollectionBotaStore = new ListStore<Valeur>();
typesCollectionBotaCombo = new ComboBox<Valeur>();
typesCollectionBotaCombo.setTabIndex(tabIndex++);
typesCollectionBotaCombo.setFieldLabel(i18nC.typeCollectionBotanique());
typesCollectionBotaCombo.setDisplayField("nom");
typesCollectionBotaCombo.setForceSelection(true);
typesCollectionBotaCombo.setValidator(new Validator() {
@Override
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (typeCollectionBotaStore.findModel("nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
}
return retour;
}
});
typesCollectionBotaCombo.setTriggerAction(TriggerAction.ALL);
typesCollectionBotaCombo.setStore(typeCollectionBotaStore);
administratifFieldSet.add(typesCollectionBotaCombo, new FormData(250, 0));
mediateur.obtenirListeValeurEtRafraichir(this, "typeCollectionBota");
typeDepotStore = new ListStore<Valeur>();
typeDepotCombo = new ComboBox<Valeur>();
typeDepotCombo.setTabIndex(tabIndex++);
236,29 → 176,10
}
});
typeDepotCombo.setTriggerAction(TriggerAction.ALL);
typeDepotCombo.setStore(typeCollectionBotaStore);
typeDepotCombo.setStore(typeDepotStore);
administratifFieldSet.add(typeDepotCombo, new FormData(250, 0));
mediateur.obtenirListeValeurEtRafraichir(this, "typeDepot");
TextField<String> coteChp = new TextField<String>();
coteChp.setTabIndex(tabIndex++);
coteChp.setFieldLabel(i18nC.cote());
administratifFieldSet.add(coteChp, new FormData(450, 0));
NumberField nbreEchantillonChp = new NumberField();
nbreEchantillonChp.setFieldLabel(i18nC.nbreEchantillon());
nbreEchantillonChp.setToolTip(i18nC.nbreEchantillonInfo());
nbreEchantillonChp.setFormat(NumberFormat.getFormat("#"));
nbreEchantillonChp.setToolTip(i18nC.champNumerique());
administratifFieldSet.add(nbreEchantillonChp);
TextField<String> nomChp = new TextField<String>();
nomChp.setTabIndex(tabIndex++);
nomChp.setFieldLabel(i18nC.nomCollection());
nomChp.setAllowBlank(false);
nomChp.getMessages().setBlankText(i18nC.champObligatoire());
administratifFieldSet.add(nomChp, new FormData(450, 0));
ChampMultiValeurs nomsAlternatifsChp = new ChampMultiValeurs(i18nC.intituleAlternatifCollection());
administratifFieldSet.add(nomsAlternatifsChp);
273,7 → 194,7
descriptionFieldSet = new FieldSet();
descriptionFieldSet.setHeading(i18nC.collectionDescriptionTitre());
descriptionFieldSet.setCollapsible(true);
descriptionFieldSet.setLayout(Formulaire.creerFormLayout(150, LabelAlign.LEFT));
descriptionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
 
TextArea descriptionChp = new TextArea();
descriptionChp.setFieldLabel(i18nC.description());
293,11 → 214,21
this.add(descriptionFieldSet);
}
private void creerFieldsetCouverture() {
FieldSet couvertureFieldSet = new FieldSet();
couvertureFieldSet.setHeading("Couvertures");
couvertureFieldSet.setCollapsible(true);
couvertureFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
lieuCouvertureChp = new TextArea();
lieuCouvertureChp.setFieldLabel(i18nC.lieuCouvertureCollection());
couvertureFieldSet.add(lieuCouvertureChp, new FormData(550, 0));
this.add(couvertureFieldSet);
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
rafraichirValeurListe(listeValeurs);
} else if (nouvellesDonnees instanceof ProjetListe) {
if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(projets, projetsCombo);
} else if (nouvellesDonnees instanceof StructureListe) {
306,6 → 237,9
} else if (nouvellesDonnees instanceof CollectionListe) {
CollectionListe collections = (CollectionListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(collections, collectionsCombo);
} else if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
rafraichirValeurListe(listeValeurs);
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
312,11 → 246,7
}
private void rafraichirValeurListe(ValeurListe listeValeurs) {
if (listeValeurs.getId().equals(config.getListeId("typeCollectionNcd"))) {
Formulaire.rafraichirComboBox(listeValeurs, typesCollectionCombo);
} else if (listeValeurs.getId().equals(config.getListeId("typeCollectionBota"))) {
Formulaire.rafraichirComboBox(listeValeurs, typesCollectionBotaCombo);
} else if (listeValeurs.getId().equals(config.getListeId("typeDepot"))) {
if (listeValeurs.getId().equals(config.getListeId("typeDepot"))) {
Formulaire.rafraichirComboBox(listeValeurs, typeDepotCombo);
} else {
GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
/trunk/src/org/tela_botanica/client/vues/FormulaireOnglet.java
12,6 → 12,7
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
 
public abstract class FormulaireOnglet extends TabItem implements Rafraichissable {
23,6 → 24,8
protected String mode = null;
protected int tabIndex = 100;
protected static LabelAlign alignementLabelDefaut = LabelAlign.LEFT;
protected static int largeurLabelDefaut = 250;
public FormulaireOnglet() {
parametrer(this);
34,7 → 37,11
}
public static void parametrer(TabItem onglet) {
onglet.setLayout(new FormLayout());
FormLayout layout = new FormLayout();
layout.setLabelWidth(largeurLabelDefaut);
layout.setLabelAlign(alignementLabelDefaut);
onglet.setLayout(layout);
onglet.setStyleAttribute("padding", "10px");
onglet.setScrollMode(Scroll.AUTO);
onglet.setData("acces", false);
/trunk/src/org/tela_botanica/client/vues/CollectionForm.java
1,8 → 1,7
package org.tela_botanica.client.vues;
 
import java.util.HashMap;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Collection;
import org.tela_botanica.client.modeles.Information;
9,17 → 8,22
import org.tela_botanica.client.modeles.MenuApplicationId;
import org.tela_botanica.client.modeles.Valeur;
 
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.StoreEvent;
import com.extjs.gxt.ui.client.store.StoreListener;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.google.gwt.core.client.GWT;
 
public class CollectionForm extends Formulaire implements Rafraichissable {
27,8 → 31,7
private Collection collection = null;
private Collection collectionCollectee = null;
 
private HashMap<String,ComboBox<Valeur>> champsCbv = new HashMap<String,ComboBox<Valeur>>();
private HashMap<String,ListStore<Valeur>> champsLsv = new HashMap<String,ListStore<Valeur>>();
private ChampComboBoxListeValeurs typesCollectionCombo = null;
private TabPanel onglets = null;
private TabItem generalOnglet = null;
36,47 → 39,91
private TabItem publicationOnglet = null;
private TabItem descriptionOnglet = null;
private TabItem contenuOnglet = null;
private TabItem documentOnglet = null;
private TabItem inventaireOnglet = null;
private TextField<String> nomChp = null;
public CollectionForm(Mediateur mediateurCourrant, String modeDeCreation) {
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.COLLECTION);
// Création des onglets
onglets = creerOnglets();
// Ajout des onglets au formulaire général
panneauFormulaire.add(onglets);
creerFieldsetPrincipal();
}
protected TabPanel creerOnglets() {
TabPanel ongletsCollection = new TabPanel();
private void creerFieldsetPrincipal() {
FieldSet principalFieldSet = new FieldSet();
principalFieldSet.setHeading("Info");
principalFieldSet.setCollapsible(true);
principalFieldSet.setLayout(Formulaire.creerFormLayout(150, LabelAlign.LEFT));
nomChp = new TextField<String>();
nomChp.setTabIndex(tabIndex++);
nomChp.setFieldLabel(i18nC.nomCollection());
nomChp.setAllowBlank(false);
nomChp.getMessages().setBlankText(i18nC.champObligatoire());
principalFieldSet.add(nomChp, new FormData(450, 0));
typesCollectionCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionNcd(), "typeCollectionNcd", tabIndex++);
typesCollectionCombo.setValeurDefaut(Valeur.COLLECTION_NCD_HERBIER);
typesCollectionCombo.addListener(Events.Select, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
Valeur valeur = typesCollectionCombo.getValue();
panneauFormulaire.remove(onglets);
mediateur.activerChargement("");
if (valeur != null && valeur.getId().equals(Valeur.COLLECTION_NCD_HERBIER)) {
onglets = creerOngletsHerbier();
panneauFormulaire.add(onglets);
} else {
onglets = creerOngletsDefaut();
panneauFormulaire.add(onglets);
}
mediateur.desactiverChargement();
panneauFormulaire.layout();
}
});
principalFieldSet.add(typesCollectionCombo, new FormData(150, 0));
typesCollectionCombo.fireEvent(Events.Select);
panneauFormulaire.setTopComponent(principalFieldSet);
}
protected TabPanel creerOngletsDefaut() {
TabPanel ongletsCollectionDefaut = new TabPanel();
// Onlget formulaire GENERAL
ongletsCollectionDefaut.add(creerOngletGeneral());
// Onlget formulaire AUTEUR
ongletsCollectionDefaut.add(creerOngletAuteur());
 
return ongletsCollectionDefaut;
}
protected TabPanel creerOngletsHerbier() {
TabPanel ongletsCollectionHerbier = 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)
ongletsCollection.setHeight("100%");
ongletsCollectionHerbier.setHeight("100%");
// Onlget formulaire GENERAL
ongletsCollection.add(creerOngletGeneral());
ongletsCollectionHerbier.add(creerOngletGeneral());
// Onlget formulaire AUTEUR
ongletsCollection.add(creerOngletAuteur());
ongletsCollectionHerbier.add(creerOngletAuteur());
// Onlget formulaire PUBLICATION
ongletsCollection.add(creerOngletPublication());
ongletsCollectionHerbier.add(creerOngletPublication());
// Onlget formulaire DESCRIPTION
ongletsCollection.add(creerOngletDescription());
ongletsCollectionHerbier.add(creerOngletDescription());
// Onlget formulaire CONTENU
ongletsCollection.add(creerOngletContenu());
ongletsCollectionHerbier.add(creerOngletContenu());
// Onlget formulaire DOCUMENT
ongletsCollection.add(creerOngletDocument());
// Onlget formulaire INVENTAIRE
ongletsCollection.add(creerOngletInventaire());
ongletsCollectionHerbier.add(creerOngletInventaire());
// Sélection de l'onglet par défaut
ongletsCollection.setSelection(descriptionOnglet);
ongletsCollectionHerbier.setSelection(contenuOnglet);
return ongletsCollection;
return ongletsCollectionHerbier;
}
private TabItem creerOngletGeneral() {
100,29 → 147,10
}
private TabItem creerOngletContenu() {
contenuOnglet = creerOnglet(i18nC.collectionContenu(), "contenu");
contenuOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
//peuplerOngletContenu();
contenuOnglet.layout();
}
});
contenuOnglet = new CollectionFormContenu(this);
return contenuOnglet;
}
private TabItem creerOngletDocument() {
documentOnglet = creerOnglet(i18nC.collectionDocument(), "document");
documentOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
//peuplerOngletDocument();
documentOnglet.layout();
}
});
return documentOnglet;
}
private TabItem creerOngletInventaire() {
inventaireOnglet = creerOnglet(i18nC.collectionInventaire(), "inventaire");
inventaireOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
136,16 → 164,13
}
public void rafraichir(Object nouvellesDonnees) {
try {
if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
rafraichirInformation(info);
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
} catch (Exception e) {
GWT.log(mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), e);
if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
rafraichirInformation(info);
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
controlerFermetureApresRafraichissement();
}
 
167,7 → 192,7
}
private void actualiserPeuplementOnglet() {
onglets.setSelection(onglets.getSelectedItem());
// TODO : déclencher le peuplement de l'onglet courant
}
 
private void actualiserTitrePanneau() {