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.
Attributes | Name and Description |
---|---|
|
caplin.component.Component()
|
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
getSerializedState()
Invoked when the windowing environment needs to save the state of this component. |
|
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. |
►
caplin.component.Component()
►
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.
►
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.
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.
►
String
getSerializedState()
Invoked when the windowing environment needs to save the state of this component. It returns an XML string representation of the state.
This method is compulsory, and must be implemented.
Example:
mybank.MyComponent = function() { this.m_sSubject = null; }; caplin.implement(mybank.MyComponent, caplin.component.Component); mybank.MyComponent.setSubject = function(sSubject) { this.m_sSubject = sSubject; }; // other caplin.component.Component methods ... mybank.MyComponent.getSerializedState = function() { return "<myComponent subject=\"" + this.m_sSubject + "\" />"; };
null
or undefined
.
►
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.
caplin.component.container.Container | oContainer | The container 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.
caplin.component.frame.ComponentFrame | oComponentFrame | The frame enclosure that wraps this component. |