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

Added COPY-Operation. #46

Closed watho closed 5 years ago

watho commented 5 years ago

Thank you for this gread add-on.

For my needs i have added a Copy-Operation which might be interesting for you too despite the fact that this is no real CRUD-Operation.

It is similar to Add-Operation but new Items are populated with properties of currently selected item. Copy functionality is inside CrudListener.preCopy and uses Jackson-ObjectMapper as default. I have added an usage example in the README.md.

It is only tested with WindowBasedCrudLayout cause i don't use the other ones.

alejandro-du commented 5 years ago

Hi, thanks for your PR. Unfortunately, I cannot merge this since it changes the central idea of a generic CRUD: "Copy" is not a CRUD operation but a combination of custom logic plus the Create operation. For this user-specific requirements, you can add a button to the UI with the CrudLayout.addToolbarComponent(Element) method and invoke the logic to copy data in a click listener.