PDA

View Full Version : TreeStore models not updated



francesco.calabri
14 Mar 2011, 9:23 AM
Hi all,
I've been working around the example of "basic tree grid". I've just added a grid from which I can add models to the tree grid. All works...
But when I manipulate the structure of the tree, the models contained in the store aren't updated (I mean their parent-childs relation), even if it "visually" happens.

this is my code:


package it.netstudio.trust.gwt.client.widget.articoli;

import it.netstudio.trust.gwt.client.ArticoliService;
import it.netstudio.trust.gwt.client.ArticoliServiceAsync;
import it.netstudio.trust.gwt.client.mvc.model.articoli.ArticoloDistintaBaseModel;
import it.netstudio.trust.gwt.client.mvc.model.articoli.ArticoloVO;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.Style.SortDir;
import com.extjs.gxt.ui.client.data.BasePagingLoader;
import com.extjs.gxt.ui.client.data.BeanModel;
import com.extjs.gxt.ui.client.data.BeanModelReader;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.dnd.TreeGridDragSource;
import com.extjs.gxt.ui.client.dnd.TreeGridDropTarget;
import com.extjs.gxt.ui.client.dnd.DND.Feedback;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.GridEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.util.IconHelper;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.RowData;
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGrid;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGridCellRenderer;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbstractImagePrototype;

public class DistintaBaseWindow extends Window {

private ArticoliServiceAsync remoteProvider = GWT.create(ArticoliService.class);
private PagingToolBar toolBar;
private TreeGrid<ArticoloDistintaBaseModel> tree;

public DistintaBaseWindow(final ArticoloDistintaBaseModel rootModel) {

setHeading("Composizione Distinta Base");
setLayout(new RowLayout(Orientation.HORIZONTAL));
setMaximizable(true);
setClosable(false);
setSize(800, 550);
setModal(true);

LayoutContainer left = new LayoutContainer(new RowLayout());

final FormPanel searchPanel = new FormPanel();
searchPanel.setHeading("Articoli Disponibili");
searchPanel.setPadding(5);
TextField<String> cod = new TextField<String>();
cod.setFieldLabel("Codice");
cod.setName("codice");
TextField<String> des = new TextField<String>();
des.setFieldLabel("Descrizione");
des.setName("descrizione");
TextField<String> art = new TextField<String>();
art.setFieldLabel("Art. Forn.");
art.setName("codiceArticoloFornitore");
FormData f = new FormData("100%");
searchPanel.add(cod, f);
searchPanel.add(des, f);
searchPanel.add(art, f);
ToolBar filter = new ToolBar();
filter.add(new Button("Reset", IconHelper.createPath("images/clear.png"), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
searchPanel.reset();
}
}));
filter.add(new FillToolItem());
filter.add(new Button("Filtra", IconHelper.createPath("images/filter.png"), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
Map<String, String> filters = new HashMap<String, String>();
for (Field<?> f : searchPanel.getFields())
filters.put(f.getName(), (String) f.getValue());
remoteProvider.setArticoliDBFilter(filters, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
System.out.println("ART DB FILTER FAILURE!!");
}
public void onSuccess(Void result) {
toolBar.refresh();
}
});
}
}));
searchPanel.setBottomComponent(filter);

ContentPanel gridPanel = new ContentPanel(new FitLayout());
gridPanel.setHeaderVisible(false);

ColumnConfig codice = new ColumnConfig("codice", "Codice", 150);
ColumnConfig codiceArtFornitore = new ColumnConfig("codiceArticoloFornitore", "Articolo Fornitore", 120);
ColumnConfig descrizione = new ColumnConfig("descrizione", "Descrizione", 150);

RpcProxy<PagingLoadResult<ArticoloVO>> artProxy = new RpcProxy<PagingLoadResult<ArticoloVO>>() {
@Override
protected void load(Object loadConfig,
AsyncCallback<PagingLoadResult<ArticoloVO>> callback) {
// chiamata per articoli tipo C e S
remoteProvider.findAllArticoliDistintaBase((PagingLoadConfig) loadConfig, callback);
}
};
final BasePagingLoader<PagingLoadResult<BeanModel>> loader;
loader = new BasePagingLoader<PagingLoadResult<BeanModel>>(artProxy, new BeanModelReader());
loader.setRemoteSort(true);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);
store.setDefaultSort("descrizione", SortDir.ASC);
toolBar = new PagingToolBar(25);
toolBar.bind(loader);
final Grid<BeanModel> grid = new Grid<BeanModel>(store,
new ColumnModel(Arrays.asList(codice, codiceArtFornitore, descrizione)));
grid.setAutoExpandColumn("descrizione");
grid.setStripeRows(true);
grid.setColumnLines(true);
grid.setLoadMask(true);
grid.getSelectionModel().setSelectionMode(SelectionMode.MULTI);
grid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>() {
public void handleEvent(GridEvent<BeanModel> be) {
loader.load(0, 25);
}
});
gridPanel.add(grid);
gridPanel.setBottomComponent(toolBar);

left.add(searchPanel, new RowData(1, .3d));
left.add(gridPanel, new RowData(1, .7d));

