Permalink
Browse files

添加了动态form演示的雏形

  • Loading branch information...
1 parent 073a50c commit 7f773b8ec6fabb7b98d9a9592b6e42e511496a9a @henryyan committed Jul 17, 2012
View
@@ -1,17 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
- <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
View
@@ -26,12 +26,12 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
- <name>org.maven.ide.eclipse.maven2Builder</name>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
@@ -5,7 +5,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
- <wb-resource deploy-path="/" source-path="/src/main/webapp"/>
+ <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
+ <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<property name="context-root" value="kft-activiti-demo"/>
<property name="java-output-path" value="/kft-activiti-demo/target/classes"/>
</wb-module>
View
@@ -210,7 +210,6 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
- <version>2.1</version>
</dependency>
<!-- GENERAL UTILS end -->
@@ -269,25 +268,6 @@
<build>
<plugins>
- <!-- 增加functional test的Source目录 -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-functional-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/test/functional</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
<!-- test插件, 设置內存/ClassLoader -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -79,7 +79,7 @@ public ProcessDefinition findProcessDefinition(String processDefinitionId) {
*/
public void deployFromClasspath(String... processKey) throws Exception {
ResourceLoader resourceLoader = new DefaultResourceLoader();
- String[] processKeys = { "leave" };
+ String[] processKeys = { "leave", "leave-dynamic-from" };
for (String loopProcessKey : processKeys) {
/*
@@ -110,7 +110,7 @@ public void deployFromClasspath(String... processKey) throws Exception {
* @throws IOException 找不到zip文件时
*/
private void deploySingleProcess(ResourceLoader resourceLoader, String processKey) throws IOException {
- String classpathResourceUrl = "classpath:/diagrams/" + processKey + "/" + processKey + ".zip";
+ String classpathResourceUrl = "classpath:/deployments/" + processKey + ".zip";
logger.debug("read workflow from: {}", classpathResourceUrl);
Resource resource = resourceLoader.getResource(classpathResourceUrl);
InputStream inputStream = resource.getInputStream();
@@ -0,0 +1,68 @@
+package me.kafeitu.demo.activiti.web.form.dynamic;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.activiti.engine.FormService;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.form.StartFormData;
+import org.activiti.engine.impl.form.StartFormDataImpl;
+import org.activiti.engine.repository.ProcessDefinition;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
+
+/**
+ * 动态FormController
+ *
+ * @author HenryYan
+ */
+@Controller
+@RequestMapping(value = "/form/dynamic")
+public class DynamicFormController {
+
+ @Autowired
+ private RepositoryService repositoryService;
+
+ @Autowired
+ private FormService formService;
+
+ /**
+ * 动态form流程列表
+ * @param model
+ * @return
+ */
+ @RequestMapping(value = { "list", "" })
+ public ModelAndView processDefinitionList(Model model) {
+ ModelAndView mav = new ModelAndView("/form/dynamic/dynamic-form-process-list");
+ List<ProcessDefinition> newResult = new ArrayList<ProcessDefinition>();
+ List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().list();
+
+ /*
+ * 只读取包含dynamic的流程
+ */
+ for (ProcessDefinition processDefinition : list) {
+ if (processDefinition.getKey().indexOf("dynamic") != -1) {
+ newResult.add(processDefinition);
+ }
+ }
+ mav.addObject("processes", newResult);
+ return mav;
+ }
+
+ /**
+ * 读取启动流程的表单字段
+ */
+ @RequestMapping(value = "get-start-form-field/{processDefinitionId}")
+ @ResponseBody
+ public StartFormData findFieldOfForm(@PathVariable("processDefinitionId") String processDefinitionId) throws Exception {
+ StartFormDataImpl startFormData = (StartFormDataImpl) formService.getStartFormData(processDefinitionId);
+ startFormData.setProcessDefinition(null);
+ return startFormData;
+ }
+
+}
Binary file not shown.
Binary file not shown.
@@ -88,14 +88,14 @@
<omgdi:waypoint x="270" y="127"></omgdi:waypoint>
<omgdi:waypoint x="270" y="190"></omgdi:waypoint>
<bpmndi:BPMNLabel>
- <omgdc:Bounds height="13" width="100" x="10" y="0"></omgdc:Bounds>
+ <omgdc:Bounds height="11" width="100" x="10" y="0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="290" y="107"></omgdi:waypoint>
<omgdi:waypoint x="358" y="107"></omgdi:waypoint>
<bpmndi:BPMNLabel>
- <omgdc:Bounds height="13" width="100" x="-24" y="-17"></omgdc:Bounds>
+ <omgdc:Bounds height="11" width="100" x="-24" y="-17"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
@@ -106,7 +106,7 @@
<omgdi:waypoint x="535" y="107"></omgdi:waypoint>
<omgdi:waypoint x="590" y="107"></omgdi:waypoint>
<bpmndi:BPMNLabel>
- <omgdc:Bounds height="13" width="100" x="-27" y="-17"></omgdc:Bounds>
+ <omgdc:Bounds height="11" width="100" x="-27" y="-17"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
@@ -118,15 +118,15 @@
<omgdi:waypoint x="514" y="217"></omgdi:waypoint>
<omgdi:waypoint x="323" y="217"></omgdi:waypoint>
<bpmndi:BPMNLabel>
- <omgdc:Bounds height="13" width="100" x="10" y="0"></omgdc:Bounds>
+ <omgdc:Bounds height="11" width="100" x="10" y="0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
<omgdi:waypoint x="250" y="300"></omgdi:waypoint>
<omgdi:waypoint x="142" y="299"></omgdi:waypoint>
<omgdi:waypoint x="142" y="135"></omgdi:waypoint>
<bpmndi:BPMNLabel>
- <omgdc:Bounds height="13" width="100" x="10" y="0"></omgdc:Bounds>
+ <omgdc:Bounds height="11" width="100" x="10" y="0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
@@ -137,7 +137,7 @@
<omgdi:waypoint x="290" y="300"></omgdi:waypoint>
<omgdi:waypoint x="625" y="300"></omgdi:waypoint>
<bpmndi:BPMNLabel>
- <omgdc:Bounds height="13" width="100" x="10" y="0"></omgdc:Bounds>
+ <omgdc:Bounds height="11" width="100" x="10" y="0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,52 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<head>
+ <%@ include file="/common/global.jsp"%>
+ <title>动态Form流程列表</title>
+ <%@ include file="/common/meta.jsp" %>
+ <%@ include file="/common/include-base-styles.jsp" %>
+ <%@ include file="/common/include-jquery-ui-theme.jsp" %>
+ <link href="${ctx }/js/common/plugins/jui/extends/timepicker/jquery-ui-timepicker-addon.css" type="text/css" rel="stylesheet" />
+
+ <script src="${ctx }/js/common/jquery.js" type="text/javascript"></script>
+ <script src="${ctx }/js/common/plugins/jui/jquery-ui.min.js" type="text/javascript"></script>
+ <script src="${ctx }/js/common/plugins/jui/extends/timepicker/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
+ <script src="${ctx }/js/common/plugins/jui/extends/i18n/jquery-ui-date_time-picker-zh-CN.js" type="text/javascript"></script>
+ <script src="${ctx }/js/common/common.js" type="text/javascript"></script>
+ <script src="${ctx }/js/module/form/dynamic/process.js?v=${timeInMillis}" type="text/javascript"></script>
+</head>
+
+<body>
+ <table width="100%" class="need-border">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>DID</th>
+ <th>名称</th>
+ <th>KEY</th>
+ <th>版本号</th>
+ <th>XML</th>
+ <th>图片</th>
+ <th>操作</th>
+ </tr>
+ </thead>
+ <tbody>
+ <c:forEach items="${processes }" var="process">
+ <tr>
+ <td class='process-id'>${process.id }</td>
+ <td>${process.deploymentId }</td>
+ <td class='process-name'>${process.name }</td>
+ <td>${process.key }</td>
+ <td>${process.version }</td>
+ <td><a target="_blank" href='${ctx }/workflow/resource/deployment?deploymentId=${process.deploymentId}&resourceName=${process.resourceName }'>${process.resourceName }</a></td>
+ <td><a target="_blank" href='${ctx }/workflow/resource/deployment?deploymentId=${process.deploymentId}&resourceName=${process.diagramResourceName }'>${process.diagramResourceName }</a></td>
+ <td><a class="startup-process">启动</a></td>
+ </tr>
+ </c:forEach>
+ </tbody>
+ </table>
+</body>
+</html>
@@ -2,7 +2,7 @@
<ul id="css3menu">
<li class="topfirst"><a rel="main/welcome">首页</a></li>
<li>
- <a rel="#">考勤模块</a>
+ <a rel="#">请假(自定义表单)</a>
<ul>
<li><a rel="oa/leave/apply">请假申请</a></li>
<li><a rel="oa/leave/list/task">请假办理</a></li>
@@ -11,6 +11,12 @@
</ul>
</li>
<li>
+ <a rel="#">动态表单</a>
+ <ul>
+ <li><a rel="form/dynamic/list">流程列表</a></li>
+ </ul>
+ </li>
+ <li>
<a rel="#">工作流</a>
<ul>
<li><a rel='workflow/process-list'>流程管理</a></li>
@@ -72,7 +72,7 @@
<session-timeout>20</session-timeout>
</session-config>
- <!-- 出错页面定义 -->
+ <!-- 出错页面定义
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/WEB-INF/views/error/500.jsp</location>
@@ -84,5 +84,5 @@
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/views/error/404.jsp</location>
- </error-page>
+ </error-page> -->
</web-app>
@@ -11,6 +11,7 @@ String themeVersion = "1.8.16";
session.setAttribute("themeName", defaultTheme);
session.setAttribute("themeVersion", themeVersion);
+pageContext.setAttribute("timeInMillis", System.currentTimeMillis());
%>
<script type="text/javascript">
var ctx = '<%=request.getContextPath() %>';
@@ -46,3 +46,6 @@ td.label {
-khtml-border-bottom-right-radius: 12px;
border-bottom-right-radius: 12px;
}
+
+/* 自动完成的loading图片 */
+.ui-loading { background: url('../images/ajax/loading.gif') right center no-repeat; padding-left: 18px;}
Oops, something went wrong.

0 comments on commit 7f773b8

Please sign in to comment.