@Override protected void setup() { // Multiselect Table t = new Table("Multiselect"); addComponent(t); t.setSelectable(false); t.setMultiSelect(true); t.setPageLength(5); t.addContainerProperty("Name", String.class, null); Set<Object> selected = new HashSet<>(); for (int i = 0; i < 30; i++) { Item item = t.addItem(i); item.getItemProperty("Name").setValue("Name " + i); if (i % 2 == 0) { selected.add(i); } } t.setValue(selected); // Singleselect t = new Table("Singleselect"); addComponent(t); t.setSelectable(false); t.setMultiSelect(false); t.setPageLength(5); t.addContainerProperty("Name", String.class, null); for (int i = 0; i < 30; i++) { Item item = t.addItem(i); item.getItemProperty("Name").setValue("Name " + i); } t.setValue(3); }
private void blinkTable() { final Table table = new Table(); table.setPageLength(5); table.addContainerProperty(new Object(), String.class, null); for (int i = 0; i < 50; i++) { table.addItem(new Object[] {"Row"}, new Object()); } System.out.println("adding component"); addComponent(table); new Thread() { @Override public void run() { getSession().lock(); try { Thread.sleep(500); access( new Runnable() { @Override public void run() { System.out.println("removing component"); removeComponent(table); button.setCaption(SUCCESS_CAPTION); } }); } catch (InterruptedException e) { e.printStackTrace(); } finally { getSession().unlock(); } } }.start(); }
@Override protected void setup() { getLayout().setSizeFull(); final Table table = new Table(); table.setSizeFull(); table.addContainerProperty("column1", String.class, "Humpty"); table.addContainerProperty("column2", String.class, "Dumpty"); table.addContainerProperty("column3", String.class, "Doe"); for (int row = 0; row < 100; row++) { table.addItem(); } HorizontalLayout buttons = new HorizontalLayout(); for (Object col : table.getContainerPropertyIds()) { buttons.addComponent(createResetButton(col, table)); } addComponent(table); addComponent(buttons); }