Package org.eclipse.graphiti.mm.algorithms

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


    if (participant.getParticipantMultiplicity() != null) {
      Shape shape = peService.createShape(containerShape, false);
      peService.setPropertyValue(shape, MULTIPLICITY_MARKER, Boolean.toString(true));
      Rectangle invisibleRectangle = gaService.createInvisibleRectangle(shape);
      GraphicsAlgorithm parentGa = containerShape.getGraphicsAlgorithm();
      int x = (parentGa.getWidth() / 2) - 10;
      int y = parentGa.getHeight() - 20;
      gaService.setLocationAndSize(invisibleRectangle, x, y, 20, 20);

      Polyline line1 = gaService.createPolyline(invisibleRectangle, new int[] { 0, 0, 0, 20 });
      line1.setLineWidth(2);
      line1.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
View Full Code Here


    Iterator<Shape> iterator = peService.getAllContainedShapes(markerContainer).iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      String value = peService.getPropertyValue(shape, property);
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      if (value != null && new Boolean(value)) {
        lastX = ga.getX();
        peService.deletePictogramElement(shape);
      } else {
        totalWidth += ga.getWidth();
        if (lastX != -1) {
          gaService.setLocation(ga, lastX, ga.getY(), true);
          lastX = ga.getX() + ga.getWidth();
        }
      }
    }

    totalWidth = totalWidth == 0 ? 10 : totalWidth;
    GraphicsAlgorithm ga = markerContainer.getGraphicsAlgorithm();
    gaService.setLocationAndSize(ga, (parentW / 2) - (totalWidth / 2), ga.getY(), totalWidth, MARKER_HEIGHT);
  }
View Full Code Here

    gaService.setLocationAndSize(ga, (parentW / 2) - (totalWidth / 2), ga.getY(), totalWidth, MARKER_HEIGHT);
  }

  private static GraphicsAlgorithmContainer createActivityMarkerGaContainer(ContainerShape markerContainer,
          String property) {
    GraphicsAlgorithm ga = markerContainer.getGraphicsAlgorithm();

    int totalWidth = MARKER_WIDTH;
    int parentW = ((ContainerShape) markerContainer.eContainer()).getGraphicsAlgorithm().getWidth();
    int lastX = 0;

    Iterator<Shape> iterator = peService.getAllContainedShapes(markerContainer).iterator();
    while (iterator.hasNext()) {
      Shape containedShape = (Shape) iterator.next();
      GraphicsAlgorithm containedGa = containedShape.getGraphicsAlgorithm();
      totalWidth += containedGa.getWidth();
      lastX = containedGa.getX() + containedGa.getWidth();
    }

    gaService.setLocationAndSize(ga, (parentW / 2) - (totalWidth / 2), ga.getY(), totalWidth, MARKER_HEIGHT);

    Shape shape = peService.createShape(markerContainer, false);
View Full Code Here

  }

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

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

    for (Shape s : peService.getAllContainedShapes(choreographyContainer)) {
      String property = peService.getPropertyValue(s, ChoreographyProperties.CHOREOGRAPHY_NAME);
      if (property != null && new Boolean(property)) {
        GraphicsAlgorithm ga = s.getGraphicsAlgorithm();
        setTextLocation(choreographyContainer, (Text) ga, newWidth, newHeight);
      }
      property = peService.getPropertyValue(s, ChoreographyProperties.CALL_CHOREO_BORDER);
      if (property != null && new Boolean(property)) {
        GraphicsAlgorithm ga = s.getGraphicsAlgorithm();
        gaService.setSize(ga, newWidth, newHeight);
        peService.sendToFront(s);
      }
      // use it when property editor supports enums
      // property = peService.getPropertyValue(s, ChoreographyProperties.CHOREOGRAPHY_MARKER_SHAPE);
View Full Code Here

  @Override
  public boolean canDirectEdit(IDirectEditingContext context) {
    PictogramElement pe = context.getPictogramElement();
    Object bo = getBusinessObjectForPictogramElement(pe);
    GraphicsAlgorithm ga = context.getGraphicsAlgorithm();

    return bo instanceof ExclusiveGateway && ga instanceof Text;
  }
View Full Code Here

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

    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);
View Full Code Here

  @Override
  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;
      }
View Full Code Here

    super.postMoveShape(context);
    Activity activity = BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(), Activity.class);
    new AbstractBoundaryEventOperation() {
      @Override
      protected void doWorkInternal(ContainerShape container) {
        GraphicsAlgorithm ga = container.getGraphicsAlgorithm();

        MoveShapeContext newContext = new MoveShapeContext(container);
        newContext.setDeltaX(context.getDeltaX());
        newContext.setDeltaY(context.getDeltaY());
        newContext.setSourceContainer(context.getSourceContainer());
        newContext.setTargetContainer(context.getTargetContainer());
        newContext.setTargetConnection(context.getTargetConnection());
        newContext.setLocation(ga.getX(), ga.getY());
        newContext.putProperty(ACTIVITY_MOVE_PROPERTY, true);

        IMoveShapeFeature moveFeature = getFeatureProvider().getMoveShapeFeature(newContext);
        if (moveFeature.canMoveShape(newContext)) {
          moveFeature.moveShape(newContext);
View Full Code Here

  @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

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.