ComponentLifecycleEvents
interface is implemented by classes that
need to observe a particular component's life-cycle events. caplin.component.Component
instances themselves automatically implement this interface, since Component
extends ComponentLifecycleEvents
.
Component life cycle events are emitted by the object that hosts the components. This is either the top-level caplin.component.frame.FrameManager for the application, or any composite type component that itself contains other components. Overriding any of the methods in this listener interface is optional, but doing so will enable you to react to the related event.
The FrameManager
determines whether the event methods are called immediately
before or immediately after the event they refer to.
Attributes | Name and Description |
---|---|
|
caplin.component.ComponentLifecycleEvents()
|
Attributes | Name and Description |
---|---|
|
void
onActivate()
Invoked when the frame becomes the active or focused frame within the page. |
|
void
onClose()
Invoked when the frame containing this component is closed. |
|
void
onDeactivate()
Invoked when the frame ceases to be the active or focused frame within the page. |
|
void
onHide()
Invoked when a frame is no longer in view. |
|
void
onMaximize()
Invoked when the frame has been maximized. |
|
void
onMinimize()
Invoked when the frame has been minimized. |
|
void
onOpen(int nWidth, int nHeight)
Invoked when the frame is first displayed. |
|
void
onResize(int nWidth, int nHeight)
Invoked when the dimensions of the frame change. |
|
void
onRestore()
Invoked when the frame has been restored from a minimized or maximized state. |
|
void
onShow()
Invoked when a frame that has been hidden (see #onHide) is now back in view. |
►
caplin.component.ComponentLifecycleEvents()
►
void
onActivate()
Invoked when the frame becomes the active or focused frame within the page.
►
void
onClose()
Invoked when the frame containing this component is closed.
This method should be used to clean up any resources the component currently has open,
including subscriptions and any other listeners that may have been registered. Once
onClose()
has been called no further methods will be called for this
component.
It is possible for the onClose()
method to be invoked before
onOpen()
if the component was instantiated but never displayed (for example if the
user was not permissioned to view the component) in which case this method should only be used
to clean up any resources it has opened within its constructor, and not those that it would
have opened within onOpen()
.
►
void
onDeactivate()
Invoked when the frame ceases to be the active or focused frame within the page.
►
void
onHide()
Invoked when a frame is no longer in view. It should stop or suspend any resources that may be processor intensive, such as subscriptions, so they are not active whilst the frame is hidden.
►
void
onOpen(int nWidth, int nHeight)
Invoked when the frame is first displayed. It will only ever be called once, which will always
be after the caplin.component.Component#getElement method has been called on the
Component
.
FrameManager
implementations must invoke this method after the element returned
by Component.getElement()
has been added to the page. Initalization code that needs
to know the size of the component, or that uses the computed CSS styles that will only become
valid after the component's HTML has been added to the view should be placed here.
int | nWidth | The width of the frame, in pixels. |
int | nHeight | The height of the frame, in pixels. |
►
void
onResize(int nWidth, int nHeight)
Invoked when the dimensions of the frame change.
int | nWidth | The new width of the frame, in pixels. |
int | nHeight | The new height of the frame, in pixels. |
►
void
onRestore()
Invoked when the frame has been restored from a minimized or maximized state.
►
void
onShow()
Invoked when a frame that has been hidden (see #onHide) is now back in view. It
should restore any resources that were stopped or suspended by onHide()
.
Note that this method is not called when the component within the frame is first displayed (see #onOpen).