Annotation Interface Route


Registers an annotated class as corresponding to some route. It means that that screen should be opened when URL ends with specified route and that URL should be changed according to the route when the screen is opened.


Example:
Screen annotated with @Route("help") corresponds to "/app/{rootRoute}/help" route, where {rootRoute} equals to currently opened root screen.

This screen will be opened when URL changes from "/app/{rootRoute}" to "/app/{rootRoute}/help" and URL will be changed in the same way when the screen is opened.


Required parent screen that should be opened to form a route can be specified with "parent" property. If this property is set but parent screen isn't opened annotated screen route will not be applied.


The "parentPrefix" property enables to merge common route parts if a route of previous screen in tab is the same as route configured in this property.


Example. Let two screens exist:

   @Route("orders")
   public class OrderBrowse { ... }

   @Route(route = "orders/edit", parentPrefix = "orders")
   public class OrderEdit { ... }
 
When OrderEdit screen is opened after OrderBrowse screen resulting address will be "app/{rootRoute}/users/edit".


It allows to specify clear routes for each screen and avoid repeats in URL. Annotated class must be a direct or indirect subclass of Screen.


The "root" property enables to specify that the route is for root window (like LoginWindow or MainWindow).

See Also: