BAObjectHandler
The BaObjectHandler takes over the management of the BaObject.
Use
The implementation is done via the respective interfaces.
IUsesBaObject
Provision of the BaObjectHandler.
Requires:
- TcHmiBaFramework
module MyNamespace {
export class MyClass<A extends MyClass.IAttributes = MyClass.IAttributes> extends TcHmi.BuildingAutomation.Base implements TcHmi.BuildingAutomation.BaObjectHandler.IUsesBaObject {
public baObjectHandler: TcHmi.BuildingAutomation.BaObjectHandler;
constructor(id: string, parent: TcHmi.BuildingAutomation.IBaseNode | null, attr?: A) {
super(id, parent, attr);
this.baObjectHandler = new TcHmi.BuildingAutomation.BaObjectHandler(this);
}
public processBaObject() {
if (this.baObjectHandler.baObject == null) return;
// do work
}
}
export module MyClass {
export interface IAttributes extends TcHmi.BuildingAutomation.Base.IAttributes {
// optional additional attributes
}
}
}
IFCUsesBaObject
Providing the BaObjectHandler with BaObject attribute for the TcHmi Designer.
Requires:
- TcHmiBaFramework
- TcHmiBaControls
module MyNamespace {
export class MyControl extends TcHmi.BuildingAutomation.Controls.System.BaseControl implements TcHmi.BuildingAutomation.BaObjectHandler.IFCUsesBaObject {
public baObjectHandler: TcHmi.BuildingAutomation.BaObjectHandler;
constructor(element: JQuery, pcElement: JQuery, attrs: TcHmi.Controls.ControlAttributeList) {
super(element, pcElement, attrs);
this.baObjectHandler = new TcHmi.BuildingAutomation.BaObjectHandler(this);
}
public processBaObject() {
if (this.baObjectHandler.baObject == null) return;
// do work
}
public setBaObject(p: TcHmi.BuildingAutomation.BA.BaBasicObject | TcHmi.BuildingAutomation.BA.BaBasicObject.IBaBasicObjectAttributes | TcHmi.Symbol | null | undefined): this {
this.baObjectHandler.setBaObject(p);
return this;
}
public getBaObject() {
return this.baObjectHandler.baObject;
}
}
}
In the interface IFCUsesBaObject the setters and getters for the BaObject are already defined, so in the Description.json only the BaObject attribute has to be defined.
"attributes": [
{
"name": "data-tchmi-ba-object",
"displayName": "BaObject",
"propertyName": "BaObject",
"propertySetterName": "setBaObject",
"propertyGetterName": "getBaObject",
"visible": true,
"themeable": "None",
"type": "tchmi:framework#/definitions/Symbol",
"category": "BA",
"description": "BA object of the control.",
"requiredOnCompile": false,
"readOnly": false,
"bindable": true,
"heritable": true,
"defaultValue": null,
"defaultValueInternal": null
}
]
Properties
Name | Description |
---|---|
loadChildren | Determines whether all child elements are loaded when setting the BaObject (as BaView). |
loadTexts | Determines whether all texts are loaded when setting the BaObject (as BaView). |
enableParentBaObjectProcessor | Determines whether the BaObject processor of the parent control is called. |
baObject | Returns the BaObject. |
baObjectSymbolExpression | Returns the SymbolExpression from the BaObject. |
isLoadingBaObject | Checks if the BaObject is set but still loading. |
Methods
Name | Description |
---|---|
setBaObject | Sets the BaObject. |
resolveBaObject | Resolves the passed information to create a BaObject. |
readBaObject | Reads the BaObject from the server. |
watchBaVariable | Adds a watch to the passed BaVariable. The Watch is also destroyed when the class is destroyed. |
tryWatchBaVariable | Attempts to monitor a BaVariable. |
tryWatchChildrenBaVariable | Attempts to monitor a BaVariable of a child element of a BaView. |
watchValueRange | Monitors the value range of a specific variable. |
checkBaObjectAccess | Checks the OperationType and the write access of the BaVariable ValueRm. |