Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1326 → Rev 1327

/branches/v1.0-syrah/src/org/tela_botanica/client/vues/collection/CollectionFormGeneral.java
6,8 → 6,14
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.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.ChampMultiValeurs;
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypesPaginable;
import org.tela_botanica.client.composants.ConteneurMultiChamps;
import org.tela_botanica.client.composants.pagination.ProxyCollections;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyStructures;
import org.tela_botanica.client.composants.pagination.ProxyValeur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.collection.Collection;
20,6 → 26,8
import org.tela_botanica.client.vues.Formulaire;
import org.tela_botanica.client.vues.FormulaireOnglet;
 
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
47,9 → 55,9
 
private HiddenField<String> idCollectionChp = null;
private ComboBox<Projet> projetsCombo = null;
private ComboBox<Structure> structuresCombo = null;
private ComboBox<Collection> collectionsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null;
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null;
private ChampCaseACocher periodeConstitutionChp = null;
private ChampComboBoxListeValeurs groupementPrincipeCombo = null;
103,17 → 111,34
liaisonFieldSet.setCollapsible(true);
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
projetsCombo = new ComboBox<Projet>();
projetsCombo.setTabIndex(tabIndex++);
projetsCombo.setFieldLabel(i18nC.projetChamp());
projetsCombo.setDisplayField("nom");
projetsCombo.setForceSelection(true);
projetsCombo.setValidator(new Validator() {
/*********************************/
/** Champ Projets **/
/*********************************/
ModelType modelTypeProjets = new ModelType();
modelTypeProjets.setRoot("projets");
modelTypeProjets.setTotalName("nbElements");
modelTypeProjets.addField("cpr_nom");
modelTypeProjets.addField("cpr_id_projet");
String displayNameProjets = "cpr_nom";
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>();
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.setWidth(250, 600);
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.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
} else if (projetsCombo.getStore().findModel("cpr_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
122,24 → 147,37
return retour;
}
});
projetsCombo.setTriggerAction(TriggerAction.ALL);
projetsCombo.setStore(new ListStore<Projet>());
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
liaisonFieldSet.add(projetsCombo, new FormData(450, 0));
mediateur.selectionnerProjet(this, null);
 
