Examples of ILayoutNode


Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

        ListIterator li = lnodes.listIterator();
        int numberOfLevels = 0;
        Node rootNode = null;
       
        while (li.hasNext()) {
          ILayoutNode lnode = (ILayoutNode)li.next();
          int level = checkLevel(lnode.getNode(), 0);
          if (numberOfLevels < level) {
            numberOfLevels = level;
          }
          //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++) {
          levelspace[i] = 0;
View Full Code Here

Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

  private static void setXinNode(Node node, int [] levelspace, List lnodes) {
    int width = 100;
    ListIterator li = lnodes.listIterator();
    boolean find = false;
    while ((find != true) & (li.hasNext())) {
      ILayoutNode lnode = (ILayoutNode)li.next();
      Node helpNode = lnode.getNode();
      if (helpNode.equals(node)) {
        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);
View Full Code Here

Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

    int i = 0;
    for (i=0; i<parentNode.getSourceEdges().size(); i++) {
      Node childNode = (Node)((Edge)parentNode.getSourceEdges().get(i)).getTarget();
      boolean find = false;
      while ((find != true) & (li.hasNext())) {
        ILayoutNode lnode = (ILayoutNode)li.next();
        Node helpNode = lnode.getNode();
        if (helpNode.equals(childNode)) {
          distance = distance + lnode.getWidth();
          find = true;
        }
      }
    }
    distance = (distance + (i - 1)*DISTANCE_X_BETWEEN_NODES)/2;
 
View Full Code Here

Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

           
            int width = 100;
        ListIterator li = lnodes.listIterator();
        boolean find = false;
        while ((find != true) & (li.hasNext())) {
          ILayoutNode lnode = (ILayoutNode)li.next();
          Node hNode = lnode.getNode();
          if (hNode.equals(node)) {
            width = lnode.getWidth();
            find = true;
          }
        } 
            if (levelspace[level-1]<distance + width) {
              levelspace[level-1] = distance + width;
View Full Code Here

Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

        int gridWidth = 0;
        int gridHeight = 0;
        ListIterator li = lnodes.listIterator();
             
        while (li.hasNext()) {
          ILayoutNode lnode = (ILayoutNode)li.next();
          if (lnode.getWidth() > gridWidth)
            gridWidth = lnode.getWidth();
          if (lnode.getHeight() > gridHeight)
            gridHeight = lnode.getHeight();
        }
       
        // add a small buffer in HiMetric units
        gridWidth += 100;
        gridHeight += 100;
       
        int i = 0;
        li = lnodes.listIterator();
        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

Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

        final int rowsize = (int)Math.round(Math.sqrt(lnodes.size()));
       
        // REDUCE
        ListIterator liter = lnodes.listIterator();
        while (liter.hasNext()) {
          ILayoutNode lnode = (ILayoutNode)liter.next();
                   
          if ((lnode.getNode().getElement() instanceof ConnectionInitialization) ||
              (lnode.getNode().getElement() instanceof LocalVariableStatement)) {
           
            Shape shape = (Shape)((Node)lnode.getNode());
            DecorationNode decorationNode = (DecorationNode)shape.getChildren().get(0);
           
            if ((lnode.getNode().getElement() instanceof ConnectionInitialization) && (decorationNode.isVisible() == true)) {
             
              Node nodeCI = (Node)lnode.getNode();
             
              Edge e = (Edge)nodeCI.getSourceEdges().get(0);
              e.setVisible(false);
             
              decorationNode.setVisible(false);
             
              /*
              //RGB to Integer
              System.out.println("original shape line color:  " + shape.getLineColor());             
              FigureUtilities fu =  new FigureUtilities();
              RGB rgb = new RGB(255,255,255); // White Color (255,255,255)
              int rgbInt = fu.RGBToInteger(rgb);
              System.out.println("RGB to Integer: " + rgbInt);
              */
             
              //White Line -> RGB(255,255,255) to Integer = 16777215
              shape.setLineColor(16777215);
             
              //System.out.println("REDUCE - CI is NOT Visible");
            }

            if ((lnode.getNode().getElement() instanceof LocalVariableStatement) && (decorationNode.isVisible() == true)) {
              // 1.LocalVariableStatement
              Node nodeLVS = (Node)lnode.getNode();
              if (!nodeLVS.getChildren().isEmpty()) {
                // 2.LocalVariableStatement
                Node nodeSecondLVS = (Node)nodeLVS.getChildren().get(0);
                    //System.out.println("nodeSecondLVS: " + nodeSecondLVS.getElement());
                if ((nodeSecondLVS.getElement() instanceof LocalVariableStatement) && (!nodeSecondLVS.getChildren().isEmpty())) {
                  // 1. LocalVariable
                  Node nodeLV = (Node)nodeSecondLVS.getChildren().get(0);
                      //System.out.println("nodeLV: " + nodeLV.getElement());
                  if ((nodeLV.getElement() instanceof LocalVariable) && (nodeLV.getChildren().size() == 2)) {
                    //2. & 3. LocalVariable
                    Node nodeFirstChildLV = (Node)nodeLV.getChildren().get(0);
                    Node nodeSecondChildLV = (Node)nodeLV.getChildren().get(1);
                        //System.out.println("nodeFirstChildLV: " + nodeFirstChildLV.getElement());
                        //System.out.println("nodeSecondChildLV: " + nodeSecondChildLV.getElement());
                    if ((nodeFirstChildLV.getElement() instanceof LocalVariable) && (nodeFirstChildLV.getChildren().isEmpty()) &&
                        (nodeSecondChildLV.getElement() instanceof LocalVariable) && (nodeSecondChildLV.getChildren().isEmpty())) {
                     
                      if (!nodeLV.getSourceEdges().isEmpty()) {
                        Edge e = (Edge)nodeLV.getSourceEdges().get(0);
                        e.setVisible(false);
                      }
                     
                      if (!nodeLV.getTargetEdges().isEmpty()) {
                        Edge e = (Edge)nodeLV.getTargetEdges().get(0);
                        e.setVisible(false);
                      }
                     
                      decorationNode.setVisible(false);
                     
                      //White Line -> RGB(255,255,255) to Integer = 16777215
                      shape.setLineColor(16777215);
                     
                      //System.out.println("REDUCE - LVS is NOT Visible");
                    }
                  }
                }
              } 
            }
          }
        }
       
       
        //SET POSITION
        ListIterator li = lnodes.listIterator();
        int freeLeftPosition = DISTANCE_X;
        int freeSecondLeftPosition = DISTANCE_X;
        int freeTopPosition = DISTANCE_Y;
        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

Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

        final int rowsize = (int)Math.round(Math.sqrt(lnodes.size()));
       
        //RENEW
        ListIterator liter = lnodes.listIterator();
        while (liter.hasNext()) {
          ILayoutNode lnode = (ILayoutNode)liter.next();
                   
          if ((lnode.getNode().getElement() instanceof ConnectionInitialization) ||
              (lnode.getNode().getElement() instanceof LocalVariableStatement)) {
           
            Shape shape = (Shape)((Node)lnode.getNode());
            DecorationNode decorationNode = (DecorationNode)shape.getChildren().get(0);
           
            if ((lnode.getNode().getElement() instanceof ConnectionInitialization) && (decorationNode.isVisible() == false)) {
             
              Node nodeCI = (Node)lnode.getNode();
             
              //Original color of Line -> Integer = 11579568
              shape.setLineColor(11579568);
             
              decorationNode.setVisible(true);
             
              Edge e = (Edge)nodeCI.getSourceEdges().get(0);
              e.setVisible(true);
             
              //System.out.println("RENEW - CI is Visible");
            }

            if ((lnode.getNode().getElement() instanceof LocalVariableStatement) && (decorationNode.isVisible() == false)) {
              // 1.LocalVariableStatement
              Node nodeLVS = (Node)lnode.getNode();
              if (!nodeLVS.getChildren().isEmpty()) {
                // 2.LocalVariableStatement
                Node nodeSecondLVS = (Node)nodeLVS.getChildren().get(0);
                    //System.out.println("nodeSecondLVS: " + nodeSecondLVS.getElement());
                if ((nodeSecondLVS.getElement() instanceof LocalVariableStatement) && (!nodeSecondLVS.getChildren().isEmpty())) {
                  // 1. LocalVariable
                  Node nodeLV = (Node)nodeSecondLVS.getChildren().get(0);
                      //System.out.println("nodeLV: " + nodeLV.getElement());
                  if ((nodeLV.getElement() instanceof LocalVariable) && (nodeLV.getChildren().size() == 2)) {
                    //2. & 3. LocalVariable
                    Node nodeFirstChildLV = (Node)nodeLV.getChildren().get(0);
                    Node nodeSecondChildLV = (Node)nodeLV.getChildren().get(1);
                        //System.out.println("nodeFirstChildLV: " + nodeFirstChildLV.getElement());
                        //System.out.println("nodeSecondChildLV: " + nodeSecondChildLV.getElement());
                    if ((nodeFirstChildLV.getElement() instanceof LocalVariable) && (nodeFirstChildLV.getChildren().isEmpty()) &&
                        (nodeSecondChildLV.getElement() instanceof LocalVariable) && (nodeSecondChildLV.getChildren().isEmpty())) {
                     
                      //shape.setVisible(true);
                      //nodeLVS.setVisible(true);
                     
                      //Original color of Line -> Integer = 11579568
                      shape.setLineColor(11579568);
                     
                      decorationNode.setVisible(true);
                     
                      if (!nodeLV.getSourceEdges().isEmpty()) {
                        Edge e = (Edge)nodeLV.getSourceEdges().get(0);
                        e.setVisible(true);
                      }
                     
                      if (!nodeLV.getTargetEdges().isEmpty()) {
                        Edge e = (Edge)nodeLV.getTargetEdges().get(0);
                        e.setVisible(true);
                      }
                         
                      //System.out.println("RENEW - LVS is Visible");
                    }
                  }
                }
              } 
            }
          }
        }
       
        // calculate the grid size
        int gridWidth = 0;
        int gridHeight = 0;
        ListIterator li = lnodes.listIterator();
       
       
       
        while (li.hasNext()) {
          ILayoutNode lnode = (ILayoutNode)li.next();
          if (lnode.getWidth() > gridWidth)
            gridWidth = lnode.getWidth();
          if (lnode.getHeight() > gridHeight)
            gridHeight = lnode.getHeight();
        }
       
        // add a small buffer in HiMetric units
        gridWidth += 100;
        gridHeight += 100;
       
        int i = 0;
        li = lnodes.listIterator();
        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

Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

        ListIterator li = lnodes.listIterator();
        int numberOfLevels = 0;
        Node rootNode = null;
       
        while (li.hasNext()) {
          ILayoutNode lnode = (ILayoutNode)li.next();
          int level = checkLevel(lnode.getNode(), 0);
          if (numberOfLevels < level) {
            numberOfLevels = level;
          }
          //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++) {
          levelspace[i] = 0;
View Full Code Here

Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

  private static void setXinNode(Node node, int [] levelspace, List lnodes) {
    int width = 100;
    ListIterator li = lnodes.listIterator();
    boolean find = false;
    while ((find != true) & (li.hasNext())) {
      ILayoutNode lnode = (ILayoutNode)li.next();
      Node helpNode = lnode.getNode();
      if (helpNode.equals(node)) {
        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);
View Full Code Here

Examples of org.eclipse.gmf.runtime.diagram.ui.services.layout.ILayoutNode

    int i = 0;
    for (i=0; i<parentNode.getSourceEdges().size(); i++) {
      Node childNode = (Node)((Edge)parentNode.getSourceEdges().get(i)).getTarget();
      boolean find = false;
      while ((find != true) & (li.hasNext())) {
        ILayoutNode lnode = (ILayoutNode)li.next();
        Node helpNode = lnode.getNode();
        if (helpNode.equals(childNode)) {
          distance = distance + lnode.getWidth();
          find = true;
        }
      }
    }
    distance = (distance + (i - 1)*DISTANCE_X_BETWEEN_NODES)/2;
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.