Directory

← Back

GlazedLists Vaadin Container

Containers made easy: A Container implementation backed by GlazedLists

Author

Rating

This is a Container implementation for Vaadin that is backed by a GlazedLists' (www.glazedlists.com) EventList.

This makes your life great in several ways:

  • It's easy to use.
  • GlazedLists can do a bunch of really powerful transformations on data lists.
  • It supports Server Push (introduced in Vaadin 7.1), so all your data changes push to the client without any extra work from you (threading is taken care of).
  • Sorting, filtering and editing are fully supported.
  • Work with your domain objects (POJOs) rather than having to use Items and Properties all the time (though Property and Item are provided by the container so binding and such still works).

Requires Java 8.

Sample code

public class MyTest extends HorizontalLayout {

	public MyTest() {
		// Put objects into the base list. You can do all sorts of transformations
		// on this using standard GlazedLists list implementations
		EventList<Person> data = GlazedLists.eventListOf(
		    new Person( "Rob", "Eden", 37 ),
		    new Person( "Joe", "Somebody", 25 ),
		    new Person( "Fred", "Whoever", 64 ) );

		// PropertyHandlers define hot to convert betwen your POJOs and properties.
		// BeanPropertyHandler uses JavaBeans
		PropertyHandler<Person> handler = 
			new BeanPropertyHandler( Person.class, Object.class );

		// Create the container
		Container container =
			EventListContainer.create( data, handler, UI.getCurrent() ).build();
		Table table = new Table( "People", container );
		addComponent( table );
	}


	class Person {
		private String firstName;
		private String lastName;
		private int age;

		Person( String firstName, String lastName, int age ) {
			this.firstName = firstName;
			this.lastName = lastName;
			this.age = age;
		}

		public String getFirstName() { return firstName; }
		public String getLastName() { return lastName; }
		public int getAge() { return age; }
	}
}

Links

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

The 1.3.x version branch supports Vaadin 8 using the version 7 compatibility libraries. Use this version if you are still using the compatibility APIs.

Released
2017-11-30
Maturity
STABLE
License
BSD 2-clause "Simplified" License

Compatibility

Framework
Vaadin 7.7+
Vaadin 8.0+
Vaadin 7.4+ in 1.2.9
Vaadin 7.1+ in 1.0.7
Browser
Browser Independent
Online