UIBrick
Hierarchy
- VisualBrick
- UIBrick
Index
Constructors
Properties
Methods
Constructors
constructor
Returns UIBrick
Properties
readonlygetProperties
Type declaration
Return the list of properties tags as an ordered array
Returns string[]
staticcontainsRel
Relation between a container (a CloudObject
) that has children (other CloudObject
s)
For example, from a folder to the contained elements or from a function to the elements needed for that function to run.
staticextendRel
Model CloudObjects
can inherit relations and properties
from another CloudObject
model to mimic their behaviour.
Relation from a model to the CloudObject model it extends.
A --extendRel-> B
A inherits B’s properties and relations.
staticextendedByRel
Inverse relation of extendRel
staticinstancesRel
Inverse relation of modelRel between a model and its instances
Equivalent to modelRel.getInverse()
staticmodelRel
Relation between a CloudObject
and its model
instance --modelRel-> model
staticnameProp
Name property for all CloudObjects
staticpropertyRel
Relation between a model and the properties it defines.
Methods
clear
Called every time the context is cleared.
Parameters
$: BrickContext
the brick context
Returns void
destroy
Called when the brick ends its lifecycle and gets destroyed.
Parameters
$: BrickContext
the brick context
Returns void
draw
Called when the DOM Element associated to that brick has been added to the document and is ready to be drawn.
Parameters
$: BrickContext
the brick context
domElement: Element
the associated DOM Element
Returns any
equals
Compare this CloudObject and the given one and return whether they are identical or not.
Parameters
object: any
the object to compare
Returns boolean
true if the specified object is the same CloudObject
follow
Start a query from this instance and follow the relation given as argument. The query starts from this single instance, and follows a relation to an arbitrary number of destination instances. See Query.follow(relation)
The following are equivalent:
myCloudObject.follow(relation);
myCloudObject.query().follow(relation);Type parameters
- D: CloudObject<D>
Parameters
Returns Query<D, never>
query starting from
this
and following the relationrelation
as first step of the query
followSingle
Start a
querySingle
from this instance that follows 0..1 relationsThe query starts from this instance, and follow the relation to a single destination instance. It is equivalent to
QuerySingle.from(this).follow(relation)
.Type parameters
- D: CloudObject<D>
Parameters
Returns QuerySingle<D>
a query following 0-1 relations
get
Get the current value of the specified property for this CloudObject instance
Type parameters
- T
Parameters
property: InstanceOrTag | Property<T>
property or property’s tag
Returns T
property value
getInputs
Return the list of inputs tags as an ordered array.
Returns string[]
getModel
Every
CloudObject
has a model which defines relations and properties its instances may have.Returns CloudObject
the model of this
CloudObject
instance as aCloudObject
instance
getModelTag
Every
CloudObject
has a model which defines relations and properties its instances may have.Returns string
the tag of the model of this
CloudObject
instance
getOutputs
Return the list of outputs tags as an ordered array
Returns string[]
getSource
Return the source id that owns this cloud object.
Returns string
getTag
Every
CloudObject
has a unique tag.Returns string
tag of the CloudObject
init
Called when the brick starts its lifecycle and gets initialized.
Parameters
$: BrickContext
the brick context
Returns void
isPersisted
Return the persistence state of this instance.
CloudObject
s can either be volatile, and only live in the local cache. In this case, theCloudObject
instance is not persisted. If aCloudObject
is persisted, it is stored in an external data store. This means that the instance can be accessible through other Olympe VMs in the same environment.Returns boolean
a boolean indicating if this object is persisted in a non-volatile way.
name
Every
CloudObject
can define a value for itsnameProperty
. This method returns the current value of that property for this instance.Returns string
the value of the
name property
ofthis
observe
Get an observable to the current value of the specified property for this
CloudObject
instance.The observable gets the new value each time the property gets updated in the datacloud. The observable gets completed automatically once the specified context is cleared. If
waitForValue
is set to FALSE (TRUE by default), the first value received by the observable is null if there is no value at call time.Type parameters
- T
Parameters
context: Context
context to which the Observable is attached
property: InstanceOrTag | Property<T>
property or property’s tag to observe
optionalwaitForValue: boolean
whether the observable wait for a first value to get a value. (Default = true)
Returns Observable<T>
Observable of property values
observeProperties
Get an observable to pair [property, value] for this
CloudObject
instance.The observable gets the new value each time any property gets updated in the datacloud. The observable gets completed automatically once the specified context is cleared.
Type parameters
- T
Parameters
context: Context
Context to which the Observable will be attached
Returns Observable<[Property<T>, T]>
Observable of property values
onDestroy
Parameters
$: BrickContext
the brick context
Returns void
onInit
Parameters
$: BrickContext
the brick context
Returns void
onUpdate
Parameters
$: BrickContext
the brick context
inputs: any[]
array of input values
outputs: (value: any) => void[]
array of output setter functions.
Returns void
query
render
Render an element for the given
context
. Can returnnull
if no element is rendered.Parameters
$: BrickContext
the brick context
properties: any[]
property values that have been s
Returns Element
the rendered element
run
Run the brick itself using the specified context.
Parameters
$: BrickContext
the brick context
Returns void
setupExecution
Observe the context to define when the brick
update
method should be called.Parameters
$: BrickContext
the brick context
Returns Observable<any>
an observable that emit a value anytime the brick
update
method should be called.
toJSON
Create a Javascript object from this CloudObject current state, including its tag and property values. It provides the same result as toObject called with nameAsKey = true and inheritedProperties = false.
Returns Object
toObject
Create a Javascript object from this CloudObject current state.
Parameters
optionalnamesAsKey: boolean
If true, use the property name instead of the property tag as keys of the generated object.
optionalinheritedProperties: boolean
If false, do not including inherited property. By default, it includes them.
Returns Object
update
Called whenever the conditions to update the brick are satisfied (as defined by method
configCoreUpdate
). By default, a function updates whenever an input gets a new value, but only if all inputs have a value.Parameters
$: BrickContext
the brick context
inputs: any[]
array of input values
outputs: (any: any) => void[]
array of output setter functions. A setter updates a specific output value of the brick.
Returns void | Promise<void>
updateParent
Attach the
element
rendered byrender()
to itsparent
(in the DOM). Must return the function to clear the parent from that element. That function is called just before the next call to updateParent.If the
render()
method returns null, only the clear function of previous call toupdateParent()
will be called.Parameters
parent: Element
the parent element
element: Element
the element to attach
Returns () => void
the function to clear the element from its parent.
Attach the
element
rendered byrender()
to itsparent
(in the DOM). Must return the function to clear the parent from that element. That function is called just before the next call to updateParent.If the
render()
method returns null, only the clear function of previous call toupdateParent()
will be called.Returns void
the function to clear the element from its parent.
staticasInstance
Get this
CloudObject
class as aCloudObject
instance.Type parameters
- T
Parameters
this: Class<T>
Returns T
the current data type class as a CloudObject instance.
staticcreateWith
Create an instance of the specified data type (or
model
) in the local datacloud (not persisted) with the specified property values.If the model is not specified, it uses
this
DataType.Type parameters
- T
Parameters
this: Class<T>
properties: Map<InstanceOrTag, any>
mappings of (propertyTag -> propertyValue)
optionalmodel: InstanceOrTag
tag of the model of the
CloudObject
you want to create.optionalsource: string
Returns T
newly created
CloudObject
staticexists
Checks whether a
CloudObject
exists or not.Parameters
tag: InstanceOrTag
tag of the
CloudObject
Returns boolean
true
iftag
is valid and references a CloudObject.
staticget
Get the CloudObject whose tag is specified.
This only works if the
CloudObject
is already present in the local datacloud cache. (NB: you can use a Query to retrieve a distant CloudObject)Type parameters
- T: CloudObject<T>
Parameters
tag: InstanceOrTag
tag of the
CloudObject
Returns T
CloudObject
specified by the tag
staticgetProperties
The attributes of a CloudObject are called properties. Properties can be of different types, e.g.
Property<string>
,Property<number>
,Property<Date>
.If a
Person
CloudObject
has anage
property, all the instances ofPerson
can access theage
property using the same tag, the tag of theage
property. This method returns all properties defined by the Data Type associated to this class.Returns Property<any>[]
All properties defined for a data type
staticgetRelations
Return all the relations whose origin OR destination is the CloudObject associated to this class.
Type parameters
- O: CloudObject<O>
- D: CloudObject<D>
Parameters
this: Class<O>
Returns (Relation<O, D> | Relation<D, O>)[]
All relations defined on the current data type. It can be the destination or the origin of the relations.
staticinstancesOf
Return a query starting from all instances of this Data Type.
Type parameters
- T: CloudObject<T>
Parameters
model: InstanceOrTag | Class<T>
data type to get instances of
Returns Query<T, never>
A query starting from the instances of the specified model.
use VisualBrick instead