Package org.eclipse.graphiti.services

Examples of org.eclipse.graphiti.services.IGaService


      }

      @Override
      protected void createConnectionDecorators(Connection connection) {
        IPeService peService = Graphiti.getPeService();
        IGaService gaService = Graphiti.getGaService();

        ConnectionDecorator endDecorator = peService.createConnectionDecorator(connection, false, 1.0, true);

        int w = 5;
        int l = 10;

        Polyline polyline = gaService.createPolyline(endDecorator, new int[] { -l, w, 0, 0, -l, -w });
        polyline.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
        polyline.setLineWidth(1);
      }

      @Override
View Full Code Here


    }
    return layout;
  }

  private void moveX(GraphicsAlgorithm ga, GraphicsAlgorithm parentGa, LocationType locType) {
    IGaService gaService = Graphiti.getGaService();
    if (isLeft(locType)) {
      gaService.setLocation(ga, parentGa.getX() - (ga.getWidth() / 2), ga.getY());
    } else {
      gaService.setLocation(ga, parentGa.getX() + parentGa.getWidth() - (ga.getWidth() / 2), ga.getY());
    }
  }
View Full Code Here

  private boolean isLeft(LocationType locType) {
    return locType == LocationType.TOP_LEFT || locType == LocationType.LEFT || locType == LocationType.BOTTOM_LEFT;
  }

  private void moveY(GraphicsAlgorithm ga, GraphicsAlgorithm parentGa, LocationType locType) {
    IGaService gaService = Graphiti.getGaService();
    if (isTop(locType)) {
      gaService.setLocation(ga, ga.getX(), parentGa.getY() - (ga.getHeight() / 2));
    } else {
      gaService.setLocation(ga, ga.getX(), parentGa.getY() + parentGa.getHeight() - (ga.getHeight() / 2));
    }
  }
View Full Code Here

      }

      @Override
      protected void createConnectionDecorators(Connection connection) {
        IPeService peService = Graphiti.getPeService();
        IGaService gaService = Graphiti.getGaService();

        ConnectionDecorator endDecorator = peService.createConnectionDecorator(connection, false, 1.0, true);

        int w = 5;
        int l = 10;

        Polyline polyline = gaService.createPolyline(endDecorator, new int[] { -l, w, 0, 0, -l, -w });
        polyline.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
        polyline.setLineWidth(1);
      }

      @Override
View Full Code Here

      }

      @Override
      protected void createConnectionDecorators(Connection connection) {
        IPeService peService = Graphiti.getPeService();
        IGaService gaService = Graphiti.getGaService();

        ConnectionDecorator endDecorator = peService.createConnectionDecorator(connection, false, 1.0, true);
        ConnectionDecorator startDecorator = peService.createConnectionDecorator(connection, false, 0, true);

        int w = 5;
        int l = 15;
       
        Polyline polyline = gaService.createPolygon(endDecorator, new int[] { -l, w, 0, 0, -l, -w, -l, w });
        polyline.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
        polyline.setBackground(manageColor(IColorConstant.WHITE));
        polyline.setFilled(true);
        polyline.setLineWidth(1);

        Ellipse ellipse = gaService.createEllipse(startDecorator);
        ellipse.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
        ellipse.setBackground(manageColor(IColorConstant.WHITE));
        ellipse.setFilled(true);
        ellipse.setLineWidth(1);
        gaService.setSize(ellipse, 10, 10);
      }

      @Override
      protected Class<? extends BaseElement> getBoClass() {
        return MessageFlow.class;
View Full Code Here

  protected void postMoveShape(IMoveShapeContext context) {
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();

    Object property = context.getProperty("activity.move");
    if (property != null && (Boolean) property) {
      IGaService gaService = Graphiti.getGaService();
      GraphicsAlgorithm ga = containerShape.getGraphicsAlgorithm();
      gaService.setLocation(ga, ga.getX() + context.getDeltaX(), ga.getY() + context.getDeltaY());
    } else {
      BoundaryEvent event = BusinessObjectUtil.getFirstElementOfType(containerShape, BoundaryEvent.class);
      PictogramElement activityContainer = BusinessObjectUtil.getFirstBaseElementFromDiagram(getDiagram(),
          event.getAttachedToRef());
      PositionOnLine newPos = BoundaryEventPositionHelper.getPositionOnLineUsingAbsoluteCoordinates(
View Full Code Here

  }

  @Override
  protected void hook(Activity activity, ContainerShape container, IAddContext context, int width, int height) {
    IPeService peService = Graphiti.getPeService();
    IGaService gaService = Graphiti.getGaService();

    Shape textShape = peService.createShape(container, false);
    MultiText text = gaService.createDefaultMultiText(getDiagram(), textShape, activity.getName());
    int padding = GraphicsUtil.TASK_IMAGE_SIZE;
    gaService.setLocationAndSize(text, 0, padding, width, height - padding);
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    text.getFont().setBold(true);
    link(textShape, activity);
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
    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_BOUNDARY_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

          connection.getBendpoints().add(bendPoint);
        }
      }
    }

    IGaService gaService = Graphiti.getGaService();
    Polyline polyline = gaService.createPolyline(connection);
    polyline.setLineStyle(LineStyle.SOLID);
    polyline.setForeground(Graphiti.getGaService().manageColor(getDiagram(), IColorConstant.BLACK));

    // create link and wire it
    link(connection, addedSequenceFlow);

    // add dynamic text decorator for the reference name
    ConnectionDecorator textDecorator = peCreateService.createConnectionDecorator(connection, true, 0.5, true);
    MultiText text = gaService.createDefaultMultiText(getDiagram(), textDecorator);
    text.setStyle(StyleUtil.getStyleForTask((getDiagram())));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_LEFT);
    text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
    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())) {
      TextUtil.setTextSize(addedSequenceFlow.getName(), text);
    }
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
    final int width = context.getWidth() <= 0 ? 205 : context.getWidth();
    final int height = context.getHeight() <= 0 ? 205 : context.getHeight();

    final IGaService gaService = Graphiti.getGaService();
    RoundedRectangle roundedRectangle; // need to access it later
    {
      // create invisible outer rectangle expanded by
      // the width needed for the anchor
      final Rectangle invisibleRectangle = gaService.createInvisibleRectangle(containerShape);
      gaService.setLocationAndSize(invisibleRectangle, context.getX(), context.getY(), width, height);

      // create and set visible rectangle inside invisible rectangle
      roundedRectangle = gaService.createRoundedRectangle(invisibleRectangle, 5, 5);
      roundedRectangle.setParentGraphicsAlgorithm(invisibleRectangle);
      roundedRectangle.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      gaService.setLocationAndSize(roundedRectangle, 0, 0, width, height);

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

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

      // create and set text graphics algorithm
      final Text text = gaService.createDefaultText(getDiagram(), shape, addedSubProcess.getName());
      text.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
      text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
      Font font = null;
      if (OSUtil.getOperatingSystem() == OSEnum.Mac) {
        font = gaService.manageFont(getDiagram(), text.getFont().getName(), 11, false, true);
      } else {
        font = gaService.manageDefaultFont(getDiagram(), false, true);
      }
      text.setFont(font);
      gaService.setLocationAndSize(text, 0, 0, width, 20);

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

      // 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);
    }

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

    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

TOP

Related Classes of org.eclipse.graphiti.services.IGaService

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.