Directory

← Back

NavigationBuilder

A builder-style way of programming navigation with event handling in Vaadin.

Author

Rating

Popularity

<100

This addon provides a builder-style way of programming navigation in Vaadin.

It enriches the existing functionality. No widgetset compiling required.

Features

  1. Builder-style navigation implementations;
  2. Open (external) url's in current or new tab;
  3. Navigate to url fragments (like '/app');
  4. Navigate through browser history (back/next);
  5. Make use of pre-configured navigations;
  6. Attach your own listeners to be executed upon navigation;
  7. Navigate right away, or prepare your navigation and perform it later (or again).

Sample code

NavigationUtils.navigate()
                .to("www.google.com")
                .inNewTab()
                .withListener(event1 -> LOGGER.trace("Navigating to external url in a new tab."))
                .go();
NavigationUtils.navigate()
                    .toLocation("/register")
                    .withListener(e -> LOGGER.trace("Navigating to " + e.getUrl()))
                    .go();
NavigationUtils.createReloadNavigation().withListener(l -> System.out.println("Page reloaded!")).go(); // Adding a listener to the pre-configured navigation.
NavigationUtils.createBackNavigation().go(); // Go back one page in the browser history
NavigationUtils.createNextNavigation().go(); // Go one page forward in the browser history
List<NavigationBuilder> navigations = new ArrayList<>();
NavigationBuilder reload = NavigationUtils.navigate().reload();
NavigationBuilder openGoogleInNewTab = NavigationUtils.navigate()
        .to("http://www.google.com")
        .inNewTab();
NavigationListener navigationListener = navigationEvent -> {
    LOGGER.info("Some custom navigation of type: {} was executed.", navigationEvent.getNavigationType());
};
navigations.add(reload);
navigations.add(openGoogleInNewTab);
navigations.forEach(builder -> {
    builder.withListener(navigationListener);
    builder.go();
});

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

Released
2017-05-05
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.0+
Vaadin 8.0+ in 1.1.1
Browser
Browser Independent

NavigationBuilder - Vaadin Add-on Directory

A builder-style way of programming navigation with event handling in Vaadin. NavigationBuilder - Vaadin Add-on Directory
This addon provides a builder-style way of programming navigation in Vaadin. It enriches the existing functionality. No widgetset compiling required. ## Features 1. Builder-style navigation implementations; 2. Open (external) url's in current or new tab; 3. Navigate to url fragments (like '/app'); 4. Navigate through browser history (back/next); 5. Make use of pre-configured navigations; 6. Attach your own listeners to be executed upon navigation; 7. Navigate right away, or prepare your navigation and perform it later (or again).
Issue Tracker
Source Code
Introduction Blog Post
Author Homepage

NavigationBuilder version 1.1
null

NavigationBuilder version 1.1.1
1. Better UI accessing; 2. Added support for reload (refresh) navigation.

NavigationBuilder version 1.1.2
1. Added support for browser back/next navigation; 2. Added utility methods returning pre-configured navigations (reload, back, next).

NavigationBuilder version 1.1.3
- Added NavigationType that can be retrieved from the NavigationEvent; - Breaking change (only for navigations stored in variables): classes are now all prefixed with 'Navigation' (some where 'Navigate' previously); - Small refactoring and improvements.

Online