Echo
Application
Class Hierarchy:

Representation of a single application instance. Derived objects must invoke constructor with root component id.

Constructor Summary
Public Echo.Application()
Creates a new application instance.

Class Field Summary
Internal _nextUid
Next unique identifier.

Class Method Summary
Public generateUid()
Generates a unique identifier.

Instance Method Summary
Public, Virtual init()
Performs application initialization operations.
Public, Virtual dispose()
Performs application disposal/resource cleanup operations.
Public addListener()
Adds an arbitrary event listener.
Public doDispose()
Invoked by application container to dispose of the application.
Public doInit()
Invoked by application container to initialize of the application.
Internal _findModalContextRoot()
Recursively determines the current root component of the modal context.
Public fireEvent()
Provides notification of an arbitrary event.
Public focusNext()
Focuses the previous/next component based on the currently focused component.
Public getComponentByRenderId()
Retrieves the registered component with the specified render id.
Public getFocusedComponent()
Returns the focused component.
Public getLayoutDirection()
Returns the default layout direction of the application.
Public getLocale()
Returns the default locale of the application.
Public getModalContextRoot()
Returns the root component of the modal context.
Public getStyleSheet()
Returns the application style sheet.
Public isActive()
Returns the active state of the application.
Public notifyComponentUpdate()
Notifies the application of an update to a component.
Internal _registerComponent()
Registers a component with the application.
Public removeListener()
Removes an arbitrary event listener.
Public setFocusedComponent()
Sets the focused component.
Public setLayoutDirection()
Sets the application default layout direction.
Public setLocale()
Sets the application default locale.
Internal _setModal()
Informs the application of the modal state of a specific component.
Public setStyleSheet()
Sets the application style sheet.
Internal _unregisterComponent()
Unregisters a component from the application.

Events
componentUpdate An event fired when any component within the application is updated. Listening for this event may degrade the performance of an application, due to the frequency with which it will be fired.
focus An event fired when the focused component of the application changes.
modal An event fired when the modal state of the application changes.

Constructor Detail
Echo.Application()
Creates a new application instance.

Class Method Detail
generateUid
Generates a unique identifier. Identifiers are unique for the duration of the existence of this namespace.

Instance Method Detail
init
Performs application initialization operations. This method should be provided by an application implementation if required. The superclass' init() method should always be invoked out of convention. The client property will be available.

dispose
Performs application disposal/resource cleanup operations. This method should be provided by an application implementation if required. The superclass' dispose() method should always be invoked out of convention. The client property will be available.

addListener
Adds an arbitrary event listener.
Parameters:
eventType (String) - the event type name
eventTarget (Function) - the method to invoke when the event occurs (the event will be passed as the single argument)

doDispose
Invoked by application container to dispose of the application. Invokes application-overridable dispose() method. Once invoked, the application will no longer function and cannot be used again. This method will free any resources allocated by the application.

doInit
Invoked by application container to initialize of the application. Invokes application-overridable init() method.

_findModalContextRoot
Recursively determines the current root component of the modal context.
Parameters:
searchComponent (Echo.Component) - (optional) the component from which to search (this parameter is provided when recursively searching, if omitted the sear will begin at the root component of the application).
Returns:
the current modal context root component

fireEvent
Provides notification of an arbitrary event. Listeners will be notified based on the event's type property.
Parameters:
event - the event to fire

focusNext
Focuses the previous/next component based on the currently focused component.
Parameters:
reverse (Boolean) - false to focus the next component, true to focus the previous component

getComponentByRenderId
Retrieves the registered component with the specified render id.
Parameters:
renderId (String) - the render id
Returns:
(Echo.Component) the component

getFocusedComponent
Returns the focused component.
Returns:
(Echo.Component) the focused component

getLayoutDirection
Returns the default layout direction of the application.
Returns:
(Echo.LayoutDirection) the default layout direction

getLocale
Returns the default locale of the application.
Returns:
(String) the default locale

getModalContextRoot
Returns the root component of the modal context.
Returns:
(Echo.Component) the root component of the modal context

getStyleSheet
Returns the application style sheet.
Returns:
(Echo.StyleSheet) the application style sheet

isActive
Returns the active state of the application.
Returns:
(Boolean) the active state of the application, a value of true indicating the application is ready for user input, a value of false indicating otherwise

notifyComponentUpdate
Notifies the application of an update to a component. Fires a componentUpdate event.
Parameters:
parent (Echo.Component) - the parent component
propertyName (String) - the updated property
oldValue - the previous property value
newValue - the new property value

_registerComponent
Registers a component with the application. Invoked when a component is added to a hierarchy of components that is registered with the application.
Parameters:
component (Echo.Component) - the component to register

removeListener
Removes an arbitrary event listener.
Parameters:
eventType (String) - the event type name
eventTarget (Function) - the method to invoke when the event occurs (the event will be passed as the single argument)

setFocusedComponent
Sets the focused component. A "focus" event is fired to application listeners to inform them of the change.
Parameters:
newValue (Echo.Component) - the new focused component

setLayoutDirection
Sets the application default layout direction.
Parameters:
newValue (Echo.LayoutDirection) - the new layout direction

setLocale
Sets the application default locale.
Parameters:
newValue (String) - the new locale

_setModal
Informs the application of the modal state of a specific component. When modal components are unregistered, this method must be executed in order to avoid a memory leak.
Parameters:
component - the component
modal - the modal state

setStyleSheet
Sets the application style sheet.
Parameters:
newValue (Echo.StyleSheet) - the new style sheet

_unregisterComponent
Unregisters a component from the application. This method is invoked when a component is removed from a hierarchy of components registered with the application.
Parameters:
component (Echo.Component) - the component to remove