Skip to main content
Hitachi Vantara Lumada and Pentaho Documentation

Container

pentaho.type.mixins.Container

A mixin class that contains functionality shared by the instance container classes: Complex and List.

Extends

Constructor

Name Description
new Container()

This class was not designed to be constructed directly. It was designed to be used as a mixin.

Members

Name Description
$changeset : pentaho.type.changes.Changeset

Gets the changeset of this instance in the ambient transaction, if any, or null.

$hasChanges : boolean

Gets a value that indicates if this instance has any changes in the ambient transaction.

$references : Array.<Object>

Gets the references to this container, or null, if none.

$uid : string

Gets the unique identifier of the instance.

$version : number

Gets the current version of the instance.

base : function
 
Protected

If a method has been overridden, then the base method provides access to the overridden method.

Methods

Name Description
_createChangeset(transaction) : pentaho.type.changes.Changeset
 
Abstract
 
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(event, type, phase, keyArgs) : object
 
Protected

Emits an event given an arbitrary payload object, its type and phase. Returns the event payload object, unless the event is canceled.

_emitSafe(event) : pentaho.lang.Event
 
Protected

Variation of the _emit method in which errors thrown by event listeners are caught and logged.

_hasListeners(type, phase) : boolean
 
Protected

Determines if there are any registrations for a given event type and phase.

_hasObservers(type) : boolean
 
Protected

Determines if there are any registrations for a given event type, for at least one of its phases.

_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) : pentaho.lang.UserError | undefined
 
Protected

Called before a changeset is committed.

clone() : pentaho.type.mixins.Container

Creates a shallow clone of this container.

extend(source, keyArgs) : Object

Extend an object with the properties of another.

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).

Constructor Details

new Container()

This class was not designed to be constructed directly. It was designed to be used as a mixin.

Source: javascript/web/pentaho/type/mixins/Container.js, line 35

Members Details

$changeset: pentaho.type.changes.Changeset

Gets the changeset of this instance in the ambient transaction, if any, or null.

Source: javascript/web/pentaho/type/mixins/Container.js, line 203

$hasChanges: boolean

Gets a value that indicates if this instance has any changes in the ambient transaction.

Source: javascript/web/pentaho/type/mixins/Container.js, line 213

$references: Array.<Object>

Gets the references to this container, or null, if none.

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 145

$uid: string

Gets the unique identifier of the instance.

Source: javascript/web/pentaho/type/mixins/Container.js, line 129

$version: number

Gets the current version of the instance.

Source: javascript/web/pentaho/type/mixins/Container.js, line 177

base: function
 
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

Methods Details

_createChangeset(transaction) : pentaho.type.changes.Changeset
 
Abstract
 
Protected

Creates a changeset with this container as owner and returns it.

Source: javascript/web/pentaho/type/mixins/Container.js, line 238

Parameters:
Name Default Value Summary
transaction : pentaho.type.changes.Transaction

The transaction that owns this changeset.

Returns:
Name Description
pentaho.type.changes.Changeset

A changeset of the appropriate type.

_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 261

Inherited From: pentaho.lang.EventSource#_emit

Parameters:
Name Default Value Summary
event : pentaho.lang.Event

The event object.

Returns:
Name Description
pentaho.lang.Event | null

The given event object or null, when canceled.

See also:  pentaho.lang.EventSource#_emitSafe , pentaho.lang.EventSource#_emitGeneric

_emitGeneric(event, type, phase, keyArgs) : object
 
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 313

Inherited From: pentaho.lang.EventSource#_emitGeneric

Parameters:
Name Default Value Summary
event : object

The event object.

type : nonEmptyString

The type of the event.

phase : nonEmptyString
 
Optional

The phase of the event. For unstructured events don't specify this argument (or specify a Nully value).

keyArgs : Object
 
Optional

The keyword arguments' object.

Parameters:
Name Default Value Summary
isCanceled : function
 
Optional

A predicate that indicates if a given event object is in a canceled state.

errorHandler : function
 
Optional

When specified with a null value, no error handling is performed and errors thrown by listeners are thrown back to this method's caller. When unspecified or specified as undefined, defaults to a function that simply log the listener errors, and let execution continue to following listeners. The function arguments are: the error, the event, the event type and the event phase.

Returns:
Name Description
object | null

The event payload object or null, when the event is canceled.

_emitSafe(event) : pentaho.lang.Event
 
Protected

Variation of the _emit method in which errors thrown by event listeners are caught and logged.

If an event listener throws an error, the following event listeners are still processed.

Source: javascript/web/pentaho/lang/EventSource.js, line 283

Inherited From: pentaho.lang.EventSource#_emitSafe

