CAPH.WUI.WIDGET.SCENEMANAGER
SceneManager represents a manager of different scenes. Scene can be a widget or a set of widgets, scene can be shown or hidden. User can add/remove/show/hide different scenes easily by this class.
Contents
Constructor
SceneManager | ||
Description | ||
The constructor of SceneManager widget, in order to create SceneManager object. | ||
Parameters | ||
uiContext | Object | caph.wui.widget.UIContext |
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
var uicontext = new caph.wui.widget.UIContext(); var scencMgr = new caph.wui.widget.SceneManager(uicontext); |
Methods
equals | ||
Description | ||
Compares the contents of two objects using strict equality, objects are considered equal if they both have the same set of properties and the values of those properties are equal. | ||
Parameters | ■Object - Object - The object which wants to compare with current object. | |
Return | ■Boolean - true : Indicates whether the two objects are equal, if they are equal, return true. - false : if they aren't equal, return false. | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var SceneManager = window.caph.wui.widget.SceneManager; var sceneManager = new SceneManager(); var obj = sceneManager.clone(); var isequal = obj.equals(sceneManager); |
hideScene | ||
Description | ||
Hides the scene specified by name. | ||
Parameters | ■name - String - The name of scene | |
Return | ■void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var scencMgr = new caph.wui.widget.Scene.SceneManager(); var scene1 =new caph.wui.widget.Scene.Scene(); scencMgr.addScene('s1', scene1); scenecMgr.showScene('s1'); scenecMgr.hideScene('s1'); |
removeScene | ||
Description | ||
Removes the scene from the SceneManager by the scene name. Current active scene can't be removed. | ||
Parameters | ■name - String - The name of scene | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var scencMgr = new caph.wui.widget.SceneManager(); var scene1 =new caph.wui.widget.Scene(); scencMgr.addScene('s1', scene1); scencMgr.removeScene('s1'); |
showScene | ||
Description | ||
Shows the scene specified by name. | ||
Parameters | ■name - String - The name of scene | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var scencMgr = new caph.wui.widget.SceneManager(); var scene1 =new caph.wui.widget.Scene(); scencMgr.addScene('s1', scene1); scencMgr.showScene('s1', getSceneAnimation() ); var getSceneAnimation = function() { var loader = new AniLoader(); var sceneIn = new SyncAnimation( sceneToBeShown, [{ type: 'fade', opacity: 1 }], { duration: 500 } ); var sceneOut = new SyncAnimation( sceneToBeDestroy, [{ type: 'fade', opacity: 0 }], { duration: 500 } ); loader.add( [sceneIn,sceneOut] ); loader.start( uicontext ); } |
addScene | ||
Description | ||
Adds a scene to a SceneManager. | ||
Parameters | ■name - String - The name of scene ■scene - Object - A scene object instance of caph.wui.widget.Scene. | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var scencMgr = new caph.wui.widget.SceneManager(); var scene1 =new caph.wui.widget.Scene(); var getSceneAnimation = function() { var loader = new AniLoader(); var sceneIn = new SyncAnimation( sceneToBeShown, [{ type: 'fade', opacity: 1 }], { duration: 500 } ); var sceneOut = new SyncAnimation( sceneToBeDestroy, [{ type: 'fade', opacity: 0 }], { duration: 500 } ); loader.add( [sceneIn,sceneOut] ); loader.start( uicontext ); } scencMgr.addScene('s1', getSceneAnimation()); |
clone | ||
Description | ||
Creates and returns clone object from current object, the cloned object will have the same properties and same methods with the current object. | ||
Parameters | ■Void | |
Return | ■Object - The cloned object. | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var SceneManager= window.caph.wui.widget.SceneManager; var widget =new SceneManager(); var obj = widget.clone(); |
addSceneEventHandler | ||
Description | ||
create a scene with a inputted scene event handler and add it to the SceneManager. | ||
Parameters | ■name - String - The name of scene. ■sceneEventHandler (Optional) - Function - callback function. | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var sceneMgr = new caph.wui.widget.SceneManager(); var scene1 =new caph.wui.widget.Scene(); sceneMgr.addScene('s1', scene1); sceneMgr.addSceneEventHandler('s1', function(){ sceneMgr.showScene('s1', getSceneAnimation()); }); var getSceneAnimation = function() { var loader = new AniLoader(); var sceneIn = new SyncAnimation( sceneToBeShown, [{ type: 'fade', opacity: 1 }], { duration: 500 } ); var sceneOut = new SyncAnimation( sceneToBeDestroy, [{ type: 'fade', opacity: 0 }], { duration: 500 } ); loader.add( [sceneIn,sceneOut] ); loader.start( uicontext ); } |
getCurScene | ||
Description | ||
Returns the current scene. | ||
Parameters | ■Void | |
Return | ■Array - list of scenes | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var sceneMgr = new caph.wui.widget.SceneManager(); var scene1 =new caph.wui.widget.Scene(); sceneMgr.addScene('s1', scene1); sceneMgr.getCurScene(); |
setFirstScene | ||
Description | ||
set the scene will be first shown by caph.app.AppCore. | ||
Parameters | ■name - String - The name of scene set as the first scene of apps. | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var sceneMgr = new caph.wui.widget.SceneManager(); var scene1 =new caph.wui.widget.Scene(); sceneMgr.addScene('s1', scene1); sceneMgr.setFirstScene('s1'); |
init | ||
Description | ||
initializes scene manager. | ||
Parameters | ■uicontext - Object - caph.wui.widget.UIContext | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var uicontext = new caph.wui.widget.UIContext(); var sceneMgr = new caph.wui.widget.SceneManager(uicontext); var sceneMgr.init(uicontext); |
SceneManager | ||
Description | ||
(Constructor) The constructor of SceneManager widget, in order to create SceneManager object. | ||
Parameters | ■uicontext - Object - caph.wui.widget.UIContext | |
Return | ■Object - An instance of SceneManager | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var uicontext = new caph.wui.widget.UIContext(); var scencMgr = new caph.wui.widget.SceneManager(uicontext); |