Custom Form Type

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2013 09:21 PM
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:
I compiled these into a jar, and wacked them into activiti-explorer/WEB-INF/lib. I then modified activiti-ui-context.xml to have:
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.
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 AbstractFormPropertyRendererpublic class IntegerValidator extends AbstractStringValidatorpublic 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.
Labels:
- Labels:
-
Archive
6 REPLIES 6

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2013 09:33 PM
Oh, just to be clear:
<code>
package org.xxx.xxx.formtypes;
import org.activiti.engine.form.AbstractFormType;
public class IntegerFormType extends AbstractFormType {
public static final String TYPE_NAME = "integer";
@Override
public Object convertFormValueToModelValue(String propertyValue) {
return Integer.parseInt(propertyValue);
}
@Override
public String convertModelValueToFormValue(Object modelValue) {
return ((Integer)modelValue).toString();
}
@Override
public String getName() {
return TYPE_NAME;
}
}
</code>
<code>
package org.xxx.xxx.formtypes;
import org.activiti.engine.form.AbstractFormType;
public class IntegerFormType extends AbstractFormType {
public static final String TYPE_NAME = "integer";
@Override
public Object convertFormValueToModelValue(String propertyValue) {
return Integer.parseInt(propertyValue);
}
@Override
public String convertModelValueToFormValue(Object modelValue) {
return ((Integer)modelValue).toString();
}
@Override
public String getName() {
return TYPE_NAME;
}
}
</code>

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2013 10:09 PM
Just found this: http://www.jorambarrez.be/blog/2013/03/13/creating-a-new-form-property-in-activiti/
Seems that whatever I was reading was wrong… let me try that again
Seems that whatever I was reading was wrong… let me try that again

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2013 10:14 PM
Yip that was all it was, I was missing:
<code>
<bean id="processEngineConfiguration" … >
…
<property name="customFormTypes">
<list>
…
<bean class="org.activiti.explorer.form.MonthFormType"/>
</list>
</property>
</bean>
</code>
<code>
<bean id="processEngineConfiguration" … >
…
<property name="customFormTypes">
<list>
…
<bean class="org.activiti.explorer.form.MonthFormType"/>
</list>
</property>
</bean>
</code>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2013 05:46 AM
Now that was a nice monologue 😉
But thanks for posting back!
But thanks for posting back!

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2014 08:52 AM
Hi pedwards
Could you post the full eclipse project ? the community would appreciate for sure!
Thanks
Could you post the full eclipse project ? the community would appreciate for sure!
Thanks

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2016 05:00 PM
Hello,
1-I have same scenario for Pedwards but the thing i didn't understand is that how i will load to the activiti explorer my custom form property ?
how ?
i tried to insert this code into my eclipse process engine configuration file but the activiti explorer isn't identifying it:
<code>
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
<property name="databaseSchemaUpdate" value="true" />
<property name="customFormTypes">
<list>
<bean id="enumformtype" class="log_stream.enumformtype"/>
</list>
</property>
</bean>
</code>
2-that what i understod from this link http://www.jorambarrez.be/blog/2013/03/13/creating-a-new-form-property-in-activiti/, but i didn't understand how inserting the custom form type into the eclipse configuraton file will notify activiti explorer for identifying this custom form type ???
please anyone has an idea.
1-I have same scenario for Pedwards but the thing i didn't understand is that how i will load to the activiti explorer my custom form property ?
how ?
i tried to insert this code into my eclipse process engine configuration file but the activiti explorer isn't identifying it:
<code>
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
<property name="databaseSchemaUpdate" value="true" />
<property name="customFormTypes">
<list>
<bean id="enumformtype" class="log_stream.enumformtype"/>
</list>
</property>
</bean>
</code>
2-that what i understod from this link http://www.jorambarrez.be/blog/2013/03/13/creating-a-new-form-property-in-activiti/, but i didn't understand how inserting the custom form type into the eclipse configuraton file will notify activiti explorer for identifying this custom form type ???
please anyone has an idea.
