Package org.eclipse.graphiti.mm.algorithms

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


        ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) graphicalViewer.getEditPartRegistry().get(LayerManager.ID);
        IFigure gridFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.GRID_LAYER);
        IColorConstant cc = StyleUtil.getColorConstant(PreferenceManager.getInstance().loadPreferenceAsString(PreferencesConstants.EDITOR_GRID_COLOR));
        Diagram diagram = designEditor.getDiagram();
        if (cc != null && diagram != null) {
          GraphicsAlgorithm ga = diagram.getGraphicsAlgorithm();
          if (ga != null){
            ga.setForeground(GraphitiUi.getGaService().manageColor(diagram, cc));
            gridFigure.repaint();
            gridFigure.revalidate();
            designEditor.getDiagramBehavior().refreshContent();
          }
        }
View Full Code Here


    }
  }

  private static void resizeParticipantBandChildren(ContainerShape container, int w) {
    for (Shape s : container.getChildren()) {
      GraphicsAlgorithm ga = s.getGraphicsAlgorithm();
      if (ga instanceof Text) {
        gaService.setSize(ga, w, ga.getHeight());
      } else if (ga instanceof Rectangle) {
        gaService.setLocation(ga, (w / 2) - (ga.getWidth() / 2), ga.getY());
      }
    }
  }
View Full Code Here

      BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(container, BPMNShape.class);
      diElements.remove(bpmnShape);
      peService.deletePictogramElement(container);
    }

    GraphicsAlgorithm ga = choreographyContainer.getGraphicsAlgorithm();
    IDimension size = gaService.calculateSize(ga);

    List<ContainerShape> newContainers = new ArrayList<ContainerShape>();
    int y = 0;
    boolean first = true;
View Full Code Here

    if (context.getHeight() == -1 && context.getWidth() == -1) {
      return true;
    }

    GraphicsAlgorithm ga = ((ContainerShape) context.getPictogramElement()).getGraphicsAlgorithm();

    int i = compare(ga.getHeight(), ga.getWidth(), context.getHeight(), context.getWidth());

    Lane lane = (Lane) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(), Lane.class);

    if (i < 0 && lane.getFlowNodeRefs().size() == 0) {
      return true;
View Full Code Here

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

    GraphicsAlgorithm containerGa = containerShape.getGraphicsAlgorithm();
    IGaService gaService = Graphiti.getGaService();

    int containerHeight = containerGa.getHeight();
    Iterator<Shape> iterator = containerShape.getChildren().iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      IDimension size = gaService.calculateSize(ga);
      if (containerHeight != size.getHeight()) {
        if (ga instanceof Polyline) {
          Polyline line = (Polyline) ga;
          Point firstPoint = line.getPoints().get(0);
          Point newPoint = gaService.createPoint(firstPoint.getX(), containerHeight);
          line.getPoints().set(1, newPoint);
        } else if (ga instanceof Text) {
          gaService.setHeight(ga, containerHeight);
        }
      }
    }

    Shape shape = FeatureSupport.getShape(containerShape, ParticipantMultiplicityUpdateFeature.MULTIPLICITY_MARKER,
        Boolean.toString(true));
    if (shape != null) {
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      int x = (containerGa.getWidth() / 2) - 10;
      int y = containerGa.getHeight() - 20;
      gaService.setLocation(ga, x, y);
    }
View Full Code Here

        List<ContainerShape> topBands = topAndBottomBands.getFirst();

        int y = 3;
        if (!topBands.isEmpty()) {
          ContainerShape containerShape = topBands.get(topBands.size() - 1);
          GraphicsAlgorithm ga = containerShape.getGraphicsAlgorithm();
          y = ga.getY() + ga.getHeight() + 3;
        }

        gaService.setLocationAndSize(text, 0, y, w, TEXT_H);
      }
    };
View Full Code Here

    List<ContainerShape> topBands = topAndBottomBands.getFirst();

    int y = 3;
    if (!topBands.isEmpty()) {
      ContainerShape containerShape = topBands.get(topBands.size() - 1);
      GraphicsAlgorithm ga = containerShape.getGraphicsAlgorithm();
      y = ga.getY() + ga.getHeight() + 3;
    }

    gaService.setLocationAndSize(text, 0, y, w, TEXT_H);
  }
View Full Code Here

    Collection<Shape> shapes = peService.getAllContainedShapes((ContainerShape) context.getShape());
    for (Shape s : shapes) {
      Participant participant = BusinessObjectUtil.getFirstElementOfType(s, Participant.class);
      if (participant != null) {
        ContainerShape container = (ContainerShape) s;
        GraphicsAlgorithm ga = container.getGraphicsAlgorithm();

        BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(s, BPMNShape.class);
        ILocation loc = Graphiti.getLayoutService().getLocationRelativeToDiagram(context.getShape());

        Bounds bounds = bpmnShape.getBounds();
        bounds.setX(loc.getX() + ga.getX());
        bounds.setY(loc.getY() + ga.getY());
      }
    }
    ChoreographyUtil.moveChoreographyMessageLinks((ContainerShape) context.getPictogramElement());
  }
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 Participant && ga instanceof Text;
  }
View Full Code Here

    Shape textShape = getShape(container, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
    Text textGa = (Text) textShape.getGraphicsAlgorithm();
    String text = textGa.getValue() == null ? "" : textGa.getValue();
    IDimension size = GraphitiUi.getUiLayoutService().calculateTextSize(text, textGa.getFont());

    GraphicsAlgorithm parentGa = container.getGraphicsAlgorithm();

    if (size.getWidth() > getMinimumWidth()) {
      gaService.setSize(parentGa, size.getWidth() + 3, parentGa.getHeight());
    } else {
      gaService.setSize(parentGa, getMinimumWidth(), parentGa.getHeight());
    }

    gaService.setSize(textGa, size.getWidth() + 3, textGa.getHeight());

    return true;
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.