Directory

← Back

vaadin-container-utils

Util library to work with Vaadin Containers

Author

Contributors

Rating

vaadin-container-utils is a util library to facilitate the creation of Containers.

It currently contains two main classes to use :

  • ContainerUtils : Utils class useful for common and generic operation on Container such as initialize, add a property, etc.
  • ContainerFactory : Create different type of Container from a list of Bean using different algorithm to get the list of properties.

It also contains a @Container annotation to easily annotate your beans for behavior in creating Vaadin containers. The corresponding PropertyReaderAlogrithm is then AnnotationReaderAlgorithm.

The goals when creating this library is to ease the creation of different type of containers, while still have a maximum flexibility. Before having a 1.0 version, there is a lot of improvement to push (Pivotable containers, better customization, etc.).

Sample code

// Simple default ContainerFactory
// Looking for properties by attributes (of MyBean)
ContainerFactory<MyBean> containerFactory = ContainerFactory.getByAttributes(MyBean.class);

// Looking for properties by getter methods (of MyBean)
ContainerFactory<MyBean> containerFactory = ContainerFactory.getByGetters(MyBean.class);

// ContainerFactory containerFactory already defined
// Specify an existing Container (container), and a list of MyBean
containerFactory.getContainerFromList(container, myBeans);

// Specify an existing null Container, and a list of MyBean
Container.Filterable filterableContainer = null;
containerFactory.getContainerFromList(filterableContainer, myBeans, Filterable.class);

// Specify a list of MyBean and a type of Container
Container.Filterable filterableContainer = null;
containerFactory.getContainerFromList(myBeans, Filterable.class);
@Container(properties = {
        @Property(name = "string", types = { ContainerType.EXTENDED,
                ContainerType.RESUME }),
        @Property(name = "number", types = { ContainerType.RESUME }, attribute = "integer") })
private static class TestBean {

    private String string;
    private Integer integer;

    public String getString() {
        return string;
    }

    public Integer getInteger() {
        return integer;
    }
}

// […]



// Looking for properties by annotation @Container (of MyBean)
// Using ContainerType.RESUME definition
ContainerFactory<MyBean> containerFactory = ContainerFactory.getByAnnotation(MyBean.class, ContainerType.RESUME);
// Using ContainerType.EXTENDED definition
ContainerFactory<MyBean> containerFactory = ContainerFactory.getByAnnotation(MyBean.class, ContainerType.EXTENDED);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

getContainerFromList is deprecated for a more generic method getContainerFromCollection.

Released
2012-08-05
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.7+
Browser
Browser Independent

vaadin-container-utils - Vaadin Add-on Directory

Util library to work with Vaadin Containers vaadin-container-utils - Vaadin Add-on Directory
vaadin-container-utils is a util library to facilitate the creation of Containers. It currently contains two main classes to use : * ContainerUtils : Utils class useful for common and generic operation on Container such as initialize, add a property, etc. * ContainerFactory : Create different type of Container from a list of Bean using different algorithm to get the list of properties. It also contains a @Container annotation to easily annotate your beans for behavior in creating Vaadin containers. The corresponding PropertyReaderAlogrithm is then AnnotationReaderAlgorithm. The goals when creating this library is to ease the creation of different type of containers, while still have a maximum flexibility. Before having a 1.0 version, there is a lot of improvement to push (Pivotable containers, better customization, etc.).
Online