Package org.eclipse.graphiti.mm.algorithms

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


  @Override
  public boolean canDirectEdit(IDirectEditingContext context) {
    PictogramElement pe = context.getPictogramElement();
    Object bo = getBusinessObjectForPictogramElement(pe);
    GraphicsAlgorithm ga = context.getGraphicsAlgorithm();
    return bo instanceof Lane && ga instanceof Text;
  }
View Full Code Here


  }

  @Override
  public boolean layout(ILayoutContext context) {
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();
    GraphicsAlgorithm parentGa = containerShape.getGraphicsAlgorithm();

    Iterator<Shape> iterator = Graphiti.getPeService().getAllContainedShapes(containerShape).iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      IGaService gaService = Graphiti.getGaService();

      int newWidth = parentGa.getWidth();
      int newHeight = parentGa.getHeight();

      String markerProperty = Graphiti.getPeService().getPropertyValue(shape,
          GraphicsUtil.ACTIVITY_MARKER_CONTAINER);
      if (markerProperty != null && new Boolean(markerProperty)) {
        int x = (newWidth / 2) - (ga.getWidth() / 2);
        int y = newHeight - ga.getHeight() - 3 - getMarkerContainerOffset();
        gaService.setLocation(ga, x, y);
        continue;
      }

      Shape rectShape = FeatureSupport.getShape(containerShape, "activity", Boolean.toString(true));
View Full Code Here

    EList<Shape> children = container.getChildren();
    ECollections.sort(children, new SiblingLaneComparator());
    for (Shape s : children) {
      Object bo = BusinessObjectUtil.getFirstElementOfType(s, BaseElement.class);
      if (bo != null && (bo instanceof Lane || bo instanceof Participant) && !bo.equals(elem)) {
        GraphicsAlgorithm ga = s.getGraphicsAlgorithm();
        service.setLocation(ga, 15, height);
        height += ga.getHeight() - 1;
        if (ga.getWidth() >= width) {
          width = ga.getWidth();
        } else {
          service.setSize(ga, width, ga.getHeight());
        }
      }
    }

    GraphicsAlgorithm ga = container.getGraphicsAlgorithm();

    if (height == 0) {
      return new Dimension(ga.getWidth(), ga.getHeight());
    } else {
      int newWidth = width + 15;
      int newHeight = height + 1;
      service.setSize(ga, newWidth, newHeight);

      for (Shape s : children) {
        GraphicsAlgorithm childGa = s.getGraphicsAlgorithm();
        if (childGa instanceof Text) {
          s.getGraphicsAlgorithm().setHeight(newHeight);
        } else if (childGa instanceof Polyline) {
          Polyline line = (Polyline) childGa;
          Point firstPoint = line.getPoints().get(0);
View Full Code Here

        }
      }
    }

    if (dimensions.isEmpty()) {
      GraphicsAlgorithm ga = root.getGraphicsAlgorithm();
      for (Shape s : root.getChildren()) {
        GraphicsAlgorithm childGa = s.getGraphicsAlgorithm();
        if (childGa instanceof Text) {
          s.getGraphicsAlgorithm().setHeight(ga.getHeight());
        } else if (childGa instanceof Polyline) {
          Polyline line = (Polyline) childGa;
          Point firstPoint = line.getPoints().get(0);
View Full Code Here

    int width = root.getGraphicsAlgorithm().getWidth() - 15;

    for (Shape s : root.getChildren()) {
      Object o = BusinessObjectUtil.getFirstElementOfType(s, BaseElement.class);
      if (checkForResize(elem, s, o)) {
        GraphicsAlgorithm ga = s.getGraphicsAlgorithm();
        service.setSize(ga, width, ga.getHeight());
        postResizeFixLenghts((ContainerShape) s);
      }
    }
  }
View Full Code Here

    Bounds bounds = bpmnShape.getBounds();

    bounds.setX(loc.getX());
    bounds.setY(loc.getY());

    GraphicsAlgorithm graphicsAlgorithm = element.getGraphicsAlgorithm();
    IDimension size = Graphiti.getGaService().calculateSize(graphicsAlgorithm);
    bounds.setHeight(size.getHeight());
    bounds.setWidth(size.getWidth());

    if (element instanceof ContainerShape) {
View Full Code Here

      Point point = DcFactory.eINSTANCE.createPoint();

      List<Point> waypoint = edge.getWaypoint();
      waypoint.clear();

      GraphicsAlgorithm graphicsAlgorithm = connection.getStart().getGraphicsAlgorithm();
      // FIXME connections must create anchors!!!
      if (graphicsAlgorithm != null) {
        point.setX(graphicsAlgorithm.getX());
        point.setY(graphicsAlgorithm.getY());
      } else {
        point.setX(connection.getStart().getParent().getGraphicsAlgorithm().getX());
        point.setY(connection.getStart().getParent().getGraphicsAlgorithm().getY());
      }
      waypoint.add(point);

      if (connection instanceof FreeFormConnectionImpl) {
        FreeFormConnectionImpl freeForm = (FreeFormConnectionImpl) connection;
        EList<org.eclipse.graphiti.mm.algorithms.styles.Point> bendpoints = freeForm.getBendpoints();
        for (org.eclipse.graphiti.mm.algorithms.styles.Point bp : bendpoints) {
          addBendPoint(freeForm, point);
        }
      }

      point = DcFactory.eINSTANCE.createPoint();
      graphicsAlgorithm = connection.getEnd().getGraphicsAlgorithm();
      if (graphicsAlgorithm != null) {
        point.setX(graphicsAlgorithm.getX());
        point.setY(graphicsAlgorithm.getY());
      } else {
        point.setX(connection.getEnd().getParent().getGraphicsAlgorithm().getX());
        point.setY(connection.getEnd().getParent().getGraphicsAlgorithm().getY());
      }
      waypoint.add(point);
View Full Code Here

    }
    return map;
  }

  public static Point getCenterPoint(Shape s) {
    GraphicsAlgorithm ga = s.getGraphicsAlgorithm();
    ILocation loc = peService.getLocationRelativeToDiagram(s);
    return gaService.createPoint(loc.getX() + (ga.getWidth() / 2), loc.getY() + (ga.getHeight() / 2));
  }
View Full Code Here

    StyleUtil.applyBGStyle(ellipse, this);

    if (importing) { // if loading from DI then place according to context
      gaService.setLocationAndSize(ellipse, context.getX(), context.getY(), EVENT_SIZE, EVENT_SIZE);
    } else { // otherwise place it in the center of shape for user to adjust it
      GraphicsAlgorithm ga = context.getTargetContainer().getGraphicsAlgorithm();
      int x = ga.getX() + context.getX() - (EVENT_SIZE / 2);
      int y = ga.getY() + context.getY() - (EVENT_SIZE / 2);
      gaService.setLocationAndSize(ellipse, x, y, EVENT_SIZE, EVENT_SIZE);
    }

    Ellipse circle = GraphicsUtil.createIntermediateEventCircle(ellipse);
    circle.setStyle(StyleUtil.getStyleForClass(getDiagram()));
View Full Code Here

      x += loc.getX();
      y += loc.getY();
    }

    BoundaryEvent event = BusinessObjectUtil.getFirstElementOfType(context.getShape(), BoundaryEvent.class);
    GraphicsAlgorithm eventGa = context.getShape().getGraphicsAlgorithm();
    ContainerShape activityContainer = (ContainerShape) BusinessObjectUtil.getFirstBaseElementFromDiagram(diagram,
            event.getAttachedToRef());
    GraphicsAlgorithm activityGa = activityContainer.getGraphicsAlgorithm();
    ILocation activityLoc = peService.getLocationRelativeToDiagram(activityContainer);

    if (!(activityContainer.equals(context.getTargetContainer()) || activityContainer.eContainer().equals(
            context.getTargetContainer()))) {
      return false;
    }

    PositionOnLine pos = getPositionOnLine(x, y, eventGa.getWidth(), eventGa.getHeight(), activityLoc.getX(),
            activityLoc.getY(), activityGa.getWidth(), activityGa.getHeight());
    return pos.isLegalPosition();
  }
View Full Code Here

TOP

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

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.