Interface IPluginFormElementWidget

  • All Superinterfaces:
    IFCPlugin, IFCRemoteSyncPlugin, INamedUiElement, INameProviding, ITransferable, Serializable

    public interface IPluginFormElementWidget
    extends IFCRemoteSyncPlugin
    Interface for plugins to integrate own form element widgets within the form designer. These widgets are added to the drawer panel that usually contain the built-in standard items such as input fields and select elements.

    To create a form element widget, you need to create class that implements IXItemWidget. This class contains the server side logic of the plugin, such as how the HTML is rendered and how the data is validated. Optionally, you can also create a JavaScript file that will be loaded when the form designer is opened. This JavaScript file can contain custom client side logic. It can be used, for example, when you need to declare additional item properties or when you need custom property editors in the form designer.

    See the node module fc-form-designer (available via the custom XIMA npm registry) for more details regarding the contents of the JavaScript file. That module contains the TypeScript declaration files with the client side API.

    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • getCssData

        default String getCssData()
        Return the path to the CSS file that is loaded when the form designer is opened. This file should contain additional styles required for the widget within the form designer. Note that these styles should apply only to the form widget element. If you need additional styles for the form designer UI, such as for custom editors, use getCssDataForDesignerUi().

        The default implementation reads the #getCssPath() via {getResourceAsString(String).

        Returns:
        The contents of the CSS to include in form when the form is edited within the form designer.
      • getCssDataForDesignerUi

        default String getCssDataForDesignerUi()
                                        throws IOException
        Return the path to the CSS file that is loaded when the form designer is opened. This file should contain additional styles required for the designer UI, such as for custom property editors. Styles from with CSS file are not available within the form, use getCssData() for styles that should apply to the widget form element.

        The default implementation returns null, which loads no additional styles.

        Returns:
        The contents of the CSS to include in the form designer UI context, outside the form.
        Throws:
        IOException - When the data could not be loaded.
      • getCssPath

        default String getCssPath()
        Return the path to the CSS file that is loaded when the form designer is opened. This file should contain additional styles required for the widget within the form designer. Note that these styles should apply only to the form widget element. If you need additional styles for the form designer UI, such as for custom editors, use getCssDataForDesignerUi().

        The returned path must point to an existing resource in the classpath of this plugin.

        The default implementation expects the resource to be located at includes/designer/designer-min.css.

        Returns:
        The path where the CSS resource is located.
      • getJavaScriptData

        default String getJavaScriptData()
        Returns the contents of the JavaScript file that is loaded when the form designer is opened . This file should contain the setup logic for the designer, such as adding custom properties or editors.

        The default implementation reads the #getJavaScriptPath() via {getResourceAsString(String).

        See the node module fc-form-designer (available via the custom XIMA npm registry) for more details regarding the contents of the JavaScript file. That module contains the TypeScript declaration files with the client side API.

        Returns:
        The contents of the JavacScript to include in the form designer.
      • getJavaScriptPath

        default String getJavaScriptPath()
        Returns the path to the JavaScript file that is loaded when the form designer is opened. This file should contain the setup logic for the designer, such as adding custom properties or editors. The returned path must point to an existing resource in the classpath of this plugin.

        The default implementation expects the resource to be located at includes/designer/designer-min.js.

        See the node module fc-form-designer (available via the custom XIMA npm registry) for more details regarding the contents of the JavaScript file. That module contains the TypeScript declaration files with the client side API.

        Returns:
        The path where the JavaScript resource is located.
      • getResource

        default InputStream getResource​(String path)
        Reads the resource at the given path. The default implementation simply reads the resource at the given path from the class loader of this plugin. Normally you should not have to override this method.
        Parameters:
        path - The path from which to load the CSS file.
        Returns:
        The data with CSS resource.
      • getResourceAsString

        default String getResourceAsString​(String path)
        Reads the resource at the given path. The default implementation simply reads the resource at the given path from the class loader of this plugin. Normally you should not have to override this method.
        Parameters:
        path - The path from which to load the CSS file.
        Returns:
        The data with CSS resource.
      • getWidgets

        List<Class<? extends IXItemWidget>> getWidgets​(Locale locale)
        Parameters:
        locale - Current locale.
        Returns:
        The list of all available form element widgets.
      • isAvailableInDesigner

        default boolean isAvailableInDesigner​(IPluginFormElementWidgetIsAvailableInDesignerParams params)
        Optional method for checking whether a widget is available in the form designer. This method is called when a new form designer is opened, and is passed the current project being edited, as well as the widget to check. It is called once for each widget returned by getWidgets(Locale). When this method returns false, the widget is not shown in the list of available elements in the designer. When the form already contains an instance of the widget, an error message is shown to the user that the widget could not be found.

        This method lets you omit certain widgets under certain circumstances. The default implementation simply returns true.

        Parameters:
        params - Parameters with the widget to check and the current project being edited.
        Returns:
        Whether the widget is available.
        Since:
        7.0.0