Mojo.Controller.StageController

Class Detail

This class provides methods to manipulate scenes on the stage. A stage is an HTML structure very similar to a standard browser window. A single application may have multiple stages and a single stage may contain multiple scenes.

This class is a constructor which gets instantiated for you, and is typically accessed using this.controller.

Method Summary


Method Detail

Mojo.Controller.StageController.activate()

Programatically activates this stage. Causes card windows to be maximized.


Mojo.Controller.StageController.activeScene()

Returns the SceneController object for the currently active scene from this stage, if any. If no scenes are active, returns undefined.


Mojo.Controller.StageController.deactivate()

Programatically deactivates this stage. Causes card windows to be minimized.


Mojo.Controller.StageController.delegateToSceneAssistant(functionName)

Use to call a method on the assistant of the current scene of this stage. The first parameter is the name of the property that contains the function to call. The remaining parameters are passed to that function. The this keyword is bound to the scene assistant for this call.

Parameters


Mojo.Controller.StageController.getAppController()

Returns the current application controller.


Mojo.Controller.StageController.getScenes()

Returns an array of scene controllers currently on the stack. result[0] is the bottom scene on the stack.


Mojo.Controller.StageController.getWindowOrientation(orientation)

Gets the orientation of the stage's window.

Parameters


{Boolean} Mojo.Controller.StageController.hasNewContent()

Returns true if the current stage has new content for the indicator, and false otherwise.


Mojo.Controller.StageController.indicateNewContent(hasNew)

Makes the core navi button pulsate if true. This is mainly intended to alert the user to dashboard events that desire user attention.

Parameters


Mojo.Controller.StageController.isActiveAndHasScenes()

Returns true if the stage is both active and has currently pushed.


{Boolean} Mojo.Controller.StageController.isChildWindow()

Utility function to find out if the current window is a child window. Returns true for child windows.


Mojo.Controller.StageController.loadStylesheet(path)

Loads a stylesheet -- and any versions of it for the current locale -- into the stage's document.

Parameters


Mojo.Controller.StageController.parentSceneAssistant(targetSceneAssistant)

Returns the scene assistant of the scene above this scene in the scene stack, or undefined if there is no such scene.

Parameters


Mojo.Controller.StageController.popScene(returnValue, options)

Removes a scene from the scene stack, passing the return value to the newly revealed scene's activate method. Note that this is an asynchronous operation.

Parameters


Mojo.Controller.StageController.popScenesTo(targetScene, options)

Removes scenes from the scene stack until the target scene is reached, or there are no scenes remaining on the stack. targetScene may be either the SceneController for the desired scene, the scene DOM ID, or the scene name. If targetScene is undefined, all scenes will be popped. Intermediate popped scenes are not reactivated, nor is there any visual transition to signify their removal from the stack. Note that this is an asynchronous operation.

To avoid showing a transition to the scene if you're already on top, you can use this check:

if (myScene.stageController.topScene() !== myScene.controller) {
  myScene.controller.stageController.popScenesTo(myScene.controller);
}

Parameters


Mojo.Controller.StageController.pushAppSupportInfoScene()

Overview

This method pushes a scene containing application support information, populated with data gathered from the application's appinfo.json file. It uses the following basic properties from Mojo.appInfo:

Additionally, this method uses a "support" property, which is an object containing at least one of the three following properties:

The "support" object can, optionally, contain a "resources" property; an array of objects with the following properties:

Here is an example appinfo.json:

{
  "id": "com.mycompany.myapp",
  "version": "1.0.0",
  "vendor": "My Company",
  "vendorurl": "http://www.mycompany.com",
  "type": "web",
  "main": "index.html",
  "title": "My App",
  "icon": "icon.png",
  "smallicon": "icon32x32.png",
  "copyright": "© Copyright 2009 My Company, Inc.",
  "support": {
      "url": "http://support.mycompany.com",
      "email": {
          "address": "support@mycompany.com",
          "subject": "Support"
      },
      "phone": "555-555-5555",
      "resources": [
          {
              "type": "scene",
              "label": "Help Topics",
              "sceneName": "topics"
          },
          {
              "type": "web",
              "label": "Discussion Forums",
              "url": "http://forums.mycompany.com/"
          }
      ]
  }
} 

Function Call

this.controller.StageController.pushAppSupportInfoScene(); 


Mojo.Controller.StageController.pushCommander(cmdr)

Adds the given commander to the top of this StageController's stack. The commanders in this stack are only used when this scene is the current scene.

Parameters


Mojo.Controller.StageController.pushScene(sceneArguments)

Push a new scene; the Scene Lifecycle initial setup includes this function. Note that this is an asynchronous operation. An app calls StageController.pushScene('myScene'):

  1. A div is created with the view HTML for the new scene, and inserted into the <body>.
  2. A SceneController for 'myScene' is instantiated.
  3. A scene assistant for 'myScene' is instantiated, if available.
  4. The new scene is placed on the stage's scene stack then the Scene Controller and assistant's setup() methods are called and Widgets (divs that specify x-mojo-element) are created, rendered, and added to the DOM.

At this point, scene should now be ready for initial display, even if the app is waiting for a service request to complete to provide dynamic data to fill out the scene.

  1. The StageController transitions the scene onto the stage.
  2. When the transition is complete, the scene controller and assistant's activate method is called, and the scene is ready for action.

Parameters


Mojo.Controller.StageController.removeCommander(cmdr)

Removes a commander from the commander stack.

Parameters


Mojo.Controller.StageController.sendEventToCommanders(event)

Sends the given event through the entire command chain, starting with the CommanderStack in the current scene, and progressing to the StageController's stack if the current scene does not call event.stopPropagation().

Parameters


Mojo.Controller.StageController.setClipboard(escapeHTML:, escapeHTML)

This allows the client application to send text to the clipboard to be pasted elsewhere later.

Parameters


Mojo.Controller.StageController.setWindowOrientation(orientation)

Sets the orientation of the stage's window.

Parameters


Mojo.Controller.StageController.setWindowProperties(props)

Changes properties of the window.

Parameters


Mojo.Controller.StageController.swapScene(sceneArguments)

Pops the current scene and simultaneously pushed a new scene without activating & deactivating any underlying scenes. Note that this is an asynchronous operation.

Parameters


Mojo.Controller.StageController.topScene()

Returns the topmost scene from this stage.


Mojo.Controller.StageController.unloadStylesheet(path)

Unloads a stylesheet -- and any versions of it for the current locale -- from the stage's document.

Parameters