Package ej.navigation

Class Page


  • public abstract class Page
    extends java.lang.Object
    The unit of navigation.

    An application creates a screen by extending this class and implementing getContent(). A page is a lightweight factory for its visual content, not the content itself: the navigator asks the page to build its widget each time the page is about to be shown, so a fresh widget is produced on every navigation to the page.

    A page is never constructed by the Navigator: the application's PageFactory builds it from the page's int key. Per-navigation data is supplied through the page's own constructor (constructor injection performed by the factory); the framework owns no parameter slot, and the public navigation API accepts keys, never page instances. The data itself may come from the navigation that triggered the build: Navigator.navigateTo(int, Object) and Navigator.replaceWith(int, Object) carry an argument to PageFactory.create(int, Object), which the factory injects. A page navigates through Navigator.getInstance().

    Since:
    0.2.0
    • Constructor Summary

      Constructors 
      Constructor Description
      Page()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract ej.mwt.Widget getContent()
      Creates the visual content of this page.
      protected void onEntered()
      Notifies this page that it has become the active page.
      protected void onExited()
      Notifies this page that it has ceased to be the active page.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Page

        public Page()
    • Method Detail

      • getContent

        protected abstract ej.mwt.Widget getContent()
        Creates the visual content of this page.

        Called by the Navigator when the page is about to be shown. A fresh widget is produced on each navigation to the page.

        Returns:
        the visual content of this page.
      • onEntered

        protected void onEntered()
        Notifies this page that it has become the active page.

        Invoked immediately after the navigation operation, before the transition animation starts. A navigation requested from this callback is deferred and performed once the navigation in progress is finished. This default implementation does nothing.

      • onExited

        protected void onExited()
        Notifies this page that it has ceased to be the active page.

        Invoked with the same timing as onEntered(). This default implementation does nothing.