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();

    // support direct editing if it is a literal
    if (Utility.isObjectLiteral(bo)) {
      return true;
    }
View Full Code Here


    EdgeList edgeList = new EdgeList();
    NodeList nodeList = new NodeList();
    EList<Shape> children = d.getChildren();
    for (Shape shape : children) {
      Node node = new Node();
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      node.x = ga.getX();
      node.y = ga.getY();
      node.width = ga.getWidth();
      node.height = ga.getHeight();
      node.data = shape;
      shapeToNode.put(shape, node);
      nodeList.add(node);
    }
    EList<Connection> connections = d.getConnections();
View Full Code Here

        boolean anythingChanged = false;
       
        ContainerShape containerShape =
            (ContainerShape) context.getPictogramElement();
        GraphicsAlgorithm containerGa = containerShape.getGraphicsAlgorithm();

        int containerWidth = containerGa.getWidth();

        for (Shape shape : containerShape.getChildren()){

            GraphicsAlgorithm graphicsAlgorithm = shape.getGraphicsAlgorithm();
            IGaService gaService = Graphiti.getGaService();

            IDimension size =
                 gaService.calculateSize(graphicsAlgorithm);
View Full Code Here

  @Override
  public boolean canDirectEdit(IDirectEditingContext context) {

    PictogramElement pe = context.getPictogramElement();
    Object bo = getBusinessObjectForPictogramElement(pe);
    GraphicsAlgorithm ga = context.getGraphicsAlgorithm();

    // support direct editing, if it is a PE, and the user clicked
    // directly on the text and not somewhere else in the rectangle
    if (bo instanceof LocalVariableStatement) {
      return true;
View Full Code Here

    int mY = location.y;
    context.setX(mX);
    context.setY(mY);

    if (pe instanceof Shape && !(pe instanceof Diagram)) {
      GraphicsAlgorithm ga = pe.getGraphicsAlgorithm();
      if (ga != null) {
        ILocation relLocation = Graphiti.getPeService().getLocationRelativeToDiagram((Shape) pe);
        int x = relLocation.getX();
        int y = relLocation.getY();
        int width = ga.getWidth();
        int height = ga.getHeight();

        if (mX > x && mX < x + width && mY > y && mY < y + height) {
          int relativeX = mX - x;
          int relativeY = mY - y;
          ILocationInfo locationInfo = Graphiti.getLayoutService().getLocationInfo((Shape) pe, relativeX, relativeY);
View Full Code Here

    EdgeList edgeList = new EdgeList();
    NodeList nodeList = new NodeList();
    EList<Shape> children = d.getChildren();
    for (Shape shape : children) {
      Node node = new Node();
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      node.x = ga.getX();
      node.y = ga.getY();
      node.width = ga.getWidth();
      node.height = ga.getHeight();
      node.data = shape;
      shapeToNode.put(shape, node);
      nodeList.add(node);
    }
    EList<Connection> connections = d.getConnections();
View Full Code Here

  @Override
  public GraphicsAlgorithm[] getClickArea(PictogramElement pe) {
    IFeatureProvider featureProvider = getFeatureProvider();
    Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);
    if (bo instanceof AbstractNode && !(bo instanceof Flow)) {
      GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm();
      GraphicsAlgorithm rectangle = invisible;
      if (invisible.getGraphicsAlgorithmChildren().size() > 0) {
        rectangle = invisible.getGraphicsAlgorithmChildren().get(0);
        if (invisible.getGraphicsAlgorithmChildren().size()>1) {
          rectangle = invisible.getGraphicsAlgorithmChildren().get(1);
        }
View Full Code Here

  @Override
  public GraphicsAlgorithm getSelectionBorder(PictogramElement pe) {
    IFeatureProvider featureProvider = getFeatureProvider();
    Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);
    if (bo instanceof AbstractNode) {
      GraphicsAlgorithm invisible = pe.getGraphicsAlgorithm();
      GraphicsAlgorithm rectangle = invisible;
      if (invisible.getGraphicsAlgorithmChildren().size() > 0) {
        rectangle = invisible.getGraphicsAlgorithmChildren().get(0);
        if (invisible.getGraphicsAlgorithmChildren().size()>1) {
          rectangle = invisible.getGraphicsAlgorithmChildren().get(1);
        }
View Full Code Here

  }

  public boolean layout(ILayoutContext context) {
    boolean anythingChanged = false;
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();
    GraphicsAlgorithm containerGa = containerShape.getGraphicsAlgorithm();
    // the containerGa is the invisible rectangle
    // containing the visible rectangle as its (first and only) child
    GraphicsAlgorithm rectangle = containerGa.getGraphicsAlgorithmChildren().get(0);

    // height of invisible rectangle
    if (containerGa.getHeight() < MIN_HEIGHT) {
      containerGa.setHeight(MIN_HEIGHT);
      anythingChanged = true;
    }

    // height of visible rectangle (same as invisible rectangle)
    if (rectangle.getHeight() != containerGa.getHeight()) {
      rectangle.setHeight(containerGa.getHeight());
      anythingChanged = true;
    }

    // width of invisible rectangle
    if (containerGa.getWidth() < MIN_WIDTH) {
      containerGa.setWidth(MIN_WIDTH);
      anythingChanged = true;
    }

    // width of visible rectangle (smaller than invisible rectangle)
    int rectangleWidth = containerGa.getWidth() - AddNodeFeature.INVISIBLE_RIGHT_SPACE;
    if (rectangle.getWidth() != rectangleWidth) {
      rectangle.setWidth(rectangleWidth);
      anythingChanged = true;
    }

    // width of text and line (same as visible rectangle)
    for (Shape shape : containerShape.getChildren()) {
      GraphicsAlgorithm graphicsAlgorithm = shape.getGraphicsAlgorithm();
      IGaService gaService = Graphiti.getGaService();
      IDimension size = gaService.calculateSize(graphicsAlgorithm);
      if (rectangleWidth != size.getWidth()) {
        gaService.setWidth(graphicsAlgorithm, rectangleWidth);
        anythingChanged = true;
View Full Code Here

  @Override
  public boolean canDirectEdit(IDirectEditingContext context) {
    PictogramElement pe = context.getPictogramElement();
    Object bo = getBusinessObjectForPictogramElement(pe);
    GraphicsAlgorithm ga = context.getGraphicsAlgorithm();
    // support direct editing, if it is a EClass, and the user clicked
    // directly on the text and not somewhere else in the rectangle
    if (bo instanceof AbstractNode && ga instanceof Text) {
      // EClass eClass = (EClass) bo;
      // additionally the flag isFrozen must be false
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.