标签:style blog http io ar color os 使用 sp
自定义表单类型
使用动态表单,需要定义表单的字段以及属性,在WEB流程设计器中没有Default字段(Eclipse中有),给设计带来了一定的困难,下面介绍如何在WEB流程设计器中扩展表单。
{ "id" : "formproperty_type", "name" : "Type", "name_de" : "Typ", "type" : "Choice", "value" : "", "width" : 100, "optional" : false, "items" : [ { "id" : "c1", "title" : "String", "title_de" : "String", "value" : "string", "refToView" : "" }, { "id" : "c2", "title" : "Date", "title_de" : "Date", "value" : "date", "refToView" : "" }, { "id" : "c3", "title" : "Long", "title_de" : "Long", "value" : "long", "refToView" : "" }, { "id" : "c4", "title" : "Boolean", "title_de" : "Boolean", "value" : "boolean", "refToView" : "" }, { "id" : "c5", "title" : "Enum", "title_de" : "Enum", "value" : "enum", "refToView" : "" }, { "id" : "c6", "title" : "SmartRef", "title_de" : "SmartRef", "value" : "smartref", "refToView" : "" }, { "id" : "c7", "title" : "Group", "title_de" : "Group", "value" : "group", "refToView" : "" } ] } |
?
?
public class GroupFormType extends AbstractFormType { ????protected Map<String, String> values; ????public GroupFormType(){} ????public GroupFormType(Map<String, String> values) ????{ ????????this.values = values; ????} ????@Override ????public String getName() ????{ ????????return ActivitiConstants.GROUP_TYPE; ????} ????@Override ????public Object convertFormValueToModelValue(String propertyValue) ????{ ????????return propertyValue; ????} ????@Override ????public String convertModelValueToFormValue(Object modelValue) ????{ ????????return modelValue == null ? null : modelValue.toString(); ????} ????@Override ????public Object getInformation(String key) ????{ ????????if (ActivitiConstants.VALUES_KEY.equals(key)) ????????{ ????????????return values; ????????} else ????????{ ????????????return null; ????????} ????} } |
?
public class CustomFormTypes extends FormTypes { ????@Override ????public AbstractFormType parseFormPropertyType(FormProperty formProperty) ????{ ????????if (ActivitiConstants.GROUP_TYPE.equals(formProperty.getType())) ????????{ ????????????Map<String, String> values = new LinkedHashMap<String, String>(); ????????????for (FormValue formValue : formProperty.getFormValues()) ????????????{ ????????????????values.put(formValue.getId(), formValue.getName()); ????????????} ????????????return new GroupFormType(values); ????????} else if (ActivitiConstants.SMART_REF_TYPE.equals(formProperty.getType())) ????????{ ????????????Map<String, String> values = new LinkedHashMap<String, String>(); ????????????for (FormValue formValue : formProperty.getFormValues()) ????????????{ ????????????????values.put(formValue.getId(), formValue.getName()); ????????????} ????????????return new SmartRefFormType(values); ????????} else ????????{ ????????????return super.parseFormPropertyType(formProperty); ????????} ? ????} } |
?
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"> <property name="formTypes"> <bean class="com.pera.dwf.web.activiti.formtype.CustomFormTypes" /> </property> <property name="customFormTypes"> <list> <bean class="org.activiti.engine.impl.form.StringFormType" /> <bean class="org.activiti.engine.impl.form.LongFormType" /> <bean class="org.activiti.engine.impl.form.DateFormType"> ????<constructor-arg value="yyyy-MM-dd" /> </bean> <bean class="org.activiti.engine.impl.form.BooleanFormType" /> <bean class="com.pera.dwf.web.activiti.formtype.GroupFormType"></bean> <bean class="com.pera.dwf.web.activiti.formtype.SmartRefFormType"></bean> </list> </property> |
?
0: ? { infos:? { 5ef89d50-95ff-4e33-8aa1-48df354c6c52:?"不合格品文档" } - fp:? { id:?"Excel1" name:?"不合格品文档" type:? { name:?"smartref" } - value:?null required:?false writable:?true readable:?true } - } |
?
标签:style blog http io ar color os 使用 sp
原文地址:http://www.cnblogs.com/shm10/p/4105245.html