Package org.eclipse.draw2d.graph

Examples of org.eclipse.draw2d.graph.Node


    if (nodeCount > 1)
    {
      NodeList candidateList = new NodeList();
      for (Iterator<Node> iter = nodeList.iterator(); iter.hasNext();)
      {
        Node sourceNode = iter.next();

        //we will need to set up a dummy relationship for any node not
        // in one already
        if (sourceNode.outgoing.size() == 0 && sourceNode.incoming.size() == 0)
        {
          candidateList.add(sourceNode);
          sourceNode.setRowConstraint(2);
        }
        else
        {
          sourceNode.setRowConstraint(1);
        }
      }
      if (candidateList.size() > 1)
      {
        int index = 0;
        while (index < candidateList.size() - 1)
        {
          Node sourceNode = candidateList.getNode(index++);
          Node targetNode = candidateList.getNode(index);
          newDummyEdge(targetNode, sourceNode);
        }
      }
    }
  }
View Full Code Here


    EdgeList edgeList = new EdgeList();
    NodeList nodeList = new NodeList();
    List<DiagramNodeModel> children = diagramModel.getNodes();
    for (DiagramNodeModel child : children)
    {
      Node node = new Node();
      Rectangle bounds = child.getShapePresentation().getFigure().getBounds();//child.getNodeBounds();
      node.x = bounds.x;
      node.y = bounds.y;
      node.width = bounds.width;
      node.height = bounds.height;
View Full Code Here

  {
    NodeList myNodes = new NodeList();
    myNodes.addAll(graph.nodes);
    for (Object object : myNodes)
    {
      Node node = (Node) object;
      DiagramNodeModel nodeModel = (DiagramNodeModel) node.data;
      DiagramNodePart nodePart = nodeModel.getModelPart();
      nodePart.setNodeBounds(node.x, node.y, autoLayout, false);
    }   
  }
View Full Code Here

      if (nodes != null)
      {
        //int bpIndex = 0;
        for (int i = 0; i < nodes.size(); i++)
        {
          Node vn = nodes.getNode(i);
          int x = vn.x;
          int y = vn.y;
          if (getGraphDirection() == PositionConstants.EAST)
          {
            if (edge.isFeedback())
View Full Code Here

  private Diagram mapGraphCoordinatesToDiagram(CompoundDirectedGraph graph) {
    NodeList myNodes = new NodeList();
    myNodes.addAll(graph.nodes);
    myNodes.addAll(graph.subgraphs);
    for (Object object : myNodes) {
      Node node = (Node) object;
      Shape shape = (Shape) node.data;
      shape.getGraphicsAlgorithm().setX(node.x);
      shape.getGraphicsAlgorithm().setY(node.y);
      shape.getGraphicsAlgorithm().setWidth(node.width);
      shape.getGraphicsAlgorithm().setHeight(node.height);
View Full Code Here

    CompoundDirectedGraph dg = new CompoundDirectedGraph();
    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();
View Full Code Here

    graph.setMargin(new Insets(20, 60, 20, 60));
    graph.setDefaultPadding(new Insets(30, 50, 30, 50));
   
    for (int i = 0; i < entitiesToLayout.length; i++) {
      InternalNode internalNode = entitiesToLayout[i];
      Node node = new Node(internalNode);
      node.setSize(new Dimension(10, 10));
      mapping.put(internalNode, node);
      graph.nodes.add(node);
    }
    for (int i = 0; i < relationshipsToConsider.length; i++) {
      InternalRelationship relationship = relationshipsToConsider[i];
      Node source = (Node) mapping.get(relationship.getSource());
      Node dest = (Node) mapping.get(relationship.getDestination());
      Edge edge = new Edge(relationship, source, dest);
      graph.edges.add(edge);
    }
    DirectedGraphLayout directedGraphLayout = new DirectedGraphLayout();
    directedGraphLayout.visit(graph);

    for (Iterator iterator = graph.nodes.iterator(); iterator.hasNext();) {
      Node node = (Node) iterator.next();
      InternalNode internalNode = (InternalNode) node.data;
      // For horizontal layout transpose the x and y coordinates
      if ((layout_styles & SWT.HORIZONTAL) == SWT.HORIZONTAL) {
        internalNode.setInternalLocation(node.y, node.x);
      } else {
View Full Code Here

  private void adjustHorizontalSpaces(DirectedGraph g) {
    for (int row = 0; row < g.ranks.size(); row++) {
      Rank rank = g.ranks.getRank(row);
      for (int n = 0; n < rank.size(); n++) {
        Node node = rank.getNode(n);
        InternalNode internalNode = (InternalNode) node.data;
        Insets padNode = g.getPadding(node);

        internalNode.setSize(internalNode.getWidthInLayout(), 25);
       
        if (node.getLeft()!=null) {
          // check space to left
          Node left = node.getLeft();
          if (left.data instanceof InternalNode) {
            InternalNode internalLeft = (InternalNode) left.data;
            Insets padLeft = g.getPadding(left);
   
            double left_end = internalLeft.getCurrentX() + internalLeft.getWidthInLayout() + padLeft.right + padNode.left;
            if (internalNode.getCurrentX() <= left_end) {
              // node overlaps with left neighbor
  //            node.x = (int)left_end;
              internalNode.setLocation(left_end, internalNode.getCurrentY());
            }
          } else {
            Activator.getLogger().warning("Unsupported object " + left.data + " can't be cast to InternalNode!");
          }
        }
       
        if (node.getRight()!=null) {
          // check space to right
          Node right = node.getRight();
          if (right.data instanceof InternalNode) {
            InternalNode internalRight = (InternalNode) right.data;
            Insets padRight = g.getPadding(right);
           
            double node_end = internalNode.getCurrentX() + internalNode.getWidthInLayout() + padNode.right + padRight.left;
View Full Code Here

      label.setText("Method-override bean");
    } else if (type == BeanType.INTERCEPTOR) {
      conn.setLineStyle(Graphics.LINE_DASHDOT);
      label.setText("Interceptor bean");
    } else {
      Node node = getReference().getNode();
      if (node instanceof ConstructorArgument) {
        label.setText("ConstructorArgument: "
            + ((ConstructorArgument) node).getName());
      } else if (node instanceof Property) {
        label.setText("Property: " + ((Property) node).getName());
View Full Code Here

    // Create bend points for edge's virtual nodes (if any)
    NodeList nodes = edge.vNodes;
    if (nodes != null) {
      for (int i = 0; i < nodes.size(); i++) {
        Node node = nodes.getNode(i);

        // Check if edge was inverted (due to broken cycle)
        if (edge.isFeedback()) {
          bends.add(new AbsoluteBendpoint(node.x
              + GraphPart.MARGIN_SIZE, node.y
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.graph.Node

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.