Class: ObjectRegistry

bcdui.factory. ObjectRegistry

The object registry is a class that tracks registration of BCD-UI objects by their id. It also offers methods to wait for the registration of one or more objects so that the dependencies can be managed more easily.

Use the singleton bcdui.factory.objectRegistry for registering

new bcdui.factory.ObjectRegistry()

factory/objectRegistry.js, line 25
This class should not be instantiated directly, because there is already a singleton instance at bcdui.factory.objectRegistry which is used by the factory methods.

Methods

deRegisterObject(obj)

factory/objectRegistry.js, line 176
Removes a DataProvider from the object registry.

Use this if you need access from XSLT, XAPI or JSP to objects created via JavaScript.

Name Type Description
obj bcdui.core.DataProvider The DataProvider to be removed from the registry.

generateTemporaryId()

factory/objectRegistry.js, line 80
Get a new page-unique id. Use this if you don't car about the id's value but need a unique one.

generateTemporaryIdInScope()

factory/objectRegistry.js, line 88
Get a new page-unique id for a certain scope, i.e. prefix. The prefix makes it easier to debug.

getObject(id){bcdui.core.DataProvider}

factory/objectRegistry.js, line 65
Retrieves a DataProvider from the ObjectRegistry by the provided id. Use this if you need access from JavaScript to objects, which where created via XSLT, XAPI or JSP.
Name Type Description
id string | SymLink The object to be resolved from the registry.
Returns:
Type Description
bcdui.core.DataProvider The object registered under the id or null if no such object exists.

registerObject(obj)

factory/objectRegistry.js, line 194
Registers a new object in the object registry by its unique id property. Pending listeners can be informed on that event. Additionally it creates a JavaScript variable with the name of the object id and the object as value.

Use this if you need access from XSLT, XAPI or JSP to objects created via JavaScript.

Name Type Description
obj bcdui.core.DataProvider The DataProvider to be registered.

toString(){String}

factory/objectRegistry.js, line 307
Returns:
Type Description
String A string describing the current state of the object registry.

withObjects(args1, args2)

factory/objectRegistry.js, line 140
Waits until one or more ids are registered (but not necessarily ready) and then calls a JavaScript function. If they are already registered the JavaScript function will be called immediately.

Use this if you need access from JavaScript to objects, which where created via XSLT, XAPI or JSP. See withReadyObjects()

Name Type Description
args1 Object | Array.<string> | string This can either be a parameter object or an array of id strings or a single id. The format of the parameter object is as follows
  • ids: {string[]|string} The array of ids that must be registered before the callback function is called.
  • fn: {Function} The function to be called when the ids are registered.
args2 function If the first parameter is not a parameter object, then this is the callback function that is called as soon as the requested ids are registered.

withReadyObjects(args1, args2, skipExecute)

factory/objectRegistry.js, line 231
Waits until the specified DataProvider ids are registered and reach their ready states. Then it calls the specified callback function. Please note that it also works when the data providers are already in their ready state; then the callback is called immediately. Note that it will also execute the DataProviders it waits fir, if they are not yet ready. The interface is identical to the withObjects() function.
Name Type Description
args1 Object | Array.<string> | string The parameter object or the object ids.
args2 function The callback function if argsOrIds is an array.
skipExecute boolean do not execute the non-ready dataproviders

withReadyObjectsNoExecute(args1, args2)

factory/objectRegistry.js, line 282
Waits until the specified DataProvider ids are registered and reach their ready states. Then it calls the specified callback function. Please note that it also works when the data providers are already in their ready state; then the callback is called immediately. It does not execute the DataProviders it waits for, it waits until somebody else executes it. The interface is identical to the bcdui.factory.objectRegistry.withObjects function.
Name Type Description
args1 Object | Array.<string> | string The parameter object or the object ids.
args2 function The callback function if argsOrIds is an array.