Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1328 → Rev 1329

/trunk/src/org/tela_botanica/client/vues/commentaire/CommentaireListeVue.java
34,6 → 34,7
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.GroupingStore;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.util.Util;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.button.Button;
116,7 → 117,7
// Gestion de la grille
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
// ATTENTION : les noms des colonnes doivent correspondre aux noms variables de la classe utilisée dans la liste
colonnes.add(new ColumnConfig("_collection_nom_", i18nC.commentaireCollection(), 150));
colonnes.add(new ColumnConfig("_collection_nom_", i18nC.commentaireCollection(), 150));
colonnes.add(creerColonneType());
colonnes.add(new ColumnConfig("_titre_", i18nC.commentaireTitre(), 150));
colonnes.add(new ColumnConfig("_ponderation_", i18nC.commentairePonderation(), 30));
144,7 → 145,9
public String render(GroupColumnData data) {
String f = modeleDesColonnes.getColumnById(data.field).getHeader();
String l = data.models.size() == 1 ? i18nC.commentaireSingulier() : i18nC.commentairePluriel();
return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
if (Util.isEmptyString(data.group)) return f + ": aucune (" + data.models.size() + " " + l + ")";
else return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
}
});
176,11 → 179,14
// FIXME : créer une classe Ontologie qui mixe le code ci-dessous et tout ce qui concerne l'ontologie dans DetailVue
String type = "";
String[] valeurs = model.getCollectionACommentaire().getType().split(aDonnee.SEPARATEUR_VALEURS);
int nbreValeurs = valeurs.length;
int indexAvtDernier = nbreValeurs - 1;
if (nbreValeurs > 0) {
for (int i = 0; i < nbreValeurs; i++) {
String valeur = valeurs[i];
if (valeur.matches("^[0-9]+$")) {
if (valeur.equals("0")) {
valeur = "";
198,6 → 204,7
}
}
}
model.set("_type_", type);
return type;
}
293,6 → 300,7
private void chargerListe() {
if (commentaires != null) {
List<Commentaire> liste = commentaires.toList();
store.removeAll();
store.add(liste);
/trunk/src/org/tela_botanica/client/vues/commentaire/CommentaireDetailVue.java
9,6 → 9,7
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.vues.DetailVue;
 
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.util.Format;
import com.extjs.gxt.ui.client.util.Params;
import com.extjs.gxt.ui.client.widget.ContentPanel;
38,6 → 39,7
panneauPrincipal.setLayout(new FitLayout());
panneauPrincipal.setHeaderVisible(false);
panneauPrincipal.setBodyBorder(false);
panneauPrincipal.setScrollMode(Scroll.AUTO);
entete = new Html();
entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
/trunk/src/org/tela_botanica/client/vues/commentaire/CommentaireForm.java
4,8 → 4,10
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.ChampSliderPourcentage;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.MenuApplicationId;
17,6 → 19,8
import org.tela_botanica.client.util.UtilString;
import org.tela_botanica.client.vues.Formulaire;
 
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.store.ListStore;
import com.extjs.gxt.ui.client.widget.Info;
36,7 → 40,7
private Commentaire commentaire;
 
private ComboBox<Projet> projetsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private TextField<String> titreChp;
private TextArea texteChp;
private ChampSliderPourcentage ponderationChp;
84,21 → 88,30
}
private void creerChamps() {
projetsCombo = new ComboBox<Projet>();
projetsCombo.setTabIndex(tabIndex++);
projetsCombo.setFieldLabel(i18nC.projetChamp());
projetsCombo.setDisplayField("nom");
projetsCombo.setTriggerAction(TriggerAction.ALL);
projetsCombo.setStore(new ListStore<Projet>());
projetsCombo.setEmptyText(i18nC.txtListeProjetDefaut());
projetsCombo.setEditable(false);
projetsCombo.setForceSelection(true);
projetsCombo.setAllowBlank(false);
projetsCombo.setValidator(new Validator() {
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(100, 550);
projetsCombo.getCombo().setTabIndex(tabIndex++);
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
projetsCombo.getCombo().setEmptyText(i18nC.txtListeProjetDefaut());
projetsCombo.getCombo().setForceSelection(true);
projetsCombo.getCombo().setEditable(false);
projetsCombo.getCombo().setAllowBlank(false);
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> champ, String valeurAValider) {
String retour = null;
if (UtilString.isEmpty(valeurAValider)
|| projetsCombo.getStore().findModel("nom", valeurAValider) == null) {
|| projetsCombo.getStore().findModel("cpr_nom", valeurAValider) == null) {
champ.setValue(null);
retour = i18nC.selectionnerValeur();
}
105,10 → 118,9
return retour;
}
});
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
panneauFormulaire.add(projetsCombo, new FormData(450, 0));
mediateur.selectionnerProjet(this, null, null);
titreChp = new TextField<String>();
titreChp.setFieldLabel(i18nC.commentaireTitre());
134,10 → 146,6
if (nouvellesDonnees instanceof Commentaire) {
// Si on a reçu les details d'une publication
rafraichirCommentaire((Commentaire) nouvellesDonnees);
} else if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(projets, projetsCombo);
setValeurComboProjets();
} else if (nouvellesDonnees instanceof Information) {
rafraichirInformation((Information) nouvellesDonnees);
} else {
159,8 → 167,9
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getValue() != null && projetsCombo.isValid()) {
valeur = projetsCombo.getValue().getId();
if (projetsCombo.getCombo().getValue() != null && projetsCombo.getCombo().isValid()) {
Projet projet = new Projet (projetsCombo.getValeur());
valeur = projet.getId();
}
return valeur;
}
167,9 → 176,9
private void setValeurComboProjets() {
if (projetsCombo.getStore() != null ) {
if (mode.equals(Formulaire.MODE_MODIFIER) && commentaire != null) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", commentaire.getIdProjet()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", commentaire.getIdProjet()));
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", mediateur.getProjetId()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", mediateur.getProjetId()));
}
}
}
207,7 → 216,6
 
private Boolean etreValide() {
Boolean valide = false;
Debug.log("formulaire"+formulaireValideOk+" - Commentaire :"+commentaireValideOk);
if (formulaireValideOk && commentaireValideOk) {
valide = true;
}