Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myTable = new Table();
- myTable.addContainerProperty("c1", Boolean.class, null);
- myTable.setColumnCollapsed("c1", true);
- myTable.addGeneratedColumn("chk1", new ColumnGenerator() {
- @Override
- public Object generateCell(Table source, final Object itemId, Object columnId) {
- Property prop = source.getItem(itemId).getItemProperty("c1");//columnId
- final CheckBox cb = new CheckBox(null, prop);
- cb.setImmediate(true);
- cb.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(Property.ValueChangeEvent event) {
- if (myTable.getContainerProperty(itemId, "field").getValue() != null) {
- if (!myTable.getContainerProperty(itemId, "field").getValue().equals("") && !myTable.getContainerProperty(itemId, "field").getValue().equals("0")) {
- System.out.println("qta_prel:"+myTable.getContainerProperty(itemId, "field").getValue());
- } else {
- cb.setValue(null);
- getWindow().showNotification("Type something", Window.Notification.TYPE_ERROR_MESSAGE);
- }
- }
- }
- });
- return cb;
- }
- });
- myTable.addContainerProperty("field", String.class, null);
- // insert on table
- myTable.addItem(new Object[] { rs.getBoolean("chk1"), rs.getString("field") }, null);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement