Package ch.zhaw.tasklist.ui
Class Router
- java.lang.Object
-
- ch.zhaw.tasklist.ui.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.
-
-
-
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 viewroute
- the route to the viewrouterCallback
- the callback that is called when the view (or a child) is targeted byrouteTo(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 targettedargs
- arguments that are passed to the view
-
-