Package org.eclipse.draw2d.graph

Examples of org.eclipse.draw2d.graph.NodeList


        }
    }

    protected void applyResults(ElementConnectionEditPart connectionPart)    {
        Edge e = (Edge) partToNodesMap.get(connectionPart);
        NodeList nodes = e.vNodes;
        PolylineConnection conn = (PolylineConnection) connectionPart.getConnectionFigure();
        conn.setTargetDecoration(new PolygonDecoration());
        if (nodes != null) {
            List<Bendpoint> bends = new ArrayList<Bendpoint>();
            for (int i = 0; i < nodes.size(); i++) {
                Node vn = nodes.getNode(i);
                int x = vn.x;
                int y = vn.y;
                if (e.isFeedback()) {
                    bends.add(new AbsoluteBendpoint(x, y + vn.height));
                    bends.add(new AbsoluteBendpoint(x, y));
View Full Code Here


   *
   * @param graph Graph containing layouted nodes
   * @return Diagram with elements layouted
   */
  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);
View Full Code Here

  private CompoundDirectedGraph mapDiagramToGraph() {
    Map<AnchorContainer, Node> shapeToNode = new HashMap<AnchorContainer, Node>();
    Diagram d = getDiagram();
    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();
      node.data = shape;
      shapeToNode.put(shape, node);
      nodeList.add(node);
    }
    EList<Connection> connections = d.getConnections();
    for (Connection connection : connections) {
     
      //Be wary about broken connections
View Full Code Here

        }
    }

    protected void applyResults(ElementConnectionEditPart connectionPart)    {
        Edge e = (Edge) partToNodesMap.get(connectionPart);
        NodeList nodes = e.vNodes;
        PolylineConnection conn = (PolylineConnection) connectionPart.getConnectionFigure();
        conn.setTargetDecoration(new PolygonDecoration());
        if (nodes != null) {
            List bends = new ArrayList();
            for (int i = 0; i < nodes.size(); i++) {
                Node vn = nodes.getNode(i);
                int x = vn.x;
                int y = vn.y;
                if (e.isFeedback()) {
                    bends.add(new AbsoluteBendpoint(x, y + vn.height));
                    bends.add(new AbsoluteBendpoint(x, y));
View Full Code Here

    //if node count is only one then we don't have to worry about whether
    // the nodes are connected
    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

    DiagramModel diagramModel = diagramEditor.getDiagramModel();
    Map<DiagramNodeModel, Node> shapeToNode = new HashMap<DiagramNodeModel, Node>();
    DirectedGraph dg = new DirectedGraph();
    dg.setDirection(getGraphDirection());
    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;
      node.data = child;
      shapeToNode.put(child, node);
      nodeList.add(node);
    }
    List<DiagramConnectionModel> connections = diagramModel.getConnections();
    for (DiagramConnectionModel connection : connections)
    {
      DiagramNodeModel sourceNode = connection.getSourceNode();
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  private void mapGraphNodeCoordinatesToDiagram(final DirectedGraph graph, boolean autoLayout)
  {
    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();
View Full Code Here

      if (!(edge.data instanceof DiagramConnectionModel))
      {
        continue;
      }
      DiagramConnectionModel conn = (DiagramConnectionModel)edge.data;
      NodeList nodes = edge.vNodes;
      DiagramConnectionPart connPart = conn.getModelPart();
      ArrayList<org.eclipse.sapphire.ui.Point> connBendPoints = new ArrayList<org.eclipse.sapphire.ui.Point>();
      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

    mapGraphCoordinatesToDiagram(graph);
  }


  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);
View Full Code Here

  private CompoundDirectedGraph mapDiagramToGraph() {
    Map<AnchorContainer, Node> shapeToNode = new HashMap<AnchorContainer, Node>();
    Diagram d = getDiagram();
    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();
      node.data = shape;
      shapeToNode.put(shape, node);
      nodeList.add(node);
    }
    EList<Connection> connections = d.getConnections();
    for (Connection connection : connections) {
      AnchorContainer source = connection.getStart().getParent();
      AnchorContainer target = connection.getEnd().getParent();
View Full Code Here

TOP

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

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.