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) { |