Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1331 → Rev 1327

/branches/v1.0-syrah/src/org/tela_botanica/client/vues/collection/CollectionFormPersonne.java
6,11 → 6,7
 
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;
37,8 → 33,6
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;
57,11 → 51,7
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;
75,7 → 65,6
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;
96,8 → 85,7
private CollectionAPersonneListe personnesAjoutees = null;
private CollectionAPersonneListe personnesSupprimees = null;
private ChampComboBoxRechercheTempsReelPaginable personnesSaisisComboBox = null;
private ChampComboBoxRechercheTempsReelPaginable recherchePersonnesCombo = null;
private ComboBox<Personne> personnesSaisisComboBox = null;
private Button personnesBoutonSupprimer = null;
private Button personnesBoutonModifier = null;
private ListStore<Valeur> listeIon = null;
288,46 → 276,36
return bouton;
}
private ChampComboBoxRechercheTempsReelPaginable creerComboBoxPersonnesSaisies() {
ModelType modelTypePersonnes = new ModelType();
modelTypePersonnes.setRoot("personnes");
modelTypePersonnes.setTotalName("nbElements");
modelTypePersonnes.addField("cp_fmt_nom_complet");
modelTypePersonnes.addField("cp_id_personne");
private ComboBox<Personne> creerComboBoxPersonnesSaisies() {
ListStore<Personne> personnesSaisiesStore = new ListStore<Personne>();
personnesSaisiesStore.add(new ArrayList<Personne>());
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";
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());
}
}
return retour;
}
});
recherchePersonnesCombo.getCombo().addListener(Events.Select, new Listener<BaseEvent>() {
comboBox.addListener(Events.Select, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
if (personnesSaisisComboBox.getValeur() instanceof ModelData) {
Personne personneSaisiSelectionnee = new Personne(personnesSaisisComboBox.getValeur());
if (personnesSaisisComboBox.getValue() instanceof Personne) {
Personne personneSaisiSelectionnee = personnesSaisisComboBox.getValue();
ajouterDansGrille(personneSaisiSelectionnee);
personnesSaisisComboBox.getCombo().setValue(null);
personnesSaisisComboBox.setValue(null);
}
}
});
 
return recherchePersonnesCombo;
return comboBox;
}
private void ajouterDansGrille(Personne personne) {
540,13 → 518,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) {