virtualnew Widget()
Constructor: Generates the ID and initializes the
Widget with attributes, callbacks and subscriber
that are specified in the provided functions.
Requires
- module:easejs
- module:MathUuid
- module:Callback
- module:CallbackList
- module:AttributeType
- module:AttributeValue
- module:AttributeTypeList
- module:AttributeValueList
- module:ConditionList
- module:Subscriber
- module:SubscriberList
- module:WidgetDescription
- module:Discoverer
Members
-
protectedattributesAttributeValueList
-
All available Attributes and their values.
-
protectedattributeTypesAttributeTypeList
-
Types of all available attributes.
-
protectedcallbacksCallbackList
-
List of Callbacks.
-
protectedconstantAttributesAttributeValueList
-
All available constant Attributes and their values.
-
protectedconstantAttributeTypesAttributeTypeList
-
Types of all available ConstantAttributes.
-
protecteddiscovererDiscoverer
-
Associated discoverer.
-
idstring
-
ID of the Widget. Will be generated.
-
namestring
-
Name of the Widget.
-
protectedoldAttributesAttributeValueList
-
This temporary variable is used for storing the old attribute values. So these can be used to check conditions.
-
protectedsubscribersSubscriberList
-
List of Subscriber.
Methods
-
addAttribute(_attribute)
-
Adds a new AttributeValue. If the given value is not included in the list, the associated type will be also added. Otherwise, only the value will be updated.
Name Type Description _attribute
AttributeValue AttributeValue -
protectedaddCallback(_callback)
-
Adds a new Callback.
Name Type Description _callback
Callback List or Array of AttributeValues. -
protectedaddConstantAttribute(_constantAttribute)
-
Adds a new constantAttributeValue. If the given value is not included in the list, the associated type will be also added. Otherwise, only the value will be updated.
Name Type Description _constantAttribute
AttributeValue AttributeValue -
addSubscriber(_subscriber)
-
Adds a new Subscriber.
Name Type Description _subscriber
Subscriber Subscriber -
virtualdidFinishInitialization(_attributeTypes)
-
Method will be invoked after the initialization of the widget finished. Can be overridden by inheriting classes to take action after initialization.
Name Type Description _attributeTypes
-
getAttributes(_attributeTypeList){AttributeValueList}
-
Returns the last acquired attribute values.
Name Type Description _attributeTypeList
AttributeTypeList -
getAttributeTypes(){AttributeTypeList}
-
Returns the available AttributeTypes.
-
getCallbacks(){CallbackList}
-
Returns a list of callbacks that can be subscribed to.
-
getCallbacks(){Array}
-
Returns the specified callbacks that can be subscribed to.
-
getConstantAttributes(){AttributeValueList}
-
Returns the ConstantAttributes.
-
virtualgetDescription(){WidgetDescription}
-
Returns the description of this component.
-
getId(){string}
-
Returns the id of the widget.
-
getName(){string}
-
Returns the name of the widget.
-
getSubscriber(){SubscriberList}
-
Returns the Subscriber.
-
virtualgetType(){string}
-
Returns the type of this class, in this case "Widget".
-
getWidgetConstantAttributeTypes(){AttributeTypeList}
-
Returns the available ConstantAttributeTypes (attributes that do not change).
-
protectedinit()
-
Function for initializing. Calls all initFunctions and will be called by the constructor.
-
virtual,protectedinitAttributes()
-
Initializes the provided Attributes.
-
virtual,protectedinitCallbacks()
-
Initializes the provided Callbacks.
-
virtualinitCallbacks()
-
Notifies other components and sends the attributes.
-
virtual,protectedinitConstantAttributes()
-
Initializes the provided ConstantAttributes.
-
virtual,protectedintervalRunning(_interval)
-
Runs the context acquisition constantly in an interval. Can be called by init.
Name Type Description _interval
integer Interval in ms -
protectedisAttribute(_attribute){boolean}
-
Verifies whether the specified attributes is a provided Attribute.
Name Type Description _attribute
AttributeValue -
virtualputData(_data)
-
Updates the Attributes by external components.
Name Type Description _data
AttributeValueList | Array Data that should be entered. -
virtualqueryGenerator(_function)
-
Queries the associated sensor and updates the attributes with new values. Must be overridden by the subclasses. Overriding subclasses can call this.__super(_function) to invoke the provided callback function.
Name Type Description _function
function nullable For alternative actions, because an asynchronous function can be used. -
queryWidget(){AttributeValueList}
-
Returns all available AttributeValues, Attributes and ConstantAtrributes.
-
register()
-
Registers the component to the associated Discoverer.
-
removeSubscriber(_subscriber)
-
Removes the specified Subscriber.
Name Type Description _subscriber
Subscriber Subscriber -
protectedsendToSubscriber(_callbackName)
-
Sends all Attributes, specified in the given callback, to components which are subscribed to this Callback.
Name Type Description _callbackName
string Name of the searched Callback. -
protectedsetAttributes(_attributes)
-
Sets the AttributeValueList and also the associated AttributeTypes.
Name Type Description _attributes
AttributeValueList | Array List or Array of AttributeValues -
protectedsetCallbacks(_callbacks)
-
Sets Callbacks.
Name Type Description _callbacks
CallbackList | Array List or Array of Callbacks. -
protectedsetConstantAttributes(_constantAttributes)
-
Sets the ConstantAttributeValueList and also the associated AttributeTypes.
Name Type Description _constantAttributes
AttributeValueList | Array List or Array of AttributeValues -
setDiscoverer(_discoverer)
-
Sets the associated Discoverer and registers to that.
Name Type Description _discoverer
Discoverer Discoverer -
protectedsetId(_id)
-
Sets the id of the Widget.
Name Type Description _id
string Id of the Widget. -
protectedsetName(_name)
-
Sets the name of the Widget.
Name Type Description _name
string Name of the Widget. -
protectedsetSubscriber(_subscriber)
-
Sets SubscriberList.
Name Type Description _subscriber
SubscriberList | Array List or Array of Subscriber. -
updateAndQueryWidget(_function){AttributeValueList}
-
Updates and returns all available AttributeValues, Attributes and ConstantAtrributes.
Name Type Description _function
function nullable For alternative actions, because an asynchronous function can be used. -
updateWidgetInformation(_function)
-
Updates the attributes by calling queryGenerator.
Name Type Description _function
function nullable For alternative actions, because an asynchronous function can be used.