Class Router


  • public class Router
    extends java.lang.Object
    The Router allows the UI to route between different Views. A View can register itself using a route and is then notified when it (or a child) is targeted.
    • Constructor Summary

      Constructors 
      Constructor Description
      Router()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Router getInstance()
      Get the instance of the Router.
      void register​(javafx.scene.Node node, java.lang.String route, java.util.function.BiConsumer<javafx.scene.Node,​java.lang.Object[]> routerCallback)
      Register a control to the router.
      void routeTo​(java.lang.String route, java.lang.Object... args)
      Route to the specific route.
      • Methods inherited from class java.lang.Object

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

      • Router

        public Router()
    • Method Detail

      • getInstance

        public static Router getInstance()
        Get the instance of the Router.
        Returns:
        the router
      • register

        public void register​(javafx.scene.Node node,
                             java.lang.String route,
                             java.util.function.BiConsumer<javafx.scene.Node,​java.lang.Object[]> routerCallback)
        Register a control to the router.
        Parameters:
        node - the view
        route - the route to the view
        routerCallback - the callback that is called when the view (or a child) is targeted by routeTo(String, Object...)
      • routeTo

        public void routeTo​(java.lang.String route,
                            java.lang.Object... args)
        Route to the specific route.
        Parameters:
        route - the route to be targetted
        args - arguments that are passed to the view