Package org.eclipse.draw2d.graph

Examples of org.eclipse.draw2d.graph.Edge


  @Override
  public void contributeToGraph(CompoundDirectedGraph graph, Map<AbstractGraphicalEditPart, Object> map) {
    Node source = (Node) map.get(getSource());
    Node target = (Node) map.get(getTarget());
    Node n = (Node) map.get(this);
    graph.edges.add(new Edge(source, n));
    graph.edges.add(new Edge(n, target));
  }
View Full Code Here


    for (int n = 0; n < members.size(); n++) {
      a = (EditPart) members.get(n);
      node = (Node) map.get(a);
      if (!(a instanceof StructuredActivityPart)) {
        if (prev != null) {
          Edge e = new Edge(prev, node);
          graph.edges.add(e);
        }
        prev = node;
      }
    }
View Full Code Here

    super.activate();
    ((Transition) getModel()).addPropertyChangeListener(this);
  }

  protected void applyGraphResults(CompoundDirectedGraph graph, Map<AbstractGraphicalEditPart, Object> map) {
    Edge e = (Edge) map.get(this);
    NodeList nodes = e.vNodes;
    PolylineConnection conn = (PolylineConnection) getConnectionFigure();

    if (nodes != null && !isManualLayout()) {
      List<AbsoluteBendpoint> bends = new ArrayList<AbsoluteBendpoint>();
      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));
        }
        else {
          bends.add(new AbsoluteBendpoint(x, y));
View Full Code Here

  protected void contributeToGraph(CompoundDirectedGraph graph, Map<AbstractGraphicalEditPart, Object> map) {
    GraphAnimation.recordInitialState(getConnectionFigure());
    Node source = (Node) map.get(getSource());
    Node target = (Node) map.get(getTarget());
    Edge e = new Edge(this, source, target);
    graph.edges.add(e);
    map.put(this, e);
  }
View Full Code Here

    }
    for (InternalRelationship relationship : relationshipsToConsider) {
      Node source = (Node) mapping.get(relationship.getSource());
      Node dest = (Node) mapping.get(relationship.getDestination());
      if (source != null && dest != null) {
        Edge edge = new Edge(relationship, source, dest);
        graph.edges.add(edge);
      }
    }
    DirectedGraphLayout directedGraphLayout = new DirectedGraphLayout();
    directedGraphLayout.visit(graph);
