Package org.eclipse.bpmn2.di

Examples of org.eclipse.bpmn2.di.BPMNShape


    //给根plane set 关联元素
    bpmnPlane.setBpmnElement(BpmnModelUtil.getBaseElement(bpmnModel, process.getId()));
    //给shape元素 set 关联元素
    for(DiagramElement diagram :  bpmnModel.getDiagrams().get(0).getPlane().getPlaneElement()){
      if(diagram instanceof BPMNShape){
        BPMNShape bpmnShape = (BPMNShape)diagram;
        String shapeId = bpmnShape.getId();
        String elementId = BpmnJsonConverterUtil.getElementIdFromShapeId(shapeId);
        BaseElement bpmnElement = BpmnModelUtil.getElement(bpmnModel,elementId,BaseElement.class);
        bpmnShape.setBpmnElement(bpmnElement);
      }
    }
    //生成线条元素
    readEdgeDI(edgeMap, sourceAndTargetMap, bpmnModel);
    return bpmnModel;
View Full Code Here


      //}
     
      for (DiagramElement diagramElement : bpmnDiagram.getPlane().getPlaneElement()) {

        if (diagramElement instanceof BPMNShape) {
          BPMNShape bpmnShape = (BPMNShape) diagramElement;
          if(bpmnShape.getBounds().getX()+bpmnShape.getBounds().getWidth()>maxX)
          {
            maxX=bpmnShape.getBounds().getX()+bpmnShape.getBounds().getWidth();
     
          }
          if(bpmnShape.getBounds().getY()+bpmnShape.getBounds().getHeight()>maxY)
          {
            maxY=bpmnShape.getBounds().getY()+bpmnShape.getBounds().getHeight();
           
          }
         
       
          if(minY==0){
            minY=bpmnShape.getBounds().getY();
          }else{
            if(bpmnShape.getBounds().getY()<minY)
            {
              minY=bpmnShape.getBounds().getY();
            }
          }
         
          if(minX==0){
            minX=bpmnShape.getBounds().getX();
          }else{
            if(bpmnShape.getBounds().getX()<minX)
            {
              minX=bpmnShape.getBounds().getX();
           
            }
          }
         
          BaseElement bpmnElement=getBaseElement(bpmnShape.getBpmnElement());
       
         
         
          if(bpmnElement==null){
            continue;
View Full Code Here

 
  public static BPMNShape getBpmnShape(Definitions definitions,String elementId){
    List<DiagramElement> diagramElements=definitions.getDiagrams().get(0).getPlane().getPlaneElement();
    for (DiagramElement diagramElement : diagramElements) {
      if(diagramElement instanceof BPMNShape){
        BPMNShape bpmnShape = (BPMNShape) diagramElement;
        BaseElement bpmnElement=getBaseElement((DefinitionsBehavior)definitions,bpmnShape.getBpmnElement());
        if(bpmnElement==null){
          continue;
        }
        if(elementId.equals(bpmnElement.getId())){
          return bpmnShape;
View Full Code Here

        String stencilId = BpmnJsonConverterUtil.getStencilId(jsonChildNode);
        if (STENCIL_SEQUENCE_FLOW.equals(stencilId) == false) {
         
          String elementId = BpmnJsonConverterUtil.getElementId(jsonChildNode);
        Bounds graphicInfo=DcFactory.eINSTANCE.createBounds();
        BPMNShape bpmnShape=BpmnDiFactory.eINSTANCE.createBPMNShape();
        bpmnShape.setBounds(graphicInfo);
        bpmnShape.setId(BpmnJsonConverterUtil.getFormatShapeId(elementId));
          JsonNode boundsNode = jsonChildNode.get(EDITOR_BOUNDS);
          ObjectNode upperLeftNode = (ObjectNode) boundsNode.get(EDITOR_BOUNDS_UPPER_LEFT);
          double upLeftX = upperLeftNode.get(EDITOR_BOUNDS_X).asDouble();
          double upLeftY = upperLeftNode.get(EDITOR_BOUNDS_Y).asDouble();
          //坐标修正
View Full Code Here

      }
     
      BPMNEdge eggeTemp=BpmnDiFactory.eINSTANCE.createBPMNEdge();
      eggeTemp.getWaypoint().addAll(graphicInfoList);
      eggeTemp.setId(edgeId);
      BPMNShape sourceElement = BpmnModelUtil.getBpmnShape(bpmnModel, BpmnJsonConverterUtil.getElementId(sourceRefNode));
      BPMNShape targetElement = BpmnModelUtil.getBpmnShape(bpmnModel, BpmnJsonConverterUtil.getElementId(targetRefNode));
      eggeTemp.setSourceElement(sourceElement);
      eggeTemp.setTargetElement(targetElement);
      eggeTemp.setBpmnElement(BpmnModelUtil.getElement(bpmnModel,BpmnJsonConverterUtil.getElementIdFromEdgeId(edgeId),BaseElement.class));
      bpmnModel.getDiagrams().get(0).getPlane().getPlaneElement().add(eggeTemp);
    }
View Full Code Here

    BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
    ArrayNode dockersArrayNode = objectMapper.createArrayNode();
    ObjectNode dockNode = objectMapper.createObjectNode();
   
   
    BPMNShape graphicInfo = BpmnModelUtil.getBpmnShape(model, boundaryEvent.getId());;
    BPMNShape parentGraphicInfo = BpmnModelUtil.getBpmnShape(model,boundaryEvent.getAttachedToRef().getId());
    dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getBounds().getX() + graphicInfo.getBounds().getWidth() - parentGraphicInfo.getBounds().getX());
    dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getBounds().getY() - parentGraphicInfo.getBounds().getY());
    dockersArrayNode.add(dockNode);
    flowElementNode.put("dockers", dockersArrayNode);
   
    if (boundaryEvent.isCancelActivity() == false) {
      propertiesNode.put(PROPERTY_CANCEL_ACTIVITY, PROPERTY_VALUE_NO);
View Full Code Here

    this.model = model;
    this.processor = processor;
    this.subProcessX = subProcessX;
    this.subProcessY = subProcessY;
    this.shapesArrayNode = shapesArrayNode;
    BPMNShape bpmnShape=BpmnModelUtil.getBpmnShape(model, flowElement.getId());
    Bounds bounds=bpmnShape.getBounds();
    String stencilId = null;
    stencilId = getStencilId(flowElement);
    double upleftX = bounds.getX() - subProcessX;
    double upleftY = bounds.getY() - subProcessY;
    //坐标修正
View Full Code Here

  public static List<BPMNShape> getParicipantBandBpmnShapes(ContainerShape choreographyActivityContainerShape) {
    List<BPMNShape> bpmnShapes = new ArrayList<BPMNShape>();
    List<ContainerShape> containers = getParticipantBandContainerShapes(choreographyActivityContainerShape);
    for (ContainerShape container : containers) {
      BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(container, BPMNShape.class);
      bpmnShapes.add(bpmnShape);
    }
    return bpmnShapes;
  }
View Full Code Here

      List<ContainerShape> participantBands) {
    List<ContainerShape> top = new ArrayList<ContainerShape>();
    List<ContainerShape> bottom = new ArrayList<ContainerShape>();

    if (participantBands.size() == 1) {
      BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(participantBands.get(0), BPMNShape.class);
      ParticipantBandKind bandKind = bpmnShape.getParticipantBandKind();
      if (bandKind == ParticipantBandKind.TOP_INITIATING || bandKind == ParticipantBandKind.TOP_NON_INITIATING) {
        top.add(participantBands.get(0));
      } else if (bandKind == ParticipantBandKind.BOTTOM_INITIATING
          || bandKind == ParticipantBandKind.BOTTOM_NON_INITIATING) {
        bottom.add(participantBands.get(0));
View Full Code Here

  private static Comparator<ContainerShape> getParticipantBandComparator() {
    return new Comparator<ContainerShape>() {

      @Override
      public int compare(ContainerShape c1, ContainerShape c2) {
        BPMNShape bpmnShape1 = BusinessObjectUtil.getFirstElementOfType(c1, BPMNShape.class);
        Bounds bounds1 = bpmnShape1.getBounds();
        BPMNShape bpmnShape2 = BusinessObjectUtil.getFirstElementOfType(c2, BPMNShape.class);
        Bounds bounds2 = bpmnShape2.getBounds();
        return new Float(bounds1.getY()).compareTo(new Float(bounds2.getY()));
      }

    };
  }
View Full Code Here

TOP

Related Classes of org.eclipse.bpmn2.di.BPMNShape

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.