05-23-2017 06:31 PM
Hi every one, I have a problem with custom types. I did it
package test;
import org.activiti.engine.form.AbstractFormType;
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;
}
}
package test;
import org.activiti.engine.form.FormProperty;
import org.activiti.explorer.Messages;
import org.activiti.explorer.ui.form.AbstractFormPropertyRenderer;
import com.vaadin.ui.Field;
import com.vaadin.ui.TextArea;
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;
}
}
In activiti.cfg.xml
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="customFormTypes">
<list>
<bean class="test.TextAreaFormType"/>
</list>
</property>
<property name="jdbcUrl" value="@jdbc.url@" />
<property name="jdbcDriver" value="@jdbc.driver@" />
<property name="jdbcUsername" value="@jdbc.username@" />
<property name="jdbcPassword" value="@jdbc.password@" />
activiti-ui-context.xml
<!-- Custom form property renderers can be plugged in here -->
<bean id="formPropertyRendererManager" class="org.activiti.explorer.ui.form.FormPropertyRendererManager" lazy-init="true">
<!-- 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.DoubleFormPropertyRenderer" />
<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="test.TextAreaFormPropertyRenderer" />
</list>
</property>
</bean>
In .bpmn
So, when I try to deploy my .bar I get this error
05-24-2017 07:30 AM
From an initial look what you've posted looks in line with the MonthFormPropertyRenderer example (Creating a new form property in Activiti ). As a diagnostic check perhaps it's worth checking that those versions of the config files are the ones being read? To check whether those are the config files being used, maybe you could try taking parts of those files out and restarting to see whether you then get an error related what you've taken out (e.g. MonthFormPropertyRenderer entry and see if you get an error for that when you upload your file)? I also notice you've used a different package name from the examples - I wouldn't expect that to be the problem but it is worth checking.
05-24-2017 09:35 AM
Explore our Alfresco products with the links below. Use labels to filter content by product module.