*/
root.add(createGrid());
}
private Grid createGrid() {
final Grid grid = new Grid(3, 1);
final PagingTable table = createTable();
table.setSize("100%", "100%");
grid.setWidget(0, 0, table);
grid.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);
grid.getCellFormatter().setWidth(0, 0, "100%");
grid.getCellFormatter().setHeight(0, 0, "100%");
HorizontalPanel hpanel = new HorizontalPanel();
hpanel.add(new Label("Show Column:"));
for(int i = 0; i < table.getColumnLayout().getTotalColumnCount(); ++i) {
final CheckBox checkbox = new CheckBox(String.valueOf(i));
checkbox.setValue(true);
hpanel.add(checkbox);
final int ii = i;
checkbox.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
table.show(ii, checkbox.getValue());
table.update();
}
});
}
grid.setWidget(1, 0, hpanel);
hpanel = new HorizontalPanel();
hpanel.add(new Button("Clear", new ClickHandler() {
public void onClick(ClickEvent event) {
table.clear();
}
}));
hpanel.add(new Button("Reset", new ClickHandler() {
public void onClick(ClickEvent event) {
table.reset();
}
}));
hpanel.add(new Button("Simulate Failure", new ClickHandler() {
public void onClick(ClickEvent event) {
table.onFailure(null);
}
}));
grid.setWidget(2, 0, hpanel);
grid.setSize("100%", "100%");
return grid;
}