use of org.vaadin.grid.cellrenderers.action.DeleteButtonRenderer.DeleteRendererClickEvent in project GridFastNavigation by TatuLund.
the class DemoUI method initGrid.
private void initGrid(final Grid grid) {
// Add some columns
DeleteButtonRenderer deleteButton = new DeleteButtonRenderer(new DeleteRendererClickListener() {
@Override
public void click(DeleteRendererClickEvent event) {
grid.getContainerDataSource().removeItem(event.getItem());
}
}, FontAwesome.TRASH.getHtml() + " Delete", FontAwesome.CHECK.getHtml() + " Confirm");
deleteButton.setHtmlContentAllowed(true);
grid.addColumn("action", Boolean.class);
grid.getColumn("action").setEditable(false);
grid.getColumn("action").setRenderer(deleteButton);
grid.addColumn("col1", String.class);
grid.addColumn("col2", String.class);
for (int i = 0; i < 5; ++i) {
grid.addColumn("col" + (i + 3), Integer.class);
}
grid.addColumn("col8", Date.class);
grid.addColumn("col10", Boolean.class);
grid.addColumn("col11", String.class);
ComboBox comboBox = new ComboBox();
comboBox.addItems("Soft", "Medium", "Hard");
grid.getColumn("col11").setEditorField(comboBox);
// Make column 2 read only to test statically read only columns
grid.getColumn("col2").setEditable(false);
Random rand = new Random();
for (int i = 0; i < 100; ++i) {
grid.addRow(true, "string 1 " + i, "string 2 " + i, rand.nextInt(i + 10), rand.nextInt(i + 10), rand.nextInt(i + 10), rand.nextInt(i + 10), rand.nextInt(i + 10), new Date(), false, "Medium");
}
grid.setSelectionMode(SelectionMode.SINGLE);
grid.setSizeFull();
}
Aggregations