/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/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); |
} |
} |