private void addListeners() { // Register Button Listeners form.save.addClickListener(this); form.edit.addClickListener(this); form.cancel.addClickListener(this); form.update.addClickListener(this); form.delete.addClickListener(this); // Register Table Listerners table.addValueChangeListener(this); }
private ContentType getUpdateEntity(FieldGroup binder) { final ContentTypeModel bean = ((BeanItem<ContentTypeModel>) binder.getItemDataSource()).getBean(); final ContentType contentType = new ContentType.Builder() .name(bean.getName()) .description(bean.getDescription()) .id(table.getValue().toString()) .build(); return contentType; }
@Override public void valueChange(Property.ValueChangeEvent event) { final Property property = event.getProperty(); if (property == table) { try { final ContentType contentType = contentTypeService.findById(table.getValue().toString()); final ContentTypeModel bean = getModel(contentType); form.binder.setItemDataSource(new BeanItem<>(bean)); setReadFormProperties(); } catch (Exception r) { } } }