![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
The initialize() method must be implemented by the ControlWrapper. It is invoked once per control instance. It is invoked after all the Control Type resource dependencies have been loaded, but before the form data model has been initialized. Any configuration properties that are defined statically will be provided at this time, although any properties that support binding or API support may be updated after the initialize() method is called. The implementation needs to add the markup to the DOM at this point for the given renderMode, although there are cases when the control is being rendered in a grid pane where the markup needs to be handled in the refresh() method.
• component: an object of type Component. Component represents the form-level Control or Pane object that hosts this custom control. The form model objects obtained through the component represent read-only versions of the form models. The initial configuration of the control can be accessed using the control object in the component, including any custom properties defined by the Control Type.
• renderMode: This is a string that specifies the mode in which the control is to be rendered. The possible values are:
− For Control Types that specify any of the renderModes static, view-text, and view-html, those modes will not be passed into the initialize() method, but will instead be handled as follows:
− static: If the control is being rendered in a static pane, then no instance of the control wrapper is instantiated and the renderStatic() method defined on the ControlWrapper Class is called instead.
− view-text and view-html: The form will access the getFormattedValue() method of the ControlWrapper when a view-only version of the control is needed.This method must be implemented by the ControlWrapper. It is invoked for rendering of the control in the same Render Mode as originally specified in initialize(). This method is only called after the initialize() method, and is called at any point when the control configuration or value has been updated. This method will be called at least once after initializing.
• updates: This is an array that contains the names of configuration properties updated since the last initialize() or refresh() method invocation. For example: if the array contains the value myProperty, then that means the value of the custom property named myProperty has been updated since the last refresh(). The full set of configuration properties can always be accessed using the control in the component object passed to the ControlWrapper in the intialize() method. There is a set of built-in keys that can reference properties common to all controls: "label", "hint", "required", "enabled", "readOnly", "visible", "locale", and "validation". The updates array can also contain the custom property names, if the value of any of those properties changed since the last refresh() method call.This is an optional method that returns a simple read-only rendering of the value managed by this control. This method only needs to be implemented if either the view-text or view-html render modes are supported. At most, one of these modes can be supported.
• view-text: The return value of this method will be plain text that is rendered in the DOM within a DOM Text mode.
• view-html: The return value is a string representation of HTML markup and is treated as such when added to the DOM.See the com.tibco.forms.extension package for a set of built-in utilities for formatting values of various types.
• value: This is the value to be formatted.This method returns true if the ControlWrapper is ready to be initialized. This method is repeatedly called until it returns true or the loading of the form times out. This gives the wrapper a chance to check whether necessary libraries are loaded prior to initialization. If only the needed libraries are specified directly in the Components Library model, then it should be always safe to return true from this method. However, some frameworks, such as GWT and Dojo, will load additional files that are not loaded directly by the Forms framework. For these cases, the wrapper should perform a check. For example: by checking for the existence of a needed function or class, before returning true.
If the setfocus() method is defined in the ControlWrapper, the capability always picks the "focus" capability from the ControlWrapper. If you do not want the component to handle setFocus() then do not define it in ControlWrapper.
• value1: This is the first object to compare.
• value2: This is the second object to compare.
−
−
−
• value: This is the value that needs to be formatted.
• label: (Type String) - The label to be rendered for the static control.
• hint: (Type String) - The hint to be rendered for the static control.
• labelId: (Type String) - Identifier of the label as rendered by the form. This is useful for accessibility.
• propertySet: (Type Associative Array) - Initial configuration of the control, including custom properties configured in the Form Designer. The key is the name of the property as defined in the Control Type.
• resource: (Type Object) - The same as retrieved from the Component.getResources() method.
• textOnly: (Type Boolean) - If true, then the pane this is being rendered in is expecting a text-only rendering of the value. That is, no rendering of a widget that displays the value.
• parentPaneType: (Type String) - This is the string that represents the type of pane. This is equal to the value returned from the Pane.getPaneType() method. A ControlWrapper identifies the rendering on a grid pane using the parentPaneType argument.
• logger: (Type logger Object) - This is the same logger object available in Form action scripts. The logger object helps to log messages to the form log. View the form log at preview time by using the appropriate logging level in the Windows -> Preferences -> Form Designer -> Preview page. Enable logging at runtime by using the query parameter log_level with an appropriate value: TRACE, DEBUG, INFO, WARN, ERROR, FATAL. For example: http://<server>:<port>/openspace?log_level=INFO. See Table 98, Logger Class for the list of available methods.
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |