Example usage for com.vaadin.server Page addUriFragmentChangedListener

List of usage examples for com.vaadin.server Page addUriFragmentChangedListener

Introduction

In this page you can find the example usage for com.vaadin.server Page addUriFragmentChangedListener.

Prototype

@Deprecated
public Registration addUriFragmentChangedListener(Page.UriFragmentChangedListener listener) 

Source Link

Document

Adds a listener that gets notified every time the URI fragment of this page is changed.

Usage

From source file:uk.q3c.krail.core.ui.ScopedUI.java

License:Apache License

/**
 * Make sure you call this from sub-class overrides. The Vaadin Page is not available during the construction of
 * this class, but is available when this method is invoked. As a result, this method sets the navigator a listener
 * for URI changes and obtains the browser locale setting for initialising {@link CurrentLocale}. Both of these are
 * provided by the Vaadin Page.//from  w ww. j  a  v a2 s .  c  o m
 *
 * @see com.vaadin.ui.UI#init(com.vaadin.server.VaadinRequest)
 */
@Override
protected void init(VaadinRequest request) {

    VaadinSession session = getSession();
    session.setConverterFactory(converterFactory);

    // page isn't available during injected construction, so we have to do this here
    Page page = getPage();
    page.addUriFragmentChangedListener(navigator);

    setErrorHandler(errorHandler);
    session.setErrorHandler(errorHandler);
    page.setTitle(pageTitle());

    //  also loads the UserSitemap if not already loaded
    getKrailNavigator().init();

    //layout this UI, which may also create UYI components
    doLayout();

    // now that browser is active, and user sitemap loaded, and UI constructed, set up currentLocale
    currentLocale.readFromEnvironment();
    translator.translate(this);
    // Navigate to the correct start point
    String fragment = getPage().getUriFragment();
    getKrailNavigator().navigateTo(fragment);
}