Package org.eclipse.graphiti.mm.algorithms

Examples of org.eclipse.graphiti.mm.algorithms.Ellipse


    final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
    boxAnchor.setRelativeWidth(1.0);
    boxAnchor.setRelativeHeight(0.51);
    boxAnchor.setReferencedGraphicsAlgorithm(roundedRectangle);
    final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
    gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    layoutPictogramElement(containerShape);

    return containerShape;
  }
View Full Code Here


    final int width = context.getWidth() <= 0 ? 35 : context.getWidth();
    final int height = context.getHeight() <= 0 ? 35 : context.getHeight();

    final IGaService gaService = Graphiti.getGaService();

    Ellipse circle;
    {
      final Ellipse invisibleCircle = gaService.createEllipse(containerShape);
      invisibleCircle.setFilled(false);
      invisibleCircle.setLineVisible(false);
      gaService.setLocationAndSize(invisibleCircle, context.getX(), context.getY(), width, height);

      // create and set visible circle inside invisible circle
      circle = gaService.createEllipse(invisibleCircle);
      circle.setParentGraphicsAlgorithm(invisibleCircle);
      circle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      gaService.setLocationAndSize(circle, 0, 0, width, height);

      // create link and wire it
      link(containerShape, addedEvent);
    }

    {
      final Shape shape = peCreateService.createShape(containerShape, false);
      final Image image = gaService.createImage(shape, PluginImage.IMG_THROW_SIGNAL.getImageKey());
      image.setWidth(20);
      image.setHeight(20);
      gaService.setLocationAndSize(image, (width - 20) / 2, (height - 20) / 2, 20, 20);
    }

    // add a chopbox anchor to the shape
    peCreateService.createChopboxAnchor(containerShape);
    if (!(addedEvent instanceof EndEvent)) {

      // create an additional box relative anchor at middle-right
      final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor.setRelativeWidth(1.0);
      boxAnchor.setRelativeHeight(0.51);
      boxAnchor.setReferencedGraphicsAlgorithm(circle);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }
    layoutPictogramElement(containerShape);

    return containerShape;
View Full Code Here

    final int width = context.getWidth() <= 0 ? 35 : context.getWidth();
    final int height = context.getHeight() <= 0 ? 35 : context.getHeight();

    final IGaService gaService = Graphiti.getGaService();

    Ellipse circle;
    {
      final Ellipse invisibleCircle = gaService.createEllipse(containerShape);
      invisibleCircle.setFilled(false);
      invisibleCircle.setLineVisible(false);
      gaService.setLocationAndSize(invisibleCircle, context.getX(), context.getY(), width, height);

      // create and set visible circle inside invisible circle
      circle = gaService.createEllipse(invisibleCircle);
      circle.setParentGraphicsAlgorithm(invisibleCircle);
      circle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      gaService.setLocationAndSize(circle, 0, 0, width, height);

      // create link and wire it
      link(containerShape, addedEvent);
    }

    // add a chopbox anchor to the shape
    peCreateService.createChopboxAnchor(containerShape);
    if (!(addedEvent instanceof EndEvent)) {

      // create an additional box relative anchor at middle-right
      final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor.setRelativeWidth(1.0);
      boxAnchor.setRelativeHeight(0.51);
      boxAnchor.setReferencedGraphicsAlgorithm(circle);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }
    layoutPictogramElement(containerShape);

    return containerShape;
View Full Code Here

      peCreateService.createChopboxAnchor(containerShape);
      final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor.setRelativeWidth(0.51);
      boxAnchor.setRelativeHeight(0.10);
      boxAnchor.setReferencedGraphicsAlgorithm(polygon);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }

    {
      // add a another chopbox anchor to the shape
      peCreateService.createChopboxAnchor(containerShape);
      final BoxRelativeAnchor boxAnchor2 = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor2.setRelativeWidth(0.51);
      boxAnchor2.setRelativeHeight(0.93);
      boxAnchor2.setReferencedGraphicsAlgorithm(polygon);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor2, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }

    // call the layout feature
    layoutPictogramElement(containerShape);