add(left, new RowData(.48d, 1, new Margins(8,1,8,8)));

LayoutContainer buttonColumn = new LayoutContainer(new CenterLayout());
//button for add a new model to the tree, from the selection of the grid
Button addB = new Button();
addB.setIcon(IconHelper.createPath("images/arrow.gif"));
addB.setSize(20, 20);
addB.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
for (BeanModel b : grid.getSelectionModel().getSelectedItems()) {
ArticoloVO a = b.getBean();
ArticoloDistintaBaseModel model;
model = new ArticoloDistintaBaseModel(
null, a, null
);
model.setParent(rootModel);
tree.getTreeStore().insert(model, tree.getTreeStore().getChildCount(), false);
}
}
});
buttonColumn.add(addB);

add(buttonColumn, new RowData(.04d, 1));

ContentPanel treePanel = new ContentPanel(new FitLayout());
treePanel.setHeading("Distinta Base");

ColumnConfig codiceT = new ColumnConfig("articolo.codice", "Articolo", 150);
codiceT.setRenderer(new TreeGridCellRenderer<BeanModel>());
codiceT.setSortable(false);
ColumnConfig codiceArtFornitoreT = new ColumnConfig("articolo.codiceArticoloFornitore", "Articolo Fornitore", 50);
codiceArtFornitoreT.setSortable(false);
ColumnConfig descrizioneT = new ColumnConfig("articolo.descrizione", "Descrizione", 150);
descrizioneT.setSortable(false);

TreeStore<ArticoloDistintaBaseModel> treeStore = new TreeStore<ArticoloDistintaBaseModel>();
treeStore.setMonitorChanges(true);
if (rootModel != null)
for (ModelData m : rootModel.getChildren())
treeStore.add((ArticoloDistintaBaseModel) m, true);

tree = new TreeGrid<ArticoloDistintaBaseModel>(treeStore,
new ColumnModel(Arrays.asList(codiceT, codiceArtFornitoreT, descrizioneT)));
tree.setAutoExpandColumn("articolo.descrizione");
tree.getStyle().setLeafIcon(IconHelper.createPath("images/jigsaw.png"));
AbstractImagePrototype a = IconHelper.createPath("images/composite.png");
tree.getStyle().setNodeCloseIcon(a);
tree.getStyle().setNodeOpenIcon(a);

TreeGridDropTarget target;
new TreeGridDragSource(tree);
target = new TreeGridDropTarget(tree);
target.setAllowDropOnLeaf(true);
target.setAllowSelfAsSource(true);
target.setFeedback(Feedback.BOTH);

treePanel.add(tree);


add(treePanel, new RowData(.48d, 1, new Margins(8, 8, 8, 1)));
addButton(new Button("Save", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
tree.getTreeStore().commitChanges();
for (ArticoloDistintaBaseModel m : tree.getStore().getModels()) {
System.out.println(m);
//always print the initial situation
//even if the structure of the tree is changed
}
}
}));
addButton(new Button("Close", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
hide();
}
}));
setButtonAlign(HorizontalAlignment.CENTER);
}
}


where the model is:


package it.netstudio.trust.gwt.client.mvc.model.articoli;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.data.BaseTreeModel;
import com.extjs.gxt.ui.client.data.ModelData;

public class ArticoloDistintaBaseModel extends BaseTreeModel {

/**
*
*/
private static final long serialVersionUID = 1L;

public ArticoloDistintaBaseModel() {
super();
}

public ArticoloDistintaBaseModel(Integer id, ArticoloVO articolo, Integer posizione) {
super();
setId(id);
setArticolo(articolo);
setPosizione(posizione);
}

public ArticoloDistintaBaseModel(ArticoloDistintaBaseModel copy) {
super();
setId(copy.getId());
setArticolo(copy.getArticolo());
setPosizione(copy.getPosizione());
setParent(copy.parent);
setAllowNestedValues(copy.allowNestedValues);
setSilent(copy.isSilent());
setProperties(copy.getProperties());
List<ModelData> children = new ArrayList<ModelData>();
for (ModelData m : copy.getChildren())
children.add(new ArticoloDistintaBaseModel((ArticoloDistintaBaseModel) m));
setChildren(children);
}

public Integer getId() {
return (Integer) get("id");
}

public void setId(Integer id) {
set("id", id);
}

public ArticoloVO getArticolo() {
return (ArticoloVO) get("articolo");
}

public void setArticolo(ArticoloVO articolo) {
set("articolo", articolo);
}

public Integer getPosizione() {
return (Integer) get("posizione");
}

public void setPosizione(Integer posizione) {
set("posizione", posizione);
}

@Override
public String toString() {
return "ArticoloDistintaBaseModel [id=" + getId() + ", articolo=" + getArticolo().getCodice() +
", posizione=" + getPosizione() + ", figli=" + getChildren().toString() + "]";
}

}

and ArticoloVO is a simple Bean marked with "BeanModelMarker".

Any idea of the cause? Where I'm wrong?

I'm using:
GWT 2.1.1
GXT 2.2.0

Thanks to all,
F

