Package org.eclipse.graphiti.services

Examples of org.eclipse.graphiti.services.IGaService


    // 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 ? 40 : context.getWidth();
    final int height = context.getHeight() <= 0 ? 40 : context.getHeight();

    final IGaService gaService = Graphiti.getGaService();

    Polygon polygon;
    {
      int xy[] = new int[] { 0, 20, 20, 0, 40, 20, 20, 40, 0, 20 };
      final Polygon invisiblePolygon = gaService.createPolygon(containerShape, xy);
      invisiblePolygon.setFilled(false);
      invisiblePolygon.setLineVisible(false);
      gaService.setLocationAndSize(invisiblePolygon, context.getX(), context.getY(), width, height);

      // create and set visible polygon inside invisible polygon
      polygon = gaService.createPolygon(invisiblePolygon, xy);
      polygon.setParentGraphicsAlgorithm(invisiblePolygon);
      polygon.setStyle(StyleUtil.getStyleForEvent(getDiagram()));
      gaService.setLocationAndSize(polygon, 0, 0, width, height);

      // create link and wire it
      link(containerShape, addedGateway);
    }
   
    // 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


          connection.getBendpoints().add(bendPoint);
        }
      }
    }
   
    IGaService gaService = Graphiti.getGaService();
    Polyline polyline = gaService.createPolyline(connection);
    polyline.setLineStyle(LineStyle.DOT);
    polyline.setLineWidth(2);
    polyline.setForeground(Graphiti.getGaService().manageColor(getDiagram(), IColorConstant.BLACK));

    // create link and wire it
View Full Code Here

    final TextAnnotation annotation = (TextAnnotation) context.getNewObject();
   
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(context.getTargetContainer(), true);
   
    final IGaService gaService = Graphiti.getGaService();
   
    // TODO: we currently only support horizontal lanes!!!
    final int height = Math.max(50, context.getHeight());
    final int width = Math.max(100, context.getWidth());
    final int commentEdge = 20;
   
    final Rectangle rect = gaService.createInvisibleRectangle(containerShape);
    gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);
   
    final Shape lineShape = peCreateService.createShape(containerShape, false);
    final Polyline line
      = gaService.createPolyline(lineShape
          , new int[] { commentEdge, 0, 0, 0, 0, height, commentEdge, height });
    line.setStyle(StyleUtil.getStyleForTask(getDiagram()));
    line.setLineWidth(2);
    gaService.setLocationAndSize(line, 0, 0, commentEdge, height);
   
    final Shape textShape = peCreateService.createShape(containerShape, false);
    final MultiText text = gaService.createDefaultMultiText(getDiagram(), textShape, annotation.getText());
    text.setStyle(StyleUtil.getStyleForTask(getDiagram()));
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    if (OSUtil.getOperatingSystem() == OSEnum.Mac) {
      text.setFont(gaService.manageFont(getDiagram(), text.getFont().getName(), 11));
    }
    gaService.setLocationAndSize(text, 5, 5, width - 5, height - 5);
   
    // link both, the container as well as the text shape so direct editing works together
    // with updating and property handling
    link(containerShape, annotation);
    link(textShape, annotation);
View Full Code Here

  public static Style getStyleForTask(Diagram diagram) {
    final String styleId = "TASK"; //$NON-NLS-1$

    Style style = findStyle(diagram, styleId);
    if (style == null) { // style not found - create new style
      IGaService gaService = Graphiti.getGaService();
      style = gaService.createStyle(diagram, styleId);
      style.setForeground(gaService.manageColor(diagram, BPMN_CLASS_FOREGROUND));
      gaService.setRenderingStyle(style, getDefaultTaskColor(diagram));
      style.setLineWidth(20);
    }
    return style;
  }
View Full Code Here

  public static Style getStyleForPool(Diagram diagram) {
    final String styleId = "POOL"; //$NON-NLS-1$

    Style style = findStyle(diagram, styleId);
    if (style == null) { // style not found - create new style
      IGaService gaService = Graphiti.getGaService();
      style = gaService.createStyle(diagram, styleId);
      style.setForeground(gaService.manageColor(diagram, BPMN_CLASS_FOREGROUND));
      style.setBackground(gaService.manageColor(diagram, ColorConstant.WHITE));
      style.setLineWidth(20);
    }
    return style;
  }
View Full Code Here

  public static Style getStyleForEvent(Diagram diagram) {
    final String styleId = "EVENT"; //$NON-NLS-1$

    Style style = findStyle(diagram, styleId);
    if (style == null) { // style not found - create new style
      IGaService gaService = Graphiti.getGaService();
      style = gaService.createStyle(diagram, styleId);
      style.setForeground(gaService.manageColor(diagram, BPMN_CLASS_FOREGROUND));
      gaService.setRenderingStyle(style, getDefaultEventColor(diagram));
      style.setLineWidth(20);
    }
    return style;
  }
View Full Code Here

    final String styleId = "BPMN-POLYGON-ARROW"; //$NON-NLS-1$

    Style style = findStyle(diagram, styleId);

    if (style == null) { // style not found - create new style
      IGaService gaService = Graphiti.getGaService();
      style = gaService.createStyle(diagram, styleId);
      style.setForeground(gaService.manageColor(diagram, IColorConstant.BLACK));
      style.setBackground(gaService.manageColor(diagram, IColorConstant.BLACK));
      style.setLineWidth(1);
    }
    return style;
  }
View Full Code Here

          , Diagram diagram) {
    final GradientColoredArea gca = StylesFactory.eINSTANCE.createGradientColoredArea();
    gcas.add(gca);
    gca.setStart(StylesFactory.eINSTANCE.createGradientColoredLocation());
   
    IGaService gaService = Graphiti.getGaService();
   
    final Color startColor = gaService.manageColor(diagram, ColorUtil.getRedFromHex(colorStart)
                          , ColorUtil.getGreenFromHex(colorStart)
                          , ColorUtil.getBlueFromHex(colorStart));
    gca.getStart().setColor(startColor);
   
//    gca.getStart().setColor(StylesFactory.eINSTANCE.createColor());
//    gca.getStart().getColor().setBlue(ColorUtil.getBlueFromHex(colorStart));
//    gca.getStart().getColor().setGreen(ColorUtil.getGreenFromHex(colorStart));
//    gca.getStart().getColor().setRed(ColorUtil.getRedFromHex(colorStart));
    gca.getStart().setLocationType(locationTypeStart);
    gca.getStart().setLocationValue(locationValueStart);
    gca.setEnd(StylesFactory.eINSTANCE.createGradientColoredLocation());
   
    final Color endColor = gaService.manageColor(diagram, ColorUtil.getRedFromHex(colorEnd)
      , ColorUtil.getGreenFromHex(colorEnd)
      , ColorUtil.getBlueFromHex(colorEnd));
   
    gca.getEnd().setColor(endColor);
    gca.getEnd().setLocationType(locationTypeEnd);
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()));
      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

      if(lineCount < width) {
        lineCount++;
      }
      lineCount++;
    }
    IGaService gaService = Graphiti.getGaService();
    gaService.setSize(textComponent, 100, lineCount * textDimension.getHeight());
  }
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.