Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.GraphicInfo


        if (!bpmnModel.getFlowLocationMap().isEmpty()) {
         
          int maxX = 0;
          int maxY = 0;
          for (String key : bpmnModel.getLocationMap().keySet()) {
            GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(key);
            double elementX = graphicInfo.getX() + graphicInfo.getWidth();
            if (maxX < elementX) {
              maxX = (int) elementX;
            }
            double elementY = graphicInfo.getY() + graphicInfo.getHeight();
            if (maxY < elementY) {
              maxY = (int) elementY;
            }
          }
         
View Full Code Here


    if (OSUtil.getOperatingSystem() == OSEnum.Mac) {
      text.setFont(gaService.manageFont(getDiagram(), text.getFont().getName(), 11));
    }
   
    if(addConContext.getProperty("org.activiti.designer.connectionlabel") != null) {
      GraphicInfo labelLocation = (GraphicInfo) addConContext.getProperty("org.activiti.designer.connectionlabel");
      gaService.setLocation(text, (int)labelLocation.getX(), (int)labelLocation.getY());
    } else {
      gaService.setLocation(text, 10, 0);
    }
   
    if (StringUtils.isNotEmpty(addedSequenceFlow.getName())) {
View Full Code Here

 
    if((freeFormConnection.getBendpoints() == null || freeFormConnection.getBendpoints().size() == 0)) {
      difference = 11;
    }
 
    GraphicInfo lastGraphicInfo = flowGraphicsList.get(flowGraphicsList.size() - 1);
   
    if((targetBottomY + difference) < lastGraphicInfo.getY()) {
      flowGraphicsList.add(createFlowGraphicInfo(targetMiddleX, targetY + targetHeight));

    } else if((targetY - difference) > lastGraphicInfo.getY()) {
      flowGraphicsList.add(createFlowGraphicInfo(targetMiddleX, targetY));

    } else if(targetX > lastGraphicInfo.getX()) {
      flowGraphicsList.add(createFlowGraphicInfo(targetX, targetMiddleY));

    } else {
      flowGraphicsList.add(createFlowGraphicInfo(targetX + targetWidth, targetMiddleY));
    }
View Full Code Here

   
    return flowGraphicsList;
  }
 
  protected GraphicInfo createFlowGraphicInfo(int x, int y) {
    GraphicInfo graphicInfo = new GraphicInfo();
    graphicInfo.setX(x);
    graphicInfo.setY(y);
    return graphicInfo;
  }
View Full Code Here

    graphicInfo.setY(y);
    return graphicInfo;
  }
 
  protected GraphicInfo createGraphicInfo(int x, int y, int width, int height) {
    GraphicInfo graphicInfo = new GraphicInfo();
    graphicInfo.setX(x);
    graphicInfo.setY(y);
    graphicInfo.setWidth(width);
    graphicInfo.setHeight(height);
    return graphicInfo;
  }
View Full Code Here

      for (String elementId : model.getLocationMap().keySet()) {
        xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_SHAPE, BPMNDI_NAMESPACE);
        xtw.writeAttribute(ATTRIBUTE_DI_BPMNELEMENT, elementId);
        xtw.writeAttribute(ATTRIBUTE_ID, "BPMNShape_" + elementId);
       
        GraphicInfo graphicInfo = model.getGraphicInfo(elementId);
        xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE);
        xtw.writeAttribute(ATTRIBUTE_DI_HEIGHT, "" + graphicInfo.height);
        xtw.writeAttribute(ATTRIBUTE_DI_WIDTH, "" + graphicInfo.width);
        xtw.writeAttribute(ATTRIBUTE_DI_X, "" + graphicInfo.x);
        xtw.writeAttribute(ATTRIBUTE_DI_Y, "" + graphicInfo.y);