Parameters:
Name Default Value Summary
event : pentaho.lang.Event

The event object.

Returns:
Name Description
pentaho.lang.Event | null

The given event object or null, when canceled.

See also:  pentaho.lang.EventSource#_emit , pentaho.lang.EventSource#_emitGeneric

_hasListeners(type, phase) : boolean
 
Protected

Determines if there are any registrations for a given event type and phase.

This method can be used to avoid creating expensive event objects for event type and phase pairs that don't have registrations.

Source: javascript/web/pentaho/lang/EventSource.js, line 189

Inherited From: pentaho.lang.EventSource#_hasListeners

Parameters:
Name Default Value Summary
type : nonEmptyString

The type of the event.

phase : nonEmptyString
 
Optional

The phase of a structured event. For unstructured events don't specify this argument.

Returns:
Name Description
boolean

true if the event has any listeners for the given event type and phase; false, otherwise.

Example

if(this._hasListeners("select", "will")) {

 var event = new Event("select", this);

 if(this._emit(event)) {
 // Select Will phase
 }
}
_hasObservers(type) : boolean
 
Protected

Determines if there are any registrations for a given event type, for at least one of its phases.

This method can be used to avoid creating expensive event objects for event types that currently have no registrations.

Source: javascript/web/pentaho/lang/EventSource.js, line 232

Inherited From: pentaho.lang.EventSource#_hasObservers

Parameters:
Name Default Value Summary
type : nonEmptyString

The type of the event.

Returns:
Name Description
boolean

true if the event has any observers for the given event type; false, otherwise.

Example

if(this._hasObservers("select")) {

 var event = new Event("select");

 if(this._emitGeneric(event, "select", "will")) {
 // Select Will

 this._emitGeneric(event, "select", "did");
 }
}
_initClone(clone)
 
Protected

Initializes a shallow clone of this container.

The default implementation calls pentaho.type.mixins.Container#_initContainer.

Source: javascript/web/pentaho/type/mixins/Container.js, line 119

Parameters:
Name Default Value Summary
clone : pentaho.type.mixins.Container

The cloned container to initialize.

_initContainer()
 
Protected

Initializes a container instance.

Source: javascript/web/pentaho/type/mixins/Container.js, line 53

_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 290

Parameters:
Name Default Value Summary
changeset : pentaho.type.changes.Changeset

The set of changes.

_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 311

Parameters:
Name Default Value Summary
changeset : pentaho.type.changes.Changeset

The set of changes.

reason : Error

The reason why the changes were rejected.

_onChangeWill(changeset) : pentaho.lang.UserError | undefined
 
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 269

Parameters:
Name Default Value Summary
changeset : pentaho.type.changes.Changeset

The set of changes.

Returns:
Name Description
pentaho.lang.UserError | undefined

An error if the changeset was canceled; or, undefined otherwise.

clone() : pentaho.type.mixins.Container

Creates a shallow clone of this container.

All property values or elements are shared with the clone.

Source: javascript/web/pentaho/type/mixins/Container.js, line 104

Returns:
Name Description
pentaho.type.mixins.Container

The cloned container.

extend(source, keyArgs) : Object

Extend an object with the properties of another.

Methods that are overridden are accessible through this.base.

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

Parameters:
Name Default Value Summary
source : Object

The instance specification.

keyArgs : Object
 
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
exclude : Object
 
Optional

A map of property names to exclude from source.

Returns:
Name Description
Object

This object.

Implements:
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 dispose method of the registration handle returned by on, upon registration. Alternatively, as a convenience syntax, the registration handle can be passed as the single argument to this method.

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

Parameters:
Name Default Value Summary
typeOrHandle : nonEmptyString | Array.<nonEmptyString> | 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 typeOrHandle is not an event registration handle; ignored, otherwise.

See also:  pentaho.lang.IEventSource#on

Implements:
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 type represents multiple event types, the returned event registration handle is a composite registration for all of the event types.

This method is compatible with the dojo/on API.

Source: doc-js/pentaho/lang/IEventSource.jsdoc, line 90

Inherited From: pentaho.lang.EventSource#on

Parameters:
Name Default Value Summary
type : nonEmptyString | Array.<nonEmptyString>

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.

Parameters:
Name Default Value Summary
priority : number
 
Optional
0

The listening priority. Higher priority observers are notified of an event before any lower priority observers. The priority can be set to -Infinity or Infinity. In case two observers are assigned the same priority, the registration order determines which is notified first.

Returns:
Name Description
pentaho.lang.IEventRegistrationHandle

An event registration handle that can be used for later removal.

See also:  pentaho.lang.IEventSource#off