alejandro-du / crudui

Automatically generate CRUD-like Vaadin views for any Java Bean
https://vaadin.com/directory#!addon/crud-ui-add-on
Apache License 2.0
86 stars 54 forks source link

Develop #108

Closed frialey63 closed 2 years ago

frialey63 commented 2 years ago

Hi Alejandro, Thanks for merging my previous patch. This patch improves the "update button column" with two APIs which add the facility to control enablement of these buttons as their associated items are selected/deselected in the grid:

org.vaadin.crudui.crud.impl.GridCrud.getUpdateButton(T)
org.vaadin.crudui.crud.impl.GridCrud.setUpdateButtonColumnEnabled(boolean)

This is necessary to match the control which can be achieved via setEnabled() on the existing API getAddButton(), getUpdateButton and getDeleteButton().

Other minor chnages as noted in the README:

Also, I think there is a minor problem with the update mechanism: if Cancel is clicked on the form then the entry remains displayed as selected and the update button is enabled; however, it Update is clicked on the form then the entry is displayed as deselected but the update button remains enabled (and the grid still has a selection as can be seen from the selection listener). There may be an underlying problem with the non-display of the selection in this scenario? My workaround is to add a call to grid.deselect() which keeps the button state consistent with the grid selection (also required for the add operation).

Paul

alejandro-du commented 2 years ago

Thanks a lot for the contribution. Keep'em coming! I'll publish a new version of the add-on with these improvements.