PDA

View Full Version : [FIXED] [2.0 RC1] some TreeGrid bugs



takayser
30 Jun 2009, 10:19 AM
Please use my testcase and follow the instructions to reproduce the bugs.

Bug 1) Nullpointer
- click addParentA
- click add childA to parentA
- expand parentA
- collapse parentA
- click add childA to parentA
- expand parentA

-> Nullpointer

Bug 2) Loosing items
- click addParentA
- click add childA to parentA
- expand parentA
- click addParentB
- collapse parentA
- expand parentA

-> There is not anymore a parent B

Bug 3) refresh TreeGrid
- uncomment 4x treeGrid.getView().refresh(true);
- click addParentA
- click add childA to parentA

-> there is no collapse/expand arrow, click next to parentA, it will appear.

Testcase

public void onModuleLoad() {

final BaseModelData parentA = new BaseModelData();
parentA.set("name", "parentA");

final BaseModelData parentB = new BaseModelData();
parentB.set("name", "parentB");

Viewport viewport = new Viewport();
ContentPanel contentPanel = new ContentPanel(new FitLayout());
contentPanel.setSize(600, 500);

final TreeStore<ModelData> treeStore = new TreeStore<ModelData>();
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig("name", 500);
column.setRenderer(new TreeGridCellRenderer<Beanmodel>());
columns.add(column);
ColumnModel cm = new ColumnModel(columns);
final TreeGrid<ModelData> treeGrid = new TreeGrid<ModelData>(treeStore, cm);

contentPanel.add(treeGrid);

contentPanel.addButton(new Button("add parentA", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
treeStore.add(parentA, false);
treeGrid.getView().refresh(true);
}
}));

contentPanel.addButton(new Button("add childA to parentA", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
BaseModelData childA = new BaseModelData();
childA.set("name", "childA");
treeStore.add(parentA, childA, false);
treeGrid.getView().refresh(true);
}
}));

contentPanel.addButton(new Button("add parentB", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
treeStore.add(parentB, false);
treeGrid.getView().refresh(true);
}
}));

contentPanel.addButton(new Button("add childB to parentB", new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
BaseModelData childB = new BaseModelData();
childB.set("name", "childB");
treeStore.add(parentB, childB, false);
treeGrid.getView().refresh(true);
}
}));
viewport.add(contentPanel);
RootPanel.get().add(viewport);
}

darrellmeyer
1 Jul 2009, 8:56 AM
Thanks for the detailed post. All 3 bugs are fixed in RC2.