Codota Logo
ViewNavigator
Code IndexAdd Codota to your IDE (free)

How to use
ViewNavigator
in
com.holonplatform.vaadin7.navigator

Best Java code snippets using com.holonplatform.vaadin7.navigator.ViewNavigator (Showing top 16 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: com.holon-platform.vaadin7/documentation-vaadin

public void obtain() {
  // tag::obtain[]
  Optional<ViewNavigator> navigator = ViewNavigator.getCurrent(); // <1>
  ViewNavigator viewNavigator = ViewNavigator.require(); // <2>
  // end::obtain[]
}
origin: com.holon-platform.vaadin7/holon-vaadin-navigator

/**
 * Navigate to the {@link View} identified by given <code>viewName</code> using the same behaviour of
 * {@link #navigateTo(String, Map)} but rendering the View contents in an application Window, using optional
 * <code>windowConfiguration</code> to setup Window features.
 * @param viewName View name
 * @param windowConfiguration View Window configurator
 * @return The UI Window in which the View is displayed
 * @throws ViewNavigationException View with given name cannot be found or other view handling error
 */
default Window navigateInWindow(String viewName, Consumer<ViewWindowConfigurator> windowConfiguration)
    throws ViewNavigationException {
  return navigateInWindow(viewName, windowConfiguration, null);
}
origin: com.holon-platform.vaadin7/holon-vaadin-navigator

@Override
public void navigate() throws ViewNavigationException {
  navigator.navigateTo(viewName, parameters);
}
origin: com.holon-platform.vaadin7/holon-vaadin-navigator

/**
 * Requires the current {@link ViewNavigator}. If not available using {@link #getCurrent()}, an
 * {@link IllegalStateException} is thrown.
 * @return Current ViewNavigator
 * @throws IllegalStateException ViewNavigator is not available as a {@link Context} resource of from current UI
 */
static ViewNavigator require() {
  return getCurrent().orElseThrow(() -> new IllegalStateException(
      "ViewNavigator is not available as context resource or from current UI"));
}
origin: com.holon-platform.vaadin7/holon-vaadin-spring

@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
  if (bean instanceof View) {
    ViewNavigator navigator = ViewNavigator.require();
    if (navigator instanceof ViewConfigurationProvider) {
      return ViewNavigationUtils.injectContext((ViewConfigurationProvider) navigator, (View) bean);
    }
  }
  return bean;
}
origin: com.holon-platform.vaadin7/documentation-vaadin

public void config2() {
  // tag::config2[]
  UI ui = getUI();
  ViewNavigator.builder() //
      .viewDisplay(ui) //
      .withView("view1", View1.class) // <1>
      .withView("view2", View2.class) // <2>
      .defaultViewName("view1") // <3>
      .buildAndBind(ui);
  // end::config2[]
}
origin: com.holon-platform.vaadin7/documentation-vaadin

@Override
public boolean display(View view, String viewName, Map<String, String> parameters)
    throws ViewNavigationException {
  addTab(ViewNavigator.getViewContent(view), viewName, FontAwesome.PUZZLE_PIECE);
  return true;
}
origin: com.holon-platform.vaadin7/documentation-vaadin

public void nav3() {
  // tag::nav3[]
  ViewNavigator navigator = getViewNavigator();
  navigator.toView("myView").withParameter("parameter1", "test").withParameter("parameter2", 34.5).navigate(); // <1>
  navigator.toView("myView").navigateInWindow(); // <2>
  navigator.toView("myView").navigateInWindow(windowConfig -> {
    windowConfig.fullWidth();
    windowConfig.styleName("my-window-style");
  }); // <3>
  // end::nav3[]
}
origin: com.holon-platform.vaadin7/holon-vaadin-navigator

/**
 * Navigate to given state using concrete {@link Navigator}.
 * <p>
 * Authentication check using {@link Authenticate} annotation is performed before the actual view navigation.
 * </p>
 * @param viewConfiguration View configuration. If <code>null</code> the view configuration is obtained using
 *        {@link #getViewConfiguration(Class)}
 * @param navigationState Navigation state
 */
private void navigateToState(ViewConfiguration viewConfiguration, String navigationState) {
  // check authentication
  if (checkAuthentication(navigationState, viewConfiguration)) {
    navigator.navigateToState(navigationState);
  } else {
    // track view in history to allow backward navigation
    if (!isVolatile(viewConfiguration)) {
      trackInHistory(navigationState);
    }
  }
}
origin: com.holon-platform.vaadin7/documentation-vaadin

@Override
protected void init(VaadinRequest request) {
  ViewNavigator navigator = ViewNavigator.builder() // <1>
      .viewDisplay(this) // <2>
      .addProvider(getViewProvider()) // <3>
      .defaultViewName("home") // <4>
      .errorView(MY_ERROR_VIEW) // <5>
      .errorViewProvider(getErrorViewProvider()) // <6>
      .maxNavigationHistorySize(1000) // <7>
      .navigateToDefaultViewWhenViewNotAvailable(true) // <8>
      .withViewChangeListener(new ViewChangeListener() { // <9>
        @Override
        public boolean beforeViewChange(ViewChangeEvent event) {
          // ...
          return true;
        }
        @Override
        public void afterViewChange(ViewChangeEvent event) {
          // ...
        }
      }).buildAndBind(this); // <10>
}
origin: com.holon-platform.vaadin7/holon-vaadin-navigator

