Salut tout le monde.
J'ai utilisé GXT Grid pour la première fois, pour afficher des données issues d'un BDD.J'ai suivi pas mal de tutoriel mais je n'y arrive pas.Un exception est levé:"java.lang.ClassCastException".Je n'arrive pas a identifié le source de l'erreur,et si quelqu'un pouvait m'aider,voici quelque code source
Code Bean Model:
Code construction Grid:public class IntervenantModel implements BeanModelTag,Serializable{
private String matricule;
private String nom;
private String tel;
private String login;
private String mail;
public void setMatricule(String matricule){
this.matricule=matricule;
}
public void setNom(String nom){
this.nom=nom;
}
public void setMail(String mail){
this.mail=mail;
}
public void setTel(String tel){
this.tel=tel;
}
public void setLogin(String login){
this.login=login;
}
public String getMatricule(){
return matricule;
}
public String getNom(){
return nom;
}
public String getLogin(){
return login;
}
public String getMail(){
return mail;
}
public String getTel(){
return tel;
}
}
Code recuperation du liste:if(loader==null){
RpcProxy<List<IntervenantModel>> proxy=new RpcProxy<List<IntervenantModel>>(){
@Override
protected void load(Object loadConfig,
AsyncCallback<List<IntervenantModel>> callback) {
getService().getAllIntervenant(callback);
}
};
loader = new BasePagingLoader<PagingLoadResult<ModelData>>(proxy,new BeanModelReader());
loader.setRemoteSort(true);
loader.load(0,10);
loader.addLoadListener(new LoadListener(){
@Override
public void loaderLoadException(LoadEvent le) {
MessageBox.alert("test", le.exception.toString(), null);
}
});
toolBar.bind(loader);
toolBar.refresh();
if (store == null)
{
store = new ListStore<BeanModel>(loader);
}
}
grid= new Grid<BeanModel>(store, new ColumnModel(getColumnConfigs()));
Merci d'avancepublic List getAllIntervenant(){
List<Intervenant>listServer=interManager.getAllIntervenant();
List<IntervenantModel>listClient=new ArrayList<IntervenantModel>();
Iterator it=listServer.iterator();
while(it.hasNext()){
Intervenant tmpServer=(Intervenant)it.next();
String nom=tmpServer.getNomIntervenant();
String matricule=tmpServer.getImmatriculeIntervenant();
String login=tmpServer.getLoginIntervenant();
String tel=tmpServer.getTelIntervenant();
String mail=tmpServer.getMailIntervenant();
IntervenantModel tmpClient=new IntervenantModel();
tmpClient.setLogin(login);tmpClient.setMail(mail);
tmpClient.setMatricule(matricule);tmpClient.setNom(nom);
tmpClient.setTel(tel);
listClient.add(tmpClient);
}
return listClient;
}
Partager