sven
14 Mar 2011, 9:54 AM
Changes in the relationship are not mantained in the model. You will always have to query the store for this informations

francesco.calabri
16 Mar 2011, 7:35 AM
Thanks Sven for you help!
I've got another two questions about this window I'm trying to create:
1) Is possibile to have TreeGridCellRenderer and GridCellRenderer (on different columns) at the same time?
2) Since I upgraded GXT to 2.2.3 version, the informations in the tree aren't displayed anymore? any hint?

The new code of the window:


package it.netstudio.trust.gwt.client.widget.articoli;

import it.netstudio.trust.gwt.client.ArticoliService;
import it.netstudio.trust.gwt.client.ArticoliServiceAsync;
import it.netstudio.trust.gwt.client.GreetingService;
import it.netstudio.trust.gwt.client.GreetingServiceAsync;
import it.netstudio.trust.gwt.client.mvc.model.anagrafica.FornitoreVO;
import it.netstudio.trust.gwt.client.mvc.model.articoli.ArticoloDistintaBaseModel;
import it.netstudio.trust.gwt.client.mvc.model.articoli.ArticoloVO;
import it.netstudio.trust.gwt.client.mvc.model.articoli.LineaProduttivaVO;
import it.netstudio.trust.gwt.client.mvc.model.articoli.MaterialeArticoloVO;
import it.netstudio.trust.gwt.client.mvc.model.articoli.SpecialitaVO;
import it.netstudio.trust.gwt.client.widget.MyDualList;

import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.IconAlign;
import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.Style.SortDir;
import com.extjs.gxt.ui.client.data.BaseListLoader;
import com.extjs.gxt.ui.client.data.BasePagingLoader;
import com.extjs.gxt.ui.client.data.BeanModel;
import com.extjs.gxt.ui.client.data.BeanModelReader;
import com.extjs.gxt.ui.client.data.ListLoadResult;
import com.extjs.gxt.ui.client.data.ListLoader;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.dnd.DropTarget;
import com.extjs.gxt.ui.client.dnd.TreeGridDragSource;
import com.extjs.gxt.ui.client.dnd.TreeGridDropTarget;
import com.extjs.gxt.ui.client.dnd.DND.Feedback;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.GridEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.util.IconHelper;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.BoxComponent;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.RowData;
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.extjs.gxt.ui.client.widget.treegrid.EditorTreeGrid;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGrid;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGridCellRenderer;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbstractImagePrototype;

public class DistintaBaseWindow extends Window {

private ArticoliServiceAsync remoteProvider = GWT.create(ArticoliService.class);
private GreetingServiceAsync fornitoriProvider = GWT.create(GreetingService.class);
private PagingToolBar toolBar;
private TreeGrid<ArticoloDistintaBaseModel> tree;
private BasePagingLoader<PagingLoadResult<BeanModel>> loader;

public DistintaBaseWindow(final ArticoloDistintaBaseModel rootModel) {

System.out.println("TREE: "+rootModel);

setHeading("Composizione Distinta Base");
setLayout(new RowLayout(Orientation.HORIZONTAL));
setMaximizable(true);
setClosable(false);
setSize(800, 550);
setModal(true);

LayoutContainer left = new LayoutContainer(new RowLayout());

final FormPanel searchPanel = new FormPanel();
searchPanel.setHeading("Articoli Disponibili");
searchPanel.setPadding(5);

TextField<String> cod = new TextField<String>();
cod.setFieldLabel("Codice");
cod.setName("codice");

TextField<String> des = new TextField<String>();
des.setFieldLabel("Descrizione");
des.setName("descrizione");

ComboBox<BeanModel> lnpCombo = new ComboBox<BeanModel>();
lnpCombo.setFieldLabel("Linea Prod.");
lnpCombo.setName("linea.id");
lnpCombo.setDisplayField("descrizione");
lnpCombo.setTriggerAction(TriggerAction.ALL);
RpcProxy<List<LineaProduttivaVO>> proxyLNP = new RpcProxy<List<LineaProduttivaVO>>() {
@Override
protected void load(Object loadConfig,
AsyncCallback<List<LineaProduttivaVO>> callback) {
remoteProvider.findAllLineeProduttive(callback);
}
};
ListLoader<ListLoadResult<BeanModel>> loaderLNP = new BaseListLoader<ListLoadResult<BeanModel>>(proxyLNP, new BeanModelReader());
lnpCombo.setStore(new ListStore<BeanModel>(loaderLNP));

ComboBox<BeanModel> speCombo = new ComboBox<BeanModel>();
speCombo.setFieldLabel("Specialit&agrave;");
speCombo.setName("specialita.id");
speCombo.setDisplayField("descrizione");
speCombo.setTriggerAction(TriggerAction.ALL);
RpcProxy<List<SpecialitaVO>> proxySPE = new RpcProxy<List<SpecialitaVO>>() {
@Override
protected void load(Object loadConfig,
AsyncCallback<List<SpecialitaVO>> callback) {
remoteProvider.findAllSpecialita(callback);
}
};
ListLoader<ListLoadResult<BeanModel>> loaderSPE = new BaseListLoader<ListLoadResult<BeanModel>>(proxySPE, new BeanModelReader());
speCombo.setStore(new ListStore<BeanModel>(loaderSPE));

TextField<String> art = new TextField<String>();
art.setFieldLabel("Art. Forn.");
art.setName("codiceArticoloFornitore");

ComboBox<BeanModel> prodCombo = new ComboBox<BeanModel>();
prodCombo.setFieldLabel("Produttore");
prodCombo.setName("produttore.id");
prodCombo.setDisplayField("descrizione");
prodCombo.setTriggerAction(TriggerAction.ALL);
RpcProxy<List<FornitoreVO>> proxyPROD = new RpcProxy<List<FornitoreVO>>() {
@Override
protected void load(Object loadConfig,
AsyncCallback<List<FornitoreVO>> callback) {
fornitoriProvider.findAllFornitori(callback);
}
};
ListLoader<ListLoadResult<BeanModel>> loaderPROD = new BaseListLoader<ListLoadResult<BeanModel>>(proxyPROD, new BeanModelReader());
prodCombo.setStore(new ListStore<BeanModel>(loaderPROD));

ComboBox<BeanModel> matCombo = new ComboBox<BeanModel>();
matCombo.setFieldLabel("Materiale");
matCombo.setName("materiale.id");
matCombo.setDisplayField("descrizione");
matCombo.setTriggerAction(TriggerAction.ALL);
RpcProxy<List<MaterialeArticoloVO>> proxyMAT = new RpcProxy<List<MaterialeArticoloVO>>() {
@Override
protected void load(Object loadConfig,
AsyncCallback<List<MaterialeArticoloVO>> callback) {
remoteProvider.findAllMaterialiArticolo(callback);
}
};
ListLoader<ListLoadResult<BeanModel>> loaderMAT = new BaseListLoader<ListLoadResult<BeanModel>>(proxyMAT, new BeanModelReader());
matCombo.setStore(new ListStore<BeanModel>(loaderMAT));

FormData f = new FormData("100%");
searchPanel.add(cod, f);
searchPanel.add(des, f);
searchPanel.add(lnpCombo, f);
searchPanel.add(speCombo, f);
searchPanel.add(art, f);
searchPanel.add(prodCombo, f);
searchPanel.add(matCombo, f);

ToolBar filter = new ToolBar();
filter.add(new Button("Reset", IconHelper.createPath("images/clear.png"), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
searchPanel.reset();
}
}));
filter.add(new FillToolItem());
filter.add(new Button("Filtra", IconHelper.createPath("images/filter.png"), new SelectionListener<ButtonEvent>() {
@SuppressWarnings("unchecked")
@Override
public void componentSelected(ButtonEvent ce) {
Map<String, Serializable> filters = new HashMap<String, Serializable>();
for (Field<?> f : searchPanel.getFields()) {
if (f instanceof ComboBox) {
if (f.getValue() == null)
filters.put(f.getName(), null);
else filters.put(f.getName(), (Integer) ((ComboBox) f).getValue().get("id"));
} else
filters.put(f.getName(), (String) f.getValue());
}
remoteProvider.setArticoliDBFilter(filters, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
System.out.println("ART DB FILTER FAILURE!!");
}
public void onSuccess(Void result) {
toolBar.refresh();
}
});
}
}));
searchPanel.setBottomComponent(filter);

ContentPanel gridPanel = new ContentPanel(new FitLayout());
gridPanel.setHeaderVisible(false);

ColumnConfig codice = new ColumnConfig("codice", "Codice", 150);
ColumnConfig codiceArtFornitore = new ColumnConfig("codiceArticoloFornitore", "Articolo Fornitore", 120);
ColumnConfig descrizione = new ColumnConfig("descrizione", "Descrizione", 150);

RpcProxy<PagingLoadResult<ArticoloVO>> artProxy = new RpcProxy<PagingLoadResult<ArticoloVO>>() {
@Override
protected void load(Object loadConfig,
AsyncCallback<PagingLoadResult<ArticoloVO>> callback) {
// chiamata per articoli tipo C e S
remoteProvider.findAllArticoliDistintaBase((PagingLoadConfig) loadConfig, callback);
}
};
loader = new BasePagingLoader<PagingLoadResult<BeanModel>>(artProxy, new BeanModelReader());
loader.setRemoteSort(true);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);
store.setDefaultSort("descrizione", SortDir.ASC);
toolBar = new PagingToolBar(25);
toolBar.bind(loader);
final Grid<BeanModel> grid = new Grid<BeanModel>(store,
new ColumnModel(Arrays.asList(codice, codiceArtFornitore, descrizione)));
grid.setAutoExpandColumn("descrizione");
grid.setStripeRows(true);
grid.setColumnLines(true);
grid.setLoadMask(true);
grid.getSelectionModel().setSelectionMode(SelectionMode.MULTI);
grid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>() {
public void handleEvent(GridEvent<BeanModel> be) {
loader.load(0, 25);
}
});
gridPanel.add(grid);
gridPanel.setBottomComponent(toolBar);