liaisonFieldSet.add(projetsCombo, new FormData(600, 0));
structuresCombo = new ComboBox<Structure>();
structuresCombo.setTabIndex(tabIndex++);
structuresCombo.setFieldLabel(i18nC.lienStructureCollection());
structuresCombo.setDisplayField("nom");
structuresCombo.setForceSelection(true);
structuresCombo.setValidator(new Validator() {
/*************************************/
/** Champ Structures **/
/*************************************/
 
ModelType modelTypeStructures = new ModelType();
modelTypeStructures.setRoot("structures");
modelTypeStructures.setTotalName("nbElements");
modelTypeStructures.addField("cs_nom");
modelTypeStructures.addField("cs_id_structure");
String displayNameStructures = "cs_nom";
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>();
structuresCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
structuresCombo.setWidth(250, 600);
structuresCombo.getCombo().setTabIndex(tabIndex++);
structuresCombo.getCombo().setFieldLabel(i18nC.lienStructureCollection());
structuresCombo.getCombo().setForceSelection(true);
structuresCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
structuresCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
structuresCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (structuresCombo.getStore().findModel("nom", field.getRawValue()) == null) {
} else if (structuresCombo.getStore().findModel("cs_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
148,22 → 186,37
return retour;
}
});
structuresCombo.setTriggerAction(TriggerAction.ALL);
structuresCombo.setStore(new ListStore<Structure>());
liaisonFieldSet.add(structuresCombo, new FormData(450, 0));
mediateur.selectionnerStructureParProjet(this, null);
 
liaisonFieldSet.add(structuresCombo, new FormData(600, 0));
collectionsCombo = new ComboBox<Collection>();
collectionsCombo.setTabIndex(tabIndex++);
collectionsCombo.setFieldLabel(i18nC.lienMereCollection());
collectionsCombo.setDisplayField("nom");
collectionsCombo.setForceSelection(true);
collectionsCombo.setValidator(new Validator() {
/*************************************/
/** Champ Collections **/
/*************************************/
ModelType modelTypeCollections = new ModelType();
modelTypeCollections.setRoot("collections");
modelTypeCollections.setTotalName("nbElements");
modelTypeCollections.addField("cc_nom");
modelTypeCollections.addField("cc_id_collection");
String displayNameCollections = "cc_nom";
ProxyCollections<ModelData> proxyCollections = new ProxyCollections<ModelData>();
collectionsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyCollections, modelTypeCollections, displayNameCollections);
collectionsCombo.setWidth(250, 600);
collectionsCombo.getCombo().setTabIndex(tabIndex++);
collectionsCombo.getCombo().setFieldLabel(i18nC.lienMereCollection());
collectionsCombo.getCombo().setForceSelection(true);
collectionsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
collectionsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
collectionsCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (collectionsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
} else if (collectionsCombo.getStore().findModel("cc_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
172,10 → 225,8
return retour;
}
});
collectionsCombo.setTriggerAction(TriggerAction.ALL);
collectionsCombo.setStore(new ListStore<Collection>());
liaisonFieldSet.add(collectionsCombo, new FormData(450, 0));
mediateur.selectionnerCollectionParProjet(this, null);
 
liaisonFieldSet.add(collectionsCombo, new FormData(600, 0));
this.add(liaisonFieldSet);
}
318,7 → 369,7
public ArrayList<String> verifier() {
ArrayList<String> messages = new ArrayList<String>();
if (projetsCombo.getValue() == null || !projetsCombo.isValid()) {
if (projetsCombo.getCombo().getValue() == null || !projetsCombo.getCombo().isValid()) {
messages.add(i18nM.selectionObligatoire(i18nC.articleUn()+" "+i18nC.projetSingulier(), i18nC.articleLa()+" "+i18nC.collectionSingulier()));
}
return messages;
359,57 → 410,48
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getValue() != null) {
valeur = projetsCombo.getValue().getId();
if (projetsCombo.getCombo().getValue() != null) {
Projet projet = new Projet(projetsCombo.getValeur());
valeur = projet.getId();
}
return valeur;
}
private void setValeurComboProjets() {
if (projetsCombo.getStore() != null && collection != null) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", collection.getIdProjet()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", collection.getIdProjet()));
}
}
private String getValeurComboStructures() {
String valeur = "";
if (structuresCombo.getValue() != null) {
valeur = structuresCombo.getValue().getId();
if (structuresCombo.getCombo().getValue() != null) {
Structure structure = new Structure(structuresCombo.getValeur());
valeur = structure.getId();
}
return valeur;
}
private void setValeurComboStructures() {
if (structuresCombo.getStore() != null && collection != null) {
structuresCombo.setValue(structuresCombo.getStore().findModel("id_structure", collection.getIdStructure()));
structuresCombo.getCombo().setValue(structuresCombo.getStore().findModel("cs_id_structure", collection.getIdStructure()));
}
}
private String getValeurComboCollections() {
String valeur = "";
if (collectionsCombo.getValue() != null) {
valeur = collectionsCombo.getValue().getId();
if (collectionsCombo.getCombo().getValue() != null) {
Collection collection = new Collection(collectionsCombo.getValeur());
valeur = collection.getId();
}
return valeur;
}
private void setValeurComboCollections() {
if (collectionsCombo.getStore() != null && collection != null) {
collectionsCombo.setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
if (collectionsCombo.getCombo().getStore() != null && collection != null) {
collectionsCombo.getCombo().setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
}
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(projets, projetsCombo);
setValeurComboProjets();
} else if (nouvellesDonnees instanceof StructureListe) {
StructureListe structures = (StructureListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(structures, structuresCombo);
setValeurComboStructures();
} else if (nouvellesDonnees instanceof CollectionListe) {
CollectionListe collections = (CollectionListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(collections, collectionsCombo);
setValeurComboCollections();
} else if (nouvellesDonnees instanceof ValeurListe) {
if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
rafraichirValeurListe(listeValeurs);
} else {