Constructor
new ViewManager()
- Source:
ViewManager manages ViewNavigator.It Subscribe to EventBroadcaster's Navigation channel to receive navigation change events. ViewManager find ViewNavigator based on Path Routes data and it match route info received in navigation change event.
Classes
Members
routes
- Source:
Here path is routeID, navigatorID is viewNavigatorId, parentId is DOM Element Id or ViewId in case of Nested View Navigators By Default Main DOM Element have id="root"
Example
Sample Router Object is to be implement in "AppViewManager" class (subclass of ViewManager)
initRoutes() {
let tmpRoutes = [
{ path: "/login", navigatorId: " LoginNavigator",parentId: "root" },
{ path: "/file", navigatorId: " FileNavigator",parentId: "root" },
{ path: "/logout", navigatorId: "ExitNavigator",parentId: "root" },
]
this.routes = new Router(tmpRoutes);
}
Here "path" is routeID, "navigatorId" is viewNavigatorId, "parentId" is DOM Element Id or ViewId or ContainerId.
By Default Main DOM Element have id="root"
Methods
addNavigator(_navigator, _navigatorId)
- Source:
ViewManager maintains navigators object in Key, Value form. Where key is viewNavigatorID and value is ViewNavigator Object Instance
Parameters:
Name | Type | Description |
---|---|---|
_navigator |
Object | ViewNavigator |
_navigatorId |
string | ViewNavigatorID |
createNavigator(_navigatorId, _parentId, _parentConId) → {Object}
- Source:
ViewManager calls createNavigator method when ViewNavigator is not created yet.
Example
createNavigator method is to be override in "AppViewManager" class (subclass of ViewManager)
createNavigator(_navigatorId, _parentId,_parentContainerId) {
let tmpNavigator = null;
switch (_navigatorId) {
case "simpleNavigator":
tmpNavigator = new SimpleNavigator(_navigatorId, _parentId,_parentContainerId);
break;
default:
tmpNavigator = new ViewNavigator(_navigatorId, _parentId,_parentContainerId);
}
return tmpNavigator;
}
Parameters:
Name | Type | Description |
---|---|---|
_navigatorId |
string | ViewNavigatorId |
_parentId |
string | ParentId is DOM Element id or ViewID |
_parentConId |
string | ParentContainerID used in case of NestedNavigator |
Returns:
- New Instance of ViewNavigator
- Type
- Object
destroyAll()
- Source:
- To Do:
-
- Implment destroy method
findRouteNavigator(_route) → {Array}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
_route |
string | Path Route Name |
Returns:
- NavigatorID Array
- Type
- Array
getNavigator(_navigatorId) → {Object}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
_navigatorId |
string | ViewNavigatorID |
Returns:
- ViewNavigator Object Instance by ViewNavigatorId.
- Type
- Object
getNavigatorParent(_navigatorId) → {string}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
_navigatorId |
string | ViewNavigatorID |
Returns:
- ParentID of ViewNavigator
- Type
- string
getParentNavContainer(_route, _navParentViewId) → {string}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
_route |
string | Path Route Name |
_navParentViewId |
string | Parent ViewID |
Returns:
- Parent Container ID of ViewNavigator
- Type
- string
initialize()
- Source:
Implement by subclass to initialise
Example
initialize method is to be override in "AppViewManager" class (subclass of ViewManager)
initialize() {
super.initialize();
this.initRoutes();
}
removeNavigator(_navigatorId)
- Source:
removes ViewNavigator object instance from navigators array.
Parameters:
Name | Type | Description |
---|---|---|
_navigatorId |
String | NavigatorId |