JavaScript Extension Development API for Oracle Visual Builder Cloud Service - Classic Applications

Class: components.dt/js/api/ComponentProviderRegistry

This is a singleton object. Do not create an instance.

Registry of custom component service providers.

When writing a custom component that is about to be registered into ABCS you register its service providers in ComponentProviderRegistry. ABCS then picks the providers from here and ask them to return service instances (Creators, Generators, Property Inspectors and others) when needed depending on the lifecycle phase applied to the component at the moment.

Service providers (and the services themselves) that you may plug into ABCS are descibed by the component registration object, registered into ABCS with ComponentProviderRegistry.registerComponent and unregistered (when the component is to be removed from ABCS) with ComponentProviderRegistry.unregisterComponent

Version:
  • 16.3.5
Source:
See:

Object Literals

components.dt/js/api/ComponentProviderRegistry.ComponentRegistration

Members

Methods

registerComponent(componentRegistration) → {Boolean}

stable API

Registers component service providers into ABCS and with that basically activates the component's functionality inside ABCS UI.

This is to be called when you want to make your component active inside ABCS and make it able to be dropped from the Component Palette, properly render inside an ABCS page or let users modify its behaviour in Property Inspector UI.

You are supposed to pass a component registration object defining providers of the various ABCS services as the method parameter.

This does not overwrite previous registrations, if there is a registration with the same id already present, it will not be overwritten and false will be returned.

Parameters:
Name Type Description
componentRegistration components.dt/js/api/ComponentProviderRegistry.ComponentRegistration

component registration

Version:
  • 16.3.5
Source:
See:
Throws:

When componentRegistration is invalid.

Type
Error
Returns:

true when the component successfully registers its registration object. If there is an existing registration with the same id present, the method will return false.

Type
Boolean
Example

Register component services

define([
    'components.dt/js/api/ComponentProviderRegistry',
    'myComponent/PaletteRegistrationProvider',
    'myComponent/CreatorProvider',
    'myComponent/GeneratorProvider',
    'myComponent/PropertyInspectorProvider',
    'myComponent/DeleterProvider'
], function (
    componentProviderRegistry,
    myPaletteRegistrationProviderInstance,
    myCreatorProviderInstance,
    myGeneratorProviderInstance,
    myPropertyInspectorProviderInstance,
    myDeleterProviderInstance
) {
    // create registration object with all service providers to register
    var myComponentRegistration = {
        id: 'com.my.MyComponent',
        displayName: 'My Cool Component',
        paletteRegistrationProvider: myPaletteRegistrationProviderInstance,
        creatorProvider: myCreatorProviderInstance,
        generatorProvider: myGeneratorProviderInstance,
        propertyInspectorProvider: myPropertyInspectorProviderInstance,
        deleterProvider: myDeleterProviderInstance
    };

    // register the component registration into ABCS
    componentProviderRegistry.registerComponent(myComponentRegistration);
});

unregisterComponent(componentID) → {Boolean}

stable API

Removes existing component's registration.

Call this if you no longer want your component to be part of ABCS.

Removes all its palette registration, creators, property inspectors, generators and other services from the ABCS system previously registered with ComponentProviderRegistry.registerComponent.

Parameters:
Name Type Description
componentID String

component id the component was registered with.

Version:
  • 16.3.5
Source:
Returns:

flag indicating the component has been unregistered successfully. Will be true only if a previously existing registration is successfully removed.

Type
Boolean
Example

Unregister component services

// simply call ComponentProviderRegistry.unregisterComponent
// to unregister all component service providers
if (componentProviderRegistry.unregisterComponent('com.my.MyComponent')) {
    console.log('MyComponent successfully unregistered from ABCS');
}