Constructor
# new Component(parent, id, setupData)
Create an abstract view component.
Parameters:
Name | Type | Description |
---|---|---|
parent |
object
|
The parent component object. |
id |
string
|
The id should be a unique string idetifier. |
setupData |
object
|
Deprecated paramenter will be removed in future. |
Classes
Methods
# addDomElement(tag) → {object}
Add a DOM element with an optional CSS class.
Parameters:
Name | Type | Description |
---|---|---|
tag |
string
|
The HTML tag to be created. |
The DOM element.
object
# addElementClasslist(classList)
Helper method for adding classes to an DOM element.
Parameters:
Name | Type | Description |
---|---|---|
classList |
string
|
One ore more class names separated with spaces. |
# build()
Build the DOM element(s) of a customized component.
This method has to be overriden by derived classes.
# countDescendants() → {number}
Count all descendant components.
Descendants are children, grandchildren, and so on.
Number of descendants.
number
# createDomElement(tag) → {object}
Create a DOM element with an optional CSS class.
Parameters:
Name | Type | Description |
---|---|---|
tag |
string
|
The HTML tag to be created. |
The DOM element.
object
# getComponentById(id) → {Component}
Get component by id.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
The id of the component to find. |
The found component or null, if no component has the given id.
# getDomElement(selector) → {HTMLElement}
Retrieve an element from the DOM.
Parameters:
Name | Type | Description |
---|---|---|
selector |
string
|
DOM selector to the element. |
The DOM element or null.
HTMLElement
# getPropertyNames(customPropertyNames) → {array}
Get property names.
Parameters:
Name | Type | Description |
---|---|---|
customPropertyNames |
array
|
An array with the names of a derived class. |
An array with property names or undefined, if no properties exist.
array
# handleMessage(message)
Handles a message send to the component.
Parameters:
Name | Type | Description |
---|---|---|
message |
string
|
The message to be handled. |
# propertiesChanged()
Update component after changes to it.
This method has to be overriden by derived classes.
This method will be called, when properties has been changed.
The component has to reflect the changes in its visual representation.
# setProperties(data)
Set component properties by data.
Parameters:
Name | Type | Description |
---|---|---|
data |
array
|
An array with data in the form of name/value pairs. |