PDA

View Full Version : Paging grid and Gilead doesn't work



John99
30 Aug 2009, 4:37 AM
Hello.
My BeanModel paging grid doesn't load. I use Gilead in stateless mode and hibernate.
Code:



RpcProxy<BasePagingLoadResult<User>> proxy = new RpcProxy<BasePagingLoadResult<User>>() {
@Override
public void load(Object loadConfig,
AsyncCallback<BasePagingLoadResult<User>> callback) {
service.loadUserList(callback);
}
};

// loader
final BasePagingLoader<BasePagingLoadResult<ModelData>> loader = new BasePagingLoader<BasePagingLoadResult<ModelData>>(
proxy, new BeanModelReader());
loader.setRemoteSort(true);

ListStore<BeanModel> store = new ListStore<BeanModel>(loader);

final PagingToolBar toolBar = new PagingToolBar(50);
//toolBar.add(new Button("ddfsdf"));
toolBar.bind(loader);

List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("id", "Id", 50));
columns.add(new ColumnConfig("version", "Version", 100));
columns.add(new ColumnConfig("login", "Login", 150));
columns.add(new ColumnConfig("firstName", "First Name", 150));
columns.add(new ColumnConfig("lastName", "Last Name", 150));
columns.add(new ColumnConfig("password", "Password", 150));
ColumnModel cm = new ColumnModel(columns);

final Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);
grid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>() {
public void handleEvent(GridEvent<BeanModel> be) {
grid.getStore().getLoader().load();
}
});
grid.setLoadMask(true);
grid.setBorders(true);
grid.setAutoExpandColumn("login");

ContentPanel panel = new ContentPanel();
panel.setHeaderVisible(false);
panel.setSize(800, 500);
panel.setLayout(new FitLayout());
panel.setBottomComponent(toolBar);


but non paging BeanModel Grid loads ok.

Code:

RpcProxy<List<User>> proxy = new RpcProxy<List<User>>() {
@Override
public void load(Object loadConfig,
AsyncCallback<List<User>> callback) {
service.loadUserList(callback);
}
};
BeanModelReader reader = new BeanModelReader();

// loader and store
ListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(
proxy, reader);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);

// loader.load();

// column model
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("id", "Id", 50));
columns.add(new ColumnConfig("version", "Version", 100));
columns.add(new ColumnConfig("login", "Login", 150));
columns.add(new ColumnConfig("firstName", "First Name", 150));
columns.add(new ColumnConfig("lastName", "Last Name", 150));
columns.add(new ColumnConfig("password", "Password", 150));
ColumnModel cm = new ColumnModel(columns);

final Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);
// grid.setAutoExpandColumn("login");

grid.setLoadMask(true);
grid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>() {
@Override
public void handleEvent(GridEvent<BeanModel> be) {
grid.getStore().getLoader().load();
}
});

ContentPanel panel = new ContentPanel();
// panel.setHeading("BeanModel Grid Example");
panel.setHeaderVisible(false);
panel.setSize(800, 500);
panel.setLayout(new FitLayout());
panel.add(grid);

Regards, Evgeny

John99
30 Aug 2009, 5:19 AM
CLOSED. My fault. ))

Arno.Nyhm
31 Aug 2009, 4:31 AM
CLOSED. My fault. ))

can you please also describe how you solve it? this helps others with a similar problem.

borisperezg
2 Jun 2010, 11:12 AM
Hi... I have the same problem but, I could not make it work.

I have my Entidad and EntidadBeanModel... but, when I compile the project I get this error:
Compiling module co.gov.dafp.web.DataExploration
[java] Resolving co.gov.dafp.web.client.model.EntidadBeanModel
[java] Found type 'co.gov.dafp.web.client.model.EntidadBeanModel'
[java] [ERROR] Annotation error: cannot resolve co.gov.dafp.web.client.model.Entidad
[java] java.lang.ClassNotFoundException: co.gov.dafp.web.client.model.Entidad

At the of error I get this other message:
[ERROR] Line 34: Failed to resolve 'com.extjs.gxt.ui.client.data.BeanModelLookup' via deferred binding

DataExploration is my Entry-point. The source code for both classes are:



package co.gov.dafp.web.client.model;

import com.extjs.gxt.ui.client.data.BeanModelMarker;
import com.extjs.gxt.ui.client.data.BeanModelMarker.BEAN;

@BEAN(co.gov.dafp.web.client.model.Entidad.class)
public interface EntidadBeanModel extends BeanModelMarker {

}



package co.gov.dafp.web.client.model;

import java.io.Serializable;

import com.extjs.gxt.ui.client.data.BeanModelTag;

public class Entidad implements BeanModelTag, Serializable {

private String id, nombre, departamento, municipio;

public Entidad(){}

public Entidad(String id, String nombre, String departamento,
String municipio) {
super();
this.id = id;
this.nombre = nombre;
this.departamento = departamento;
this.municipio = municipio;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getNombre() {
return nombre;
}

public void setNombre(String nombre) {
this.nombre = nombre;
}

public String getDepartamento() {
return departamento;
}

public void setDepartamento(String departamento) {
this.departamento = departamento;
}

public String getMunicipio() {
return municipio;
}

public void setMunicipio(String municipio) {
this.municipio = municipio;
}
}

I hope that someone can help me. Thanks a lot.

borisperezg
2 Jun 2010, 12:13 PM
Hi... I reviewed several forum and I found the solution. In this page I found it:
http://www.mail-archive.com/cypal-studio-for-gwt@googlegroups.com/msg00144.html

The problem is that at the compiling time, the classes folder is clean, so, the class's reference in Bean tag is missing, so, I had to create another project and put there the class.

So, Entidad and EntidadBeanModel were created in other proyect and associated in build path of my proyect and too in and Ant file maked to create war file.

So... problem resolved.

Sorry for English.

See ya.