activiti6.0实现流程图片自定义颜色当前任务为红色,走过的任务为绿色,连线文字显示

更新时间:2023-05-21 11:50:30 阅读: 评论:0

activiti6.0实现流程图⽚⾃定义颜⾊当前任务为红⾊,⾛过的任
务为绿⾊,连线⽂字显⽰
没有测试过⼦流程是否显⽰正确
需要重写图⽚⽣产代码
import org.del.AssociationDirection;
import org.del.GraphicInfo;
import org.activiti.image.impl.DefaultProcessDiagramCanvas;
import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import Rectangle2D;
import RoundRectangle2D;
import java.awt.image.BufferedImage;
AttributedCharacterIterator;
房屋买卖合同模板
AttributedString;
public class CFProcessDiagramCanvasExt extends DefaultProcessDiagramCanvas {
//定义连线颜⾊为蓝⾊
protected static Color HIGHLIGHT_SequenceFlow_COLOR = ;
public CFProcessDiagramCanvasExt(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, String annotatio        super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
}
/**
* 重写绘制连线的⽅式,设置绘制颜⾊
*/
@Override
public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault, String connectionType, AssociationDirection associationDirection,        Paint originalPaint = Paint();
Stroke originalStroke = Stroke();
if (connectionType.equals("association")) {
} el if (highLighted) {
}
for (int i = 1; i < xPoints.length; ++i) {
Integer sourceX = xPoints[i - 1];
Integer sourceY = yPoints[i - 1];
Integer targetX = xPoints[i];
Integer targetY = yPoints[i];
Line2D.Double line = new Line2D.Double((double) sourceX, (double) sourceY, (double) targetX, (double) targetY);
}
不的英语怎么说Line2D.Double line;
if (isDefault) {
line = new Line2D.Double((double) xPoints[0], (double) yPoints[0], (double) xPoints[1], (double) yPoints[1]);
this.drawDefaultSequenceFlowIndicator(line, scaleFactor);
}
if (conditional) {
line = new Line2D.Double((double) xPoints[0], (double) yPoints[0], (double) xPoints[1], (double) yPoints[1]);
this.drawConditionalSequenceFlowIndicator(line, scaleFactor);
}
if (associationDirection.equals(AssociationDirection.ONE) || associationDirection.equals(AssociationDirection.BOTH)) {
line = new Line2D.Double((double) xPoints[xPoints.length - 2], (double) yPoints[xPoints.length - 2], (double) xPoints[xPoints.length - 1], (do            this.drawArrowHead(line, scaleFactor);
}
if (associationDirection.equals(AssociationDirection.BOTH)) {
line = new Line2D.Double((double) xPoints[1], (double) yPoints[1], (double) xPoints[0], (double) yPoints[0]);
this.drawArrowHead(line, scaleFactor);
}
}
@Override
public void drawHighLight(int x, int y, int width, int height) {
Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke();
RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);        draw(rect);
}
public void drawHighLight(int x, int y, int width, int height, Color color) {
Paint originalPaint = g.getPaint();
Stroke originalStroke = g.getStroke();
RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 20, 20);        draw(rect);
}
@Override
public void drawLabel(String text, GraphicInfo graphicInfo, boolean centered) {
float interline = 1.0f;
// text
if (text != null && text.length() > 0) {
Paint originalPaint = g.getPaint();
Font originalFont = g.getFont();
g.tPaint(Color.BLACK);
LABEL_FONT = new Font(labelFontName, Font.ITALIC, 12);
g.tFont(LABEL_FONT);
int wrapWidth = 200;
int textY = (int) Y();
// TODO: u drawMultilineText()
AttributedString as = new AttributedString(text);
as.addAttribute(TextAttribute.FOREGROUND, g.getPaint());
as.addAttribute(TextAttribute.FONT, g.getFont());
AttributedCharacterIterator aci = as.getIterator();
FontRenderContext frc = new FontRenderContext(null, true, fal);
LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc);
while (Position() < text.length()) {
TextLayout tl = Layout(wrapWidth);
textY += tl.getAscent();
Rectangle2D bb = tl.getBounds();
double tX = X();
if (centered) {
tX += (int) (Width() / 2 - bb.getWidth() / 2);
}
tl.draw(g, (float) tX, textY);
textY += tl.getDescent() + tl.getLeading() + (interline - 1.0f) * tl.getAscent();
}
/
/ restore originals
g.tFont(originalFont);
g.tPaint(originalPaint);
}
}
}
import org.del.*;
import org.del.Process;
import org.activiti.image.impl.DefaultProcessDiagramCanvas;
import org.activiti.image.impl.DefaultProcessDiagramGenerator;
天麻丸
import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import Rectangle2D;
import java.io.InputStream;
AttributedCharacterIterator;
AttributedString;
import java.util.Collections;
import java.util.List;
public class ProcessDiagramGenarateExt extends DefaultProcessDiagramGenerator {
public InputStream generateDiagram(boolean end,BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, List<String> highLightedFlow                                        String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor) {
return generateProcessDiagram(end,bpmnModel, imageType, highLightedActivities, highLightedFlows,
当之无愧的拼音activityFontName, labelFontName, annotationFontName, customClassLoader, scaleFactor).generateImage(imageType);
}
public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, String activityFontName,
String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor) {
return generateDiagram(bpmnModel, imageType, Collections.<String>emptyList(), Collections.<Strin
g>emptyList(),
activityFontName, labelFontName, annotationFontName, customClassLoader, scaleFactor);
}
public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities, List<String> highLightedFlows,
String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor) {
return generateProcessDiagram(bpmnModel, imageType, highLightedActivities, highLightedFlows,
activityFontName, labelFontName, annotationFontName, customClassLoader, scaleFactor).generateImage(imageType);
}
protected DefaultProcessDiagramCanvas generateProcessDiagram(BpmnModel bpmnModel, String imageType,
List<String> highLightedActivities, List<String> highLightedFlows,
String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader, double s
prepareBpmnModel(bpmnModel);
DefaultProcessDiagramCanvas processDiagramCanvas = initProcessDiagramCanvas(bpmnModel, imageType, activityFontName, labelFontName, annotatio
// Draw pool shape, if process is participant in collaboration
for (Pool pool : Pools()) {
GraphicInfo graphicInfo = Id());
processDiagramCanvas.Name(), graphicInfo);
}
// Draw lanes
for (Process process : Process()) {
for (Lane lane : Lanes()) {
GraphicInfo graphicInfo = Id());
processDiagramCanvas.Name(), graphicInfo);
}
}
// Draw activities and their quence-flows
// Draw activities and their quence-flows
for (FlowNode flowNode : Process().get(0).findFlowElementsOfType(FlowNode.class)) {
drawActivity(processDiagramCanvas, bpmnModel, flowNode, highLightedActivities, highLightedFlows, scaleFactor);
}
for (Process process: Process()) {
廉洁从业若干规定for (FlowNode flowNode : process.findFlowElementsOfType(FlowNode.class)) {
drawActivity(processDiagramCanvas, bpmnModel, flowNode, highLightedActivities, highLightedFlows, scaleFactor);
}
}
// Draw artifacts
for (Process process : Process()) {
for (Artifact artifact : Artifacts()) {
drawArtifact(processDiagramCanvas, bpmnModel, artifact);
}
List<SubProcess> subProcess = process.findFlowElementsOfType(SubProcess.class, true);
因式分解练习题if (subProcess != null) {
for (SubProcess subProcess : subProcess) {
for (Artifact subProcessArtifact : Artifacts()) {
drawArtifact(processDiagramCanvas, bpmnModel, subProcessArtifact);
}
}
}
}
return processDiagramCanvas;
}
/
/@Override
protected DefaultProcessDiagramCanvas generateProcessDiagram(boolean end,BpmnModel bpmnModel, String imageType, List<String> highLightedActivities        this.prepareBpmnModel(bpmnModel);
DefaultProcessDiagramCanvas processDiagramCanvas = initProcessDiagramCanvas(bpmnModel, imageType, activityFontName, labelFontName, annotatio        // Draw pool shape, if process is participant in collaboration
for (Pool pool : Pools()) {
GraphicInfo graphicInfo = Id());面试问题回答
怀不上孩子怎么办
processDiagramCanvas.Name(), graphicInfo);
}
// Draw lanes
for (Process process : Process()) {
for (Lane lane : Lanes()) {
GraphicInfo graphicInfo = Id());
processDiagramCanvas.Name(), graphicInfo);
}
}
// Draw activities and their quence-flows
for (FlowNode flowNode : Process().get(0).findFlowElementsOfType(FlowNode.class)) {
drawActivity(processDiagramCanvas, bpmnModel, flowNode, highLightedActivities, highLightedFlows, scaleFactor);
}
for (Process process : Process()) {
for (FlowNode flowNode : process.findFlowElementsOfType(FlowNode.class)) {
drawActivity(processDiagramCanvas, bpmnModel, flowNode, highLightedActivities, highLightedFlows, scaleFactor);
}
}
// Draw artifacts
for (Process process : Process()) {
for (Artifact artifact : Artifacts()) {
drawArtifact(processDiagramCanvas, bpmnModel, artifact);

本文发布于:2023-05-21 11:50:30,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/921825.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:连线   定义   重写   绘制   测试   流程
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图