Directory

← Back

LazyLayouts

Vaadin layouts for your lazy loading needs

Author

Contributors

Rating

This add-on adds lazy loading support to normal Vaadin layouts. Your application logic can perform it's DB queries and construct missing UI elements on-demand only if and when client requires those.

Current version includes: LazyVerticalLayout

Sample code

Panel panel = new Panel();
panel.setSizeFull();
setContent(panel);

LazyVerticalLayout layout = new LazyVerticalLayout();

// Make sure layout is inside scrolling parent (Panel or Window)
panel.setContent(layout);

// Add initial content
for(Tweet tweet : tweets) {
  layout.addComponent(new TweetBubble(tweet));
}

// Enable lazy loading by providing provider
layout.enableLazyLoading(new LazyComponentProvider() {
  @Override
  void onLazyComponentRequest(LazyComponentRequestEvent event) {

    // Load more data and add UI presentation of those to layout
    List<Tweet> more = getMoreTweets(5);
    for(Tweet tweet : more) {
       event.getComponentContainer().addComponent(new TweetBubble(tweet));
    }

    // Disable lazy loading request when you run out of data
    if(!hasMoreTweets()) {
      event.getComponentContainer().disableLazyLoading();
    }
  }
});

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

Adds missing extends Serializable to interfaces

Released
2017-04-05
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.0+
Vaadin 7.4+ in 0.1.4
Vaadin 7.3+ in 0.1.3
Vaadin 7.1+ in 0.1.1
Browser
Firefox
Opera
Safari
Google Chrome
iOS Browser
Android Browser
Internet Explorer
Windows Phone
Microsoft Edge
Online