Package org.eclipse.graphiti.mm.pictograms

Examples of org.eclipse.graphiti.mm.pictograms.ContainerShape


    GraphicsAlgorithm elementGraphics = element.getGraphicsAlgorithm();
    int x = elementGraphics.getX();
    int y = elementGraphics.getY();
   
    CreateContext taskContext = new CreateContext();
    ContainerShape targetContainer = (ContainerShape) element.getContainer();
    taskContext.setTargetContainer(targetContainer);
    taskContext.setLocation(x, y);
    taskContext.setHeight(elementGraphics.getHeight());
    taskContext.setWidth(elementGraphics.getWidth());
   
    FlowNode oldObject = (FlowNode) getFeatureProvider().getBusinessObjectForPictogramElement(element);
    if (oldObject instanceof BoundaryEvent) {
      BoundaryEvent boundaryEvent = (BoundaryEvent) oldObject;
      ContainerShape parentShape = (ContainerShape) getFeatureProvider().getPictogramElementForBusinessObject(boundaryEvent.getAttachedToRef());
      taskContext.setTargetContainer(parentShape);
      taskContext.setLocation(x - parentShape.getGraphicsAlgorithm().getX(), y - parentShape.getGraphicsAlgorithm().getY());
    }
   
    List<SequenceFlow> sourceList = oldObject.getOutgoingFlows();
    List<SequenceFlow> targetList = oldObject.getIncomingFlows();
   
View Full Code Here


      } 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);
View Full Code Here

        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;
        }
View Full Code Here

  }

  private void drawSequenceFlow(SequenceFlow sequenceFlow, Bpmn2MemoryModel model) {
    Anchor sourceAnchor = null;
    Anchor targetAnchor = null;
    ContainerShape sourceShape = (ContainerShape) getDiagramTypeProvider().getFeatureProvider().getPictogramElementForBusinessObject(
            model.getFlowElement(sequenceFlow.getSourceRef()));

    if (sourceShape == null) {
      return;
    }

    EList<Anchor> anchorList = sourceShape.getAnchors();
    for (Anchor anchor : anchorList) {
      if (anchor instanceof ChopboxAnchor) {
        sourceAnchor = anchor;
        break;
      }
    }

    ContainerShape targetShape = (ContainerShape) getDiagramTypeProvider().getFeatureProvider().getPictogramElementForBusinessObject(
            model.getFlowElement(sequenceFlow.getTargetRef()));

    if (targetShape == null) {
      return;
    }

    anchorList = targetShape.getAnchors();
    for (Anchor anchor : anchorList) {
      if (anchor instanceof ChopboxAnchor) {
        targetAnchor = anchor;
        break;
      }
View Full Code Here

      sourceElement = model.getArtifact(association.getSourceRef());
    }
    if (sourceElement == null) {
      return;
    }
    ContainerShape sourceShape = (ContainerShape) getDiagramTypeProvider().getFeatureProvider()
            .getPictogramElementForBusinessObject(sourceElement);

    if (sourceShape == null) {
      return;
    }

    EList<Anchor> anchorList = sourceShape.getAnchors();
    for (Anchor anchor : anchorList) {
      if (anchor instanceof ChopboxAnchor) {
        sourceAnchor = anchor;
        break;
      }
    }

    BaseElement targetElement = model.getFlowElement(association.getTargetRef());
    if (targetElement == null) {
      targetElement = model.getArtifact(association.getTargetRef());
    }
    if (targetElement == null) {
      return;
    }
    ContainerShape targetShape = (ContainerShape) getDiagramTypeProvider().getFeatureProvider()
            .getPictogramElementForBusinessObject(targetElement);

    if (targetShape == null) {
      return;
    }

    anchorList = targetShape.getAnchors();
    for (Anchor anchor : anchorList) {
      if (anchor instanceof ChopboxAnchor) {
        targetAnchor = anchor;
        break;
      }
View Full Code Here

  }

  @Override
  public PictogramElement add(IAddContext context) {
    final Task addedTask = (Task) context.getNewObject();
    final ContainerShape parent = context.getTargetContainer();

    // CONTAINER SHAPE WITH ROUNDED RECTANGLE
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);
    final IGaService gaService = Graphiti.getGaService();

    DiagramBaseShape baseShape = DiagramBaseShape.ACTIVITY;

    if (ExtensionUtil.isCustomServiceTask(addedTask)) {
View Full Code Here

  @Override
  public PictogramElement add(IAddContext context) {

    final EventSubProcess addedSubProcess = (EventSubProcess) context.getNewObject();
    final ContainerShape parent = context.getTargetContainer();

    // CONTAINER SHAPE WITH ROUNDED RECTANGLE
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);

    // EList<Property> props = containerShape.getProperties();

    // check whether the context has a size (e.g. from a create feature)
    // otherwise define a default size for the shape
View Full Code Here

  @Override
  public PictogramElement add(IAddContext context) {

    final Pool addedPool = (Pool) context.getNewObject();
    final ContainerShape parent = context.getTargetContainer();

    // CONTAINER SHAPE WITH ROUNDED RECTANGLE
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(parent, true);

    // check whether the context has a size (e.g. from a create feature)
    // otherwise define a default size for the shape
    final int width = context.getWidth() <= 0 ? 500 : context.getWidth();
    final int height = context.getHeight() <= 0 ? 150 : context.getHeight();
View Full Code Here

  public IReason updateNeeded(IUpdateContext context) {
    // retrieve name from pictogram model
    String pictogramName = null;
    PictogramElement pictogramElement = context.getPictogramElement();
    if (pictogramElement instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pictogramElement;
      for (Shape shape : cs.getChildren()) {
        if (shape.getGraphicsAlgorithm() instanceof Text) {
          Text text = (Text) shape.getGraphicsAlgorithm();
          pictogramName = text.getValue();
        }
      }
View Full Code Here

      businessName = ((Lane) bo).getName();
    }

    // Set name in pictogram model
    if (pictogramElement instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pictogramElement;
      for (Shape shape : cs.getChildren()) {
        if (shape.getGraphicsAlgorithm() instanceof Text) {
          Text text = (Text) shape.getGraphicsAlgorithm();
          text.setValue(businessName);
          return true;
        }
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.mm.pictograms.ContainerShape

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.