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


Chapter 6 Custom Controls : BOM JavaScript API for Custom Controls

BOM JavaScript API for Custom Controls
In order to support more complex custom control use cases, the JavaScript API documented for the auto-generated BOM JavaScript classes has been augmented to provide a reflective API. This allows controls to write code that can introspect objects and provide an auto-generated UI based on the type of object. For example, this would enable implementation of controls such as a tree control that can provide a user interface based on the structure of arbitrary objects. The API described here is currently only supported for use within Custom Controls.
Factory Methods
The following methods are available in the factory that is available for each BOM package.
 
Table 25 Factory Methods
className is a fully-qualified name of the BOM JavaScript class. This must be a class managed by the given factory.
From form action methods, the specific createXXX() method for a given class should be used.
className is a fully-qualified name of the BOM JavaScript class. This must be a class managed by the given factory.
 
BOM Class Methods
The following methods are available on the class object returned from the getClass(className) method of a factory, or the getClass() method of a BOM JavaScript object instance.
 
Table 26 BOM Class Methods
This array is the union of attribute names retrieved using getPrimitiveAttributeNames() and getComplexAttributeNames().
attName: name of attribute.
attName: name of attribute.
Returns true if the attribute with the given name is a multi-valued attribute as defined in the BOM.
attName: name of attribute.
Returns true if the attribute with the given name is of a primitive type or enumeration. If it returns true, it will be a member of the array returned from getPrimitiveAttributeNames().
BOM Class Instance Methods
The following methods are available on each instance of a BOM JavaScript class.
 
Table 27 BOM Class Instance Methods
attName: name of attribute.
attName is primitive and single-valued: returns a value of type String, Number, Date, or Duration, depending on the specific type of attribute.
attName is primitive and multi-valued: returns a JavaScript array containing the underlying values.
attName is complex and single-valued: returns an instance of the BOM JavaScript class associated with the attribute.
attName is complex and multi-valued: returns a List object containing the underlying values.
attName: name of attribute.
value: new value of attribute.
attName is primitive and single-valued: should be a value of type String, Number, Date, or Duration, depending on the specific type of attribute.
attName is primitive and multi-valued: should be a JavaScript array containing the underlying values.
attName is complex and single-valued: should be an instance of the BOM JavaScript class associated with the attribute.
attName is complex and multi-valued: unsupported. In this case, the List object obtained from the object should be updated directly with additions or deletions.

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