/trunk/src/org/tela_botanica/client/composants/pagination/ProxyStructures.java |
---|
11,6 → 11,7 |
import org.tela_botanica.client.modeles.ValeurListeAsyncDao; |
import org.tela_botanica.client.synchronisation.Sequenceur; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilString; |
import com.extjs.gxt.ui.client.Registry; |
import com.extjs.gxt.ui.client.data.BasePagingLoadConfig; |
29,43 → 30,37 |
} |
@Override |
public void load(TransformateurJSONaModelData reader, Object loadConfig, AsyncCallback callback, String recherche) { |
this.reader = reader; |
this.callback = callback; |
this.loadConfig = loadConfig; |
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.selectionnerStructure(this, recherche, lc.getOffset(), lc.getLimit(), sequenceur); |
} |
BasePagingLoadConfig lc = (BasePagingLoadConfig) loadConfig; |
if (UtilString.isNumber(recherche, false)) { |
mediateur.selectionnerStructureAvecPaginationProgressive(this, recherche, null, null, "array", lc.getOffset(), lc.getLimit(), sequenceur); |
} else { |
mediateur.selectionnerStructure(this, recherche, lc.getOffset(), lc.getLimit(), sequenceur); |
} |
} |
@Override |
@SuppressWarnings("unchecked") |
public void rafraichir(Object nouvellesDonnees) { |
try |
{ |
try { |
data = nouvellesDonnees; |
Debug.log("Dans ProxyStructure:"+data.toString()); |
D d = null; |
if (reader != null) |
{ |
d = (D) reader.read(loadConfig, data); |
} |
else |
{ |
d = (D) data; |
if (d instanceof List) |
{ |
d = (D) new ArrayList((List) d); |
} |
} |
if (reader != null) { |
d = (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); |
} |
catch (Exception e) |
{ |
callback.onFailure(e); |
} |
} |
} |
} |
/trunk/src/org/tela_botanica/client/composants/pagination/ProxyProjets.java |
---|
38,26 → 38,25 |
this.callback = callback; |
this.loadConfig = loadConfig; |
BasePagingLoadConfig lc = (BasePagingLoadConfig)loadConfig; |
BasePagingLoadConfig lc = (BasePagingLoadConfig) loadConfig; |
if (UtilString.isNumber(recherche, false)) mediateur.selectionnerProjet(this, recherche, "array", true, sequenceur); |
else mediateur.selectionnerProjet(this, recherche, lc.getOffset(), lc.getLimit(), sequenceur); |
if (UtilString.isNumber(recherche, false)) { |
mediateur.selectionnerProjet(this, recherche, "array", true, sequenceur); |
} else { |
mediateur.selectionnerProjet(this, recherche, lc.getOffset(), lc.getLimit(), sequenceur); |
} |
} |
@Override |
@SuppressWarnings("unchecked") |
public void rafraichir(Object nouvellesDonnees) { |
try |
{ |
try { |
data = nouvellesDonnees; |
D d = null; |
if (reader != null) |
{ |
if (reader != null) { |
d = (D) reader.read(loadConfig, data); |
} |
else |
{ |
} else { |
d = (D) data; |
if (d instanceof List) |
{ |
66,11 → 65,8 |
} |
callback.onSuccess(d); |
} |
catch (Exception e) |
{ |
} catch (Exception e) { |
callback.onFailure(e); |
} |
} |
} |
} |
/trunk/src/org/tela_botanica/client/composants/pagination/ChargeurListe.java |
---|
1,20 → 1,10 |
package org.tela_botanica.client.composants.pagination; |
import java.util.Iterator; |
import java.util.List; |
import java.util.Map; |
import java.util.Set; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.Information; |
import org.tela_botanica.client.modeles.collection.CollectionAPersonne; |
import org.tela_botanica.client.modeles.personne.Personne; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilString; |
import com.extjs.gxt.ui.client.data.BaseListLoadResult; |
import com.extjs.gxt.ui.client.data.BaseModelData; |
import com.extjs.gxt.ui.client.data.BasePagingLoadResult; |
import com.extjs.gxt.ui.client.data.BasePagingLoader; |
import com.extjs.gxt.ui.client.data.LoadEvent; |
import com.extjs.gxt.ui.client.data.PagingLoadResult; |
35,35 → 25,34 |
public boolean load(Object loadConfig, String recherche, boolean doRafraichir) { |
this.doRafraichir = doRafraichir; |
if (fireEvent(BeforeLoad, new LoadEvent(this, loadConfig))) { |
lastConfig = loadConfig; |
this.recherche = recherche; |
loadData(loadConfig, recherche); |
return true; |
} |
else return false; |
lastConfig = loadConfig; |
this.recherche = recherche; |
loadData(loadConfig, recherche); |
return true; |
} else { |
return false; |
} |
} |
public boolean load(Object loadConfig) { |
if (fireEvent(BeforeLoad, new LoadEvent(this, loadConfig))) { |
lastConfig = loadConfig; |
loadData(loadConfig, recherche); |
return true; |
} |
return false; |
if (fireEvent(BeforeLoad, new LoadEvent(this, loadConfig))) { |
lastConfig = loadConfig; |
loadData(loadConfig, recherche); |
return true; |
} |
return false; |
} |
public void load(int offset, int limit) { |
this.offset = offset; |
this.limit = limit; |
load(); |
this.offset = offset; |
this.limit = limit; |
load(); |
} |
public boolean load() { |
Object config = (reuseConfig && lastConfig != null) ? lastConfig : newLoadConfig(); |
config = prepareLoadConfig(config); |
return load(config); |
Object config = (reuseConfig && lastConfig != null) ? lastConfig : newLoadConfig(); |
config = prepareLoadConfig(config); |
return load(config); |
} |
@SuppressWarnings("unchecked") |
71,9 → 60,12 |
AsyncCallback<D> callback = new AsyncCallback<D>() { |
public void onFailure(Throwable caught) { |
onLoadFailure(config, caught); |
if (!UtilString.isEmpty(caught.getMessage())) Debug.log("[FAILURE] ChargeurListe : message="+caught.getMessage()); |
else Debug.log("[FAILURE] ChargeurListe : message=NULL. Peut-être le modelType est-il mal paramétré ?"); |
onLoadFailure(config, caught); |
if (!UtilString.isEmpty(caught.getMessage())) { |
Debug.log("[FAILURE] ChargeurListe : message="+caught.getMessage()); |
} else { |
Debug.log("[FAILURE] ChargeurListe : message=NULL. Peut-être le modelType est-il mal paramétré ?"); |
} |
} |
public void onSuccess(D result) { |
117,6 → 109,6 |
} |
} |
}; |
((Proxy)proxy).load((TransformateurJSONaModelData)reader, config, callback, recherche); |
((Proxy) proxy).load((TransformateurJSONaModelData) reader, config, callback, recherche); |
} |
} |
/trunk/src/org/tela_botanica/client/composants/pagination/Proxy.java |
---|
1,16 → 1,11 |
package org.tela_botanica.client.composants.pagination; |
import java.util.ArrayList; |
import java.util.List; |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.RegistreId; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.synchronisation.Sequenceur; |
import org.tela_botanica.client.util.Debug; |
import com.extjs.gxt.ui.client.Registry; |
import com.extjs.gxt.ui.client.data.BasePagingLoadConfig; |
import com.extjs.gxt.ui.client.data.DataReader; |
import com.extjs.gxt.ui.client.data.MemoryProxy; |
import com.extjs.gxt.ui.client.data.ModelData; |
36,5 → 31,4 |
public abstract void load(TransformateurJSONaModelData<D> reader, Object loadConfig, AsyncCallback<D> callback, String recherche); |
public abstract void rafraichir(Object nouvellesDonnees); |
} |
} |
/trunk/src/org/tela_botanica/client/composants/ChampComboBoxRechercheTempsReelPaginable.java |
---|
1,7 → 1,6 |
package org.tela_botanica.client.composants; |
import java.util.List; |
import java.util.Map; |
import org.tela_botanica.client.composants.pagination.ChargeurListe; |
import org.tela_botanica.client.composants.pagination.Proxy; |
8,31 → 7,16 |
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; |
import com.extjs.gxt.ui.client.util.Util; |
import com.extjs.gxt.ui.client.widget.LayoutContainer; |
import com.extjs.gxt.ui.client.widget.VerticalPanel; |
import com.extjs.gxt.ui.client.widget.form.ComboBox; |
import com.extjs.gxt.ui.client.widget.layout.AbsoluteLayout; |
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout; |
import com.extjs.gxt.ui.client.widget.layout.BoxLayout; |
import com.extjs.gxt.ui.client.widget.layout.FitLayout; |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout; |
import com.extjs.gxt.ui.client.widget.layout.FormData; |
import com.extjs.gxt.ui.client.widget.layout.FormLayout; |
import com.extjs.gxt.ui.client.data.BaseModelData; |
import com.extjs.gxt.ui.client.data.BasePagingLoadConfig; |
import com.extjs.gxt.ui.client.data.LoadEvent; |
import com.extjs.gxt.ui.client.data.Loader; |
39,7 → 23,6 |
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 implements Rafraichissable { |
74,9 → 57,8 |
Constructeur |
--------------*/ |
public ChampComboBoxRechercheTempsReelPaginable(Proxy<?> proxy, ModelType modeltype, String displayName) { |
this.modeltype = modeltype; |
public ChampComboBoxRechercheTempsReelPaginable(Proxy<?> proxy, ModelType modelType, String displayName) { |
this.modeltype = modelType; |
this.proxy = proxy; |
this.displayName = displayName; |
84,9 → 66,9 |
plc.setLimit(limit); |
plc.setOffset(start); |
reader = new TransformateurJSONaModelData<PagingLoadResult<ModelData>>(modeltype, null); |
reader = new TransformateurJSONaModelData<PagingLoadResult<ModelData>>(this.modeltype, null); |
loader = new ChargeurListe<PagingLoadResult<ModelData>>(proxy, reader, this); |
loader = new ChargeurListe<PagingLoadResult<ModelData>>(this.proxy, reader, this); |
loader.setLimit(plc.getLimit()); |
loader.setOffset(plc.getOffset()); |
93,25 → 75,24 |
loader.addListener(Loader.BeforeLoad, new Listener<LoadEvent>() { |
public void handleEvent(LoadEvent be) { |
be.<ModelData> getConfig().set("start", be.<ModelData> getConfig().get("offset")); |
} |
} |
}); |
loader.addListener(Loader.Load, new Listener<LoadEvent>() { |
public void handleEvent(LoadEvent be) { |
} |
} |
}); |
loader.addListener(Loader.LoadException, new Listener<LoadEvent>() { |
public void handleEvent(LoadEvent be) { |
} |
} |
}); |
combo = new ComboBox<ModelData>(); |
combo.setWidth(largeur); |
this.setWidth(largeur); |
combo.setDisplayField(displayName); |
combo.setDisplayField(this.displayName); |
combo.setHideTrigger(false); |
combo.setPageSize(plc.getLimit()); |
store = new ListStore<ModelData>(loader); |
119,17 → 100,17 |
loader.load(plc, recherche, false); |
combo.addListener(Events.KeyUp, new Listener<FieldEvent>() { |
public void handleEvent(FieldEvent fe) { |
// on vérifie que les touches enfoncées ne sont pas les flèches du clavier |
if (!fe.isNavKeyPress()) { |
recherche = combo.getRawValue(); |
plc.setLimit(limit); plc.setOffset(start); |
loader.setLimit(limit); loader.setOffset(start); |
plc.setLimit(limit); |
plc.setOffset(start); |
loader.setLimit(limit); |
loader.setOffset(start); |
loader.load(plc, recherche, false); |
} |
} |
}); |
this.add(combo); |
138,30 → 119,28 |
/*------------ |
Accesseurs |
------------*/ |
public ComboBox<ModelData> getCombo() |
{ |
public ComboBox<ModelData> getCombo() { |
return this.combo; |
} |
public ModelData getValeur() |
{ |
if (combo.getSelection() != null && combo.getSelection().size() > 0) return combo.getSelection().get(0); |
else return null; |
public ModelData getValeur() { |
if (combo.getSelection() != null && combo.getSelection().size() > 0) { |
return combo.getSelection().get(0); |
} else { |
return null; |
} |
} |
public ListStore<?> getStore() |
{ |
public ListStore<?> getStore() { |
return combo.getStore(); |
} |
public void setWidth(int largeur) |
{ |
public void setWidth(int largeur) { |
this.largeur = largeur; |
this.combo.setWidth(largeur); |
} |
public void setWidth(int tailleLabel, int largeurTotale) |
{ |
public void setWidth(int tailleLabel, int largeurTotale) { |
this.setWidth(largeurTotale); |
this.largeur = largeurTotale; |
this.combo.setWidth(largeurTotale - tailleLabel); |
178,18 → 157,15 |
Gestion du contenu du champ |
-----------------------------*/ |
public List<ModelData> collecterValeursDuChamp() |
{ |
public List<ModelData> collecterValeursDuChamp() { |
return combo.getSelection(); |
} |
public void peuplerChamp(List<ModelData> selection) |
{ |
public void peuplerChamp(List<ModelData> selection) { |
combo.setSelection(selection); |
} |
public void chargerValeurInitiale(String valeurInitiale, String champ) |
{ |
public void chargerValeurInitiale(String valeurInitiale, String champ) { |
this.valeurInitiale = valeurInitiale; |
this.champValeurInitiale = champ; |
207,23 → 183,13 |
Debug.log("ERREUR. Modele non trouvé."); |
Debug.log("Recherché : ["+champValeurInitiale+"]="+valeurInitiale); |
Debug.log("Le magasin contient "+combo.getStore().getCount()+" éléments. Les propriétés des modèles sont :"); |
for (int i=0; i<combo.getStore().getCount(); i++) { |
for (int i = 0; i < combo.getStore().getCount(); i++) { |
Debug.log(combo.getStore().getAt(i).getProperties().toString()); |
} |
} else { |
combo.setValue(combo.getStore().findModel(champValeurInitiale, valeurInitiale)); |
} |
else combo.setValue(combo.getStore().findModel(champValeurInitiale, valeurInitiale)); |
} |
} |
} |
/*---------------- |
Méthode privées |
-----------------*/ |
} |
} |