top

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.


Constructor

SceneManager

Description
The constructor of SceneManager widget, in order to create SceneManager object.
Parameters
uiContext Objectcaph.wui.widget.UIContext
Emulator SupportY
SDK ConstraintNone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
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 SupportY
SDK Constraintnone
Example
var uicontext = new caph.wui.widget.UIContext();
var scencMgr = new caph.wui.widget.SceneManager(uicontext);