Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 6 Custom Controls : Runtime Life Cycle of Custom Controls

Runtime Life Cycle of Custom Controls
The ControlWrapper implementation is subject to a very specific life cycle, which is described in Figure 134.
Figure 134 ControlWrapper Life Cycle
Preparation
The forms runtime repeatedly calls the ControlWrapper's isReady() method until it returns true.
Initialization
The forms runtime calls the constructor function to create an instance of the ControlWrapper and then calls the initialize() method on this instance.
Refresh
Whenever you update the configuration or value of the control, the form invokes the ControlWrapper.refresh() method to give the ControlWrapper a chance to update the rendering of the control.
Destruction
When the form is being taken out of service, it invokes the destroy() method on the ControlWrapper.
Runtime Life Cycle of Custom Control Used within Grid Pane
Using a custom control within a grid pane uses a specialized life cycle. It depends on the supported Render Modes of the Control Type and the Always Render setting on the Control.
Preparation
The forms runtime repeatedly calls the ControlWrapper's isReady() method until it returns true.
Initialization
When you configure the control in the Always Render mode, the form creates an instance of the ControlWrapper for each cell in the grid table. Users can view the rendering that happens at this point.
When you do not configure the control in the Always Render mode (default), the form creates a single ControlWrapper instance that is shared between the cells in a grid table column. Users cannot view the rendering that happens at this point. The form does not attach the parent node to the DOM at this point but invokes the ControlWrapper.getFormattedValue() method for each visible cell in the column of the grid table.
Refresh
When you configure the control in the Always Render mode, the form calls the refresh() method as soon as the value or other configuration settings are changed.
When you do not configure the control in the Always Render mode and focus on a cell to edit the value, the form calls the ControlWrapper.refresh() method to allow the ControlWrapper to update the rendering and reflect the current value being edited. If you change any of the configuration settings after the last refresh(), the wrapper is notified through the updates argument.
Sorting
If a control manages a complex value, the static compare() method on the ControlWrapper class is called each time user sorts the grid on that column.
Destruction
When you configure the control in Always Render mode, the form invokes the destroy() method on all instances of the ControlWrapper when the form is being taken out of service or on the specific instance when that row is deleted from the table.
If you do not configure the control in the Always Render mode, the form invokes the destroy() method on the shared instance of the ControlWrapper only when the form is being taken out of service.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved