package com.pointlion.mvc.admin.oa.workflow.flowimg.img;
import com.jfinal.log.Log;
import org.flowable.bpmn.model.AssociationDirection;
import org.flowable.bpmn.model.GraphicInfo;
import org.flowable.image.exception.FlowableImageException;
import org.flowable.image.util.ReflectUtil;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.awt.geom.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: CustomProcessDiagramCanvas
* @Author: liyang
* @Date: 2019/10/15 0015 9:55
* @Version 1.0
*/
public class CustomProcessDiagramCanvas {
private static final Log LOG = Log.getLog(CustomProcessDiagramCanvas.class);
/**
* 形状类型:长方形、菱形、椭圆
*/
public enum SHAPE_TYPE {
Rectangle, Rhombus, Ellipse
}
// Predefined sized
protected static final int ARROW_WIDTH = 5;
protected static final int CONDITIONAL_INDICATOR_WIDTH = 16;
protected static final int DEFAULT_INDICATOR_WIDTH = 10;
protected static final int MARKER_WIDTH = 12;
protected static final int FONT_SIZE = 11;
protected static final int FONT_SPACING = 2;
protected static final int TEXT_PADDING = 3;
protected static final int ANNOTATION_TEXT_PADDING = 7;
protected static final int LINE_HEIGHT = FONT_SIZE + FONT_SPACING;
// Colors
protected static Color TASK_BOX_COLOR = new Color(249, 249, 249);
protected static Color SUBPROCESS_BOX_COLOR = new Color(255, 255, 255);
protected static Color EVENT_COLOR = new Color(255, 255, 255);
protected static Color CONNECTION_COLOR = new Color(88, 88, 88);
protected static Color CONDITIONAL_INDICATOR_COLOR = new Color(255, 255, 255);
protected static Color RUNNING_HIGHLIGHT_COLOR = Color.RED;
protected static Color HIGHLIGHT_COLOR = Color.GREEN;
protected static Color LABEL_COLOR = new Color(112, 146, 190);
// protected static Color LABEL_COLOR = Color.blue;
protected static Color TASK_BORDER_COLOR = new Color(187, 187, 187);
protected static Color EVENT_BORDER_COLOR = new Color(88, 88, 88);
protected static Color SUBPROCESS_BORDER_COLOR = new Color(0, 0, 0);
// Fonts
protected static Font LABEL_FONT = new Font("微软雅黑", Font.ITALIC, 11);
protected static Font ANNOTATION_FONT = new Font("Arial", Font.PLAIN, FONT_SIZE);
protected static Font TASK_FONT = new Font("Arial", Font.PLAIN, FONT_SIZE);
// Strokes
//TODO 边框宽度修改
//protected static Stroke THICK_TASK_BORDER_STROKE = new BasicStroke(3.0f);
protected static Stroke THICK_TASK_BORDER_STROKE = new BasicStroke(2.0f);
protected static Stroke GATEWAY_TYPE_STROKE = new BasicStroke(3.0f);
protected static Stroke END_EVENT_STROKE = new BasicStroke(3.0f);
protected static Stroke MULTI_INSTANCE_STROKE = new BasicStroke(1.3f);
protected static Stroke EVENT_SUBPROCESS_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, new float[]{1.0f}, 0.0f);
protected static Stroke NON_INTERRUPTING_EVENT_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, new float[]{4.0f, 3.0f}, 0.0f);
protected static Stroke HIGHLIGHT_FLOW_STROKE = new BasicStroke(1.3f);
protected static Stroke ANNOTATION_STROKE = new BasicStroke(2.0f);
protected static Stroke ASSOCIATION_STROKE = new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, new float[]{2.0f, 2.0f}, 0.0f);
// icons
protected static int ICON_PADDING = 5;
protected static BufferedImage USERTASK_IMAGE;
protected static BufferedImage SCRIPTTASK_IMAGE;
protected static BufferedImage SERVICETASK_IMAGE;
protected static BufferedImage RECEIVETASK_IMAGE;
protected static BufferedImage SENDTASK_IMAGE;
protected static BufferedImage MANUALTASK_IMAGE;
protected static BufferedImage BUSINESS_RULE_TASK_IMAGE;
protected static BufferedImage SHELL_TASK_IMAGE;
protected static BufferedImage MULE_TASK_IMAGE;
protected static BufferedImage CAMEL_TASK_IMAGE;
protected static BufferedImage TIMER_IMAGE;
protected static BufferedImage COMPENSATE_THROW_IMAGE;
protected static BufferedImage COMPENSATE_CATCH_IMAGE;
protected static BufferedImage ERROR_THROW_IMAGE;
protected static BufferedImage ERROR_CATCH_IMAGE;
protected static BufferedImage MESSAGE_THROW_IMAGE;
protected static BufferedImage MESSAGE_CATCH_IMAGE;
protected static BufferedImage SIGNAL_CATCH_IMAGE;
protected static BufferedImage SIGNAL_THROW_IMAGE;
protected int canvasWidth = -1;
protected int canvasHeight = -1;
protected int minX = -1;
protected int minY = -1;
protected BufferedImage processDiagram;
protected Graphics2D g;
protected FontMetrics fontMetrics;
protected boolean closed;
protected ClassLoader customClassLoader;
protected String activityFontName = "Arial";
protected String labelFontName = "Arial";
/**
* Creates an empty canvas with given width and height. Allows to specify minimal boundaries on the left and upper side of the canvas. This is useful for diagrams that have
* white space there. Everything beneath these minimum values will be cropped. It's also possible to pass a specific font name and a class loader for the icon images.
*/
public CustomProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType, String activityFontName, String labelFontName, ClassLoader customClassLoader) {
this.canvasWidth = width;
this.canvasHeight = height;
this.minX = minX;
this.minY = minY;
if (activityFontName != null) {
this.activityFontName = activityFontName;
}
if (labelFontName != null) {
this.labelFontName = labelFontName;
}
this.customClassLoader = customClassLoader;
initialize(imageType);
}
/**
* Creates an empty canvas with given width and height. Allows to specify minimal boundaries on the left and upper side of the canvas. This is useful for diagrams that have
* white space there (eg Signavio). Everything beneath these minimum values will be cropped.
*
* @param minX Hint that will be used when generating the image. Parts that fall below minX on the horizontal scale will be cropped.
* @param minY Hint that will be used when generating the image. Parts that fall below minX on the horizontal scale will be cropped.
*/
public CustomProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType) {
this.canvasWidth = width;
this.canvasHeight = height;
this.minX = minX;
this.minY = minY;
initialize(imageType);
}
public void initialize(String imageType) {
if ("png".equalsIgnoreCase(imageType)) {
this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_ARGB);
} else {
this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);
}
this.g = processDiagram.createGraphics();
if ("png".equalsIgnoreCase(imageType) == false) {
this.g.setBackground(new Color(255, 255, 255, 0));
this.g.clearRect(0, 0, canvasWidth, canvasHeight);
}
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setPaint(Color.black);
Font font = new Font(activityFontName, Font.BOLD, FONT_SIZE);
g.setFont(font);
this.fontMetrics = g.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
JFinalOA 是基于 JFinal 框架开发的企业办公系统。项目主要提供办公系统的开发人员提供一套带有基本系统管理以及流程管理的开发平台,为办公常用申请部分解决方案。可快速开发办公常用的各类流程功能。选用的技术框架基本都是简单易上手的,方便自己用来做办公类项目,以及其他类型小项目都会比较方便。
资源推荐
资源详情
资源评论
收起资源包目录
JFinalOA 是基于 JFinal 框架开发的企业办公系统 (2000个子文件)
weather-icons-wind.css 142KB
bootstrap.css 124KB
bootstrap.css 124KB
weather-icons-wind.min.css 124KB
bootstrap.css 118KB
bootstrap.min.css 104KB
bootstrap.min.css 98KB
animate.css 71KB
ionicons.css 56KB
animate.min.css 52KB
ionicons.min.css 50KB
flag-icon.css 37KB
font-awesome.css 37KB
style.css 34KB
flag-icon.min.css 33KB
style.css 31KB
font-awesome.min.css 30KB
weather-icons.css 30KB
jquery.treetable.theme.default.css 29KB
style.min.css 29KB
style.min.css 26KB
weather-icons.min.css 26KB
bootstrap-datepicker.css 26KB
style-common.css 25KB
bootstrap-table-group-by.css 24KB
spinkit.css 23KB
bootstrap-datepicker.min.css 23KB
bootstrap-responsive.css 22KB
bootstrap-responsive.css 22KB
bootstrap-editable.css 21KB
select2.css 20KB
jquery-ui.css 20KB
css-loaders.css 17KB
select2.min.css 17KB
jquery-ui.min.css 17KB
bootstrap-responsive.min.css 16KB
dataTables.jqueryui.css 16KB
themify-icons.css 16KB
jquery.dataTables.css 16KB
spinkit.min.css 15KB
bootstrap-theme.css 15KB
chosen.css 14KB
dataTables.jqueryui.min.css 14KB
jquery.dataTables_themeroller.css 14KB
jquery.dataTables.min.css 14KB
summernote.min.css 14KB
summernote.css 14KB
themify-icons.min.css 14KB
common.css 13KB
bootstrap-theme.min.css 13KB
bootstrapSwitch.css 12KB
bootstrap-datetimepicker.css 12KB
chosen.min.css 12KB
dataTables.jqueryui.css 11KB
bootstrap-datetimepicker.min.css 11KB
shCore.css 10KB
style-editor.css 10KB
bootstrap-select.css 9KB
awesome.css 8KB
style.css 8KB
ng-grid-2.0.7.min.css 7KB
bootstrap-glyphicons.css 7KB
bootstrap-table.css 7KB
bootstrap-select.min.css 7KB
demo.css 7KB
metroStyle.css 6KB
nouislider.css 6KB
jasmine.css 6KB
load5.css 6KB
zTreeStyle.css 6KB
bootstrap-table.min.css 6KB
nestable-list.css 6KB
footable.standalone.css 6KB
footable.core.css 6KB
daterangepicker-bs3.css 5KB
dataTables.bootstrap4.css 5KB
styles.css 5KB
footable.standalone.min.css 5KB
nouislider.min.css 5KB
dataTables.bootstrap.css 5KB
dataTables.bootstrap4.min.css 5KB
footable.core.min.css 5KB
dataTables.foundation.css 5KB
nestable-list.min.css 4KB
dataTables.bootstrap.css 4KB
8-circle.css 4KB
10-fading-circle.css 4KB
dataTables.bootstrap.min.css 4KB
dataTables.uikit.css 4KB
footable.metro.css 4KB
dataTables.uikit.min.css 3KB
footable.metro.min.css 3KB
jquery.nouislider.css 3KB
dataTables.foundation.css 3KB
editor.css 3KB
dataTables.semanticui.css 3KB
load4.css 3KB
zTreeStyleForApi.css 3KB
magic-check.css 3KB
11-folding-cube.css 3KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6828
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功