ComponentBase
A component base contains the fundamental functionality of all components. Its methods are shared among all base components, for example, buttons, charts, and crosstabs, but also the pages of a page book and the tabs of a tab strip.
Method Summary
Type Method and Description
GenericComponentBase as(ComponentType type)
Casts the component to the specified type.
ComponentType getComponentType()
Returns the component type of the component.
String getName()
Returns the component name.
Method Detail
as
GenericComponentBase as(ComponentType type) Casts the component to the specified type. If the component is of the specified type then it is returned as an object of the specified type. If it is not of the specified type, then undefined is returned.
Example
In the following example, elements of a ComponentArray are cast as elements of Button: var a = [BUTTON_1, BUTTON_2, IMAGE_1];
// a is now a ComponentArray
a.forEach(function(element) {
  var b = element.as(ComponentType.BUTTON);
  if (b !== undefined) {
    // we found a button
    b.setText("Hello");
  }
});
Parameters
ComponentType type Component type
Returns
GenericComponentBaseIt contains the component, cast to the specified type, or undefined if the component could not be cast to the specified type.
getComponentType
ComponentType getComponentType() Returns the component type of the component.
Example
In the following example, the type of a button is retrieved: var type = BUTTON_1.getComponentType(); // type is ComponentType.Button
Returns
ComponentTypeIt contains the type of the component.
getName
String getName() Returns the component name. The name is unique in an application or composite, but not in the running state when an application contains composite instances.
Example
In the following example, the name of a Button is retrieved: var name = BUTTON_1.getName(); // name is "BUTTON_1"
Returns
StringIt contains the name of the component.