left.add(searchPanel, new RowData(1, -1));
left.add(gridPanel, new RowData(1, 1));
add(left, new RowData(.48d, 1, new Margins(8,1,8,8)));

LayoutContainer buttonColumn = new LayoutContainer(new CenterLayout());
Button addB = new Button();
addB.setIcon(IconHelper.createPath("images/arrow.gif"));
addB.setSize(20, 20);
addB.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
for (BeanModel b : grid.getSelectionModel().getSelectedItems()) {
ArticoloVO a = b.getBean();
ArticoloDistintaBaseModel model;
model = new ArticoloDistintaBaseModel(
null, a, null
);
model.setParent(rootModel);
tree.getTreeStore().insert(model, tree.getTreeStore().getChildCount(), false);
}
}
});
buttonColumn.add(addB);
add(buttonColumn, new RowData(.04d, 1));

ContentPanel treePanel = new ContentPanel(new FitLayout());
treePanel.setHeading("Distinta Base");

ColumnConfig codiceT = new ColumnConfig("articolo.codice", "Articolo", 180);
codiceT.setRenderer(new TreeGridCellRenderer<ArticoloDistintaBaseModel>());
codiceT.setSortable(false);

ColumnConfig codiceArtFornitoreT = new ColumnConfig("articolo.codiceArticoloFornitore", "Articolo Fornitore", 100);
codiceArtFornitoreT.setSortable(false);

ColumnConfig descrizioneT = new ColumnConfig("articolo.descrizione", "Descrizione", 200);
descrizioneT.setSortable(false);

ColumnConfig articoliAlt = new ColumnConfig("articoliAlt", "Alternative", 65);
articoliAlt.setSortable(false);
articoliAlt.setRenderer(new GridCellRenderer<ArticoloDistintaBaseModel>() {
private boolean init;
public Object render(final ArticoloDistintaBaseModel model,
String property, ColumnData config, int rowIndex,
int colIndex, ListStore<ArticoloDistintaBaseModel> store,
Grid<ArticoloDistintaBaseModel> grid) {
if (!init) {
init = true;
grid.addListener(Events.ColumnResize, new Listener<GridEvent<ArticoloDistintaBaseModel>>() {
public void handleEvent(GridEvent<ArticoloDistintaBaseModel> be) {
for (int i = 0; i < be.getGrid().getStore().getCount(); i++) {
if (be.getGrid().getView().getWidget(i, be.getColIndex()) != null
&& be.getGrid().getView().getWidget(i, be.getColIndex()) instanceof BoxComponent) {
((BoxComponent) be.getGrid().getView().getWidget(i, be.getColIndex())).setWidth(be.getWidth() - 10);
}
}
}
});
}
Button btn = new Button();
btn.setIcon(IconHelper.createPath("images/alternative.png"));
btn.setIconAlign(IconAlign.TOP);
btn.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
Window w = new Window();
w.setSize(500,300);
w.setBodyBorder(false);
w.setHeading("Alrticoli Alternativi a "+model.getArticolo().getCodice());
w.setModal(true);
w.setLayout(new FitLayout());
FormPanel f = new FormPanel();
f.setHeaderVisible(false);
MyDualList<BeanModel> dualList = new MyDualList<BeanModel>();
dualList.setFieldLabel("Articoli");
dualList.setSimpleTemplate("{[values.descrizione]} [{[values.tipoArticolo]}]");
RpcProxy<List<ArticoloVO>> proxy = new RpcProxy<List<ArticoloVO>>() {
@Override
protected void load(Object loadConfig,
AsyncCallback<List<ArticoloVO>> callback) {
remoteProvider.findArticoliAlternativiSelezionabili(
tree.getSelectionModel().getSelectedItem().getId(), callback);
}
};
ListLoader<ListLoadResult<BeanModel>> loader = new BaseListLoader<ListLoadResult<BeanModel>>(proxy, new BeanModelReader());
dualList.getFromList().setStore(new ListStore<BeanModel>(loader));
// TODO populate the store
dualList.getToList().setStore(new ListStore<BeanModel>());
f.add(dualList, new FormData("100% 100%"));
w.add(f);
loader.load();
w.show();
}
});
btn.setWidth(grid.getColumnModel().getColumnWidth(colIndex) - 10);
return btn;
}
});

TreeStore<ArticoloDistintaBaseModel> treeStore = new TreeStore<ArticoloDistintaBaseModel>();
if (rootModel != null)
for (ModelData m : rootModel.getChildren())
treeStore.add((ArticoloDistintaBaseModel) m, true);

tree = new EditorTreeGrid<ArticoloDistintaBaseModel>(treeStore,
new ColumnModel(Arrays.asList(
codiceT,
codiceArtFornitoreT,
descrizioneT,
articoliAlt
)));
tree.setAutoExpandColumn("articolo.descrizione");
tree.getStyle().setLeafIcon(IconHelper.createPath("images/component.png"));
AbstractImagePrototype a = IconHelper.createPath("images/composite.png");
tree.getStyle().setNodeCloseIcon(a);
tree.getStyle().setNodeOpenIcon(a);

new DropTarget(this);

TreeGridDropTarget target;
new TreeGridDragSource(tree);
target = new TreeGridDropTarget(tree);
target.setAllowDropOnLeaf(true);
target.setAllowSelfAsSource(true);
target.setFeedback(Feedback.BOTH);

treePanel.add(tree);
ToolBar ex = new ToolBar();
ex.add(new FillToolItem());
final ToggleButton expand = new ToggleButton("Espandi");
expand.setIcon(IconHelper.createPath("images/expand.png"));
expand.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
if (((ToggleButton) ce.getButton()).isPressed()) {
expand.setIcon(IconHelper.createPath("images/collapse.png"));
expand.setText("Collassa");
tree.expandAll();
} else {
expand.setIcon(IconHelper.createPath("images/expand.png"));
expand.setText("Espandi");
tree.collapseAll();
}
}
});
ex.add(expand);
treePanel.setBottomComponent(ex);
add(treePanel, new RowData(.48d, 1, new Margins(8, 8, 8, 1)));
addButton(new Button("Salva ed Esci", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
// ArticoloDistintaBaseModel tree = getStructure(rootModel);
// remoteProvider.saveDistintaBase(tree, new AsyncCallback<Void>() {
// public void onFailure(Throwable caught) {
// MessageBox.alert("Errore", "Errore durante il salvataggio della distinta.", null);
// }
//
// public void onSuccess(Void result) {
// hide();
// }
});
}
}));
addButton(new Button("Esci", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
hide();
}
}));
setButtonAlign(HorizontalAlignment.CENTER);

}


The model for the tree is remained the same. (The code is in the previous post).
The result of this code is that:
- rows's height is too small to contain the Button rendered
- all the information setted via ColumnConfig are not displayed (I have "null" in 'codiceT' ColumnConfig, and blank fields for 'codiceArtFornitoreT' and 'descrizioneT'), but the model (that I print at the beginning of the class) is correct.

Thanks,
F

sven
16 Mar 2011, 9:43 AM
1) Is possibile to have TreeGridCellRenderer and GridCellRenderer (on different columns) at the same time?

Only ONE columnconfig in a grid can have a TreeGridCellRenderer (the one that should show the tree). All others have to use a GridCellRenderer

francesco.calabri
18 Mar 2011, 1:31 AM
I've reproduced my problem in a small test-app:

Entry Point:


package example.client;

import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class ProjectEP implements EntryPoint {

public void onModuleLoad() {

RootPanel.get().clear();
final Viewport v = new Viewport();
v.setLayout(new CenterLayout());

ArticoloDistintaBaseModel root = new ArticoloDistintaBaseModel(
1, new ArticoloVO(4, "K012", "Kit Oculistica"), 0
);
ArticoloDistintaBaseModel child_1 = new ArticoloDistintaBaseModel(
2, new ArticoloVO(5, "K234", "Pinze"), 1
);
child_1.setParent(root);
root.add(child_1);

ArticoloDistintaBaseModel child_2 = new ArticoloDistintaBaseModel(
3, new ArticoloVO(6, "K509", "Tampone"), 2
);
child_2.setParent(root);
root.add(child_2);

ArticoloDistintaBaseModel child_2_1 = new ArticoloDistintaBaseModel(
4, new ArticoloVO(7, "T102", "Cerotto"), 1
);
child_2_1.setParent(child_2);
child_2.add(child_2_1);

DistintaBaseWindow w = new DistintaBaseWindow(root);
v.add(w);
RootPanel.get().add(v);

}

}


Window:


package example.client;

import java.util.Arrays;

import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.data.BasePagingLoader;
import com.extjs.gxt.ui.client.data.BeanModel;
import com.extjs.gxt.ui.client.data.BeanModelReader;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
import com.extjs.gxt.ui.client.data.PagingLoadResult;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.dnd.DropTarget;
import com.extjs.gxt.ui.client.dnd.TreeGridDragSource;
import com.extjs.gxt.ui.client.dnd.TreeGridDropTarget;
import com.extjs.gxt.ui.client.dnd.DND.Feedback;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.GridEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.util.IconHelper;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.BoxComponent;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.DualListField;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.RowData;
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.extjs.gxt.ui.client.widget.treegrid.EditorTreeGrid;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGrid;
import com.extjs.gxt.ui.client.widget.treegrid.TreeGridCellRenderer;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class DistintaBaseWindow extends Window {

private RemoteProviderAsync remoteProvider = GWT.create(RemoteProvider.class);
private PagingToolBar toolBar;
private TreeGrid<ArticoloDistintaBaseModel> tree;
private BasePagingLoader<PagingLoadResult<BeanModel>> loader;

public DistintaBaseWindow(final ArticoloDistintaBaseModel rootModel) {

System.out.println("TREE: "+rootModel);

setHeading("Composizione Distinta Base");
setLayout(new RowLayout(Orientation.HORIZONTAL));
setMaximizable(true);
setClosable(false);
setSize(800, 550);
setModal(true);

LayoutContainer left = new LayoutContainer(new RowLayout());

final FormPanel searchPanel = new FormPanel();
searchPanel.setHeading("Articoli Disponibili");
searchPanel.setPadding(5);

TextField<String> cod = new TextField<String>();
cod.setFieldLabel("Codice");
cod.setName("codice");

TextField<String> des = new TextField<String>();
des.setFieldLabel("Descrizione");
des.setName("descrizione");

TextField<String> art = new TextField<String>();
art.setFieldLabel("Art. Forn.");
art.setName("codiceArticoloFornitore");

FormData f = new FormData("100%");
searchPanel.add(cod, f);
searchPanel.add(des, f);
searchPanel.add(art, f);

ToolBar filter = new ToolBar();
filter.add(new Button("Reset", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
searchPanel.reset();
}
}));
filter.add(new FillToolItem());
filter.add(new Button("Filter"));
searchPanel.setBottomComponent(filter);