View Full Code Here

      // check whether the context has a size (e.g. from a create feature)
      // otherwise define a default size for the shape
      width = context.getWidth() <= 0 ? 55 : context.getWidth();
      height = context.getHeight() <= 0 ? 55 : context.getHeight();

      Ellipse circle;
      {
        final Ellipse invisibleCircle = gaService.createEllipse(containerShape);
        invisibleCircle.setFilled(false);
        invisibleCircle.setLineVisible(false);
        gaService.setLocationAndSize(invisibleCircle, context.getX(), context.getY(), width, height);

        // create and set visible circle inside invisible circle
        circle = gaService.createEllipse(invisibleCircle);
        circle.setParentGraphicsAlgorithm(invisibleCircle);
        circle.setStyle(StyleUtil.getStyleForTask(getDiagram()));
        gaService.setLocationAndSize(circle, 0, 0, width, height);

        // create link and wire it
        link(containerShape, addedTask);
      }
      break;
    }

    // SHAPE WITH TEXT
    {
      // create shape for text
      final Shape shape = peCreateService.createShape(containerShape, false);

      // create and set text graphics algorithm
      final MultiText text = gaService.createDefaultMultiText(getDiagram(), shape, addedTask.getName());
      text.setStyle(StyleUtil.getStyleForTask(getDiagram()));
      text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
      text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
      if (OSUtil.getOperatingSystem() == OSEnum.Mac) {
        text.setFont(gaService.manageFont(getDiagram(), text.getFont().getName(), 11));
      }

      switch (baseShape) {
      case ACTIVITY:
        gaService.setLocationAndSize(text, 0, 20, width, height - 25);
        break;
      case GATEWAY:
        gaService.setLocationAndSize(text, 0, height + 5, width, 40);
        break;
      case EVENT:
        gaService.setLocationAndSize(text, 0, height + 5, width, 40);
        break;
      }

      // create link and wire it
      link(shape, addedTask);

      // provide information to support direct-editing directly
      // after object creation (must be activated additionally)
      final IDirectEditingInfo directEditingInfo = getFeatureProvider().getDirectEditingInfo();
      // set container shape for direct editing after object creation
      directEditingInfo.setMainPictogramElement(containerShape);
      // set shape and graphics algorithm where the editor for
      // direct editing shall be opened after object creation
      directEditingInfo.setPictogramElement(shape);
      directEditingInfo.setGraphicsAlgorithm(text);
    }

    {
      final Shape shape = peCreateService.createShape(containerShape, false);
      final Image image = gaService.createImage(shape, getIcon(addedTask));

      switch (baseShape) {
      case ACTIVITY:
        gaService.setLocationAndSize(image, 5, 5, IMAGE_SIZE, IMAGE_SIZE);
        break;
      case GATEWAY:
        gaService.setLocationAndSize(image, (width - IMAGE_SIZE) / 2, (height - IMAGE_SIZE) / 2, IMAGE_SIZE, IMAGE_SIZE);
        break;
      case EVENT:
        gaService.setLocationAndSize(image, (width - IMAGE_SIZE) / 2, (height - IMAGE_SIZE) / 2, IMAGE_SIZE, IMAGE_SIZE);
        break;
      }

    }

    // add a chopbox anchor to the shape
    peCreateService.createChopboxAnchor(containerShape);

    // create an additional box relative anchor at middle-right
    final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
    boxAnchor.setRelativeWidth(1.0);
    boxAnchor.setRelativeHeight(0.51);
    boxAnchor.setReferencedGraphicsAlgorithm(algorithm);
    final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
    gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    layoutPictogramElement(containerShape);

    return containerShape;
  }
View Full Code Here

      peCreateService.createChopboxAnchor(containerShape);
      final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor.setRelativeWidth(0.51);
      boxAnchor.setRelativeHeight(0.10);
      boxAnchor.setReferencedGraphicsAlgorithm(polygon);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }

    {
      // add a another chopbox anchor to the shape
      peCreateService.createChopboxAnchor(containerShape);
      final BoxRelativeAnchor boxAnchor2 = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor2.setRelativeWidth(0.51);
      boxAnchor2.setRelativeHeight(0.93);
      boxAnchor2.setReferencedGraphicsAlgorithm(polygon);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor2, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }

    // call the layout feature
    layoutPictogramElement(containerShape);
View Full Code Here

      peCreateService.createChopboxAnchor(containerShape);
      final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor.setRelativeWidth(0.51);
      boxAnchor.setRelativeHeight(0.10);
      boxAnchor.setReferencedGraphicsAlgorithm(polygon);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }

    {
      // add a another chopbox anchor to the shape
      peCreateService.createChopboxAnchor(containerShape);
      final BoxRelativeAnchor boxAnchor2 = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor2.setRelativeWidth(0.51);
      boxAnchor2.setRelativeHeight(0.93);
      boxAnchor2.setReferencedGraphicsAlgorithm(polygon);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor2, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }

    // call the layout feature
    layoutPictogramElement(containerShape);
View Full Code Here

    }
   
    // This draws the circle inside the rhombus
    {
      // create and set the circle inside the polygon
      final Ellipse circle = gaService.createEllipse(polygon);
      circle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      circle.setLineWidth(3);
      circle.setParentGraphicsAlgorithm(polygon);
      gaService.setLocationAndSize(circle, 10, 10, 20, 20);
    }

    {
      // add a chopbox anchor to the shape
      peCreateService.createChopboxAnchor(containerShape);
      final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor.setRelativeWidth(0.51);
      boxAnchor.setRelativeHeight(0.10);
      boxAnchor.setReferencedGraphicsAlgorithm(polygon);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }

    {
      // add a another chopbox anchor to the shape
      peCreateService.createChopboxAnchor(containerShape);
      final BoxRelativeAnchor boxAnchor2 = peCreateService.createBoxRelativeAnchor(containerShape);
      boxAnchor2.setRelativeWidth(0.51);
      boxAnchor2.setRelativeHeight(0.93);
      boxAnchor2.setReferencedGraphicsAlgorithm(polygon);
      final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor2, gaService);
      gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
    }
   
    // call the layout feature
    layoutPictogramElement(containerShape);
View Full Code Here

    }
    return result;
  }

  public static Ellipse createInvisibleEllipse(GraphicsAlgorithmContainer gaContainer, IGaService gaService) {
    Ellipse ret = AlgorithmsFactory.eINSTANCE.createEllipse();
    ret.setX(0);
    ret.setY(0);
    ret.setWidth(0);
    ret.setHeight(0);
    ret.setFilled(false);
    ret.setLineVisible(false);
    if (gaContainer instanceof PictogramElement) {
      PictogramElement pe = (PictogramElement) gaContainer;
      pe.setGraphicsAlgorithm(ret);
    } else if (gaContainer instanceof GraphicsAlgorithm) {
      GraphicsAlgorithm parentGa = (GraphicsAlgorithm) gaContainer;
View Full Code Here

    final int width = context.getWidth() <= 0 ? 35 : context.getWidth();
    final int height = context.getHeight() <= 0 ? 35 : context.getHeight();

    final IGaService gaService = Graphiti.getGaService();

    Ellipse circle;
    {
      final Ellipse invisibleCircle = gaService.createEllipse(containerShape);
      invisibleCircle.setFilled(false);
      invisibleCircle.setLineVisible(false);
      gaService.setLocationAndSize(invisibleCircle, context.getX(), context.getY(), width, height);

      // create and set visible circle inside invisible circle
      circle = gaService.createEllipse(invisibleCircle);
      circle.setParentGraphicsAlgorithm(invisibleCircle);
      circle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      if (addedEvent instanceof EndEvent == true) {
        circle.setLineWidth(3);
      }
      gaService.setLocationAndSize(circle, 0, 0, width, height);

      // create link and wire it
      link(containerShape, addedEvent);
    }
   
    {
      final Shape shape = peCreateService.createShape(containerShape, false);
      final Image image = gaService.createImage(shape, PluginImage.IMG_ALFRESCO_LOGO.getImageKey());

      gaService.setLocationAndSize(image, 10, 10, IMAGE_SIZE, IMAGE_SIZE);
    }

    // add a chopbox anchor to the shape
    peCreateService.createChopboxAnchor(containerShape);
   
    // create an additional box relative anchor at middle-right
    final BoxRelativeAnchor boxAnchor = peCreateService.createBoxRelativeAnchor(containerShape);
    boxAnchor.setRelativeWidth(1.0);
    boxAnchor.setRelativeHeight(0.51);
    boxAnchor.setReferencedGraphicsAlgorithm(circle);
    final Ellipse ellipse = ActivitiUiUtil.createInvisibleEllipse(boxAnchor, gaService);
    gaService.setLocationAndSize(ellipse, 0, 0, 0, 0);
   
    layoutPictogramElement(containerShape);

    return containerShape;
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.mm.algorithms.Ellipse

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.