Class Page
- java.lang.Object
-
- ej.navigation.Page
-
public abstract class Page extends 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'sPageFactorybuilds it from the page'sintkey. 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)andNavigator.replaceWith(int, Object)carry an argument toPageFactory.create(int, Object), which the factory injects. A page navigates throughNavigator.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 WidgetgetContent()Creates the visual content of this page.protected voidonEntered()Notifies this page that it has become the active page.protected voidonExited()Notifies this page that it has ceased to be the active page.
-
-
-
Method Detail
-
getContent
protected abstract Widget getContent()
Creates the visual content of this page.Called by the
Navigatorwhen 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.
-
-