AnsweredAssumed Answered

Custom Form Type

Question asked by pedwards on May 6, 2013
Latest reply on Jun 13, 2016 by slaimankoeik
Hi Guys,

I'm hoping someone can quickly tell me what I'm doing wrong. I have activiti 5.12.1 running happily. I have created a simple flow with some custom forms and its all happy.

However I know I am going to need more complicated formtypes than the supplied, so as a simple test, I decided to create a "integer" form type. So I created the simple classes:

public class IntegerFormPropertyRenderer extends AbstractFormPropertyRenderer
public class IntegerValidator extends AbstractStringValidator
public class IntegerFormType extends AbstractFormType


I compiled these into a jar, and wacked them into activiti-explorer/WEB-INF/lib. I then modified activiti-ui-context.xml to have:

  <bean id="formPropertyRendererManager" class="org.activiti.explorer.ui.form.FormPropertyRendererManager">
    <!– Default renderer –>
    <property name="noTypePropertyRenderer">
      <bean class="org.activiti.explorer.ui.form.StringFormPropertyRenderer" />
    </property>
    <!– Renderers by property type –>
    <property name="propertyRenderers">
      <list>
        <bean class="org.activiti.explorer.ui.form.StringFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.EnumFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.LongFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.DateFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.UserFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.BooleanFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.ProcessDefinitionFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.MonthFormPropertyRenderer" />
        <bean class="org.xxx.xxx.formtypes.IntegerFormPropertyRenderer" />
      </list>
    </property>
  </bean>


Then I restarted everything, and tried to upload a workflow that uses this as a form component. No dice, it blows with:
org.activiti.engine.ActivitiIllegalArgumentException: unknown type 'integer' amount
   at org.activiti.engine.impl.form.FormTypes.parseFormPropertyType(FormTypes.java:55)

Which tells me that my form type never made it into FormTypes. So I attached the debugger, I can see that FormTypes is populated by default, before the explorer app is ever started. However when I do access the webapp, I can see the FormPropertyRendererManager is indeed populated with my extra class, however I don't see it ever get loaded into FormTypes.

So my question is, how do propertyRenderers get added to FormTypes? Cause at the moment it appears to me that they are ignored.

Thanks
Paul.

Outcomes