Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 979 → Rev 980

/trunk/src/org/tela_botanica/client/vues/publication/PublicationForm.java
22,6 → 22,7
import org.tela_botanica.client.vues.Formulaire;
 
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
210,6 → 211,7
comboBox.setDisplayField("fmt_nom_complet");
comboBox.setTriggerAction(TriggerAction.ALL);
comboBox.setStore(auteursStorePartage);
comboBox.addListener(Events.Valid, creerEcouteurChampObligatoire());
 
return comboBox;
}
227,6 → 229,7
titreChp = new TextField<String>();
titreChp.setName("cpu");
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
generalitesFieldset.add(titreChp, new FormData(450, 0));
collectionChp = new TextField<String>();
263,6 → 266,7
datePublicationChp.setMaxLength(4);
datePublicationChp.setMinLength(4);
datePublicationChp.setFieldLabel("Année de publication");
datePublicationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
editionFieldset.add(datePublicationChp, new FormData(40, 0));
tomeChp = new TextField<String>();
/trunk/src/org/tela_botanica/client/vues/Formulaire.java
3,8 → 3,10
import java.util.Iterator;
import java.util.List;
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.configuration.Configuration;
import org.tela_botanica.client.i18n.Constantes;
import org.tela_botanica.client.images.Images;
37,6 → 39,8
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.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.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
294,4 → 298,34
combo.setStore(store);
}
}
public static Listener<BaseEvent> creerEcouteurChampObligatoire() {
return new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
Field<?> champ = null;
boolean etreVide = true;
if (be.getSource() instanceof TextField<?>) {
champ = (TextField<?>) be.getSource();
etreVide = (champ.getRawValue().isEmpty()) ? true : false;
} else if (be.getSource() instanceof TextArea) {
champ = (TextArea) be.getSource();
etreVide = (champ.getRawValue().isEmpty()) ? true : false;
} else if (be.getSource() instanceof ChampComboBoxListeValeurs) {
champ = (ChampComboBoxListeValeurs) be.getSource();
etreVide = (champ.getValue() == null) ? true : false;
} else if (be.getSource() instanceof ComboBox<?>) {
champ = (ComboBox<?>) be.getSource();
etreVide = (champ.getValue() == null) ? true : false;
}
champ.removeStyleName(ComposantClass.OBLIGATOIRE);
champ.removeStyleName(ComposantClass.OBLIGATOIRE_OK);
if (etreVide == false) {
champ.addStyleName(ComposantClass.OBLIGATOIRE_OK);
} else {
champ.addStyleName(ComposantClass.OBLIGATOIRE);
}
}
};
}
}
/trunk/src/org/tela_botanica/client/vues/collection/CollectionForm.java
17,7 → 17,6
import org.tela_botanica.client.vues.structure.StructureForm;
 
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.Info;
77,18 → 76,7
nomChp.setFieldLabel(i18nC.nomCollection());
nomChp.setAllowBlank(false);
nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
nomChp.addListener(Events.Valid, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
nomChp.removeStyleName(ComposantClass.OBLIGATOIRE);
nomChp.removeStyleName(ComposantClass.OBLIGATOIRE_OK);
if (nomChp.getRawValue().length() != 0) {
nomChp.addStyleName(ComposantClass.OBLIGATOIRE_OK);
} else if (nomChp.getRawValue().length() == 0) {
nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
}
}
});
nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
nomChp.getMessages().setBlankText(i18nC.champObligatoire());
principalFieldSet.add(nomChp, new FormData(450, 0));
114,20 → 102,7
panneauFormulaire.layout();
}
});
typesCollectionCombo.addListener(Events.Valid, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
Valeur valeur = typesCollectionCombo.getValue();
// Gestion du style obligatoire
typesCollectionCombo.removeStyleName(ComposantClass.OBLIGATOIRE);
typesCollectionCombo.removeStyleName(ComposantClass.OBLIGATOIRE_OK);
if (valeur != null) {
typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE_OK);
} else {
typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE);
}
}
});
typesCollectionCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
principalFieldSet.add(typesCollectionCombo, new FormData(150, 0));
typesCollectionCombo.fireEvent(Events.Select);
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPersonne.java
381,21 → 381,7
typeRelationCombo.setStore(new ListStore<Valeur>());
typeRelationCombo.setEditable(false);
typeRelationCombo.addStyleName(ComposantClass.OBLIGATOIRE);
typeRelationCombo.addListener(Events.Select, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
Valeur valeur = typeRelationCombo.getValue();
// Gestion du style obligatoire
typeRelationCombo.removeStyleName(ComposantClass.OBLIGATOIRE);
typeRelationCombo.removeStyleName(ComposantClass.OBLIGATOIRE_OK);
if (valeur != null) {
typeRelationCombo.addStyleName(ComposantClass.OBLIGATOIRE_OK);
} else {
typeRelationCombo.addStyleName(ComposantClass.OBLIGATOIRE);
}
}
});
typeRelationCombo.addListener(Events.Select, Formulaire.creerEcouteurChampObligatoire());
CellEditor editeurRelation = new CellEditor(typeRelationCombo) {
@Override
/trunk/src/org/tela_botanica/client/vues/structure/StructureForm.java
1216,7 → 1216,8
TextField<String> prenomChp = new TextField<String>();
prenomChp.setAllowBlank(false);
prenomChp.getMessages().setBlankText("Ce champ est obligatoire.");
prenomChp.setAutoValidate(true);
prenomChp.setAutoValidate(true);
prenomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
column.setEditor(new CellEditor(prenomChp));
configs.add(column);
1224,7 → 1225,8
TextField<String> nomChp = new TextField<String>();
nomChp.setAllowBlank(false);
nomChp.getMessages().setBlankText("Ce champ est obligatoire.");
nomChp.setAutoValidate(true);
nomChp.setAutoValidate(true);
nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
column.setEditor(new CellEditor(nomChp));
configs.add(column);
 
1438,6 → 1440,7
nomStructureChp.setFieldLabel("Nom de la structure");
nomStructureChp.setAllowBlank(false);
nomStructureChp.getMessages().setBlankText("Ce champ est obligatoire.");
nomStructureChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
fieldSetIdentite.add(nomStructureChp, new FormData(450, 0));
1451,6 → 1454,7
projetsCombo.setEditable(false);
projetsCombo.setTriggerAction(TriggerAction.ALL);
projetsCombo.setStore(projetsMagazin);
projetsCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
fieldSetIdentite.add(projetsCombo, new FormData(450, 0));
// Création du sous-formulaire : Acronyme
/trunk/src/org/tela_botanica/client/vues/projet/ProjetForm.java
3,6 → 3,7
import java.util.ArrayList;
import java.util.Iterator;
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
17,6 → 18,7
import org.tela_botanica.client.vues.Formulaire;
 
import com.extjs.gxt.ui.client.Style.SortDir;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.MessageBox;
138,18 → 140,23
nomChp = new TextField<String>();
nomChp.setName("cpu");
nomChp.setFieldLabel("Nom");
nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
generalitesFieldset.add(nomChp, new FormData(450, 0));
abreviationChp = new TextField<String>();
abreviationChp.setFieldLabel("Abréviation");
abreviationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
generalitesFieldset.add(abreviationChp, new FormData(450, 0));
descriptionChp = new TextArea();
descriptionChp.setFieldLabel("Description");
descriptionChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
generalitesFieldset.add(descriptionChp, new FormData(450, 0));
resumeChp = new TextArea();
resumeChp.setFieldLabel("Résumé");
resumeChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
generalitesFieldset.add(resumeChp, new FormData(450, 0));
urlChp = new TextField<String>();