Class FcManualHandler

    • Method Detail

      • getDataModelClass

        public Class<? extends FcManualProps> getDataModelClass()
        Description copied from interface: IElementHandler
        Returns the class of the custom properties used by the elements handled by this element logic handler.

        The custom properties of a workflow element are internally stored as JSON. To ease the development work, you can specify a model class, and the JSON is automatically converted to an instance of that model class. Please note that the model class must be compatible with serialization mechanism used by JSON.

        See IElementHandler.getVersion() for how custom properties are updated.

        If you need more control over serialization and deserialization, specify JSONObject as the type parameter and return JSONObject.class. You will then receive the raw JSON data and may perform the serialization in whatever way you like.

        Specified by:
        getDataModelClass in interface IElementHandler<FcManualProps,​WorkflowTrigger>
        Returns:
        The class corresponding to the type parameter TData.
      • getPropertiesViewXhtml

        public URL getPropertiesViewXhtml()
                                   throws MalformedURLException
        Description copied from interface: IElementHandler
        This method must return the path to the XHTML page for the custom user interface. Usually the XHTML file is part of the JAR resources of the module or plugin. In this case, you should return an URL to a JAR file resource (jar:file:/...) like so:
         @Override
         public URL getXhtmlView() {
           return getClass().getResource("/path/to/view.xhtml");
         }
         

        The contents of this XHTML page is included in the properties panel, without a fieldset or container around it, but already inside a form (i.e. do not use a h:form as that would result in an error). You should wrap your custom UI in a naming container to ensure unique IDs that do not clash with other plugins or actions. The following is a recommended template on which you may base your UI:

         <ui:composition xmlns="http://www.w3.org/1999/xhtml"
           xmlns:h="http://xmlns.jcp.org/jsf/html"
           xmlns:f="http://xmlns.jcp.org/jsf/core"
           xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
           xmlns:o="http://omnifaces.org/ui" xmlns:p="http://primefaces.org/ui"
           xmlns:xi="http://www.xima.de/taglib/xfc">
         
           <!-- Enable bean validation (when #validateLocal is implemented via the bean validator)-->
           <o:validateBean value="#{model}" showMessageFor="@violating"  method="validateActual" />
         
           <xi:namingContainer id="myAwesomeWorkflowElement">
           
             <!--Base info with name and description (when TData extends BaseActionProps) -->
             <xi:newWorkflowActionBase id="base" value="#{model}" legend="#{msg['wf.node.myawesomelememnt']}" />
         
             <!-- Remove when TData does not have a ISingleFileProviding field -->
             <xi:singleFile id="resource" value="#{model.singleFile}" required="true" />
         
             <!-- Remove when TData does not have a IMultiFileProviding field -->
             <xi:multiFile id="resource" value="#{model.multiFile}" required="true" />
        
             <!-- Remove when TData does not implement IProviding -->
             <xi:newWorkflowProviding id="providing" value="#{model}" />
             
             <!-- Custom section with editors specific to your workflow element -->
             <p:fieldset legend="#{msg['MyAwesomeWorkflowElementProps.fieldset.base']}" styleClass="fc-fieldset">
             
               <!-- A simple input field bound to the mail property of your properties model -->
               <xi:inputText id="mail" label="#{msg['MyAwesomeWorkflowElementProps.mail']}" formPlaceholder="true"
                 value="#{model.mail}" forceIndicateRequired="true" >
                 <p:ajax event="change" partialSubmit="true"
                   listener="#{elementPropertiesBean.storeCurrent}" process="@this"
                   update=":flowchartForm:flowchart" global="false" />
               </xi:inputText>
                 
            </p:fieldset>
        
           </xi:namingContainer>
         </ui:composition>
         

        The XHTML page may access the following expression language variables:

        • model: The deserialized custom properties of the workflow element, of the type TData.
        • provider: An object that implements IWorkflowProvider, for accessing various data, such as a list of all users or text templates.
        • msg: The localized messages as returned by IElementHandler.getResourceBundle(Locale). Empty when that method returns null. For example, if the resource bundle contains the key mail.label, you can access the localized message via the EL expression ['mail.label']

        To access the values of an enum or the constants defined by a class, consider using

         <xi:importConstants type="my.fully.classified.path.MyEnum" var="MyEnum" loader="#{model}"/>
         
        The loader argument is only required for plugins and ensures that the correct class loader is used that knows about the plugin class. Without the loader attribute, the above is equivalent to the PrimeFaces tag handler <p:importConstants />.
        Specified by:
        getPropertiesViewXhtml in interface IElementHandler<FcManualProps,​WorkflowTrigger>
        Returns:
        Path to the XHTML view. Must not return null. If you do return null, it will be treated as an error and an appropriate message is displayed to the user informing them that the properties panel could not be loaded.
        Throws:
        MalformedURLException - This exception is declared for convenience - normally you would use {@link new URL} with a constant URL string that should not throw. In case an exception is thrown, it is treated the same as if this returned null.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getInstance

        public static FcManualHandler getInstance()
        Returns:
        The immutable, stateless instance of this handler.