/trunk/src/org/tela_botanica/client/composants/ChampMultiValeursMultiTypesPaginable.java |
---|
163,14 → 163,22 |
String[] valeurs = chaineExistante.split(aDonnee.SEPARATEUR_VALEURS); |
for (int i = 0; i < valeurs.length; i++) { |
String[] idEtValeur = valeurs[i].split(aDonnee.SEPARATEUR_TYPE_VALEUR); |
String idType = idEtValeur[0]; |
String idValeur = idEtValeur[1]; |
// Champ Valeur |
tempMapValeurs.put(Integer.parseInt(idType), idValeur); |
// Champ Types |
mediateur.obtenirListeValeurEtRafraichir(this, Integer.parseInt(idType), null); |
if (idEtValeur.length == 2) { |
String idType = idEtValeur[0]; |
String idValeur = idEtValeur[1]; |
// Champ Valeur |
if (idType.matches("[0-9]+")) { |
tempMapValeurs.put(Integer.parseInt(idType), idValeur); |
} else { |
tempMapValeurs.put(((Configuration)(Registry.get(RegistreId.CONFIG))).getListeId(idType), idValeur); |
} |
// Champ Types |
mediateur.obtenirListeValeurEtRafraichir(this, Integer.parseInt(idType), null); |
} else { |
InfoLogger.display("Erreur", "ChampMultiValeursMultiTypesPaginable. Erreur dans le split de "+chaineExistante, true); |
} |
} |
} |
} |
/trunk/src/org/tela_botanica/client/composants/pagination/ProxyPersonnes.java |
---|
38,7 → 38,6 |
mediateur.selectionnerPersonne(this, recherche, lc.getOffset(), lc.getLimit(), sequenceur); |
} |
@Override |
@SuppressWarnings("unchecked") |
public void rafraichir(Object nouvellesDonnees) { |
/trunk/src/org/tela_botanica/client/composants/pagination/ProxyCollections.java |
---|
28,22 → 28,19 |
super(sequenceur); |
} |
@Override |
public void load(TransformateurJSONaModelData reader, Object loadConfig, AsyncCallback callback, String recherche) { |
this.reader = reader; |
this.callback = callback; |
this.loadConfig = loadConfig; |
BasePagingLoadConfig lc = (BasePagingLoadConfig)loadConfig; |
mediateur.selectionnerCollection(this, recherche, lc.getOffset(), lc.getLimit(), sequenceur); |
} |
@Override |
@SuppressWarnings("unchecked") |
public void rafraichir(Object nouvellesDonnees) { |
try |
{ |
data = nouvellesDonnees; |
/trunk/src/org/tela_botanica/client/composants/pagination/ProxyValeur.java |
---|
40,7 → 40,6 |
mediateur.obtenirListeValeurEtRafraichir(this, nomListe, true, recherche, lc.getOffset(), lc.getLimit(), sequenceur); |
} |
@SuppressWarnings("unchecked") |
public void rafraichir(Object nouvellesDonnees) { |
try |
/trunk/src/org/tela_botanica/client/composants/pagination/ChargeurListe.java |
---|
1,5 → 1,9 |
package org.tela_botanica.client.composants.pagination; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.Information; |
import org.tela_botanica.client.util.Debug; |
import com.extjs.gxt.ui.client.data.BasePagingLoader; |
import com.extjs.gxt.ui.client.data.LoadEvent; |
import com.extjs.gxt.ui.client.data.PagingLoadResult; |
8,14 → 12,19 |
public class ChargeurListe<D extends PagingLoadResult<?>> extends BasePagingLoader<D> { |
private String recherche = ""; |
private Integer id = null; |
private Rafraichissable vueARafraichir = null; |
private boolean rafraichir = false; |
@SuppressWarnings("unchecked") |
public ChargeurListe(Proxy proxy, TransformateurJSONaModelData reader) { |
public ChargeurListe(Proxy proxy, TransformateurJSONaModelData reader, Rafraichissable vueARafraichir) { |
super(proxy, reader); |
this.vueARafraichir = vueARafraichir; |
} |
public boolean load(Object loadConfig, String recherche) { |
if (fireEvent(BeforeLoad, new LoadEvent(this, loadConfig))) { |
public boolean load(Object loadConfig, String recherche, boolean rafraichir) { |
this.rafraichir = rafraichir; |
if (fireEvent(BeforeLoad, new LoadEvent(this, loadConfig))) { |
lastConfig = loadConfig; |
this.recherche = recherche; |
50,12 → 59,22 |
@SuppressWarnings("unchecked") |
protected void loadData(final Object config, String recherche) { |
AsyncCallback<D> callback = new AsyncCallback<D>() { |
public void onFailure(Throwable caught) { |
onLoadFailure(config, caught); |
} |
public void onSuccess(D result) { |
onLoadSuccess(config, result); |
} |
onLoadSuccess(config, result); |
if (rafraichir) { |
Information info = new Information("selectionnerValeurCombo"); |
info.setDonnee(result); |
info.setMessage(""); |
vueARafraichir.rafraichir(info); |
} |
} |
}; |
((Proxy)proxy).load((TransformateurJSONaModelData)reader, config, callback, recherche); |
} |
/trunk/src/org/tela_botanica/client/composants/pagination/Proxy.java |
---|
34,25 → 34,6 |
public abstract void load(TransformateurJSONaModelData<D> reader, Object loadConfig, AsyncCallback<D> callback, String recherche); |
@SuppressWarnings("unchecked") |
public void rafraichir(Object nouvellesDonnees) { |
try { |
data = nouvellesDonnees; |
D d = null; |
if (reader != null) { |
d = reader.read(loadConfig, data); |
} else { |
d = (D) data; |
if (d instanceof List) { |
d = (D) new ArrayList((List) d); |
} |
} |
callback.onSuccess(d); |
} catch (Exception e) { |
callback.onFailure(e); |
} |
} |
public abstract void rafraichir(Object nouvellesDonnees); |
} |
/trunk/src/org/tela_botanica/client/composants/pagination/ProxyStructures.java |
---|
38,7 → 38,6 |
mediateur.selectionnerStructure(this, recherche, lc.getOffset(), lc.getLimit(), sequenceur); |
} |
@Override |
@SuppressWarnings("unchecked") |
public void rafraichir(Object nouvellesDonnees) { |
/trunk/src/org/tela_botanica/client/composants/pagination/ProxyProjets.java |
---|
37,8 → 37,7 |
BasePagingLoadConfig lc = (BasePagingLoadConfig)loadConfig; |
mediateur.selectionnerProjet(this, recherche, lc.getOffset(), lc.getLimit(), sequenceur); |
} |
@Override |
@SuppressWarnings("unchecked") |
public void rafraichir(Object nouvellesDonnees) { |
/trunk/src/org/tela_botanica/client/composants/ChampComboBoxRechercheTempsReelPaginable.java |
---|
6,11 → 6,17 |
import org.tela_botanica.client.composants.pagination.ChargeurListe; |
import org.tela_botanica.client.composants.pagination.Proxy; |
import org.tela_botanica.client.composants.pagination.TransformateurJSONaModelData; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.Information; |
import org.tela_botanica.client.modeles.Valeur; |
import org.tela_botanica.client.modeles.collection.Collection; |
import org.tela_botanica.client.synchronisation.Sequenceur; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.vues.Formulaire; |
import com.extjs.gxt.ui.client.event.BaseEvent; |
import com.extjs.gxt.ui.client.event.Events; |
import com.extjs.gxt.ui.client.event.FieldEvent; |
import com.extjs.gxt.ui.client.event.Listener; |
import com.extjs.gxt.ui.client.store.ListStore; |
import com.extjs.gxt.ui.client.util.Size; |
33,8 → 39,9 |
import com.extjs.gxt.ui.client.data.ModelData; |
import com.extjs.gxt.ui.client.data.ModelType; |
import com.extjs.gxt.ui.client.data.PagingLoadResult; |
import com.google.gwt.user.client.rpc.AsyncCallback; |
public class ChampComboBoxRechercheTempsReelPaginable extends LayoutContainer { |
public class ChampComboBoxRechercheTempsReelPaginable extends LayoutContainer implements Rafraichissable { |
//-------------// |
// ATTRIBUTS // |
44,6 → 51,7 |
private ComboBox<ModelData> combo = null; |
private Proxy<?> proxy = null; |
private AsyncCallback callback = null; |
private TransformateurJSONaModelData<PagingLoadResult<ModelData>> reader = null; |
private ChargeurListe<PagingLoadResult<ModelData>> loader = null; |
56,6 → 64,9 |
private String displayName = ""; |
private String recherche = ""; |
private String champValeurInitiale = ""; |
private String valeurInitiale = ""; |
//-------------// |
// METHODES // |
//-------------// |
63,6 → 74,7 |
/*-------------- |
Constructeur |
--------------*/ |
public ChampComboBoxRechercheTempsReelPaginable(Proxy<?> proxy, ModelType modeltype, String displayName) { |
this.modeltype = modeltype; |
75,7 → 87,7 |
reader = new TransformateurJSONaModelData<PagingLoadResult<ModelData>>(modeltype); |
loader = new ChargeurListe<PagingLoadResult<ModelData>>(proxy, reader); |
loader = new ChargeurListe<PagingLoadResult<ModelData>>(proxy, reader, this); |
loader.setLimit(plc.getLimit()); |
loader.setOffset(plc.getOffset()); |
105,15 → 117,18 |
combo.setPageSize(plc.getLimit()); |
store = new ListStore<ModelData>(loader); |
combo.setStore(store); |
loader.load(plc, recherche); |
loader.load(plc, recherche, false); |
combo.addListener(Events.KeyUp, new Listener<BaseEvent>() { |
combo.addListener(Events.KeyUp, new Listener<FieldEvent>() { |
public void handleEvent(BaseEvent be) { |
recherche = combo.getRawValue(); |
plc.setLimit(limit); plc.setOffset(start); |
loader.setLimit(limit); loader.setOffset(start); |
loader.load(plc, recherche); |
public void handleEvent(FieldEvent fe) { |
// on vérifie que les touches enfoncées ne sont pas les flèches du clavier |
if (fe.getKeyCode() <= 38 || fe.getKeyCode() >= 40) { |
recherche = combo.getRawValue(); |
plc.setLimit(limit); plc.setOffset(start); |
loader.setLimit(limit); loader.setOffset(start); |
loader.load(plc, recherche, false); |
} |
} |
}); |
131,7 → 146,7 |
public ModelData getValeur() |
{ |
if (!Util.isEmptyString(combo.getRawValue())) return combo.getSelection().get(0); |
if (combo.getSelection() != null && combo.getSelection().size() > 0) return combo.getSelection().get(0); |
else return null; |
} |
174,10 → 189,33 |
combo.setSelection(selection); |
} |
public void chargerValeurInitiale(String valeurInitiale, String champ) |
{ |
this.valeurInitiale = valeurInitiale; |
this.champValeurInitiale = champ; |
loader.load(plc, valeurInitiale, true); |
} |
/*----------------------------- |
Rafraichir |
-----------------------------*/ |
public void rafraichir(Object nouvellesDonnees) { |
if (nouvellesDonnees instanceof Information) { |
Information info = (Information) nouvellesDonnees; |
if (info.getType().equals("selectionnerValeurCombo")) { |
if (combo.getStore().findModel(champValeurInitiale, valeurInitiale) == null) Debug.log("ERREUR. Modele non trouvé"); |
else combo.setValue(combo.getStore().findModel(champValeurInitiale, valeurInitiale)); |
} |
} |
} |
/*---------------- |
Méthode privées |
-----------------*/ |
} |