Search in sources :

Example 11 with GraphicInfo

use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.

the class BpmnJsonConverter method createGraphicInfo.

private GraphicInfo createGraphicInfo(double x, double y) {
    GraphicInfo graphicInfo = new GraphicInfo();
    graphicInfo.setX(x);
    graphicInfo.setY(y);
    return graphicInfo;
}
Also used : GraphicInfo(org.activiti.bpmn.model.GraphicInfo)

Example 12 with GraphicInfo

use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.

the class BaseBpmnJsonConverter method createDataAssociation.

protected void createDataAssociation(DataAssociation dataAssociation, boolean incoming, Activity activity) {
    String sourceRef = null;
    String targetRef = null;
    if (incoming) {
        sourceRef = dataAssociation.getSourceRef();
        targetRef = activity.getId();
    } else {
        sourceRef = activity.getId();
        targetRef = dataAssociation.getTargetRef();
    }
    ObjectNode flowNode = BpmnJsonConverterUtil.createChildShape(dataAssociation.getId(), STENCIL_DATA_ASSOCIATION, 172, 212, 128, 212);
    ArrayNode dockersArrayNode = objectMapper.createArrayNode();
    ObjectNode dockNode = objectMapper.createObjectNode();
    dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(sourceRef).getWidth() / 2.0);
    dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(sourceRef).getHeight() / 2.0);
    dockersArrayNode.add(dockNode);
    if (model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() > 2) {
        for (int i = 1; i < model.getFlowLocationGraphicInfo(dataAssociation.getId()).size() - 1; i++) {
            GraphicInfo graphicInfo = model.getFlowLocationGraphicInfo(dataAssociation.getId()).get(i);
            dockNode = objectMapper.createObjectNode();
            dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX());
            dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY());
            dockersArrayNode.add(dockNode);
        }
    }
    dockNode = objectMapper.createObjectNode();
    dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(targetRef).getWidth() / 2.0);
    dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(targetRef).getHeight() / 2.0);
    dockersArrayNode.add(dockNode);
    flowNode.put("dockers", dockersArrayNode);
    ArrayNode outgoingArrayNode = objectMapper.createArrayNode();
    outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(targetRef));
    flowNode.put("outgoing", outgoingArrayNode);
    flowNode.put("target", BpmnJsonConverterUtil.createResourceNode(targetRef));
    ObjectNode propertiesNode = objectMapper.createObjectNode();
    propertiesNode.put(PROPERTY_OVERRIDE_ID, dataAssociation.getId());
    flowNode.put(EDITOR_SHAPE_PROPERTIES, propertiesNode);
    shapesArrayNode.add(flowNode);
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) GraphicInfo(org.activiti.bpmn.model.GraphicInfo) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)

Example 13 with GraphicInfo

use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.

the class BoundaryEventJsonConverter method convertElementToJson.

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.put("dockers", dockersArrayNode);
    propertiesNode.put(PROPERTY_CANCEL_ACTIVITY, boundaryEvent.isCancelActivity());
    addEventProperties(boundaryEvent, propertiesNode);
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) GraphicInfo(org.activiti.bpmn.model.GraphicInfo) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)

Example 14 with GraphicInfo

use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.

the class SubProcessJsonConverter method convertElementToJson.

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, graphicInfo.getX(), graphicInfo.getY());
    flowElementNode.put("childShapes", subProcessShapesArrayNode);
    if (subProcess instanceof Transaction) {
        propertiesNode.put("istransaction", true);
    }
    BpmnJsonConverterUtil.convertDataPropertiesToJson(subProcess.getDataObjects(), propertiesNode);
}
Also used : SubProcess(org.activiti.bpmn.model.SubProcess) Transaction(org.activiti.bpmn.model.Transaction) GraphicInfo(org.activiti.bpmn.model.GraphicInfo) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)

Example 15 with GraphicInfo

use of org.activiti.bpmn.model.GraphicInfo in project Activiti by Activiti.

the class BpmnAutoLayout method createDiagramInterchangeInformation.

protected void createDiagramInterchangeInformation(BaseElement element, List<mxPoint> waypoints) {
    List<GraphicInfo> graphicInfoForWaypoints = new ArrayList<GraphicInfo>();
    for (mxPoint waypoint : waypoints) {
        GraphicInfo graphicInfo = new GraphicInfo();
        graphicInfo.setElement(element);
        graphicInfo.setX(waypoint.getX());
        graphicInfo.setY(waypoint.getY());
        graphicInfoForWaypoints.add(graphicInfo);
    }
    bpmnModel.addFlowGraphicInfoList(element.getId(), graphicInfoForWaypoints);
}
Also used : ArrayList(java.util.ArrayList) GraphicInfo(org.activiti.bpmn.model.GraphicInfo) com.mxgraph.util.mxPoint(com.mxgraph.util.mxPoint)

Aggregations

GraphicInfo (org.activiti.bpmn.model.GraphicInfo)30 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)10 SubProcess (org.activiti.bpmn.model.SubProcess)10 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)8 FlowElement (org.activiti.bpmn.model.FlowElement)7 ArrayList (java.util.ArrayList)6 SequenceFlow (org.activiti.bpmn.model.SequenceFlow)6 EventSubProcess (org.activiti.bpmn.model.EventSubProcess)4 FlowNode (org.activiti.bpmn.model.FlowNode)4 MessageFlow (org.activiti.bpmn.model.MessageFlow)4 Process (org.activiti.bpmn.model.Process)4 Activity (org.activiti.bpmn.model.Activity)3 Artifact (org.activiti.bpmn.model.Artifact)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ExternalResource (com.vaadin.terminal.ExternalResource)2 StreamResource (com.vaadin.terminal.StreamResource)2 Embedded (com.vaadin.ui.Embedded)2 HorizontalLayout (com.vaadin.ui.HorizontalLayout)2 Label (com.vaadin.ui.Label)2 Panel (com.vaadin.ui.Panel)2