9,6 → 9,7 |
import org.tela_botanica.client.modeles.MenuApplicationId; |
import org.tela_botanica.client.modeles.Valeur; |
import org.tela_botanica.client.modeles.collection.Collection; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilArray; |
import org.tela_botanica.client.util.UtilString; |
import org.tela_botanica.client.vues.Formulaire; |
73,15 → 74,31 |
nomChp.setTabIndex(tabIndex++); |
nomChp.setFieldLabel(i18nC.nomCollection()); |
nomChp.setAllowBlank(false); |
nomChp.addStyleName("obligatoire"); |
nomChp.addListener(Events.Change, new Listener<BaseEvent>() { |
@Override |
public void handleEvent(BaseEvent be) { |
nomChp.removeStyleName("obligatoire"); |
nomChp.removeStyleName("obligatoire-ok"); |
if (nomChp.getRawValue().length() != 0) { |
nomChp.addStyleName("obligatoire-ok"); |
} else if (nomChp.getRawValue().length() == 0) { |
nomChp.addStyleName("obligatoire"); |
} |
} |
}); |
nomChp.getMessages().setBlankText(i18nC.champObligatoire()); |
principalFieldSet.add(nomChp, new FormData(450, 0)); |
|
typesCollectionCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionNcd(), "typeCollectionNcd", tabIndex++); |
typesCollectionCombo.peupler(Valeur.COLLECTION_NCD_HERBIER); |
typesCollectionCombo.addStyleName("obligatoire"); |
typesCollectionCombo.addListener(Events.Select, new Listener<BaseEvent>() { |
@Override |
public void handleEvent(BaseEvent be) { |
Valeur valeur = typesCollectionCombo.getValue(); |
|
// Gestion des onglets en fonction du type de collection |
panneauFormulaire.remove(onglets); |
mediateur.activerChargement(""); |
if (valeur != null && valeur.getId().equals(Valeur.COLLECTION_NCD_HERBIER)) { |
93,6 → 110,15 |
} |
mediateur.desactiverChargement(); |
panneauFormulaire.layout(); |
|
// Gestion du style obligatoire |
typesCollectionCombo.removeStyleName("obligatoire"); |
typesCollectionCombo.removeStyleName("obligatoire-ok"); |
if (valeur != null) { |
typesCollectionCombo.addStyleName("obligatoire-ok"); |
} else { |
typesCollectionCombo.addStyleName("obligatoire"); |
} |
} |
}); |
principalFieldSet.add(typesCollectionCombo, new FormData(150, 0)); |
206,7 → 232,7 |
personneOnglet.rafraichir(info); |
publicationOnglet.rafraichir(info); |
} else { |
Info.display("Ajout d'une Institution", info.toString()); |
Info.display("Ajout d'une collection", info.toString()); |
} |
} else if (info.getType().equals("liste_collection_a_personne")) { |
personneOnglet.rafraichir(info); |
234,7 → 260,7 |
private void actualiserTitrePanneau() { |
String titre = i18nC.titreModifFormCollection(); |
// Composition du titre |
titre += " - ID : "+collection.getId(); |
titre += " - "+i18nC.id()+" : "+collection.getId(); |
panneauFormulaire.setHeading(titre); |
} |
|
244,9 → 270,9 |
if (formulaireValide) { |
// Collecte des données du formulaire |
Collection collectionAEnregistrer = collecterCollection(); |
|
if (mode.equals(MODE_AJOUTER)) { |
mediateur.ajouterCollection(this, collectionAEnregistrer); |
Debug.log("enfin"); |
} else if (mode.equals(MODE_MODIFIER)) { |
if (collectionAEnregistrer == null) { |
Info.display("Modification d'une collection", "Rien n'a été enregistré car le formulaire n'a pas été modifié."); |
304,12 → 330,16 |
ArrayList<String> messages = new ArrayList<String>(); |
|
// Vérification des infos sur le nom de la collection |
if (nomChp.getValue() == null || nomChp.getValue().equals("") || collection.getNom().equals("")) { |
if (nomChp.getValue() == null |
|| nomChp.getValue().equals("") |
|| (mode.equals(MODE_MODIFIER) && collection != null && collection.getNom().equals(""))) { |
messages.add("Veuillez donner un nom à la collection."); |
} |
|
// Vérification des infos sur le type de collection |
if (typesCollectionCombo.getValue() == null || typesCollectionCombo.getValue().equals("") || collection.getIdProjet().equals("")) { |
if (typesCollectionCombo.getValue() == null |
|| typesCollectionCombo.getValue().equals("") |
|| (mode.equals(MODE_MODIFIER) && collection != null && collection.getIdProjet().equals(""))) { |
messages.add("Veuillez sélectionner un type pour la collection."); |
} |
|