new ActionProperty()
Represents a baja:Action in BajaScript.
Please note: this represents the Property's value and NOT the
Property itself.
Extends
Methods
-
equals(obj)
-
Indicates whether some other object is equal to this one.
Parameters:
Name Type Description objObject the reference object with which to compare.
- Inherited From:
Returns:
true if this object is the same as the obj argument; false otherwise.
- Type
- Boolean
-
equivalent(obj)
-
Compare if all of this object's properties are equal to the specified object.
Parameters:
Name Type Description objbaja.Complex - Inherited From:
Returns:
true if this object is equivalent to the specified object.
- Type
- Boolean
-
get(prop)
-
Return a
Property's value.Note that when an instance of a
Complexis created, auto-generated
accessors are created to make accessing a frozenProperty's value
convenient (see example).Parameters:
Name Type Description propbaja.Property | String the Property or Property name.
- Inherited From:
Returns:
the value for the Property (null if the Property doesn't exist).
- Type
- baja.Value
Example
Note that when an instance of a Complex is created, auto-generated setters are created to make setting a frozen Property's value convenient. The auto-generated setter is in the format of
set(first letter is capitalized)SlotName(...).// myPoint has a frozen Property named out... var val = myPoint.getOut(); val = myPoint.get('out'); //equivalent -
getAgents( [is] [, batch])
-
Returns a promise that resolves to the agent list for this Object.
Parameters:
Name Type Argument Description isArray.<String> <optional>
An optional array of filters to add to the
agent query.batchbaja.comm.Batch <optional>
An optional object used to batch network
calls together.- Inherited From:
- See:
Returns:
A promise that will resolve with the Agent Info.
- Type
- Promise
-
getDisplay( [slot] [, cx])
-
Return a display string.
If a Slot argument is defined, the display value for the Slot will be
returned. If a Slot argument is not defined, the display value for the
Complex will be returned.Parameters:
Name Type Argument Description slotbaja.Property | String <optional>
the Slot or Slot name.
cxobject <optional>
as of Niagara 4.10, you can pass a context as the
second argument to use for string formatting. When a context is passed,
a Promise will be returned to be resolved with the formatted string.- Inherited From:
Returns:
display (or null if none available).
Example
Printing display values of slots
// myPoint has a Property named out... baja.outln('The display string of the out Property: ' + myPoint.getDisplay('out')); // or use string formatting: return myPoint.getDisplay('out', { precision: 5 }) .then(function (str) { baja.outln('formatted display string: ' + str); }); -
getDisplayName( [slot])
-
Return a display name.
If a Slot is defined as an argument, the display name for the slot will
be returned. If no Slot is defined, the display name of theComplex
will be returned.Parameters:
Name Type Argument Description slotbaja.Slot | String <optional>
the Slot or Slot name.
- Inherited From:
Returns:
the display name (or null if none available).
- Type
- String
-
getFacets( [slot])
-
Return the
Facetsfor a Slot.If no arguments are provided and the
Complexhas a parent, the
facets for the parent's Property will be returned.Parameters:
Name Type Argument Description slotbaja.Slot | String <optional>
the
Slotor Slot name.- Inherited From:
Returns:
the
Facetsfor theSlot(or null if Slot not
found) or the parent's Property facets.- Type
- baja.Facets
-
getFlags( [slot])
-
Return
Flagsfor a slot or for theComplex's parent Property.If no arguments are provided and the
Complexhas a parent, the
flags for the parent'sPropertywill be returned.Parameters:
Name Type Argument Description slotbaja.Slot | String <optional>
Slotor Slot name.- Inherited From:
- See:
Returns:
the flags for the
Slotor the parent'sPropertyflags.- Type
- Number
-
getIcon()
-
Return the Object's Icon.
- Inherited From:
Returns:
- Type
- baja.Icon
-
getName()
-
Return the name of the
Component.The name is taken from the parent
Component's Property for this
Componentinstance.- Inherited From:
Returns:
name (null if not mounted).
- Type
- String
-
getParamDefault()
-
Return the Action's parameter default value.
Returns:
parameter default value (or null if the Action has no parameter).
- Type
- baja.Value
-
getParamType()
-
Return the Action's parameter Type.
Returns:
parameter type (or null if the Action has no parameter).
- Type
- Type
-
getParent()
-
Return the parent.
- Inherited From:
Returns:
parent
- Type
- baja.Complex
-
getParentComponent()
-
Get the nearest ancestor of this object which is
an instance ofComponent. If this object is itself
aComponent, then returnthis. Return
null if this object doesn't exist under aComponent.- Since:
-
- Niagara 4.10
- Inherited From:
Returns:
- Type
- baja.Component | null
-
getPropertyInParent()
-
Return the
Propertyin the parent.- Inherited From:
Returns:
the
Propertyin the parent (null if not mounted).- Type
- baja.Property
-
getReturnType()
-
Return the Action's return Type.
Returns:
return type (or null if the Action has nothing to return).
- Type
- Type
-
getSlot(slot)
-
Return the
Slot.This is useful method to ensure you have the
Slotinstance instead of the
Slot name String. If aSlotis passed in, it will simply be checked and
returned.Parameters:
Name Type Description slotbaja.Slot | String the
Slotor Slot name.- Inherited From:
Returns:
the
Slotfor theComponent(or null if the
Slotdoesn't exist).- Type
- baja.Slot
-
getSlots( [filter])
-
Return a
Cursorfor accessing aComplex's Slots.Please see module:baja/comp/SlotCursor for useful builder methods.
Parameters:
Name Type Argument Description filterfunction <optional>
function to filter out the Slots we're not interested in.
The filter function will be passed eachSlotto see if it should be
be included. The function must return false to filter out a value and true
to keep it.- Inherited From:
Returns:
a
Cursorfor iterating through theComplex's Slots.Example
// A Cursor for Dynamic Properties var frozenPropCursor = myComp.getSlots().dynamic().properties(); // A Cursor for Frozen Actions var frozenPropCursor = myComp.getSlots().frozen().actions(); // An Array of Control Points var valArray = myComp.getSlots().properties().is("control:ControlPoint").toValueArray(); // An Array of Action Slots var actionArray = myComp.getSlots().actions().toArray(); // An Object Map of slot name/value pairs var map = myComp.getSlots().properties().toMap(); // The very first dynamic Property var firstProp = myComp.getSlots().dynamic().properties().first(); // The very last dynamic Property var lastProp = myComp.getSlots().dynamic().properties().last(); // The very first dynamic Property value var firstVal = myComp.getSlots().dynamic().properties().firstValue(); // The very first dynamic Property value var lastVal = myComp.getSlots().dynamic().properties().lastValue(); // All the Slots that start with the name 'foo' var slotNameCursor = myComp.getSlots().slotName(/^foo/); // Use a custom Cursor to find all of the Slots that have a particular facets key/value var custom = myComp.getSlots(function (slot) { return slot.isProperty() && (this.getFacets(slot).get("myKey", "def") === "foo"); }); // Same as above var custom2 = myComp.getSlots().filter(function (slot) { return slot.isProperty() && (this.getFacets(slot).get("myKey", "def") === "foo"); }); // All Slots marked summary on the Component var summarySlotCursor = myComp.getSlots().flags(baja.Flags.SUMMARY); // Call function for each Property that's a ControlPoint myComp.getSlots().is("control:ControlPoint").each(function (slot) { baja.outln("The Nav ORD for the ControlPoint: " + this.get(slot).getNavOrd(); }); -
getType()
-
Get the type of this instance.
- Inherited From:
Returns:
- Type
- Type
-
getTypeDisplayName( [cx])
-
Gets the friendly type display name for this object.
Parameters:
Name Type Argument Description cxObject <optional>
a context to be passed down to Type
- Since:
-
- Niagara 4.10
- Inherited From:
- See:
-
- baja.Type#getDisplayName
Returns:
If no context is provided, the type
display name is returned synchronously as a string. If context provided,
the type display name is resolved via a promise as a string.- Type
- Promise.<string> | string
-
getValueOf(prop)
-
Return the result of
valueOfon the specified Property's value.
IfvalueOfis not available then theProperty's value is returned.Parameters:
Name Type Description propbaja.Property | String the
Propertyor Property name.- Inherited From:
- See:
Returns:
the
valueOffor theProperty's value or theProperty's
value (null if thePropertydoesn't exist). -
has(prop)
-
Return true if the
Slotexists.Parameters:
Name Type Description propbaja.Property | String the Property or Property name
- Inherited From:
Returns:
- Type
- Boolean
-
loadSlots( [obj])
-
Load all of the Slots on the
Complex.Parameters:
Name Type Argument Description objObject <optional>
the object literal for the method's arguments.
Properties
Name Type Argument Description okfunction <optional>
(Deprecated: use Promise) the ok function
callback. Called once network call has succeeded on the Server.failfunction <optional>
(Deprecated: use Promise) the fail function
callback. Called if this method has an error.batchbaja.comm.Batch <optional>
if defined, any network calls will be
batched into this object.- Inherited From:
- See:
Returns:
a promise to be resolved when the slots have been
loaded.- Type
- Promise
-
newCopy( [exact])
-
Create a clone of this
Complex.If the
exactargument is true and thisComplexis aComponentthen
thedefaultOnCloneandremoveOnCloneflags will be ignored.Parameters:
Name Type Argument Default Description exactBoolean <optional>
false flag to indicate whether to create an exact copy
- Inherited From:
Returns:
cloned Complex.
- Type
- baja.Complex
-
set(obj)
-
Set a
Property's value.If the Complex is mounted, this will asynchronously set the Property's
value on the Server.Parameters:
Name Type Description objObject the object literal for the method's arguments.
Properties
Name Type Argument Description slotbaja.Property | String the
Propertyor Property name
the value will be set on.valuethe value being set (Type must extend
baja:Value).okfunction <optional>
(Deprecated: use Promise) the ok function
callback. Called once the network call has succeeded on the Server.failfunction <optional>
(Deprecated: use Promise) the fail function
callback. Called if this method has an error.batchbaja.comm.Batch <optional>
if defined, any network calls will be
batched into this object.cx<optional>
the Context (used internally by BajaScript).
- Inherited From:
Returns:
a promise that will be resolved once the value has been
set on the Complex. If the complex is mounted, will be resolved once the
value has been saved to the server.- Type
- Promise
Examples
An object literal is used to specify the method's arguments.
myObj.set({ slot: "outsideAirTemp", value: 23.5, batch: myBatch // if defined, any network calls will be batched into this object (optional) }) .then(function () { baja.outln('value has been set on the server'); }) .catch(function (err) { baja.error('value failed to set on the server: ' + err); });Note that when an instance of a Complex is created, auto-generated setters are created to make setting a frozen Property's value convenient. The auto-generated setter is in the format of
set(first letter is capitalized)SlotName(...).// myPoint has a Property named outsideAirTemp... myObj.setOutsideAirTemp(23.5); // ... or via an Object Literal if more arguments are needed... myObj.setOutsideAirTemp({ value: 23.5, batch: myBatch }) .then(function () { baja.outln('value has been set on the server'); }); -
toString()
-
Return the
Stringrepresentation.- Inherited From:
Returns:
- Type
- String
-
valueOf()
-
Return the inner value of the object.
By default the object's instance is returned.
- Inherited From:
Returns:
the inner value of the object or just the object's instance.
- Type
- *