Class icm.util.Coordination

Represents a Coordination object that is used internally to coordinate the widgets on a page.
Defined in: <icm/util/Coordination.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 

Method Summary

Method Attributes Method Name and Description
 
cancel(participatId)
Cancel the participating
 
Constructs a Coordination object.
 
participate(topic, callback)
Identifies the widgets on the page that are to participate in the coordination.
 
start(context)
Starts the coordination of the page widgets by running the predefined coordination steps.
 
step(topic, callback, abortback)
Adds a step to the coordination procedure.

Constructor Detail

icm.util.Coordination()

Method Detail

cancel(participatId)

Cancel the participating
Parameters:
{string} participatId
representing identification of this participating, returned from the participate() function call.

constructor()

Constructs a Coordination object.

{string} participate(topic, callback)

Identifies the widgets on the page that are to participate in the coordination.
Parameters:
{string} topic
The participated coordination topic. Defined in icm/base/Constants.CoordTopic
{function} callback
A callback function that is to be executed after coordination is started. The callback function has the following parameters:
  • {object} context
  • {function} complete
  • {function} abort
  • The abort function accept an error as optional input parameter. The error is basically a javascript object with multiple name/value pairs. The coordination participator and coordinator can communicate through the error parameter. There are two built-in names are supported. One is the 'message', participator uses it to pass message back to coordinator for showing in the pop up message dialog. e.g. abort({'message':'information for show in dialog'}); The other is the 'silent', participator uses it to tell coordinator that don't show message box. e.g. abort({'silent':true});
Returns:
{string} participateId representing identification of this participating, which can be used for cancel the participate later

start(context)

Starts the coordination of the page widgets by running the predefined coordination steps.
Parameters:
{object} context
A context object that is passed to the callback function for each participator.

step(topic, callback, abortback)

Adds a step to the coordination procedure.
Parameters:
{string} topic
The topic of coordination step. Defined in icm/base/Constants.CoordTopic
{function} callback
The callback function that is to be executed after the coordination step completes. The callback(result, next, skip, context) function has the following parameters:
  • result - An array that contains the result of each participating callback. For each callback, the array contains two elements: [[true,'result1'],[false,'error']]. The first element is a Boolean value that indicates whether the participating callback completed (true) or was aborted (false).. The second element provides either the complete result of the participating callback or the reason the callback was aborted, which can be any object type.
  • {function} next - A function that determines that the current step is complete and that the coordination is to proceed to the next step.
  • {function} skip - A function used determines that the current step is complete and that the coordination is to skip the next steps.
  • The skip function accept a topic as optional input parameter, it tells the coordination about skipping to which remaining topic. If the parameter is not be given, the coordination will skip all remaining topics.
  • context - The coordination context.
{function} abortback
the error back will be executed after coordination aborted. The errorback(error, next, skip, context) function has the following parameters:
  • error - an array of two elements array which is the result of each participating callback - [[true,'result1'],[false,'error']]. The first element is a boolean, indicate if the participator complete(true) or abort(false), the second element indicates the either the complete result or abort reason which could be any object type.
  • next - A function that determines that the current step is complete and that the coordination is to proceed to the next step.
  • skip - A function used determines that the current step is complete and that the coordination is to skip the next step.
  • context - The coordination context.