public void createBPMNEdge(String key, List<GraphicInfo> graphicList) { FlowElement flowElement = bpmnModel.getFlowElement(key); if (flowElement instanceof SequenceFlow) { SequenceFlow sequenceFlow = (SequenceFlow) flowElement; List<Integer> waypoints = new ArrayList<Integer>(); for (GraphicInfo waypointInfo : graphicList) { waypoints.add((int) waypointInfo.getX()); waypoints.add((int) waypointInfo.getY()); } sequenceFlow.setWaypoints(waypoints); } else if (bpmnModel.getArtifact(key) != null) { // it's an association, so nothing to do } else { LOGGER.warn("Invalid reference in 'bpmnElement' attribute, sequenceFlow " + key + " not found"); } }
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) { SubProcess subProcess = (SubProcess) baseElement; propertiesNode.put("activitytype", "Event-Sub-Process"); propertiesNode.put("subprocesstype", "Embedded"); ArrayNode subProcessShapesArrayNode = objectMapper.createArrayNode(); GraphicInfo graphicInfo = model.getGraphicInfo(subProcess.getId()); processor.processFlowElements(subProcess, model, subProcessShapesArrayNode, formKeyMap, decisionTableKeyMap, graphicInfo.getX(), graphicInfo.getY()); flowElementNode.set("childShapes", subProcessShapesArrayNode); }
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) { BoundaryEvent boundaryEvent = (BoundaryEvent) baseElement; ArrayNode dockersArrayNode = objectMapper.createArrayNode(); ObjectNode dockNode = objectMapper.createObjectNode(); GraphicInfo graphicInfo = model.getGraphicInfo(boundaryEvent.getId()); GraphicInfo parentGraphicInfo = model.getGraphicInfo(boundaryEvent.getAttachedToRef().getId()); dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX() - parentGraphicInfo.getX()); dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY() - parentGraphicInfo.getY()); dockersArrayNode.add(dockNode); flowElementNode.set("dockers", dockersArrayNode); propertiesNode.put(PROPERTY_CANCEL_ACTIVITY, boundaryEvent.isCancelActivity()); addEventProperties(boundaryEvent, propertiesNode); }
public void drawTask(TaskIconType icon, String id, String name, GraphicInfo graphicInfo) { drawTask(id, name, graphicInfo); icon.drawIcon((int) graphicInfo.getX(), (int) graphicInfo.getY(), ICON_PADDING, g); }
protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) { SubProcess subProcess = (SubProcess) baseElement; propertiesNode.put("activitytype", "Sub-Process"); propertiesNode.put("subprocesstype", "Embedded"); ArrayNode subProcessShapesArrayNode = objectMapper.createArrayNode(); GraphicInfo graphicInfo = model.getGraphicInfo(subProcess.getId()); processor.processFlowElements(subProcess, model, subProcessShapesArrayNode, formKeyMap, decisionTableKeyMap, graphicInfo.getX(), graphicInfo.getY()); flowElementNode.set("childShapes", subProcessShapesArrayNode); if (subProcess instanceof Transaction) { propertiesNode.put("istransaction", true); } BpmnJsonConverterUtil.convertDataPropertiesToJson(subProcess.getDataObjects(), propertiesNode); }
private static void drawHighLight(DefaultProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) { processDiagramCanvas.drawHighLight((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight()); }
private Polyline2D createRectangle(GraphicInfo graphicInfo) { Polyline2D rectangle = new Polyline2D(new Point2D(graphicInfo.getX(), graphicInfo.getY()), new Point2D(graphicInfo.getX() + graphicInfo.getWidth(), graphicInfo.getY()), new Point2D(graphicInfo.getX() + graphicInfo.getWidth(), graphicInfo.getY() + graphicInfo.getHeight()), new Point2D(graphicInfo.getX(), graphicInfo.getY() + graphicInfo.getHeight()), new Point2D(graphicInfo.getX(), graphicInfo.getY())); return rectangle; }
protected void translateNestedSubprocessElements(SubProcess subProcess) { GraphicInfo subProcessGraphicInfo = bpmnModel.getLocationMap().get(subProcess.getId()); double subProcessX = subProcessGraphicInfo.getX(); double subProcessY = subProcessGraphicInfo.getY(); List<SubProcess> nestedSubProcesses = new ArrayList<SubProcess>(); for (FlowElement flowElement : subProcess.getFlowElements()) { if (flowElement instanceof SequenceFlow) { List<GraphicInfo> graphicInfos = bpmnModel.getFlowLocationMap().get(flowElement.getId()); for (GraphicInfo graphicInfo : graphicInfos) { graphicInfo.setX(graphicInfo.getX() + subProcessX + subProcessMargin); graphicInfo.setY(graphicInfo.getY() + subProcessY + subProcessMargin); } } else if (flowElement instanceof DataObject == false) { // Regular element GraphicInfo graphicInfo = bpmnModel.getLocationMap().get(flowElement.getId()); graphicInfo.setX(graphicInfo.getX() + subProcessX + subProcessMargin); graphicInfo.setY(graphicInfo.getY() + subProcessY + subProcessMargin); } if (flowElement instanceof SubProcess) { nestedSubProcesses.add((SubProcess) flowElement); } } // Continue for next level of nested subprocesses for (SubProcess nestedSubProcess : nestedSubProcesses) { translateNestedSubprocessElements(nestedSubProcess); } }
public void drawErrorStartEvent(String id, GraphicInfo graphicInfo) { drawNoneStartEvent(id, graphicInfo); int imageX = (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)); int imageY = (int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)); ERROR_THROW_IMAGE.drawIcon(imageX, imageY, ICON_PADDING, g); }
public void drawErrorEndEvent(String id, String name, GraphicInfo graphicInfo) { drawNoneEndEvent(id, name, graphicInfo); int imageX = (int) (graphicInfo.getX() + (graphicInfo.getWidth() / 4)); int imageY = (int) (graphicInfo.getY() + (graphicInfo.getHeight() / 4)); ERROR_THROW_IMAGE.drawIcon(imageX, imageY, ICON_PADDING, g); }
dockNode = objectMapper.createObjectNode(); dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX()); dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY()); dockersArrayNode.add(dockNode);
GraphicInfo graphicInfo) { int x = (int) graphicInfo.getX(); int y = (int) graphicInfo.getY(); int width = (int) graphicInfo.getWidth(); int height = (int) graphicInfo.getHeight();
public void drawGateway(GraphicInfo graphicInfo) { Polygon rhombus = new Polygon(); int x = (int) graphicInfo.getX(); int y = (int) graphicInfo.getY(); int width = (int) graphicInfo.getWidth(); int height = (int) graphicInfo.getHeight(); rhombus.addPoint(x, y + (height / 2)); rhombus.addPoint(x + (width / 2), y + height); rhombus.addPoint(x + width, y + (height / 2)); rhombus.addPoint(x + (width / 2), y); g.draw(rhombus); }
private Polyline2D createGateway(GraphicInfo graphicInfo) { double middleX = graphicInfo.getX() + (graphicInfo.getWidth() / 2); double middleY = graphicInfo.getY() + (graphicInfo.getHeight() / 2); Polyline2D gatewayRectangle = new Polyline2D(new Point2D(graphicInfo.getX(), middleY), new Point2D(middleX, graphicInfo.getY()), new Point2D(graphicInfo.getX() + graphicInfo.getWidth(), middleY), new Point2D(middleX, graphicInfo.getY() + graphicInfo.getHeight()), new Point2D(graphicInfo.getX(), middleY)); return gatewayRectangle; }
public void drawStartEvent(String id, GraphicInfo graphicInfo, IconType icon) { Paint originalPaint = g.getPaint(); g.setPaint(EVENT_COLOR); Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight()); g.fill(circle); g.setPaint(EVENT_BORDER_COLOR); g.draw(circle); g.setPaint(originalPaint); // calculate coordinates to center image if (icon != null) { int imageX = (int) Math.round(graphicInfo.getX() + (graphicInfo.getWidth() / 2) - (icon.getWidth() / 2)); int imageY = (int) Math.round(graphicInfo.getY() + (graphicInfo.getHeight() / 2) - (icon.getHeight() / 2)); icon.drawIcon(imageX, imageY, ICON_PADDING, g); } // set element's id g.setCurrentGroupId(id); }
public void drawParallelGateway(String id, GraphicInfo graphicInfo) { // rhombus drawGateway(graphicInfo); int x = (int) graphicInfo.getX(); int y = (int) graphicInfo.getY(); int width = (int) graphicInfo.getWidth(); int height = (int) graphicInfo.getHeight(); // plus inside rhombus Stroke orginalStroke = g.getStroke(); g.setStroke(GATEWAY_TYPE_STROKE); Line2D.Double line = new Line2D.Double(x + 10, y + height / 2, x + width - 10, y + height / 2); // horizontal g.draw(line); line = new Line2D.Double(x + width / 2, y + height - 10, x + width / 2, y + 10); // vertical g.draw(line); g.setStroke(orginalStroke); // set element's id g.setCurrentGroupId(id); }
public void drawExclusiveGateway(String id, GraphicInfo graphicInfo) { // rhombus drawGateway(graphicInfo); int x = (int) graphicInfo.getX(); int y = (int) graphicInfo.getY(); int width = (int) graphicInfo.getWidth(); int height = (int) graphicInfo.getHeight(); int quarterWidth = width / 4; int quarterHeight = height / 4; // X inside rhombus Stroke orginalStroke = g.getStroke(); g.setStroke(GATEWAY_TYPE_STROKE); Line2D.Double line = new Line2D.Double(x + quarterWidth + 3, y + quarterHeight + 3, x + 3 * quarterWidth - 3, y + 3 * quarterHeight - 3); g.draw(line); line = new Line2D.Double(x + quarterWidth + 3, y + 3 * quarterHeight - 3, x + 3 * quarterWidth - 3, y + quarterHeight + 3); g.draw(line); g.setStroke(orginalStroke); // set element's id g.setCurrentGroupId(id); }
public void drawInclusiveGateway(String id, GraphicInfo graphicInfo) { // rhombus drawGateway(graphicInfo); int x = (int) graphicInfo.getX(); int y = (int) graphicInfo.getY(); int width = (int) graphicInfo.getWidth(); int height = (int) graphicInfo.getHeight(); int diameter = width / 2; // circle inside rhombus Stroke orginalStroke = g.getStroke(); g.setStroke(GATEWAY_TYPE_STROKE); Ellipse2D.Double circle = new Ellipse2D.Double(((width - diameter) / 2) + x, ((height - diameter) / 2) + y, diameter, diameter); g.draw(circle); g.setStroke(orginalStroke); // set element's id g.setCurrentGroupId(id); }
public void drawNoneEndEvent(String id, String name, GraphicInfo graphicInfo) { Paint originalPaint = g.getPaint(); Stroke originalStroke = g.getStroke(); g.setPaint(EVENT_COLOR); Ellipse2D circle = new Ellipse2D.Double(graphicInfo.getX(), graphicInfo.getY(), graphicInfo.getWidth(), graphicInfo.getHeight()); g.fill(circle); g.setPaint(EVENT_BORDER_COLOR); g.setStroke(END_EVENT_STROKE); g.draw(circle); g.setStroke(originalStroke); g.setPaint(originalPaint); // set element's id g.setCurrentGroupId(id); drawLabel(name, graphicInfo); }
int y = (int) graphicInfo.getY(); int width = (int) graphicInfo.getWidth(); int height = (int) graphicInfo.getHeight();