Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1330 → Rev 1331

/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/personne/Personne.java
10,6 → 10,7
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilString;
 
import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.json.client.JSONObject;
30,6 → 31,15
public Personne() {
}
 
public Personne(ModelData model)
{
this.set("id_personne", model.get("cp_id_personne"));
this.set("fmt_nom_complet", model.get("cp_fmt_nom_complet"));
this.set("code_postal", model.get("cp_code_postal"));
this.set("ville", model.get("cp_ville"));
this.set("truk_courriel", model.get("cp_truk_courriel"));
}
public Personne(JSONObject personne) {
initialiserModele(personne);
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/publication/PublicationForm.java
8,6 → 8,7
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyStructures;
import org.tela_botanica.client.images.Images;
128,7 → 129,8
private EditorGrid<Personne> grille;
private PersonneListe personnesAjoutees = null;
private PersonneListe personnesSupprimees = null;
private ComboBox<Personne> personnesSaisiesComboBox = null;
private ChampComboBoxRechercheTempsReelPaginable personnesSaisiesComboBox = null;
private ChampComboBoxRechercheTempsReelPaginable recherchePersonnesCombo = null;
private Button personnesBoutonSupprimer = null;
private Button personnesBoutonModifier = null;
private ComboBox<Valeur> typeRelationCombo = null;
203,7 → 205,9
barreOutils.add(new Text(" ou "));
personnesSaisiesComboBox = creerComboBoxPersonnesSaisies();
creerComboBoxPersonnesSaisies();
//personnesSaisiesComboBox = recherchePersonnesCombo;;
barreOutils.add(personnesSaisiesComboBox);
barreOutils.add(new SeparatorToolItem());
343,49 → 347,41
}
}
private ComboBox<Personne> creerComboBoxPersonnesSaisies() {
ListStore<Personne> personnesSaisiesStore = new ListStore<Personne>();
private void creerComboBoxPersonnesSaisies() {
ComboBox<Personne> comboBox = new ComboBox<Personne>();
comboBox.setWidth(400);
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
comboBox.setTriggerAction(TriggerAction.ALL);
comboBox.setEditable(true);
comboBox.setDisplayField("fmt_nom_complet");
comboBox.setStore(personnesSaisiesStore);
comboBox.addKeyListener(new KeyListener() {
public void componentKeyUp(ComponentEvent ce) {
if (personnesSaisiesComboBox.getRawValue() != null && personnesSaisiesComboBox.getRawValue().length() > 0) {
if (!ce.isNavKeyPress()) {
obtenirPersonnesSaisies(personnesSaisiesComboBox.getRawValue());
}
}
}
});
comboBox.addListener(Events.Select, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
if (personnesSaisiesComboBox.getValue() instanceof Personne) {
ModelType modelTypePersonnes = new ModelType();
modelTypePersonnes.setRoot("personnes");
modelTypePersonnes.setTotalName("nbElements");
modelTypePersonnes.addField("cp_fmt_nom_complet");
modelTypePersonnes.addField("cp_id_personne");
modelTypePersonnes.addField("cp_code_postal");
modelTypePersonnes.addField("cp_ville");
modelTypePersonnes.addField("cp_truk_courriel");
String displayNamePersonnes = "cp_fmt_nom_complet";
ProxyPersonnes<ModelData> proxyPersonnes = new ProxyPersonnes<ModelData>();
personnesSaisiesComboBox = new ChampComboBoxRechercheTempsReelPaginable(proxyPersonnes, modelTypePersonnes, displayNamePersonnes);
personnesSaisiesComboBox.getCombo().addListener(Events.Select, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
if (personnesSaisiesComboBox.getValeur() instanceof ModelData) {
// N'ajouter l'auteur que s'il n'est pas déjà présent dans la grille et dans les valeurs initiales
Personne personneSaisieSelectionne = personnesSaisiesComboBox.getValue();
if (grille.getStore().findModel(personneSaisieSelectionne) != null) {
Personne personneSaisieSelectionnee = new Personne(personnesSaisiesComboBox.getValeur());
if (grille.getStore().findModel(personneSaisieSelectionnee) != null) {
Info.display("Information", "La personne est déjà présente dans la liste d'auteurs");
} else {
if (!auteursInitialListe.containsValue(personneSaisieSelectionne)) {
auteursAjoutes.put(personneSaisieSelectionne.getId(), personneSaisieSelectionne);
if (!auteursInitialListe.containsValue(personneSaisieSelectionnee)) {
auteursAjoutes.put(personneSaisieSelectionnee.getId(), personneSaisieSelectionnee);
}
ajouterDansGrille(personneSaisieSelectionne);
personnesSaisiesComboBox.setValue(null);
ajouterDansGrille(personneSaisieSelectionnee);
personnesSaisiesComboBox.getCombo().setValue(null);
}
}
}
});
return comboBox;
}
private void obtenirPersonnesSaisies(String nom) {
mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%");
}
private void ajouterDansGrille(Personne personne) {
ajouterDansGrille(personne, 0);
}
555,6 → 551,7
auteursFieldset.layout();*/
}
/*
private ComboBox<Personne> creerComboBoxAuteursSaisis() {
ListStore<Personne> auteursStore = new ListStore<Personne>();
auteursStore.add(auteursStorePartage.getModels());
572,7 → 569,7
comboBox.addListener(Events.Valid, creerEcouteurChampObligatoire());
 
return comboBox;
}
}*/
private void creerZoneGeneralites() {
FormLayout layout = new FormLayout();
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/collection/CollectionFormPersonne.java
6,7 → 6,11
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
33,6 → 37,8
import org.tela_botanica.client.vues.personne.PersonneForm;
 
import com.extjs.gxt.ui.client.Style.Scroll;
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.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
51,7 → 57,11
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
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.FormPanel;
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.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
65,6 → 75,7
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
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.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
85,7 → 96,8
private CollectionAPersonneListe personnesAjoutees = null;
private CollectionAPersonneListe personnesSupprimees = null;
private ComboBox<Personne> personnesSaisisComboBox = null;
private ChampComboBoxRechercheTempsReelPaginable personnesSaisisComboBox = null;
private ChampComboBoxRechercheTempsReelPaginable recherchePersonnesCombo = null;
private Button personnesBoutonSupprimer = null;
private Button personnesBoutonModifier = null;
private ListStore<Valeur> listeIon = null;
276,36 → 288,46
return bouton;
}
private ComboBox<Personne> creerComboBoxPersonnesSaisies() {
ListStore<Personne> personnesSaisiesStore = new ListStore<Personne>();
personnesSaisiesStore.add(new ArrayList<Personne>());
private ChampComboBoxRechercheTempsReelPaginable creerComboBoxPersonnesSaisies() {
ModelType modelTypePersonnes = new ModelType();
modelTypePersonnes.setRoot("personnes");
modelTypePersonnes.setTotalName("nbElements");
modelTypePersonnes.addField("cp_fmt_nom_complet");
modelTypePersonnes.addField("cp_id_personne");
ComboBox<Personne> comboBox = new ComboBox<Personne>();
comboBox.setWidth(200);
comboBox.setEmptyText(i18nC.chercherPersonneSaisi());
comboBox.setTriggerAction(TriggerAction.ALL);
comboBox.setEditable(true);
comboBox.setDisplayField("fmt_nom_complet");
comboBox.setStore(personnesSaisiesStore);
comboBox.addKeyListener(new KeyListener() {
public void componentKeyUp(ComponentEvent ce) {
if (personnesSaisisComboBox.getRawValue() != null && personnesSaisisComboBox.getRawValue().length() > 0) {
if (!ce.isNavKeyPress()) {
obtenirPersonnesSaisis(personnesSaisisComboBox.getRawValue());
}
String displayNamePersonnes = "cp_fmt_nom_complet";
ProxyPersonnes<ModelData> proxyPersonnes = new ProxyPersonnes<ModelData>();
recherchePersonnesCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyPersonnes, modelTypePersonnes, displayNamePersonnes);
recherchePersonnesCombo.getCombo().setForceSelection(true);
recherchePersonnesCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (recherchePersonnesCombo.getStore().findModel("cp_fmt_nom_complet", 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;
}
});
comboBox.addListener(Events.Select, new Listener<BaseEvent>() {
recherchePersonnesCombo.getCombo().addListener(Events.Select, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
if (personnesSaisisComboBox.getValue() instanceof Personne) {
Personne personneSaisiSelectionnee = personnesSaisisComboBox.getValue();
if (personnesSaisisComboBox.getValeur() instanceof ModelData) {
Personne personneSaisiSelectionnee = new Personne(personnesSaisisComboBox.getValeur());
ajouterDansGrille(personneSaisiSelectionnee);
personnesSaisisComboBox.setValue(null);
personnesSaisisComboBox.getCombo().setValue(null);
}
}
});
return comboBox;
 
return recherchePersonnesCombo;
}
private void ajouterDansGrille(Personne personne) {
518,13 → 540,13
}
String type = info.getType();
if (type.equals("liste_personne")) {
if (info.getDonnee(0) != null) {
if (info.getDonnee(0) != null) {/*
PersonneListe personnes = (PersonneListe) info.getDonnee(0);
List<Personne> liste = personnes.toList();
personnesSaisisComboBox.getStore().removeAll();
personnesSaisisComboBox.getStore().add(liste);
personnesSaisisComboBox.expand();
personnesSaisisComboBox.expand();*/
}
} else if (info.getType().equals("liste_collection_a_personne")) {
if (info.getDonnee(0) != null) {