Interface
caplin.component

Component

This interface must be implemented by a presentation-level class. A presentation-level class represents something that occupies physical space in the page container, such as the content of a panel or a dialog box. Component extends the caplin.component.ComponentLifecycleEvents interface which defines the life cycle events that may be raised by the container in response to the user's interaction with it. The Component is automatically registered with its container so that it receives these life cycle event callbacks.

Each implementation of a Component represents a different Component type, for example a Grid or a Trade Panel.

Each subclass of Component must have an createFromSerializedState method which is responsible for constructing new instances of the Component.

The windowing environment, which provides the container within which the component exists, may only use a subset of the Component interface. A component therefore should be implemented so that it will work even if the (mandatory) methods #getElement and caplin.component.ComponentLifecycleEvents#onOpen are the only methods the windowing environment will invoke.

The windowing environment determines whether the event methods are called immediately after or immediately before the event they refer to.

Component instances that have been configured via XML or saved as part of a layout are instantiated by the caplin.component.ComponentFactory. As such a Component must be registered with the using the factory's caplin.component.ComponentFactory#registerComponent method, passing in the name of the root XML tag that represents the component and a suitable static factory method can instantiate it.

Constructor Summary

Attributes Name and Description
caplin.component.Component()

Method Summary

Attributes Name and Description
caplin.component.container.Container getContainer()

Returns a reference to the container that is hosting this component.

HtmlElement getElement()

Invoked when the windowing environment needs to display this component.

, caplin.services.security.PermissionKey getPermissionKey()

Invoked so the container can determine whether the component is currently permissioned for use.

String getUniqueComponentId()

Gets a guaranteed ID for this component instance.

void setContainer(caplin.component.container.Container oContainer)

Provides a reference to the container that will be hosting this component.

void setFrame(caplin.component.frame.ComponentFrame oComponentFrame)

Provides a reference to the frame enclosure, that wraps this component so it can be displayed on the page.

Methods implemented from class caplin.core.Serializable:
getSerializedState
Methods implemented from class caplin.component.ComponentLifecycleEvents:
onActivate, onClose, onDeactivate, onHide, onMaximize, onMinimize, onOpen, onResize, onRestore, onShow

Constructor Detail

caplin.component.Component()

Method Detail

caplin.component.container.Container getContainer()

Returns a reference to the container that is hosting this component. If no container has been set then this will return undefined.

Returns
{caplin.component.container.Container} oContainer The container hosting this component.

HtmlElement getElement()

Invoked when the windowing environment needs to display this component. It returns the HTML element that must be added to the DOM to represent this component. getElement() is invoked before any of the other Component interface methods.

This method is compulsory, and must be implemented.

It should be designed execute quickly, as the windowing environment may freeze until it has returned.

Throws
caplin.core.Error
if this method is not implemented by the subclass.
Returns
{HtmlElement} The root HtmlElement used to display this component on a web page. Must not be null or undefined.

, caplin.services.security.PermissionKey getPermissionKey()

Invoked so the container can determine whether the component is currently permissioned for use.

Returns
The set of permissioning information that can be used to query caplin.services.security.PermissionService#canUserPerformAction.
{caplin.services.security.PermissionKey} The permission key

String getUniqueComponentId()

Gets a guaranteed ID for this component instance.

Returns
{String} A unique ID

void setContainer(caplin.component.container.Container oContainer)

Provides a reference to the container that will be hosting this component.

Parameters
caplin.component.container.Container oContainer The container hosting this component.
See
#setFrame

void setFrame(caplin.component.frame.ComponentFrame oComponentFrame)

Provides a reference to the frame enclosure, that wraps this component so it can be displayed on the page.

Parameters
caplin.component.frame.ComponentFrame oComponentFrame The frame enclosure that wraps this component.