Web components / Using a gICAPI web component |
Deploy web component files to the front-end platform before using gICAPI web components.
The gICAPI web component files (main HTML file, additional JavaScript files and other potential assets) must be available on the platform where the front-end executes. According to your configuration, Genero supports several solutions to provide the gICAPI web component files from a single location. In a distributed configuration with many individual front-end nodes, consider centralizing the gICAPI files on a server, instead of copying the gICAPI web component files manually to each front-end device.
When using the Genero Application Server, the gICAPI web component files must be deployed as part of the application program files.
The .xcf configuration file of your application must define the base path to search for HTML web component files. This base path is defined by the WEB_COMPONENT_DIRECTORY entry of the EXECUTION element:
<APPLICATION ... <EXECUTION> ... <WEB_COMPONENT_DIRECTORY>$(application.path)/webcomponents</WEB_COMPONENT_DIRECTORY> ...
The HTML document must be located in a sub-directory below the base path, using the same name as defined by the COMPONENTTYPE attribute. As result, the complete path to the HTML document will be:
base-path/component-type/component-type.html
For example, if the form file defines the COMPONENTTYPE attribute as follows:
WEBCOMPONENT wc = FORMOMLY.mychart, COMPONENTTYPE = "3DChart";
To simplify deployment of gICAPI web components with the GAS, consider using the fglgar utility. For more details, see GAS documentation.
When using a front-end with a direct connection (i.e. not through the GAS), you can automatically transfer web component files to the front-end. Locate the gICAPI web component files on the computer where programs execute and set the FGLIMAGEPATH environment variable. The web component files are automatically transferred if the program executes on a server and the gICAPI web component files are not found locally by the front-end.
When using FGLIMAGEPATH, gICAPI web component files are searched in the following order:
If assets such as .js, .css, .png files are referenced by a relative path name in the HTML content, the resources are also transferred via the FGLIMAGEPATH mechanism. If the assets use an absolute path with a concrete URL scheme ( http://something ), the HTML viewer will try to get the resource from the URL location.
WEBCOMPONENT wc = FORMOMLY.mychart, COMPONENTTYPE = "3DChart";
Here component-type is the name defined by the COMPONENTTYPE attribute in the form definition file.
For more details about appdir on mobile devices, see Deploying mobile apps on Android devices and Deploying mobile apps on iOS devices.
To define the base URL to the web component files for a given application, you can also use the setWebComponentPath front call. The URL must be a well formatted absolute URL (e.g. "http://myserver/components" or "file:///c:/components").
appdir appdir/main.42m appdir/form1.42f appdir/form2.42f appdir/webcomponents/3DChart appdir/webcomponents/3DChart/3DChart.html appdir/webcomponents/3DChart/3DChart.js appdir/webcomponents/3DChart/3DChart.css appdir/webcomponents/3DChart/icon_close.png ...