Class: TaskGroup

system.process. TaskGroup


new TaskGroup( [mode] [, actions])

The abstract class to creates collections who group some Action objects in one.

The abstract class to creates collections who group some Action objects in one.

Subclasses: BatchTask, Chain

Parameters:
Name Type Argument Default Description
mode string <optional>
normal

Specifies the mode of the group. This mode can be "normal" (default), "transient" or "everlasting".

actions array <optional>
null

An optional array who contains Action references to initialize the chain.

Example
var do1 = new system.process.Do() ;
var do2 = new system.process.Do() ;

do1.something = function()
{
    console.log( "#1 something" ) ;
}

do2.something = function()
{
    console.log( "#2 something" ) ;
}

var finish = function( action )
{
    trace( "finish: " + action ) ;
};

var start = function( action )
{
    trace( "start: " + action ) ;
};

var batch = new system.process.BatchTask() ;

batch.add( do1 ) ;
batch.add( do2 ) ;

batch.verbose = true ;

trace( 'batch : ' + batch.toString(true) ) ; // batch : [TaskGroup[[Do],[Do]]]
trace( 'running : ' + batch.running ) ; // running : false
trace( 'length : ' + batch.length ) ; // length : 2

batch.finishIt.connect(finish) ;
batch.startIt.connect(start) ;

batch.run() ;

// start: [TaskGroup[[Do],[Do]]]
// #1 something
// #2 something
// finish: [TaskGroup[[Do],[Do]]]

Extends

Members


<static> EVERLASTING :boolean

Determinates the "everlasting" mode of the group. In this mode the action register in the task-group can't be auto-remove.

Type:
  • boolean

<static> NORMAL :boolean

Determinates the "normal" mode of the group. In this mode the task-group has a normal life cycle.

Type:
  • boolean

<static> TRANSIENT :boolean

Determinates the "transient" mode of the group. In this mode all actions are strictly auto-remove in the task-group when are invoked.

Type:
  • boolean

<constant> changeIt :system.signals.Signal

The signal emit when the task is changed.

Type:
Inherited From:

<constant> clearIt :system.signals.Signal

The signal emit when the task is cleared.

Type:
Inherited From:

<constant> finishIt :system.signals.Signal

This signal emit when the action is finished.

Type:
Inherited From:

<constant> infoIt :system.signals.Signal

The signal emit when the task emit a message.

Type:
Inherited From:

<readonly> length

Indicates the numbers of actions register in the group.


looping :boolean

The flag to determinate if the task must be looped.

Type:
  • boolean
Inherited From:
Default Value:
  • false

<constant> loopIt :system.signals.Signal

The signal emit when the task is looped.

Type:
Inherited From:

mode

Determinates the mode of the chain. The mode can be "normal", "transient" or "everlasting".

See:
  • system.process.TaskGroup#NORMAL, system.process.TaskGroup#EVERLASTING, system.process.TaskGroup#TRANSIENT

<constant> pauseIt :system.signals.Signal

The signal emit when the task is paused.

Type:
Inherited From:

<readonly> phase :string

Indicates the current phase.

Type:
  • string
Inherited From:
See:

<constant> progressIt :system.signals.Signal

The signal emit when the task is in progress.

Type:
Inherited From:

<constant> resumeIt :system.signals.Signal

The signal emit when the task is resumed.

Type:
Inherited From:

<readonly> running :boolean

Indicates action is running.

Type:
  • boolean
Inherited From:

<constant> startIt :system.signals.Signal

This signal emit when the action is started.

Type:
Inherited From:

<constant> stopIt :system.signals.Signal

This signal emit when the task is stopped.

Type:
Inherited From:

<readonly> stopped

Indicates if the chain is stopped.


<constant> timeoutIt :system.signals.Signal

The signal emit when the task is out of time.

Type:
Inherited From:

verbose :boolean

Indicates if the toString method must be verbose or not.

Type:
  • boolean
Default Value:
  • false

Methods


add(action [, priority] [, autoRemove])

Adds an action in the chain.

Parameters:
Name Type Argument Default Description
action system.process.Action

The Action to register in this collection.

priority number <optional>
0

Determinates the priority level of the action in the chain.

autoRemove boolean <optional>
false

Apply a remove after the first finish notification.

Returns:

true if the insert is success.


clone()

Creates a copy of the object.

Overrides:
Returns:

a shallow copy of this object.


contains()

Returns true if the specified Action is register in the group.

Returns:

true if the specified Action is register in the group.


dispose()

Dispose the chain and disconnect all actions but don't remove them.


get(index)

Gets the Action register in the collection at the specified index value or null.

Parameters:
Name Type Description
index number

The index of the action element in the collection.

Returns:

the action register in the chain at the specified index value or null.


isEmpty()

Returns true if the collection is empty.

Returns:

true if the chain is empty.


isLocked()

Returns true if the object is locked.

Inherited From:
Implements:
Returns:

true if the object is locked.


lock()

Locks the object.

Inherited From:
Implements:

notifyChanged()

Notify when the process is changed.

Inherited From:

notifyCleared()

Notify when the process is cleared.

Inherited From:

notifyFinished()

Notify when the process is finished.

Inherited From:

notifyInfo()

Notify a specific information when the process is changed.

Inherited From:

notifyLooped()

Notify when the process is looped.

Inherited From:

notifyPaused()

Notify when the process is paused.

Inherited From:

notifyProgress()

Notify when the process is progress.

Inherited From:

notifyResumed()

Notify when the process is resumed.

Inherited From:

notifyStarted()

Notify when the process is started.

Inherited From:

notifyStopped()

Notify when the process is stopped.

Inherited From:

notifyTimeout()

Notify when the process is out of time.

Inherited From:

remove(action)

Removes a specific action register in the chain and if the passed-in argument is null all actions register in the chain are removed. If the chain is running the stop() method is called.

Parameters:
Name Type Description
action system.process.Action

The action to remove in the collection.

Returns:

true if the method succeeded.


reset()

Resets the task.

Inherited From:
Implements:

resume()

Resumes the task.

Inherited From:

run()

Run the command.

Inherited From:

start()

Starts the task.

Inherited From:
Implements:

stop()

Starts the process.

Inherited From:
Implements:

toArray()

Invoked when a task is finished.


toArray()

Returns the Array representation of the chain.

Returns:

the Array representation of the chain.


toString()

Returns the String representation of the chain.

Returns:

the String representation of the chain.


unlock()

Unlocks the object.

Inherited From:
Implements: