The Application class
Support in HbbTV
Available since: HbbTV 1.0 (ETSI TS 102 796 V1.1.1, OIPF DAE V1.1)
The following properties and methods shall be supported:
– privateData
– createApplication(URI,false)
– destroyApplication()
– show()
– hide() (broadcast independent applications should not call this method. Doing so may result in only the background being visible to the user).
All other properties and methods are not included.
The Application class is used to implement the characteristics of a DAE application.
If the document of an application is modified (or even replaced entirely), the Application object SHALL be retained. This means that the permission set granted when the application is created applies to all “edits” of the document or other pages in the application, until the application is destroyed.
Properties
readonly Boolean visible |
true if the application is visible, false otherwise. The value of this property is not affected by the application’s Z-index or position relative to other applications. Only calls to the show() and hide() methods will affect its value. |
readonly Boolean active |
true if the application is in the list of currently active applications, false otherwise (as defined in section 4.3.8). |
readonly StringCollection permissions |
StringCollection object containing the names of the permissions granted to this application. |
readonly Boolean isPrimaryReceiver |
true if the application receives cross application events before any other application, false otherwise. |
readonly Window window |
A strict subset of the DOM Window object representing the application. No symbols from the Window object are accessible through this property except the following: § void postMessage( any message, String targetOrigin ) |
readonly ApplicationPrivateData privateData |
Access the current application’s private data object. If an application attempts to access the privateData property of an Application object for a different application, the OITF SHALL throw an error as defined in section 10.1.1. |
function onApplicationActivated function onApplicationDeactivated function onApplicationShown function onApplicationHidden function onApplicationPrimaryReceiver function onApplicationNotPrimaryReceiver function onApplicationTopmost function onApplicationNotTopmost function onApplicationDestroyRequest function onApplicationHibernateRequest function onKeyPress function onKeyUp function onKeyDown |
Each of these event handlers represents a DOM 0 event handler that corresponds to one of the events listed in sections 4.4.7 and 7.2.6. |
Methods
void show() |
Description | If the application visualization mode as defined by method getApplicationVisualizationMode() in section 7.2.1.3, is: 1 : Make the application visible. 2 : Make the application visible. Calling this method from the application itself may have no effect. 3 : Request to make the application visible. This method only affects the visibility of an application. In the case where more than one application is visible, calls to this method will not affect the z-index of the application with respect to any other visible applications. |
void hide() |
Description | If the application visualization mode as defined by method getApplicationVisualizationMode() in section 7.2.1.3, is: 1 : Make the application invisible. 2 : Make the application invisible. Calling this method from the application itself may have no effect. 3 : Request to make the application invisible. Calling this method has no effect on the lifecycle of the application. Note: Broadcast independent applications should not call this method. Doing so may result in only the background being visible to the user |
void activateInput( Boolean gainFocus ) |
Description | Move the application to the front of the active applications list. If the application has been hidden using Application.hide(), this method does not cause the application to be shown. If the application visualization mode as defined by method getApplicationVisualizationMode() in section 7.2.1.3, is: 1 : The application’s Window object SHALL be moved to the top of the stack of visible applications. In addition, the application’s Window object SHALL gain input focus if argument gainFocus has value true. 2 : The application’s Window object SHALL be moved to the top of the stack of visible applications. In addition, the application’s Window object SHALL gain input focus if argument gainFocus has value true. Calling this method from the application itself MAY have no effect. 3 : Request to make the application’s Window object visible. Once visible, the application SHALL be given input focus, irrespective of the value for argument gainFocus. |
void deactivateInput() |
Description | Remove the application from the active applications list. This has no effect on the lifecycle of the application and MAY have no effect on the resources it uses. Applications which are not active will receive no cross-application events, unless their Application object is the target of the event (as for the events defined in section 7.2.6). Applications may still be manipulated via their Application object or their DOM tree. |
Application createApplication( String uri, Boolean createChild ) |
Description | Create a new application and add it to the application tree. Calling this method does not automatically show the newly-created application. This call is asynchronous and may return before the new application is fully loaded. An ApplicationLoaded event will be targeted at the Application object when the new application has fully loaded. If the application cannot be created, this method SHALL return null. |
Arguments | uri | The URI of the first page of the application to be created or the localURI of a Widget as defined in section 7.2.8.1.1. |
createChild | Flag indicating whether the new application is a child of the current application. A value of true indicates that the new application should be a child of the current application; a value of false indicates that it should be a sibling. |
void destroyApplication() |
Description | Terminate the application, detach it from the application tree, and make any resources used available to other applications. When an application is terminated, any child applications shall also be terminated. |
Application startWidget( WidgetDescriptor wd, Boolean createChild ) |
Description | Starts a Widget installed on the OITF. The behaviour of this method is equivalent to that of Application.createApplication(). The Widget is identified by its WidgetDescriptor. To get a list of the WidgetDescriptor objects for the installed Widgets one can check ApplicationManager.widgets property. If the Widget is already running or fails to start this call will return null. |
Arguments | wd | a WidgetDescriptor object for a Widget installed on the OITF. |
createChild | Flag indicating whether the new application is a child of the current application. A value of true indicates that the new application should be a child of the current application; a value of false indicates that it should be a sibling. |
void stopWidget( WidgetDescriptor wd ) |
Description | Terminate a running Widget. The behaviour of this method is equivalent to that of Application.destroyApplication(). Calling this method will detach the Widget from the application tree, and make any resources used available to other applications. When a Widget is terminated, any child applications shall also be terminated. |
Arguments | wd | A WidgetDescriptor object for a Widget installed on the OITF. |