public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception { String id = xtr.getAttributeValue(null, ATTRIBUTE_DI_BPMNELEMENT); GraphicInfo graphicInfo = new GraphicInfo(); String strIsExpanded = xtr.getAttributeValue(null, ATTRIBUTE_DI_IS_EXPANDED); if ("true".equalsIgnoreCase(strIsExpanded)) { graphicInfo.setExpanded(true); } else if ("false".equalsIgnoreCase(strIsExpanded)) { graphicInfo.setExpanded(false); } BpmnXMLUtil.addXMLLocation(graphicInfo, xtr); while (xtr.hasNext()) { xtr.next(); if (xtr.isStartElement() && ELEMENT_DI_BOUNDS.equalsIgnoreCase(xtr.getLocalName())) { graphicInfo.setX(Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_X))); graphicInfo.setY(Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_Y))); graphicInfo.setWidth(Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_WIDTH))); graphicInfo.setHeight(Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_HEIGHT))); model.addGraphicInfo(id, graphicInfo); break; } else if (xtr.isEndElement() && ELEMENT_DI_SHAPE.equalsIgnoreCase(xtr.getLocalName())) { break; } } }
protected void generateActivityDiagramInterchangeElements() { for (String flowElementId : generatedVertices.keySet()) { Object vertex = generatedVertices.get(flowElementId); mxCellState cellState = graph.getView().getState(vertex); GraphicInfo subProcessGraphicInfo = createDiagramInterchangeInformation(handledFlowElements.get(flowElementId), (int) cellState.getX(), (int) cellState.getY(), (int) cellState.getWidth(), (int) cellState.getHeight()); // The DI for the elements of a subprocess are generated without knowledge of the rest of the graph // So we must translate all it's elements with the x and y of the subprocess itself if (handledFlowElements.get(flowElementId) instanceof SubProcess) { // Always expanded when auto layouting subProcessGraphicInfo.setExpanded(true); } } }
@Override protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap) { SubProcess subProcess = null; if (getPropertyValueAsBoolean("istransaction", elementNode)) { subProcess = new Transaction(); } else { subProcess = new SubProcess(); } JsonNode childShapesArray = elementNode.get(EDITOR_CHILD_SHAPES); processor.processJsonElements(childShapesArray, modelNode, subProcess, shapeMap, formMap, decisionTableMap, model); JsonNode processDataPropertiesNode = elementNode.get(EDITOR_SHAPE_PROPERTIES).get(PROPERTY_DATA_PROPERTIES); if (processDataPropertiesNode != null) { List<ValuedDataObject> dataObjects = BpmnJsonConverterUtil.convertJsonToDataProperties(processDataPropertiesNode, subProcess); subProcess.setDataObjects(dataObjects); subProcess.getFlowElements().addAll(dataObjects); } //store correct convertion info... if (STENCIL_COLLAPSED_SUB_PROCESS.equals(BpmnJsonConverterUtil.getStencilId(elementNode))) { GraphicInfo graphicInfo = model.getGraphicInfo(BpmnJsonConverterUtil.getElementId(elementNode)); graphicInfo.setExpanded(false); //default is null! } return subProcess; }
newSubProcessGraphicInfo.setExpanded(false); bpmnModel.addGraphicInfo(subProcess.getId(), newSubProcessGraphicInfo);
elementGraphicInfo.setExpanded(false); bpmnModel.addGraphicInfo(parentSubProcess.getId(), elementGraphicInfo); newSubProcessGraphicInfo.setExpanded(false); bpmnModel.addGraphicInfo(subProcess.getId(), newSubProcessGraphicInfo);
elementGraphicInfo.setExpanded(false); bpmnModel.addGraphicInfo(subProcess.getId(), elementGraphicInfo);