@Override
public Window navigateInWindow(Consumer<ViewWindowConfigurator> windowConfiguration)
    throws ViewNavigationException {
  return navigator.navigateInWindow(viewName, windowConfiguration, parameters);
}
origin: com.holon-platform.vaadin7/holon-vaadin-navigator

/**
 * Navigates to the {@link View} identified by given <code>viewName</code>.
 * <p>
 * If the view being deactivated indicates it wants a confirmation for the navigation operation, the user is asked
 * for the confirmation.
 * </p>
 * <p>
 * Registered {@link ViewChangeListener}s are called upon successful view change.
 * </p>
 * @param viewName View name
 * @throws ViewNavigationException View with given name cannot be found or other view handling error
 */
default void navigateTo(String viewName) throws ViewNavigationException {
  navigateTo(viewName, null);
}
origin: com.holon-platform.vaadin7/holon-vaadin-navigator

/**
 * Navigate to the {@link View} identified by given <code>viewName</code> using the same behaviour of
 * {@link #navigateTo(String, Map)} but rendering the View contents in an application Window, using default Window
 * configuration.
 * @param viewName View name
 * @return The UI Window in which the View is displayed
 * @throws ViewNavigationException View with given name cannot be found or other view handling error
 */
default Window navigateInWindow(String viewName) throws ViewNavigationException {
  return navigateInWindow(viewName, null, null);
}
origin: com.holon-platform.vaadin7/documentation-vaadin

public void nav1() {
  // tag::nav1[]
  ViewNavigator navigator = getViewNavigator();
  navigator.navigateTo("myView"); // <1>
  Map<String, Object> parameters = new HashMap<>();
  parameters.put("parameter1", "test");
  parameters.put("parameter2", 34.5);
  navigator.navigateTo("myView", parameters); // <2>
  // end::nav1[]
}
origin: com.holon-platform.vaadin7/holon-vaadin-navigator

/**
 * Navigate to the {@link View} identified by given <code>viewName</code> using the same behaviour of
 * {@link #navigateTo(String, Map)} but rendering the View contents in an application Window, using default Window
 * configuration.
 * @param viewName View name
 * @param parameters Optional view parameters
 * @return The UI Window in which the View is displayed
 * @throws ViewNavigationException View with given name cannot be found or other view handling error
 */
default Window navigateInWindow(String viewName, Map<String, Object> parameters) throws ViewNavigationException {
  return navigateInWindow(viewName, null, parameters);
}
origin: com.holon-platform.vaadin7/documentation-vaadin

public void nav2() {
  // tag::nav2[]
  ViewNavigator navigator = getViewNavigator();
  navigator.navigateInWindow("myView"); // <1>
  Map<String, Object> parameters = new HashMap<>();
  parameters.put("parameter1", "test");
  parameters.put("parameter2", 34.5);
  navigator.navigateInWindow("myView", windowConfig -> {
    windowConfig.fullWidth();
    windowConfig.styleName("my-window-style");
  }, parameters); // <2>
  // end::nav2[]
}
com.holonplatform.vaadin7.navigatorViewNavigator

Javadoc

Navigator to manage application UI View configuration and display. Extends the features and the behaviour of a standard Vaadin Navigator component.

View parameters will be automatically injected in View instance using ViewParameter annotated fields.
Supported parameter value types are:

  • String
  • Numbers
  • Boolean
  • Enum (ordinal value must be used for enum values serialization)
  • Date using date format pattern ViewParameter#DEFAULT_DATE_PATTERN
  • LocalDate using date format pattern ISO local date (yyyy-MM-dd)
  • LocalTime using date format pattern ISO local time (HH:mm:ss)
  • LocalDateTime using date format pattern ISO local date/time ('yyyy-MM-ddTHH:mm:ss')

This navigator provides the #navigateTo(String,Map) method to trigger navigation using a Map of parameters name and values instead of a fully serialized navigation state string.

A navigateInWindow method is provided to display a View using a Window instead of the navigator default ViewDisplay component.

View display lifecycle can be intercepted by the view instance itself, using OnShow and OnLeaveannotated methods. This methods must be public and provide zero or only one parameter of ViewNavigatorChangeEvent or default ViewChangeEvent type. The OnShow annotated method will be called when the View is displayed in application interface, the OnLeave annotated methods will be called when the View is about to be deactivated to be replaced by another view in the navigation flow.

This navigator is expected to keep a history of the navigation states of the navigation flow, allowing to navigate back in navigation history using #navigateBack() method.

If correctly configured in concrete subclasses, #navigateToDefault() allow to navigate to a predefined default View (something like a homepage View).

Sub-view are supported, i.e. View instances intended to be displayed in a parent View which must implement SubViewContainer interface and take care of sub view instances display in application UI. Sub view are declared using SubViewOf annotation on View classes.

Most used methods

  • getCurrent
    Get the current ViewNavigator, if available as Context resource or from current UI.
  • navigateInWindow
  • navigateTo
  • require
    Requires the current ViewNavigator. If not available using #getCurrent(), an IllegalStateException i
  • builder
    Builder to create ViewNavigator instance in fluent-style mode
  • getViewContent
    Helper method to get given view content: if View is a ViewContentProvider, than ViewContentProvider#
  • navigateToState
    Navigates to a view and initialize the view with given parameters. The navigationState string consis
  • toView
    Get a NavigationBuilder to create a navigation declaration to navigate to given viewName using para

Popular in Java

  • Reactive rest calls using spring rest template
  • getContentResolver (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now