ContentPanel gridPanel = new ContentPanel(new FitLayout());
gridPanel.setHeaderVisible(false);

ColumnConfig codice = new ColumnConfig("codice", "Codice", 150);
ColumnConfig descrizione = new ColumnConfig("descrizione", "Descrizione", 150);

RpcProxy<PagingLoadResult<ArticoloVO>> artProxy = new RpcProxy<PagingLoadResult<ArticoloVO>>() {
@Override
protected void load(Object loadConfig,
AsyncCallback<PagingLoadResult<ArticoloVO>> callback) {
// chiamata per articoli tipo C e S
remoteProvider.findAllArticoliDistintaBase((PagingLoadConfig) loadConfig, callback);
}
};
loader = new BasePagingLoader<PagingLoadResult<BeanModel>>(artProxy, new BeanModelReader());
loader.setRemoteSort(true);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);
toolBar = new PagingToolBar(25);
toolBar.bind(loader);
final Grid<BeanModel> grid = new Grid<BeanModel>(store,
new ColumnModel(Arrays.asList(codice, descrizione)));
grid.setAutoExpandColumn("descrizione");
grid.setStripeRows(true);
grid.setColumnLines(true);
grid.setLoadMask(true);
grid.getSelectionModel().setSelectionMode(SelectionMode.MULTI);
grid.addListener(Events.Attach, new Listener<GridEvent<BeanModel>>() {
public void handleEvent(GridEvent<BeanModel> be) {
loader.load(0, 25);
}
});
gridPanel.add(grid);
gridPanel.setBottomComponent(toolBar);

left.add(searchPanel, new RowData(1, -1));
left.add(gridPanel, new RowData(1, 1));
add(left, new RowData(.48d, 1, new Margins(8,1,8,8)));

LayoutContainer buttonColumn = new LayoutContainer(new CenterLayout());
Button addB = new Button(">");
addB.setSize(20, 20);
addB.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
for (BeanModel b : grid.getSelectionModel().getSelectedItems()) {
ArticoloVO a = b.getBean();
ArticoloDistintaBaseModel model;
model = new ArticoloDistintaBaseModel(
null, a, null
);
model.setParent(rootModel);
tree.getTreeStore().insert(model, tree.getTreeStore().getChildCount(), false);
}
}
});
buttonColumn.add(addB);
add(buttonColumn, new RowData(.04d, 1));

ContentPanel treePanel = new ContentPanel(new FitLayout());
treePanel.setHeading("Distinta Base");

ColumnConfig codiceT = new ColumnConfig("articolo.codice", "Articolo", 180);
codiceT.setRenderer(new TreeGridCellRenderer<ArticoloDistintaBaseModel>());
codiceT.setSortable(false);

ColumnConfig descrizioneT = new ColumnConfig("articolo.descrizione", "Descrizione", 200);
descrizioneT.setSortable(false);

ColumnConfig articoliAlt = new ColumnConfig("articoliAlt", "Alternative", 65);
articoliAlt.setSortable(false);
articoliAlt.setRenderer(new GridCellRenderer<ArticoloDistintaBaseModel>() {
private boolean init;
public Object render(final ArticoloDistintaBaseModel model,
String property, ColumnData config, int rowIndex,
int colIndex, ListStore<ArticoloDistintaBaseModel> store,
Grid<ArticoloDistintaBaseModel> grid) {
if (!init) {
init = true;
grid.addListener(Events.ColumnResize, new Listener<GridEvent<ArticoloDistintaBaseModel>>() {
public void handleEvent(GridEvent<ArticoloDistintaBaseModel> be) {
for (int i = 0; i < be.getGrid().getStore().getCount(); i++) {
if (be.getGrid().getView().getWidget(i, be.getColIndex()) != null
&& be.getGrid().getView().getWidget(i, be.getColIndex()) instanceof BoxComponent) {
((BoxComponent) be.getGrid().getView().getWidget(i, be.getColIndex())).setWidth(be.getWidth() - 10);
}
}
}
});
}
Button btn = new Button("--");
btn.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
Window w = new Window();
w.setSize(500,300);
w.setBodyBorder(false);
w.setHeading("Alrticoli Alternativi a "+model.getArticolo().getCodice());
w.setModal(true);
w.setLayout(new FitLayout());
FormPanel f = new FormPanel();
f.setHeaderVisible(false);
DualListField<BeanModel> dualList = new DualListField<BeanModel>();
dualList.setFieldLabel("Articoli");
// TODO populate the store
dualList.getFromList().setStore(new ListStore<BeanModel>());
dualList.getToList().setStore(new ListStore<BeanModel>());
f.add(dualList, new FormData("100% 100%"));
w.add(f);
loader.load();
w.show();
}
});
btn.setWidth(grid.getColumnModel().getColumnWidth(colIndex) - 10);
return btn;
}
});

