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

Class: components.dt/js/spi/registration/GeneratorProvider

Provider interface returning instances of component view generators. Registers into ABCS with the Component Registration API.

Generator is called when the ABCS view model is rendered into HTML elements which browser understands. The generator tells ABCS how to built the HTML element for a given view.

Implement this to build your component's HTML tree from its views. GeneratorProvider.getGenerator should return a generator for all views the component owns.

When building a DOM element for a view ABCS iterates over registered generator providers and builds the view with the first generator returned from GeneratorProvider.getGenerator.
That means your provider may be asked to return a generator for an unrelated view in which case you just return undefined and the ABCS will continue searching for the proper generator.

Version:
  • 16.3.5
Source:
See:
Example

An example of a component view generator provider.

define([
   'myComponent/MyGenerator'
], function (
   Generator
   ) {

   'use strict';

   var GeneratorProvider = function () {
   };

   GeneratorProvider.prototype.getGenerator = function (view) {
       if (view.getType() === 'my-view-type' || view.getType() === 'my-other-view-type') {
           // return a generator instance understanding and capable of
           // building views of type 'my-view-type' and 'my-other-view-type'
           return new Generator();
       }
   };

   return new GeneratorProvider();

});

Methods

getGenerator(view) → {components.dt/js/spi/generators/Generator|undefined}

stable API

Gets view generator instance rendering the DOM tree for the component views.

Must be implemented and return an instance of view generator the component owns. If your component does not know how to build the view then return undefined and ABCS will try to find another generator that can build the view.

Parameters:
Name Type Description
view pages.dt/js/api/View

currently processed view.

Version:
  • 16.3.5
Source:
Returns:

view generator instance or undefined if the component does not own the view (does not know how to build its view type).

Type
components.dt/js/spi/generators/Generator | undefined