Examples of IGaService


Examples of org.eclipse.graphiti.services.IGaService

    return intoDiagram || intoLane || intoParticipant || intoSubProcess;
  }

  @Override
  public PictogramElement add(IAddContext context) {
    IGaService gaService = Graphiti.getGaService();
    IPeService peService = Graphiti.getPeService();
    @SuppressWarnings("unchecked")
    T t = (T) context.getNewObject();

    int width = GraphicsUtil.DATA_WIDTH;
    int height = GraphicsUtil.DATA_HEIGHT;
    int e = 10;
    int textArea = 15;
   
    ContainerShape container = peService.createContainerShape(context.getTargetContainer(), true);
    Rectangle invisibleRect = gaService.createInvisibleRectangle(container);
    gaService.setLocationAndSize(invisibleRect, context.getX(), context.getY(), width, height + textArea);

    Shape rectShape = peService.createShape(container, false);
    Polygon rect = gaService.createPolygon(rectShape, new int[] { 0, 0, width - e, 0, width, e, width, height, 0,
        height });
    rect.setLineWidth(1);
    StyleUtil.applyBGStyle(rect, this);
    decorate(rect);

    int p = width - e - 1;
    Polyline edge = gaService.createPolyline(rect, new int[] { p, 0, p, e + 1, width, e + 1 });
    edge.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
    edge.setLineWidth(1);

    if (isSupportCollectionMarkers()) {
      int whalf = width / 2;
      createCollectionShape(container, new int[] { whalf - 2, height - 8, whalf - 2, height });
      createCollectionShape(container, new int[] { whalf, height - 8, whalf, height });
      createCollectionShape(container, new int[] { whalf + 2, height - 8, whalf + 2, height });

      Graphiti.getPeService().setPropertyValue(container, Properties.COLLECTION_PROPERTY, Boolean.toString(false));
    }
   
    Shape textShape = peService.createShape(container, false);
    peService.setPropertyValue(textShape, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
    Text text = gaService.createDefaultText(getDiagram(), textShape, getName(t));
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    gaService.setLocationAndSize(text, 0, height, width, textArea);
   
    peService.createChopboxAnchor(container);
    AnchorUtil.addFixedPointAnchors(container, invisibleRect);
    createDIShape(container, t);
    layoutPictogramElement(container);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    return container;
  }

  private Shape createCollectionShape(ContainerShape container, int[] xy) {
    IPeService peService = Graphiti.getPeService();
    IGaService gaService = Graphiti.getGaService();
    Shape collectionShape = peService.createShape(container, false);
    Polyline line = gaService.createPolyline(collectionShape, xy);
    line.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
    line.setLineWidth(1);
    line.setLineVisible(false);
    peService.setPropertyValue(collectionShape, Properties.HIDEABLE_PROPERTY, Boolean.toString(true));
    return collectionShape;
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  }

  @Override
  public PictogramElement add(IAddContext context) {
    Gateway addedGateway = (Gateway) context.getNewObject();
    IGaService gaService = Graphiti.getGaService();
    IPeService peService = Graphiti.getPeService();

    int d = 2 * GraphicsUtil.GATEWAY_RADIUS;
    int p = GraphicsUtil.GATEWAY_TEXT_AREA;

    ContainerShape containerShape = peService.createContainerShape(context.getTargetContainer(), true);
    Rectangle rect = gaService.createInvisibleRectangle(containerShape);
    gaService.setLocationAndSize(rect, context.getX(), context.getY(), d, d + p);

    Shape gatewayShape = peService.createShape(containerShape, false);
    Polygon gateway = GraphicsUtil.createGateway(gatewayShape);
    StyleUtil.applyBGStyle(gateway, this);
    gaService.setLocationAndSize(gateway, 0, 0, d, d);
    decorateGateway(containerShape);

    Shape textShape = peService.createShape(containerShape, false);
    peService.setPropertyValue(textShape, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
    Text text = gaService.createDefaultText(getDiagram(), textShape, addedGateway.getName());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    gaService.setLocationAndSize(text, 0, d, d, p);

    createDIShape(containerShape, addedGateway);
    peService.createChopboxAnchor(containerShape);
    AnchorUtil.addFixedPointAnchors(containerShape, gateway);
    layoutPictogramElement(containerShape);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    return context.getTargetContainer().equals(getDiagram());
  }

  @Override
  public PictogramElement add(IAddContext context) {
    IGaService gaService = Graphiti.getGaService();
    IPeService peService = Graphiti.getPeService();
    Conversation c = (Conversation) context.getNewObject();

    int w = context.getWidth() > 0 ? context.getWidth() : 30;
    int h = context.getHeight() > 0 ? context.getHeight() : 30;

    ContainerShape containerShape = peService.createContainerShape(context.getTargetContainer(), true);
    Rectangle rect = gaService.createInvisibleRectangle(containerShape);
    gaService.setLocationAndSize(rect, context.getX(), context.getY(), w, h);

    int w_5th = w / 5;
    int[] xy = { w_5th, 0, w_5th * 4, 0, w, h / 2, w_5th * 4, h, w_5th, h, 0, h / 2 };
    Polygon hexagon = gaService.createPolygon(rect, xy);

    StyleUtil.applyBGStyle(hexagon, this);

    peService.createChopboxAnchor(containerShape);
    AnchorUtil.addFixedPointAnchors(containerShape, rect);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    TextAnnotation annotation = (TextAnnotation) context.getNewObject();

    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    ContainerShape containerShape = peCreateService.createContainerShape(context.getTargetContainer(), true);

    IGaService gaService = Graphiti.getGaService();

    int width = context.getWidth() > 0 ? context.getWidth() : 50;
    int height = context.getHeight() > 0 ? context.getHeight() : 100;
    int commentEdge = 15;

    Rectangle rect = gaService.createInvisibleRectangle(containerShape);
    gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);

    Shape lineShape = peCreateService.createShape(containerShape, false);
    Polyline line = gaService.createPolyline(lineShape, new int[] { commentEdge, 0, 0, 0, 0, height, commentEdge,
        height });
    line.setStyle(StyleUtil.getStyleForClass(getDiagram()));
    line.setLineWidth(2);
    gaService.setLocationAndSize(line, 0, 0, commentEdge, height);

    Shape textShape = peCreateService.createShape(containerShape, false);
    MultiText text = gaService.createDefaultMultiText(getDiagram(), textShape, annotation.getText());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    gaService.setLocationAndSize(text, 5, 5, width - 5, height - 5);

    createDIShape(containerShape, annotation);
    link(textShape, annotation);

    peCreateService.createChopboxAnchor(containerShape);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    Event e = (Event) context.getNewObject();

    IPeService peService = Graphiti.getPeService();
    ContainerShape containerShape = peService.createContainerShape(context.getTargetContainer(), true);

    IGaService gaService = Graphiti.getGaService();

    Rectangle invisibleRect = gaService.createInvisibleRectangle(containerShape);
    gaService.setLocationAndSize(invisibleRect, context.getX(), context.getY(), EVENT_SIZE, EVENT_SIZE
            + EVENT_TEXT_AREA);

    Shape ellipseShape = peService.createShape(containerShape, false);
    peService.setPropertyValue(ellipseShape, EVENT_ELEMENT, EVENT_CIRCLE);
    Ellipse ellipse = createEventShape(ellipseShape);
    StyleUtil.applyBGStyle(ellipse, this);
    decorateEllipse(ellipse);

    Shape textShape = peService.createShape(containerShape, false);
    peService.setPropertyValue(textShape, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
    Text text = gaService.createDefaultText(getDiagram(), textShape, e.getName());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    gaService.setLocationAndSize(text, 0, EVENT_SIZE, EVENT_SIZE, EVENT_TEXT_AREA);

    peService.createChopboxAnchor(containerShape);
    AnchorUtil.addFixedPointAnchors(containerShape, ellipse);
    hook(containerShape);
    createDIShape(containerShape, e);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  public PictogramElement add(IAddContext context) {
    Lane lane = (Lane) context.getNewObject();

    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    ContainerShape containerShape = peCreateService.createContainerShape(context.getTargetContainer(), true);
    IGaService gaService = Graphiti.getGaService();

    int width = context.getWidth() > 0 ? context.getWidth() : 600;
    int height = context.getHeight() > 0 ? context.getHeight() : 100;

    Rectangle rect = gaService.createRectangle(containerShape);

    StyleUtil.applyBGStyle(rect, this);

    if (FeatureSupport.isTargetLane(context) || FeatureSupport.isTargetParticipant(context)) {
      GraphicsAlgorithm ga = context.getTargetContainer().getGraphicsAlgorithm();

      if (getNumberOfLanes(context) == 1) {
        gaService.setLocationAndSize(rect, 15, 0, width - 15, height);
        for (Shape s : getFlowNodeShapes(context, lane)) {
          Graphiti.getPeService().sendToFront(s);
          s.setContainer(containerShape);
        }
      } else {
        if (context.getWidth() == -1 || context.getHeight() == -1) {
          gaService.setLocationAndSize(rect, 15, ga.getWidth() - 1, ga.getHeight() - 15, height);
          // gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);
        } else {
          ILayoutService layoutService = Graphiti.getLayoutService();
          ILocation loc = layoutService.getLocationRelativeToDiagram(containerShape);
          int x = context.getX() - loc.getX();
          int y = context.getY() - loc.getY();
          gaService.setLocationAndSize(rect, x - 15, y, ga.getWidth() - 15, height);
        }
      }
      containerShape.setContainer(context.getTargetContainer());
    } else {
      gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);
    }

    Shape textShape = peCreateService.createShape(containerShape, false);
    Text text = gaService.createText(textShape, lane.getName());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setAngle(-90);
    gaService.setLocationAndSize(text, 0, 0, 15, height);

    createDIShape(containerShape, lane);
    link(textShape, lane);

    peCreateService.createChopboxAnchor(containerShape);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  public boolean layout(ILayoutContext context) {
    boolean changed = false;

    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();
    GraphicsAlgorithm ga = containerShape.getGraphicsAlgorithm();
    IGaService gaService = Graphiti.getGaService();

    if (ga.getWidth() < 100) {
      ga.setWidth(100);
      changed = true;
    }

    if (ga.getHeight() < 50) {
      ga.setHeight(50);
      changed = true;
    }

    int containerWidth = ga.getWidth();
    int containerHeight = ga.getHeight();

    DIUtils.updateDIShape(containerShape);

    Iterator<Shape> iterator = containerShape.getChildren().iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      GraphicsAlgorithm shapeGa = shape.getGraphicsAlgorithm();
      IDimension size = gaService.calculateSize(shapeGa);
      if (containerWidth != size.getWidth() && shapeGa instanceof MultiText) {
        gaService.setWidth(shapeGa, containerWidth - 5);
        changed = true;
      }
      if (containerHeight != size.getHeight()) {
        if (shapeGa instanceof Polyline) {
          Polyline line = (Polyline) shapeGa;
          line.getPoints().set(2, getNewPoint(line, 2, containerHeight, gaService));
          line.getPoints().set(3, getNewPoint(line, 3, containerHeight, gaService));
          changed = true;
        } else if (shapeGa instanceof MultiText) {
          gaService.setHeight(shapeGa, containerHeight - 5);
          changed = true;
        }
      }
    }
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    return moveableHasFlowNodes ^ targetHasFlowNodeRefs;
  }

  @Override
  protected void internalMove(IMoveShapeContext context) {
    IGaService gaService = Graphiti.getGaService();

    Lane movedLane = getMovedLane(context);
    GraphicsAlgorithm laneGa = context.getShape().getGraphicsAlgorithm();

    Lane targetLane = getTargetLane(context);
    GraphicsAlgorithm tga = context.getTargetContainer().getGraphicsAlgorithm();

    List<Shape> shapes = getFlowNodeShapes(context, targetLane);
    modifyModelStructure(targetLane, movedLane);

    if (getNumberOfLanes(context) == 1) {
      gaService.setLocationAndSize(laneGa, 15, 0, tga.getWidth() - 15, tga.getHeight());
      for (Shape s : shapes) {
        Graphiti.getPeService().sendToFront(s);
        s.setContainer((ContainerShape) context.getShape());
      }
    } else {
      gaService.setLocationAndSize(laneGa, 15, tga.getHeight() - 1, tga.getWidth() - 15, laneGa.getHeight() + 1);
    }

    FeatureSupport.redraw(context.getTargetContainer());
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  public static Style getStyleForClass(Diagram diagram) {
    Style s = findStyle(diagram, CLASS_ID);
   
    if(s == null) {
      IGaService gaService = Graphiti.getGaService();
      s = gaService.createStyle(diagram, CLASS_ID);
      s.setForeground(gaService.manageColor(diagram, CLASS_FOREGROUND));
      s.setBackground(gaService.manageColor(diagram, CLASS_BACKGROUND));
      s.setLineWidth(1);
    }
   
    return s;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.