new ActionProperty()
Represents a baja:Action
in BajaScript.
Please note: this represents the Property
's value and NOT theProperty
itself.
Extends
Methods
-
equals(obj)
-
Indicates whether some other object is equal to this one.
Parameters:
Name Type Description obj
Object 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 obj
baja.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
Complex
is created, auto-generated
accessors are created to make accessing a frozenProperty
's value
convenient (see example).Parameters:
Name Type Description prop
baja.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 is
Array.<String> <optional>
An optional array of filters to add to the
agent query.batch
baja.comm.Batch 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])
-
Return a display string.
If a Slot argument is defined, the display name for the Slot will be
returned. If a Slot argument is not defined, the display name for the
Complex will be returned.Note that when an instance of a
Complex
is created, auto-generated
accessors are created to make accessing a frozen Slot's display string
convenient (see example).Parameters:
Name Type Argument Description slot
baja.Slot | String <optional>
the Slot or Slot name.
- Inherited From:
Returns:
display (or null if none available).
- Type
- String
Example
The auto-generated accessor is in the format of
get(first letter is capitalized)SlotNameDisplay()
. If the name of an automatically generated method is already used in theComplex
, a number will be added to the function name.// myPoint has a Property named out... baja.outln("The display string of the out Property: " + myPoint.getOutDisplay());
-
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 slot
baja.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
Facets
for a Slot.If no arguments are provided and the
Complex
has a parent, the
facets for the parent's Property will be returned.Parameters:
Name Type Argument Description slot
baja.Slot | String <optional>
the
Slot
or Slot name.- Inherited From:
Returns:
the
Facets
for theSlot
(or null if Slot not
found) or the parent's Property facets.- Type
- baja.Facets
-
getFlags( [slot])
-
Return
Flags
for a slot or for theComplex
's parent Property.If no arguments are provided and the
Complex
has a parent, the
flags for the parent'sProperty
will be returned.Parameters:
Name Type Argument Description slot
baja.Slot | String <optional>
Slot
or Slot name.- Inherited From:
- See:
Returns:
the flags for the
Slot
or the parent'sProperty
flags.- 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 thisComponent
instance.- 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
-
getPropertyInParent()
-
Return the
Property
in the parent.- Inherited From:
Returns:
the
Property
in 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
Slot
instance instead of the
Slot name String. If aSlot
is passed in, it will simply be checked and
returned.Parameters:
Name Type Description slot
baja.Slot | String the
Slot
or Slot name.- Inherited From:
Returns:
the
Slot
for theComponent
(or null if theSlot
doesn't exist).- Type
- baja.Slot
-
getSlots( [filter])
-
Return a
Cursor
for accessing aComplex
's Slots.Please see module:baja/comp/SlotCursor for useful builder methods.
Parameters:
Name Type Argument Description filter
function <optional>
function to filter out the Slots we're not interested in.
The filter function will be passed eachSlot
to 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
Cursor
for 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
-
getValueOf(prop)
-
Return the result of
valueOf
on the specified Property's value.
IfvalueOf
is not available then theProperty
's value is returned.Parameters:
Name Type Description prop
baja.Property | String the
Property
or Property name.- Inherited From:
- See:
Returns:
the
valueOf
for theProperty
's value or theProperty
's
value (null if theProperty
doesn't exist). -
has(prop)
-
Return true if the
Slot
exists.Parameters:
Name Type Description prop
baja.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 obj
Object <optional>
the object literal for the method's arguments.
Properties
Name Type Argument Description ok
function <optional>
(Deprecated: use Promise) the ok function
callback. Called once network call has succeeded on the Server.fail
function <optional>
(Deprecated: use Promise) the fail function
callback. Called if this method has an error.batch
baja.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
exact
argument is true and thisComplex
is aComponent
then
thedefaultOnClone
andremoveOnClone
flags will be ignored.Parameters:
Name Type Argument Default Description exact
Boolean <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 obj
Object the object literal for the method's arguments.
Properties
Name Type Argument Description slot
baja.Property | String the
Property
or Property name
the value will be set on.value
the value being set (Type must extend
baja:Value
).ok
function <optional>
(Deprecated: use Promise) the ok function
callback. Called once the network call has succeeded on the Server.fail
function <optional>
(Deprecated: use Promise) the fail function
callback. Called if this method has an error.batch
baja.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
String
representation.- 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
- *