View Full Code Here

      }
    });
  }

  private PictogramElement addContainerElement(BaseElement element, Bpmn2MemoryModel model, ContainerShape parent) {
    GraphicInfo graphicInfo = model.getBpmnModel().getGraphicInfo(element.getId());
    if (graphicInfo == null) {
      return null;
    }

    final IFeatureProvider featureProvider = getDiagramTypeProvider().getFeatureProvider();

    AddContext context = new AddContext(new AreaContext(), element);
    IAddFeature addFeature = featureProvider.getAddFeature(context);
    context.setNewObject(element);
    context.setSize((int) graphicInfo.getWidth(), (int) graphicInfo.getHeight());
    context.setTargetContainer(parent);

    int x = (int) graphicInfo.getX();
    int y = (int) graphicInfo.getY();

    if (parent instanceof Diagram == false) {
      x = x - parent.getGraphicsAlgorithm().getX();
      y = y - parent.getGraphicsAlgorithm().getY();
    }
View Full Code Here

      if (addFeature == null) {
        System.out.println("Element not supported: " + flowElement);
        return;
      }

      GraphicInfo graphicInfo = locationMap.get(flowElement.getId());
      if (graphicInfo == null) {

        noDIList.add(flowElement);

      } else {

        context.setNewObject(flowElement);
        context.setSize((int) graphicInfo.getWidth(), (int) graphicInfo.getHeight());

        ContainerShape parentContainer = null;
        if (parentShape instanceof Diagram) {
          parentContainer = getParentContainer(flowElement.getId(), process, (Diagram) parentShape);
        } else {
          parentContainer = parentShape;
        }

        context.setTargetContainer(parentContainer);
        if (parentContainer instanceof Diagram == false) {
          Point location = getLocation(parentContainer);
          context.setLocation((int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y);
        } else {
          context.setLocation((int) graphicInfo.getX(), (int) graphicInfo.getY());
        }

        if (flowElement instanceof ServiceTask) {

          ServiceTask serviceTask = (ServiceTask) flowElement;

          if (serviceTask.isExtended()) {

            CustomServiceTask targetTask = findCustomServiceTask(serviceTask);

            if (targetTask != null) {
              serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
              serviceTask.setImplementation(targetTask.getRuntimeClassname());
              for (FieldExtension field : serviceTask.getFieldExtensions()) {
                CustomProperty customFieldProperty = new CustomProperty();
                customFieldProperty.setName(field.getFieldName());
                if (StringUtils.isNotEmpty(field.getExpression())) {
                  customFieldProperty.setSimpleValue(field.getExpression());
                } else {
                  customFieldProperty.setSimpleValue(field.getStringValue());
                }
                serviceTask.getCustomProperties().add(customFieldProperty);
              }

              serviceTask.getFieldExtensions().clear();
            }
          }

        }

        if (flowElement instanceof BoundaryEvent) {
          BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
          if (boundaryEvent.getAttachedToRef() != null) {
            ContainerShape container = (ContainerShape) featureProvider.getPictogramElementForBusinessObject(boundaryEvent.getAttachedToRef());

            if (container != null) {
              AddContext boundaryContext = new AddContext(new AreaContext(), boundaryEvent);
              boundaryContext.setTargetContainer(container);
              Point location = getLocation(container);
              boundaryContext.setLocation((int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y);

              if (addFeature.canAdd(boundaryContext)) {
                PictogramElement newBoundaryContainer = addFeature.add(boundaryContext);
                featureProvider.link(newBoundaryContainer, new Object[] { boundaryEvent });
              }
View Full Code Here

      if (addFeature == null) {
        System.out.println("Element not supported: " + artifact);
        return;
      }

      final GraphicInfo gi = locationMap.get(artifact.getId());
      if (gi == null) {
        artifactsWithoutDI.add(artifact);
      } else {
        context.setNewObject(artifact);
        context.setSize((int) gi.getWidth(), (int) gi.getHeight());

        ContainerShape parentContainer = null;
        if (parent instanceof Diagram) {
          parentContainer = getParentContainer(artifact.getId(), process, (Diagram) parent);
        } else {
          parentContainer = parent;
        }

        context.setTargetContainer(parentContainer);
        if (parentContainer instanceof Diagram) {
          context.setLocation((int) gi.getX(), (int) gi.getY());
        } else {
          final Point location = getLocation(parentContainer);

          context.setLocation((int) gi.getX() - location.x, (int) gi.getY() - location.y);
        }

        if (addFeature.canAdd(context)) {
          final PictogramElement newContainer = addFeature.add(context);
          featureProvider.link(newContainer, new Object[] { artifact });
View Full Code Here

   
    String id = xtr.getAttributeValue(null, ATTRIBUTE_DI_BPMNELEMENT);
    while (xtr.hasNext()) {
      xtr.next();
      if (xtr.isStartElement() && ELEMENT_DI_BOUNDS.equalsIgnoreCase(xtr.getLocalName())) {
        GraphicInfo graphicInfo = new GraphicInfo();
        graphicInfo.x = Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_X)).intValue();
        graphicInfo.y = Double.valueOf(xtr.getAttributeValue(null, ATTRIBUTE_DI_Y)).intValue();
        FlowElement flowElement = model.getMainProcess().getFlowElement(id);
        if (flowElement instanceof Event) {
          graphicInfo.width = 30;
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.GraphicInfo

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.