TreeStore<ArticoloDistintaBaseModel> treeStore = new TreeStore<ArticoloDistintaBaseModel>();
if (rootModel != null)
for (ModelData m : rootModel.getChildren())
treeStore.add((ArticoloDistintaBaseModel) m, true);

tree = new EditorTreeGrid<ArticoloDistintaBaseModel>(treeStore,
new ColumnModel(Arrays.asList(
codiceT,
descrizioneT,
articoliAlt
)));
tree.setAutoExpandColumn("articolo.descrizione");
tree.getStyle().setLeafIcon(IconHelper.createPath("gxt-2.2.3/images/default/tree/leaf.gif"));
new DropTarget(this);

TreeGridDropTarget target;
new TreeGridDragSource(tree);
target = new TreeGridDropTarget(tree);
target.setAllowDropOnLeaf(true);
target.setAllowSelfAsSource(true);
target.setFeedback(Feedback.BOTH);

treePanel.add(tree);
add(treePanel, new RowData(.48d, 1, new Margins(8, 8, 8, 1)));
addButton(new Button("Save"));
addButton(new Button("Close", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
hide();
}
}));
setButtonAlign(HorizontalAlignment.CENTER);
}

}


TreeModel:


package example.client;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.data.BaseTreeModel;
import com.extjs.gxt.ui.client.data.ModelData;

public class ArticoloDistintaBaseModel extends BaseTreeModel {

/**
*
*/
private static final long serialVersionUID = 1L;

public ArticoloDistintaBaseModel() {
super();
}

public ArticoloDistintaBaseModel(Integer id, ArticoloVO articolo, Integer posizione) {
super();
setId(id);
setArticolo(articolo);
setPosizione(posizione);
}

public ArticoloDistintaBaseModel(ArticoloDistintaBaseModel copy) {
super();
setId(copy.getId());
setArticolo(copy.getArticolo());
setPosizione(copy.getPosizione());
setParent(copy.parent);
setAllowNestedValues(copy.allowNestedValues);
setSilent(copy.isSilent());
setProperties(copy.getProperties());
List<ModelData> children = new ArrayList<ModelData>();
for (ModelData m : copy.getChildren())
children.add(new ArticoloDistintaBaseModel((ArticoloDistintaBaseModel) m));
setChildren(children);
}

public Integer getId() {
return (Integer) get("id");
}

public void setId(Integer id) {
set("id", id);
}

public ArticoloVO getArticolo() {
return (ArticoloVO) get("articolo");
}

public void setArticolo(ArticoloVO articolo) {
set("articolo", articolo);
}

public Integer getPosizione() {
return (Integer) get("posizione");
}

public void setPosizione(Integer posizione) {
set("posizione", posizione);
}

@Override
public String toString() {
return "ArticoloDistintaBaseModel [id=" + getId() + ", articolo=" + getArticolo().getCodice() +
", posizione=" + getPosizione() + ", figli=" + getChildren().toString() + "]";
}
}


Grid Model: (I also implemented a BeanModelMarker for this, I don't post it)


package example.client;

import java.io.Serializable;

public class ArticoloVO implements Serializable {

/**
*
*/
private static final long serialVersionUID = 1L;

private Integer id;
private String codice;
private String descrizione;

public ArticoloVO() {
super();
}

public ArticoloVO(Integer id, String codice, String descrizione) {
super();
this.id = id;
this.codice = codice;
this.descrizione = descrizione;
}

public Integer getId() {
return id;
}

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

public String getCodice() {
return codice;
}

public void setCodice(String codice) {
this.codice = codice;
}

public String getDescrizione() {
return descrizione;
}

public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}

@Override
public String toString() {
return "ArticoloVO [codice=" + codice + ", descrizione=" + descrizione
+ ", id=" + id + "]";
}

}


The method in the servlet for the PagingResult of the grid:


@Override
public PagingLoadResult<ArticoloVO> findAllArticoliDistintaBase(
PagingLoadConfig loadConfig) {
//Data Stub
ArticoloVO first = new ArticoloVO(1, "K987", "Bisturi");
ArticoloVO second = new ArticoloVO(2, "T776", "Pantaloni");
ArticoloVO third = new ArticoloVO(3, "T045", "Panno 45x45");
List<ArticoloVO> data = new ArrayList<ArticoloVO>();
data.add(first);
data.add(second);
data.add(third);
return new BasePagingLoadResult<ArticoloVO>(data, loadConfig.getOffset(), 3);
}


2 problems in the tree grid:
1) the infos not showed (even if the ids seems to be correctly setted for column configs)
2) the rendering of the widget.

Thanks,
F