class sap.m.routing.RouteMatchedHandler

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/m/routing/RouteMatchedHandler
Application Component: CA-UI5-CTR

This class will attach to the Events of a provided router and add the views created by it to a sap.m.SplitContainer or a sap.m.NavContainer Control, if this is the target control of the route.
If the targetControl is no sap.m.SplitContainer or a sap.m.NavContainer, It will only close the dialogs, according to the property value.

When a navigation is triggered, this class will try to determine the transition of the pages based on the history.
Eg: if a user presses browser back, it will show a backwards animation.

The navigation on the container takes place in the RoutePatternMatched event of the Router. If you register on the RouteMatched event of the Router, the visual navigation did not take place yet.

Since it is hard to detect if a user has pressed browser back, this transitions will not be reliable, for example if someone bookmarked a detail page, and wants to navigate to a masterPage.
If you want this case to always show a backwards transition, you should specify a "viewLevel" property on your Route.
The viewLevel has to be an integer. The Master should have a lower number than the detail.
These levels should represent the user process of your application and they do not have to match the container structure of your Routes.
If the user navigates between views with the same viewLevel, the history is asked for the direction.

You can specify a property "transition" in a route to define which transition will be applied when navigating. If it is not defined, the nav container will take its default transition.
You can also specify "transitionParameters" on a Route, to give the transition parameters.

preservePageInSplitContainer is deprecated since 1.28 since Targets make this parameter obsolete. If you want to preserve the current view when navigating, but you want to navigate to it when nothing is displayed in the navContainer, you can set preservePageInSplitContainer = true
When the route that has this flag directly matches the pattern, the view will still be switched by the splitContainer.


Documentation links:


Constructor

Instantiates a RouteMatchedHandler.

new sap.m.routing.RouteMatchedHandler(router, closeDialogs?)
Param Type Default Value Description
router sap.ui.core.routing.Router

A router that creates views

closeDialogs? boolean true

If set to true it will close all open dialogs before navigating. If set to false it will just navigate without closing dialogs.


Methods Overview

Method Description
destroy

Removes the routeMatchedHandler from the Router

sap.m.routing.RouteMatchedHandler.extend

Creates a new subclass of class sap.m.routing.RouteMatchedHandler with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

getCloseDialogs

Gets if a navigation should close dialogs

sap.m.routing.RouteMatchedHandler.getMetadata

Returns a metadata object for class sap.m.routing.RouteMatchedHandler.

setCloseDialogs

Sets if a navigation should close dialogs

destroy

Removes the routeMatchedHandler from the Router

sap.m.routing.RouteMatchedHandler.extend

Creates a new subclass of class sap.m.routing.RouteMatchedHandler with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.base.Object.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

getCloseDialogs

Gets if a navigation should close dialogs

sap.m.routing.RouteMatchedHandler.getMetadata

Returns a metadata object for class sap.m.routing.RouteMatchedHandler.

setCloseDialogs

Sets if a navigation should close dialogs

Param Type DefaultValue Description
bCloseDialogs boolean

close dialogs if true