JSComponent
Overview
The JSComponent
class provides a set of methods for interacting with and managing components within a solution model. It offers functionality for setting and retrieving properties such as background, font type, borders, visibility, and positioning. Through various getter and setter methods, it allows for fine-tuned control over the component’s attributes, including handling design-time properties, setting Z-index values, and managing anchor configurations.
In addition to visual and layout properties, JSComponent
supports grouping components together by groupID
, enabling batch actions like enabling or disabling multiple elements at once. The class also supports retrieving and setting CSS position for components in NGClient, as well as managing event handlers and design-time properties. It provides utility methods for managing component attributes, including getting and setting attribute values, and clearing attributes when necessary.
Properties Summarized
Enables a component to stick to a specific side of form and/or to grow or shrink when a window is resized.
The background color of the component.
The type, color and style of border of the component.
CSS position is a replacement for anchoring system making it more intuitive to place a component.
The enable state of the component, default true.
The font type of the component.
The foreground color of the component.
The Z index of this component.
A String representing a group ID for this component.
The height in pixels of the component.
The name of the component.
The name of the style class that should be applied to this component.
Flag that tells if the component is transparent or not.
The visible property of the component, default true.
The width in pixels of the component.
The x coordinate of the component on the form.
The y coordinate of the component on the form.
Methods Summarized
Get the value of an attribute of the element.
Returns the attribute names of an element.
Returns the comment of this component.
Get a design-time property of an element.
Get the design-time properties of an element.
Returns the name of the form.
Returns the UUID of this component.
Set a design-time property of an element.
Remove the attribute of an element.
Clear a design-time property of an element.
void
Set the attribute value of an element.
Properties Detailed
anchors
Enables a component to stick to a specific side of form and/or to grow or shrink when a window is resized.
If opposite anchors are activated then the component with grow or shrink with the window. For example if Top and Bottom are activated, then the component will grow/shrink when the window is vertically resized. If Left and Right are activated then the component will grow/shrink when the window is horizontally resized.
If opposite anchors are not activated, then the component will keep a constant distance from the sides of the window which correspond to the activated anchors.
Type Number The anchor configuration for the component.
Sample
background
The background color of the component.
Type String The background color of the component.
Sample
borderType
The type, color and style of border of the component.
Type String The border type of the component as a string.
Sample
cssPosition
CSS position is a replacement for anchoring system making it more intuitive to place a component. CSS position should be set on form, an absolute position form can either work with anchoring or with css position. This is only working in NGClient.
Type CSSPosition The CSS position of the component.
Sample
enabled
The enable state of the component, default true.
Type Boolean True if the component is enabled; false otherwise.
Sample
fontType
The font type of the component.
Type String The font type of the component.
Sample
foreground
The foreground color of the component.
Type String The foreground color of the component.
Sample
formIndex
The Z index of this component. If two components overlap, then the component with higher Z index is displayed above the component with lower Z index.
Type Number The Z-index of the component.
Sample
groupID
A String representing a group ID for this component. If several components have the same group ID then they belong to the same group of components. Using the group itself, all components can be disabled/enabled or made invisible/visible. The group id should be a javascript compatible identifier to allow access of the group in scripting.
Type String The group ID of the component.
Sample
height
The height in pixels of the component.
Type Number The width of the component in pixels.
Sample
name
The name of the component. Through this name it can also accessed in methods. Must be a valid javascript name. (no - in the name or start with number)
Type String The name of the component.
Sample
styleClass
The name of the style class that should be applied to this component.
When defining style classes for specific component types, their names must be prefixed according to the type