View Full Code Here

  @SuppressWarnings("unchecked")
  public void contributeToGraph(CompoundDirectedGraph graph, Map map) {
    GraphAnimation.recordInitialState(getConnectionFigure());
    Node source = (Node) map.get(getSource());
    Node target = (Node) map.get(getTarget());
    Edge e = null;
    if (target.data != null && target.data instanceof AbstractStatePart) {
      IState startState = ((IWebflowState) ((AbstractStatePart) target.data)
          .getState().getElementParent()).getStartState();
      IIf sourceState = (IIf) ((AbstractStatePart) source.data)
          .getModel();
      IState targetState = ((AbstractStatePart) target.data).getState();
      if (startState.getId().equals(targetState.getId())) {
        e = new Edge(this, target, source);
      }
      else {
        List children = ((IWebflowState) ((AbstractStatePart) target.data)
            .getState().getElementParent()).getStates();
        int sourceIndex = children.indexOf(sourceState);
        int targetIndex = children.indexOf(targetState);
        if (targetIndex < sourceIndex) {
          e = new Edge(this, target, source);
        }
        else {
          e = new Edge(this, source, target);
        }
      }
    }
    else {
      List children = ((IWebflowState) ((AbstractStatePart) target.data)
          .getState().getElementParent()).getStates();
      int sourceIndex = children.indexOf(source);
      int targetIndex = children.indexOf(target);
      if (targetIndex < sourceIndex) {
        e = new Edge(this, target, source);
      }
      else {
        e = new Edge(this, source, target);
      }
    }

    graph.edges.add(e);
    map.put(this, e);
View Full Code Here

      AbstractStatePart child = (AbstractStatePart) children.get(i);

      if (child.getModel() instanceof IActionElement) {
        if (i + 1 < children.size()) {
          // insert dummy edges
          Edge e = new Edge((Node) map.get(child), (Node) map
              .get(getChildren().get(i + 1)));
          e.weight = 1;
          graph.edges.add(e);
          map.put(this.toString() + i, e);
        }
View Full Code Here

    Node target = (Node) map.get(getTarget());
    int sourceIndex = ((ActivityPart) getSource()).getModelElement().getSortIndex();
    int targetIndex = ((ActivityPart) getTarget()).getModelElement().getSortIndex();
    Node n = (Node) map.get(this);
    if (targetIndex < sourceIndex) {
      graph.edges.add(new Edge(target, n));
      graph.edges.add(new Edge(n, source));
    }
    else {
      graph.edges.add(new Edge(source, n));
      graph.edges.add(new Edge(n, target));
    }
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public void contributeToGraph(CompoundDirectedGraph graph, Map map) {
    GraphAnimation.recordInitialState(getConnectionFigure());
    Node source = (Node) map.get(getSource());
    Node target = (Node) map.get(getTarget());
    Edge e = null;
    if (target.data != null && target.data instanceof AbstractStatePart) {
      IState startState = ((IWebflowState) ((AbstractStatePart) target.data)
          .getState().getElementParent()).getStartState();
      IState sourceState = ((AbstractStatePart) source.data).getState();
      IState targetState = ((AbstractStatePart) target.data).getState();
      if (startState != null
          && startState.getId().equals(targetState.getId())) {
        e = new Edge(this, target, source);
      }
      else {
        List children = ((IWebflowState) ((AbstractStatePart) target.data)
            .getState().getElementParent()).getStates();
        int sourceIndex = children.indexOf(sourceState);
        int targetIndex = children.indexOf(targetState);
        if (targetIndex < sourceIndex) {
          e = new Edge(this, target, source);
        }
        else {
          e = new Edge(this, source, target);
        }
      }
    }
    else {
      List children = ((IWebflowState) ((AbstractStatePart) target.data)
          .getState().getElementParent()).getStates();
      int sourceIndex = children.indexOf(source);
      int targetIndex = children.indexOf(target);
      if (targetIndex < sourceIndex) {
        e = new Edge(this, target, source);
      }
      else {
        e = new Edge(this, source, target);
      }
    }
    if (getTransitionModel().getActions().size() > 0) {
      // e.weight = 3;
    }
View Full Code Here

    while (iter.hasNext()) {
      IIf theIf = (IIf) iter.next();
      if (theIf.getThenTransition() != null
          && theIf.getThenTransition().getToState() != null) {
        // insert dummy edges for layouting
        Edge e1 = new Edge((Node) map.get(this), getNode(theIf
            .getThenTransition().getToState(), map));

        // e1.weight = 5;
        graph.edges.add(e1);
        map.put(this.toString() + (j++), e1);
      }
      if (theIf.getElseTransition() != null
          && theIf.getElseTransition().getToState() != null) {
        Edge e2 = new Edge((Node) map.get(this), getNode(theIf
            .getElseTransition().getToState(), map));
        // e2.weight = 5;
        graph.edges.add(e2);
        map.put(this.toString() + (j++), e2);
      }

    }

    for (int i = 0; i < getChildren().size(); i++) {
      AbstractStatePart child = (AbstractStatePart) children.get(i);

      if (child.getModel() instanceof IActionElement
          || child.getModel() instanceof IExceptionHandler) {
        if (i + 1 < children.size()) {
          // insert dummy edges
          Edge e = new Edge((Node) map.get(child), (Node) map
              .get(getChildren().get(i + 1)));
          e.weight = 1;
          graph.edges.add(e);
          map.put(this.toString() + i, e);
        }
View Full Code Here

TOP

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

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.