AnsweredAssumed Answered

Custom form Type error -  unknown type 'textarea'

Question asked by bbarani on Mar 5, 2013
Latest reply on May 12, 2013 by mengqhai
Hi,

I created a custom form type and added the class to the applicationcontext.xml file but for some reason I am getting the below error.

Please find  below my implementation details (reference: book-form example).


Implementing a custom text area form field UI using Vaadin


public class TextAreaFormPropertyRenderer extends AbstractFormPropertyRenderer {

  public TextAreaFormPropertyRenderer() {
    super(TextAreaFormType.class);
  }

  @Override
  public Field getPropertyField(FormProperty formProperty) {
    TextArea textArea = new TextArea(getPropertyLabel(formProperty));
    textArea.setRequired(formProperty.isRequired());
    textArea.setEnabled(formProperty.isWritable());
    textArea.setRows(10);
    textArea.setColumns(50);
    textArea.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));

    if (formProperty.getValue() != null) {
       textArea.setValue(formProperty.getValue());
    }

    return textArea;
  }

}


Implementing a custom text area form type

public class TextAreaFormType extends AbstractFormType {

  public static final String TYPE_NAME = "textarea";
 
  public String getName() {
    return TYPE_NAME;
  }

  @Override
  public Object convertFormValueToModelValue(String propertyValue) {
    return propertyValue;
  }

  @Override
  public String convertModelValueToFormValue(Object modelValue) {
    return (String) modelValue;
  }
}

activiti-standalone-context.xml:

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
       <property name="dataSource" ref="dataSource" />
       <property name="transactionManager" ref="transactionManager" />
       <property name="databaseSchemaUpdate" value="true" />
       <property name="jobExecutorActivate" value="true" />
      <property name="customFormTypes">
        <list>
          <ref bean="userFormType"/>
          <ref bean="textAreaFormType"/>
        </list>
      </property>

    <!–  Custom form types –>
    <bean id="userFormType" class="org.activiti.explorer.form.UserFormType"/>
  <bean id="textAreaFormType" class="org.bpmnwithactiviti.explorer.form.TextAreaFormType"/>
  </bean>

activiti-ui-context.xml
 
<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.bpmnwithactiviti.explorer.form.TextAreaFormPropertyRenderer" />
      </list>
    </property>


Error:

SEVERE: Error while closing command context
org.activiti.engine.ActivitiException: unknown type 'textarea' | Latest BPMN.bpm
n20.xml | line 45 | column 82

        at org.activiti.engine.impl.util.xml.Parse.throwActivitiExceptionForErro
rs(Parse.java:186)
        at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java
:242)
        at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeploy
er.java:92)
        at org.activiti.engine.impl.persistence.deploy.DeploymentCache.deploy(De
ploymentCache.java:38)
        at org.activiti.engine.impl.persistence.entity.DeploymentManager.insertD
eployment(DeploymentManager.java:44)
        at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:61)
        at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:33)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(Comm
andExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execut
e(CommandContextInterceptor.java:60)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterc
eptor.java:32)
        at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServi
ceImpl.java:68

Can someone let me know what I am doing wrong?

Thanks,
Barani

Outcomes