Package org.eclipse.gmf.runtime.notation

Examples of org.eclipse.gmf.runtime.notation.Bounds


        View originalView = possibleMatches.getFirst();
        knownViewChildren.remove(originalView); // remove not to copy properties of the same view again and again
        // add command to copy properties
        if (originalView instanceof Node) {
          if (((Node) originalView).getLayoutConstraint() instanceof Bounds) {
            Bounds b = (Bounds) ((Node) originalView)
                .getLayoutConstraint();
            boundsCommand.add(new SetBoundsCommand(boundsCommand
                .getEditingDomain(), boundsCommand.getLabel(),
                descriptor, new Rectangle(b.getX(), b.getY(), b
                    .getWidth(), b.getHeight())));
          } else if (((Node) originalView).getLayoutConstraint() instanceof Location) {
            Location l = (Location) ((Node) originalView)
                .getLayoutConstraint();
            boundsCommand.add(new SetBoundsCommand(boundsCommand
                .getEditingDomain(), boundsCommand.getLabel(),
View Full Code Here


    }
   
    return new Runnable() {
      public void run() {
       
        Bounds helpBounds = null;
        Node helpNode = null;
       
        // set X & Y position of nodes
        for (int node=0; node<lnodes.size(); node++) {
          helpNode = (Node)((ILayoutNode)lnodes.get(node)).getNode();
          helpBounds = (Bounds)(helpNode).getLayoutConstraint();
          if (node == 0) {
            helpBounds.setY(DISTANCE_Y);
            helpBounds.setX(DISTANCE_X);
          }
          else  {
            int totalHeight = 0;
            for (int j=0; j<node; j++) {
              totalHeight = totalHeight + heightBox[j];
            }
            helpBounds.setY(DISTANCE_Y*(node + 1) + totalHeight);
            helpBounds.setX(DISTANCE_X);
          }
        }
   
      }
    };
View Full Code Here

    finalHeight = (FIGURE_HEIGHT+DISTANCE_Y)*maxCount-DISTANCE_Y;
       
    return new Runnable() {
      public void run() {
       
        Bounds helpBounds = null;
        Node helpNode = null;
       
       
        // set X & Y position of column-nodes
        for (int column=0; column<lnodes.size(); column++) {
          int countOfNodes = ((Node)((ILayoutNode)lnodes.get(column)).getNode()).getVisibleChildren().size();
          helpNode = (Node)((ILayoutNode)lnodes.get(column)).getNode();
          helpBounds = (Bounds)(helpNode).getLayoutConstraint();
          if (column == 0)
            helpBounds.setX(0);
          else if (column == 1)
            helpBounds.setX(DISTANCE_INPUTS_X + FIGURE_WIDTH);
          else
            helpBounds.setX((DISTANCE_LAYERS_X + FIGURE_WIDTH)*column + DISTANCE_INPUTS_X - DISTANCE_LAYERS_X);
          helpBounds.setY(finalHeight/2 - ((FIGURE_HEIGHT+DISTANCE_Y)*countOfNodes-DISTANCE_Y)/2);
          helpNode.setLayoutConstraint(helpBounds)
        }
       
        // set X & Y position of nodes in clumon
        for (int column=0; column<lnodes.size(); column++) {
          int countOfNodes = ((Node)((ILayoutNode)lnodes.get(column)).getNode()).getVisibleChildren().size();
          for (int positionInCloumn=0; positionInCloumn < countOfNodes; positionInCloumn++) {
            helpNode = (Node)((Node)((ILayoutNode)lnodes.get(column)).getNode()).getVisibleChildren().get(positionInCloumn);
            helpBounds = (Bounds)(helpNode).getLayoutConstraint();
            helpBounds.setX(0);
            helpBounds.setY((FIGURE_HEIGHT+DISTANCE_Y)*positionInCloumn);
            //helpBounds.setY(finalHeight/2 - ((FIGURE_HEIGHT+DISTANCE_Y)*countOfNodes-DISTANCE_Y)/2 +
            //    (FIGURE_HEIGHT+DISTANCE_Y)*positionInCloumn);
            helpNode.setLayoutConstraint(helpBounds);
          }
        }
 
View Full Code Here

          //check of root node
          if (level == 1) {
            rootNode = lnode.getNode();           
          }
          //set Y in node     
          Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
          bounds.setY((height + DISTANCE_Y)*(level));
          lnode.getNode().setLayoutConstraint(bounds);
        }
        //set X in node
        int[] levelspace = new int[numberOfLevels];
        for (int i=0; i<(numberOfLevels); i++) {
View Full Code Here

        width = lnode.getWidth();
        find = true;
      }
    }
    int level = checkLevel(node, 0);
    Bounds bounds = (Bounds)node.getLayoutConstraint();
    if (levelspace[level-1] == 0) {
           if (level == 1) {
             bounds.setX(0);
               levelspace[level-1] = bounds.getX() + width;
           }
           else {
             int sequence = getSequence(node);
               if (sequence == 0) {
                 Node parentNode = (Node)((Edge)node.getTargetEdges().get(0)).getSource();
                 int parentWidth = 100;
                 boolean findParent = false;
                 while ((find != true) & (li.hasNext())) {
                   ILayoutNode lnode = (ILayoutNode)li.next();
                   Node helpNode = lnode.getNode();
                   if (helpNode.equals(parentNode)) {
                     parentWidth = lnode.getWidth();
                     findParent = true;
                   }
                 }
                 Bounds parentBounds = (Bounds)parentNode.getLayoutConstraint();
                   int distance = checkChildrensDistance(parentNode, lnodes);
                 if (levelspace[level-1] < (parentBounds.getX() + parentWidth - distance)) {
                   bounds.setX(parentBounds.getX() + parentWidth - distance);
                 }
                 else {
                   bounds.setX(parentBounds.getX());
                 }
               }
               levelspace[level-1] = bounds.getX() + width;
           }
       }
       else {
           int sequence = getSequence(node);
           if (sequence == 0) {
             Node parentNode = (Node)((Edge)node.getTargetEdges().get(0)).getSource();
             int parentWidth = 100;
             boolean findParent = false;
             while ((find != true) & (li.hasNext())) {
               ILayoutNode lnode = (ILayoutNode)li.next();
               Node helpNode = lnode.getNode();
               if (helpNode.equals(parentNode)) {
                 parentWidth = lnode.getWidth();
                 findParent = true;
               }
             }
             Bounds parentBounds = (Bounds)parentNode.getLayoutConstraint();
               int distance = checkChildrensDistance(parentNode, lnodes);
             if (levelspace[level-1] < (parentBounds.getX() + parentWidth - distance - DISTANCE_X)) {
               bounds.setX(parentBounds.getX() + parentWidth - distance);
             }
             else {
                   bounds.setX(levelspace[level-1] + DISTANCE_X);
                 setXofMyParent(node, sequence, levelspace, lnodes);
             }
View Full Code Here

            Node parentNode = (Node)((Edge)node.getTargetEdges().get(0)).getSource();
            int level = checkLevel(parentNode, 0);
        //  int firstChild = ((Bounds)((Node)((Edge)parentNode.getSourceEdges().get(0)).getTarget()).getLayoutConstraint()).getX();
            Edge helpEdge = (Edge)parentNode.getSourceEdges().get(0);
            Node helpNode = (Node)helpEdge.getTarget();
            Bounds helpBounds = (Bounds)helpNode.getLayoutConstraint();
            int firstChild = helpBounds.getX();
           
            helpEdge = (Edge)parentNode.getSourceEdges().get(x);
            helpNode = (Node)helpEdge.getTarget();
            helpBounds = (Bounds)helpNode.getLayoutConstraint();
            int lastChild = helpBounds.getX();
           
            int distance = (lastChild - firstChild)/2 + firstChild;
            helpBounds = (Bounds)parentNode.getLayoutConstraint();
            helpBounds.setX(distance);
           
            int width = 100;
        ListIterator li = lnodes.listIterator();
        boolean find = false;
        while ((find != true) & (li.hasNext())) {
View Full Code Here

        while (li.hasNext()) {
          ILayoutNode lnode = (ILayoutNode)li.next();
                   
          if (lnode.getNode().getElement() instanceof ExpressionStatement ) {

            Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
            bounds.setX(0);
            bounds.setY(0);
            lnode.getNode().setLayoutConstraint(bounds);
           
           
          } else {
         
          Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
          bounds.setX((i % rowsize) * gridWidth);
          bounds.setY((i / rowsize) * gridHeight);
          lnode.getNode().setLayoutConstraint(bounds);
          i++;
          }
         
        }
 
View Full Code Here

        boolean isFirst = true;
        while (li.hasNext()) {
          ILayoutNode lnode = (ILayoutNode)li.next();
         
          if (lnode.getNode().getElement() instanceof ExpressionStatement ) {
            Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
            bounds.setX(0);
            bounds.setY(0);
            lnode.getNode().setLayoutConstraint(bounds);
          }
         
          if ((lnode.getNode().getElement() instanceof ConnectionInitialization) ||
              (lnode.getNode().getElement() instanceof LocalVariableStatement)) {
            //Check of freeTopPosition
            if (freeTopPosition < lnode.getHeight()) {
              freeTopPosition = lnode.getHeight();
            }
            Shape shape = (Shape)((Node)lnode.getNode());
            DecorationNode decorationNode = (DecorationNode)shape.getChildren().get(0);
           
            if ((lnode.getNode().getElement() instanceof LocalVariableStatement) && (decorationNode.isVisible() == true)) {
              Node nodeLVS = (Node)lnode.getNode();
              Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
              // set X position
              if (isFirst == true) {
                bounds.setX(freeLeftPosition);
                freeLeftPosition = freeLeftPosition + lnode.getWidth();
                isFirst = false;
              }
              else {
                bounds.setX(freeLeftPosition + DISTANCE_LVS_X);
                freeLeftPosition = freeLeftPosition + lnode.getWidth() + DISTANCE_LVS_X;
              }
              // set Y position
              bounds.setY(DISTANCE_Y);
              lnode.getNode().setLayoutConstraint(bounds);
            }
            else {
              Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
              bounds.setX(freeSecondLeftPosition + 10);
              freeSecondLeftPosition = freeSecondLeftPosition + lnode.getWidth();
              bounds.setY(freeTopPosition + 50 + DISTANCE_Y);
              lnode.getNode().setLayoutConstraint(bounds);
            }
          }
        }
   
View Full Code Here

        while (li.hasNext()) {
          ILayoutNode lnode = (ILayoutNode)li.next();
                   
          if (lnode.getNode().getElement() instanceof ExpressionStatement ) {

            Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
            bounds.setX(0);
            bounds.setY(0);
            lnode.getNode().setLayoutConstraint(bounds);
           
           
          } else {
         
          Bounds bounds = (Bounds)lnode.getNode().getLayoutConstraint();
          bounds.setX((i % rowsize) * gridWidth);
          bounds.setY((i / rowsize) * gridHeight);
          lnode.getNode().setLayoutConstraint(bounds);
          i++;
          }
         
        }
 
View Full Code Here

        Iterator iter = lnodes.iterator();   
        for (int i=0; i < lnodes.size(); i++) {
          Node helpNode = (Node)((ILayoutNode)lnodes.get(i)).getNode();
          if (helpNode.getElement() instanceof DataFieldType) {
            if(((DataFieldType)helpNode.getElement()).getName().equals("class")) {
              Bounds helpBounds = (Bounds)(helpNode).getLayoutConstraint();
              helpBounds.setX(BORDER_DISTANCE + ZERO_DISTANCE);
              helpBounds.setY(BORDER_DISTANCE + ZERO_DISTANCE);
            }
            else {
              for (ExtensionType helpET :((DataFieldType)helpNode.getElement()).getExtension()) {
                Bounds helpBounds = (Bounds)(helpNode).getLayoutConstraint();
                if (helpET.getName().equals("xCoordinate")) {
                  int coordinateX = BORDER_DISTANCE + ZERO_DISTANCE + (int)(Double.parseDouble(helpET.getValue())*ZERO_DISTANCE);
//                  System.out.println("coordinateX: " + coordinateX);
                  helpBounds.setX(coordinateX);
                }
                if (helpET.getName().equals("yCoordinate")) {
                  int coordinateY = BORDER_DISTANCE + ZERO_DISTANCE + (int)(Double.parseDouble(helpET.getValue())*ZERO_DISTANCE);
//                  System.out.println("coordinateY: " + coordinateY);
                  helpBounds.setY(coordinateY);
                }
                helpNode.setLayoutConstraint(helpBounds);
              }
            }
          }
          if (helpNode.getElement() instanceof ExtensionType) {
            if (((ExtensionType)helpNode.getElement()).getMixed().size() > 0) {
              String helpString = ((FeatureMap) ((ExtensionType) helpNode
                  .getElement()).getMixed()).getValue(0).toString();
              String comparativeString = " ";
              String separatedText_X = "";
              String separatedText_Y = "";
              boolean foundFirst = false;
              for (int j=0; j < (helpString.length() - comparativeString.length()); j++) {
                if (helpString.regionMatches(j, comparativeString, 0, comparativeString.length())) {
                 
                  if (foundFirst == true) {
                    separatedText_Y = helpString.substring(separatedText_X.length() + comparativeString.length(), j);
                    break;
                  }
                  if (foundFirst == false) {
                    separatedText_X = helpString.substring(0, j);
                    foundFirst = true;
                  }                 
                }
              }
              Bounds helpBounds = (Bounds)(helpNode).getLayoutConstraint();
              int coordinateX = BORDER_DISTANCE + ZERO_DISTANCE + (int)(Double.parseDouble(separatedText_X)*ZERO_DISTANCE);
//              System.out.println("coordinateX: " + coordinateX);
              helpBounds.setX(coordinateX);
              int coordinateY = BORDER_DISTANCE + ZERO_DISTANCE + (int)(Double.parseDouble(separatedText_Y)*ZERO_DISTANCE);
//              System.out.println("coordinateY: " + coordinateY);
              helpBounds.setY(coordinateY);
            }
          }
       
         
        }
View Full Code Here

TOP

Related Classes of org.eclipse.gmf.runtime.notation.Bounds

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.