List
pentaho.type. List
The base class of plural values.
A list is an ordered set of elements
of a common, base type
.
AMD Module
require(["pentaho/type/List"], function(List) { /* code goes here */ });
See also: pentaho.type.Element , pentaho.type.spec.IList , pentaho.type.spec.IListType
Extends
Constructor
Name | Description |
---|---|
new List(instSpec, keyArgs) | Creates a list instance. |
Members
Name | Description |
---|---|
$changeset : | Gets the changeset of this instance in the ambient transaction, if any, or |
$hasChanges : | Gets a value that indicates if this instance has any changes in the ambient transaction. |
$isBoundary : | Gets a value that indicates if this list is a boundary list. |
$isReadOnly : | Gets a value that indicates if this list is read-only. |
$isValid : | Determines if this value is a valid. |
$key : | Gets the key of the list value. |
$references : | Gets the references to this container, or |
$type : | Gets the type of this instance. |
$uid : | Gets the unique identifier of the instance. |
$version : | Gets the current version of the instance. |
base : Protected | If a method has been overridden, then the base method provides access to the overridden method. |
count : | Gets the number of elements in the list. |
Methods
Name | Description |
---|---|
_configure(config) Protected | Configures this value with a given distinct and non- |
_createChangeset(transaction) : pentaho.type.changes.Changeset Protected | Creates a changeset with this container as owner and returns it. |
_emit(event) : pentaho.lang.Event Protected | Emits an unstructured event and returns it, unless it was canceled. |
_emitGeneric(source, eventArgs, type, phase, keyArgs) : boolean Protected | Emits an event given an arbitrary payload object, its type and phase. Returns the event payload object, unless the event is canceled. |
_emitGenericAllAsync(source, eventArgs, type, phase, keyArgs) : Promise.< Protected | Emits an event asynchronously, given an arbitrary payload object, its type and phase, and succeeding if every listener succeeds. |
_emitSafe(event) : pentaho.lang.Event Protected | Variation of the |
_equals(other) : boolean Protected | Gets a value that indicates if a given distinct, non-null value of the same type represents the same entity. |
_hasListeners(type, phase) : boolean Protected | Determines if there are any registrations for a given event type and, optionally, phase. |
_initClone(clone) Protected | Initializes a shallow clone of this container. |
_initContainer() Protected | Initializes a container instance. |
_onChangeDid(changeset) Protected | Called after a changeset has been committed. |
_onChangeRejected(changeset, reason) Protected | Called after a changeset has been rejected. |
_onChangeWill(changeset, keyArgs) : pentaho.lang.UserError Protected | Called before a changeset is committed. |
add(fragment) | Adds one or more elements to the end of the list. |
assertValid() | Ensures that the value is valid, and throws the first validation error if it is not. |
at(index) : pentaho.type.Element | Gets the element at a specified index, or |
clear() | Removes all elements from the list. |
clone() : pentaho.type.Value Abstract | Creates a shallow clone of this value. |
configure(config) | Configures this value with a given configuration. |
each(fun, ctx) | Calls a function for each element of the list. |
equals(other) : boolean | Determines if a given value represents the same entity. |
equalsContent(other) : boolean | Gets a value that indicates if a given equal value has the same content as this one. |
extend(source, keyArgs) : Object | Extend an object with the properties of another. |
get(key) : pentaho.type.Element | Gets the element having a specified key value, if any, or |
has(key) : boolean | Gets a value that indicates if an element with a given key is present in the list. |
includes(elem) : boolean | Gets a value that indicates if a given element is present in the list. |
indexOf(elem) : number | Gets the index of a given element in the list. |
insert(fragment, index) | Inserts one or more elements, starting at the given index. |
move(elemSpec, indexNew) | Moves an element to a new position. |
off(typeOrHandle, observer) | Removes one registration given its handle, or all registrations of a given event type (or types) and observer (or listener function). |
on(type, observer, keyArgs) : pentaho.lang.IEventRegistrationHandle | Registers an observer (or listener function) for an event(s) of a given type(s). |
remove(fragment) | Removes one or more elements from the list. |
removeAt(start, count) | Removes one or more elements from the list, given the start index and the number of elements to remove. |
set(fragment, keyArgs) | Adds, removes, moves and/or updates elements to the element list. |
sort(comparer) | Sorts the elements of the list using the given comparer function. |
toArray(map, ctx) : Array.< | Creates an array with the elements of the list or values derived from each element. |
toJSON() : JsonValue | Creates a top-level JSON specification that describes this instance. |
toSpec(keyArgs) : pentaho.type.spec.Instance | Creates a specification that describes this value. |
toSpecInContext(keyArgs) : any | Creates a specification that describes this instance. |
validate() : Array.< | Determines if this value is valid. |
Constructor Details
new List(instSpec, keyArgs) | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Creates a list instance. When a derived class overrides the constructor and creates additional instance properties, the Source: javascript/web/pentaho/type/List.js, line 82
See also: pentaho.type.Element , pentaho.type.spec.IList , pentaho.type.spec.IListType |
Members Details
$changeset: |
---|
Gets the changeset of this instance in the ambient transaction, if any, or Source: javascript/web/pentaho/type/mixins/Container.js, line 194 Inherited From: pentaho.type.mixins.Container#$changeset |
$hasChanges: |
---|
Gets a value that indicates if this instance has any changes in the ambient transaction. Source: javascript/web/pentaho/type/mixins/Container.js, line 204 Inherited From: pentaho.type.mixins.Container#$hasChanges |
$isBoundary: |
---|
Gets a value that indicates if this list is a boundary list. A boundary list isolates the list holder from the list's elements. The validity of a boundary list is not affected by the validity of its elements. Changes within the elements of boundary list do not bubble to it. |
$isReadOnly: |
---|
Gets a value that indicates if this list is read-only. |
$isValid: |
---|
Determines if this value is a valid. This attribute calls Source: javascript/web/pentaho/type/Value.js, line 168 Inherited From: pentaho.type.Value#$isValid |
$key: |
---|
Gets the key of the list value. The default list implementation, returns the value of the list instance's Source: javascript/web/pentaho/type/List.js, line 232 Overrides: pentaho.type.Value#$key |
$references: |
---|
Gets the references to this container, or Note that the returned array may be empty. Do NOT change the returned array or its elements in any way. Source: javascript/web/pentaho/type/mixins/Container.js, line 137 Inherited From: pentaho.type.mixins.Container#$references |
$type: |
---|
Gets the type of this instance. Source: javascript/web/pentaho/type/Value.js, line 334 Overrides: pentaho.type.Value#$type |
$uid: |
---|
Gets the unique identifier of the instance. Source: javascript/web/pentaho/type/mixins/Container.js, line 56 Inherited From: pentaho.type.mixins.Container#$uid |
$version: |
---|
Gets the current version of the instance. Source: javascript/web/pentaho/type/mixins/Container.js, line 168 Inherited From: pentaho.type.mixins.Container#$version |
base: Protected |
---|
If a method has been overridden, then the base method provides access to the overridden method. Can also be called from within a constructor function. Source: javascript/web/pentaho/lang/Base.js, line 299 Inherited From: pentaho.lang.Base#base |
count: |
---|
Gets the number of elements in the list. |
Methods Details
_configure(config) Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Configures this value with a given distinct and non- This method can only be called when there is an ambient transaction. The default implementation throws an error if this value's type is Source: javascript/web/pentaho/type/Value.js, line 264 Overrides: pentaho.type.Value#_configure
See also: pentaho.type.Value#configure , pentaho.type.Complex#_configure , pentaho.type.List#_configure |
_createChangeset(transaction) : pentaho.type.changes.Changeset Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Creates a changeset with this container as owner and returns it. Source: javascript/web/pentaho/type/mixins/Container.js, line 229 Overrides: pentaho.type.mixins.Container#_createChangeset
|
_emit(event) : pentaho.lang.Event Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Emits an unstructured event and returns it, unless it was canceled. When this method is called, the listeners of existing registrations are notified synchronously, by priority order and then registration order, until either the event is canceled or all of the listeners have been notified. It is safe to register or unregister to/from an event type while it is being emitted. However, changes are only taken into account in subsequent emissions. If a listener function throws an error, the event processing is interrupted. No more registrations are processed and the error is passed to the caller. Source: javascript/web/pentaho/lang/EventSource.js, line 269 Inherited From: pentaho.lang.EventSource#_emit
See also: pentaho.lang.EventSource#_emitSafe , pentaho.lang.EventSource#_emitGeneric |
_emitGeneric(source, eventArgs, type, phase, keyArgs) : boolean Protected | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Emits an event given an arbitrary payload object, its type and phase. Returns the event payload object, unless the event is canceled. Source: javascript/web/pentaho/lang/EventSource.js, line 325 Inherited From: pentaho.lang.EventSource#_emitGeneric
|
_emitGenericAllAsync(source, eventArgs, type, phase, keyArgs) : Promise.< Protected | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Emits an event asynchronously, given an arbitrary payload object, its type and phase, and succeeding if every listener succeeds. Listeners are called in parallel. Returns a promise that is fulfilled or rejected with the event payload object. If any listener throws or rejects, the returned promise is rejected as well. Source: javascript/web/pentaho/lang/EventSource.js, line 454 Inherited From: pentaho.lang.EventSource#_emitGenericAllAsync
|
_emitSafe(event) : pentaho.lang.Event Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Variation of the If an event listener throws an error, the following event listeners are still processed. Source: javascript/web/pentaho/lang/EventSource.js, line 291 Inherited From: pentaho.lang.EventSource#_emitSafe
See also: pentaho.lang.EventSource#_emit , pentaho.lang.EventSource#_emitGeneric |
_equals(other) : boolean Protected | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets a value that indicates if a given distinct, non-null value of the same type represents the same entity. The default implementation considers two values equal if they have the equal keys. Source: javascript/web/pentaho/type/Value.js, line 135 Inherited From: pentaho.type.Value#_equals
See also: pentaho.type.Value#equals , pentaho.type.Value#$key |
_hasListeners(type, phase) : boolean Protected | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Determines if there are any registrations for a given event type and, optionally, phase. This method can be used to avoid creating expensive event objects for an event type and, optionally, phase, that don't have registrations. Source: javascript/web/pentaho/lang/EventSource.js, line 218 Inherited From: pentaho.lang.EventSource#_hasListeners
Examples if(this._hasListeners("click")) { var event = new Event("click", this, true); if(this._emit(event)) { // ... } } if(this._hasListeners("select")) { var event = new Event("select"); if(this._emitGeneric(this, [event], "select", "will")) { // Select ... this._emitGeneric(this, [event], "select", "finally"); } } |
_initClone(clone) Protected | ||||||
---|---|---|---|---|---|---|
Initializes a shallow clone of this container. The default implementation calls Source: javascript/web/pentaho/type/mixins/Container.js, line 121 Overrides: pentaho.type.mixins.Container#_initClone
|
_initContainer() Protected |
---|
Initializes a container instance. Source: javascript/web/pentaho/type/mixins/Container.js, line 55 Inherited From: pentaho.type.mixins.Container#_initContainer |
_onChangeDid(changeset) Protected | ||||||
---|---|---|---|---|---|---|
Called after a changeset has been committed. The default implementation emits the "did:change" event for the given changeset, if there are any listeners. When overriding, be sure to call the base implementation. Source: javascript/web/pentaho/type/mixins/Container.js, line 300 Inherited From: pentaho.type.mixins.Container#_onChangeDid
|
_onChangeRejected(changeset, reason) Protected | |||||||||
---|---|---|---|---|---|---|---|---|---|
Called after a changeset has been rejected. The default implementation emits the "rejected:change" event for the given changeset, if there are any listeners. When overriding, be sure to call the base implementation. Source: javascript/web/pentaho/type/mixins/Container.js, line 321 Inherited From: pentaho.type.mixins.Container#_onChangeRejected
|
_onChangeWill(changeset, keyArgs) : pentaho.lang.UserError Protected | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Called before a changeset is committed. The default implementation emits the "will:change" event for the given changeset, if there are any listeners. When overriding, be sure to call the base implementation. Source: javascript/web/pentaho/type/mixins/Container.js, line 262 Inherited From: pentaho.type.mixins.Container#_onChangeWill
|
add(fragment) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Adds one or more elements to the end of the list. The element or elements specified in argument Source: javascript/web/pentaho/type/List.js, line 348
|
assertValid() | ||||
---|---|---|---|---|
Ensures that the value is valid, and throws the first validation error if it is not. This method calls the Source: javascript/web/pentaho/type/Value.js, line 202 Inherited From: pentaho.type.Value#assertValid
|
at(index) : pentaho.type.Element | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets the element at a specified index, or Source: javascript/web/pentaho/type/List.js, line 252
|
clear() | ||||
---|---|---|---|---|
Removes all elements from the list. Source: javascript/web/pentaho/type/List.js, line 443
|
clone() : pentaho.type.Value Abstract | ||||
---|---|---|---|---|
Creates a shallow clone of this value. Source: javascript/web/pentaho/type/Value.js, line 93 Overrides: pentaho.type.mixins.Container#clone
|
configure(config) | ||
---|---|---|
Configures this value with a given configuration. This method ensures a transaction exists and then delegates to For more information on the semantics of configuration, see Source: javascript/web/pentaho/type/Value.js, line 232 Inherited From: pentaho.type.Value#configure |
Name | Default Value | Summary |
---|---|---|
config : any | The value configuration. |
Name | Description |
---|---|
TypeError | When the value would be changed and its type is |
See also: pentaho.type.Element#configureOrCreate , pentaho.type.Complex#_configure , pentaho.type.List#_configure
each(fun, ctx) | |||||||||
---|---|---|---|---|---|---|---|---|---|
Calls a function for each element of the list. Source: javascript/web/pentaho/type/List.js, line 471
|
equals(other) : boolean | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Determines if a given value represents the same entity. This method checks if the given value is identical to this one. Otherwise, if not Source: javascript/web/pentaho/type/Value.js, line 116 Inherited From: pentaho.type.Value#equals
See also: pentaho.type.Value#_equals |
equalsContent(other) : boolean | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets a value that indicates if a given equal value has the same content as this one. This method must only be called if the The default implementation returns Source: javascript/web/pentaho/type/Value.js, line 152 Inherited From: pentaho.type.Value#equalsContent
See also: pentaho.type.Value#equals |
extend(source, keyArgs) : Object | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Extend an object with the properties of another. Methods that are overridden are accessible through This object is extended, but its class doesn't change. Source: javascript/web/pentaho/lang/Base.js, line 1037 Inherited From: pentaho.lang.Base#extend
|
get(key) : pentaho.type.Element | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets the element having a specified key value, if any, or Source: javascript/web/pentaho/type/List.js, line 299
|
has(key) : boolean | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets a value that indicates if an element with a given key is present in the list. Source: javascript/web/pentaho/type/List.js, line 264
|
includes(elem) : boolean | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets a value that indicates if a given element is present in the list. Source: javascript/web/pentaho/type/List.js, line 277
|
indexOf(elem) : number | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets the index of a given element in the list. Source: javascript/web/pentaho/type/List.js, line 288
|
insert(fragment, index) | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Inserts one or more elements, starting at the given index. If When the index is greater than or equal to the length of the list, the element or elements are appended to the list. Source: javascript/web/pentaho/type/List.js, line 366
|
move(elemSpec, indexNew) | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Moves an element to a new position. Source: javascript/web/pentaho/type/List.js, line 395
|
off(typeOrHandle, observer) | ||
---|---|---|
Removes one registration given its handle, or all registrations of a given event type (or types) and observer (or listener function). To remove an event registration, it is sufficient to call the It is safe to unregister from an event type while it is being emitted. However, any registrations removed during the current emission will still execute. Specifying an event registration handle that has already been disposed of has no effect. Specifying an event type and observer (or listener function) that have no registrations has no effect. Source: doc-js/pentaho/lang/IEventSource.jsdoc, line 131 Inherited From: pentaho.lang.EventSource#off |
Name | Default Value | Summary |
---|---|---|
typeOrHandle : nonEmptyString | Array.< | pentaho.lang.IEventRegistrationHandle | The type or types of events, or an event registration handle to dispose of. When a string, it can be a comma-separated list of event types. | |
observer : pentaho.lang.IEventObserver | pentaho.lang.EventListener | pentaho.lang.EventListenerAsync | The event observer (or listener function). Required when |
See also: pentaho.lang.IEventSource#on
on(type, observer, keyArgs) : pentaho.lang.IEventRegistrationHandle | ||||||||
---|---|---|---|---|---|---|---|---|
Registers an observer (or listener function) for an event(s) of a given type(s). Optionally, a listening priority may be specified to adjust the order by which an observer is notified, relative to other listeners. Note that if an observer is registered more than once to the same event type, a new registration is created each time and its listeners will be called once per registration. It is safe to register for an event type while it is being emitted. However, new registrations are only taken into account in subsequent emissions. When This method is compatible with the dojo/on API. Source: doc-js/pentaho/lang/IEventSource.jsdoc, line 90 Inherited From: pentaho.lang.EventSource#on |
Name | Default Value | Summary | ||||||
---|---|---|---|---|---|---|---|---|
type : nonEmptyString | Array.< | The type or types of events. When a string, it can be a comma-separated list of event types. | |||||||
observer : pentaho.lang.IEventObserver | pentaho.lang.EventListener | pentaho.lang.EventListenerAsync | The event observer (or listener function). | |||||||
keyArgs : object Optional | Keyword arguments.
|
Name | Description |
---|---|
pentaho.lang.IEventRegistrationHandle | An event registration handle that can be used for later removal. |
See also: pentaho.lang.IEventSource#off
remove(fragment) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Removes one or more elements from the list. Specified elements that are not present in the list are ignored. Source: javascript/web/pentaho/type/List.js, line 380
|
removeAt(start, count) | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Removes one or more elements from the list, given the start index and the number of elements to remove. If Source: javascript/web/pentaho/type/List.js, line 417
|
set(fragment, keyArgs) | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Adds, removes, moves and/or updates elements to the element list. The element or elements specified in argument Source: javascript/web/pentaho/type/List.js, line 327
|
sort(comparer) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Sorts the elements of the list using the given comparer function. Source: javascript/web/pentaho/type/List.js, line 431
|
toArray(map, ctx) : Array.< | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Creates an array with the elements of the list or values derived from each element. Source: javascript/web/pentaho/type/List.js, line 458
|
toJSON() : JsonValue | ||||
---|---|---|---|---|
Creates a top-level JSON specification that describes this instance. Attributes which do not have a JSON-compatible specification are omitted. Specifically, for inline types, attributes with a function value are not supported. This method simply calls Source: javascript/web/pentaho/type/Instance.js, line 197 Inherited From: pentaho.type.Instance#toJSON
See also: pentaho.type.Instance#toSpec |
toSpec(keyArgs) : pentaho.type.spec.Instance | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Creates a specification that describes this value. If an Source: javascript/web/pentaho/type/Value.js, line 272 Inherited From: pentaho.type.Value#toSpec |
Name | Default Value | Summary | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keyArgs : Object Optional | The keyword arguments object. Passed to every value and type serialized within this scope. Please see the documentation of value subclasses for information on additional, supported keyword arguments.
|
Name | Description |
---|---|
pentaho.type.spec.Instance | A specification of this value. |
toSpecInContext(keyArgs) : any | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Creates a specification that describes this instance. Source: javascript/web/pentaho/type/Instance.js, line 177 Overrides: pentaho.type.Value#toSpecInContext
See also: pentaho.type.Instance#toSpec |
validate() : Array.< | ||||
---|---|---|---|---|
Determines if this value is valid. The default implementation does nothing and considers the instance valid. Override to implement a type's specific validation logic. You can use the error utilities in Source: javascript/web/pentaho/type/Value.js, line 187 Overrides: pentaho.type.Value#validate
See also: pentaho.type.Value#$isValid |