@Autowired capable Grid with annotation based configuration for Spring 4 and Vaadin 8
BeanGrid Add-on is Vaadin 8 compatible Add-on for @Autowiring pre-configured Vaadin Grid.
BeanGrid Add-on is a Spring @Configuration with efficient and lightweight integration of Grid via annotation based property configuration that supports editable and footer summarizable columns.
As Vaadin 8 allows defining type T for various components, this add-on makes the lives of Spring developers easier by providing a way to configure the Grid through annotations in T. The annotations are to be placed on the T's properties from which the pre configured and @Autowired Grid will pick them up.
Following annotations may be used with Grid's data type bean:
- @GridColumn - for defining a column.
- @EditableColumn - for making the column editable.
- @SummarizableColumn - for automatically summarizing the column's all values.
- @SummarizableColumnStaticText - for showing static text in the summary.
The add-on is designed to be as flexible and extensible as possible, where new editor components and field value providers can be integrated by implementing as bean:
Grid will look up the above implementations based on T's property types. For more advanced component and value providers the specialized
conversion capable providers can be implemented similarly. These types of providers allow converting between the property type in T and the type shown in the Grid's renderer or editor component.
BeanGrid supports automatically generated footer row summarizers where all the values within a column are summed up. Basic numeric summarizers are shipped with the add-on but new ones can be created for custom data types by implementing as bean the interface:
As the formatting of cell values, possible I18N integration etc are most likely needed in any real project, the BeanGrid supports translationKey resolution as well as external formatting configuration through interface:
This interface can be implemented as bean which the BeanGrid will lookup every time it needs to resolve a translationKey or timestamp formatting or various other features from the host app.
See examples from Github project.
The annotations which are to be placed on T's properties have been externalized to a separate add-on: (BeanGrid Add-on for Vaadin 8 - Common Annotations). This is simply to support using these annotations without dependencies to Vaadin or Spring if necessary.
Using this add-on requires that Vaadin is Spring aware (through Vaadin Spring integration) as well as of course Spring 4.3 environment. Using Spring Boot is optional.
Usage of Maven or other dependency management tool is recommended as the add-on has a dependency to another add-on (BeanGrid Add-on for Vaadin 8 - Common Annotations) as well as various core libraries of Spring Framework and Spring <-> Vaadin Integration.