Package org.jgraph.graph

Examples of org.jgraph.graph.DefaultEdge$DefaultRouting


    cellMap.put(node.getId(), cell);
  }

  private void addJGraphEdge(IdentifiableEdge e) {
    ConnectionSet set = new ConnectionSet();
    DefaultEdge theEdge = new DefaultEdge(e);
    DefaultGraphCell from = null;
    DefaultGraphCell to = null;
    String fromVertexId = e.getFrom().getId();
    String toVertexId = e.getTo().getId();
    if (!cellMap.containsKey(fromVertexId)) {
View Full Code Here


      Vector incomingCellVector = new Vector();
      Object[] incomingEdges =
        JGraphpadGraphModel.getIncomingEdges(graphpadGraphModel, defaultGraphCell);
      for (int index = 0; index < incomingEdges.length; index++) {
        DefaultEdge edge = (DefaultEdge) incomingEdges[index];
        Object vertex = graphpadGraphModel.getSourceVertex(graphpadGraphModel, edge);
        if (CellType.isCellActionCell(vertex)) {
          DefaultGraphCell cell = (DefaultGraphCell) vertex;
          JGraphpadBusinessObject businessObject =
            (JGraphpadBusinessObject) graphpadGraphModel.getValue(cell);
View Full Code Here

  }

  Vector getLoneEdgeVector() {
    Vector vector = new Vector();
    for (int i = 0; i < edgeVector.size(); i++) {
      DefaultEdge edge = (DefaultEdge) edgeVector.get(i);
      Object vertex = graphpadGraphModel.getSourceVertex(graphpadGraphModel, edge);
      if (vertex == null || (CellType.isCellActionCell(vertex)) == false) {
        vector.add(edge);
        continue;
      }
View Full Code Here

   * @see GraphConstants#setRouting(Map, Edge.Routing)
   * @see JGraphpadEdgeTool
   */
  protected JGraphpadEdgeTool createEdgeTool(String name,
      Object defaultValue, Edge.Routing routing) {
    DefaultEdge edge = createEdge(createEdgeUserObject(defaultValue));
    if (routing != null)
      GraphConstants.setRouting(edge.getAttributes(), routing);
    return new JGraphpadEdgeTool(name, edge);
  }
View Full Code Here

   * @param userObj
   *            The user object that the edge should contain.
   * @return Returns a new edge.
   */
  public DefaultEdge createEdge(Object userObj) {
    DefaultEdge edge = new DefaultEdge(userObj, createAttributeMap());
    configureEdge(edge);
    return edge;
  }
View Full Code Here

    // Create World Vertex
    cells[1] = createVertex("World", 140, 140, 40, 20, Color.ORANGE, true);

    // Create Edge
    DefaultEdge edge = new DefaultEdge();
    // Fetch the ports from the new vertices, and connect them with the edge
    edge.setSource(cells[0].getChildAt(0));
    edge.setTarget(cells[1].getChildAt(0));
    cells[2] = edge;

    // Set Arrow Style for edge
    int arrow = GraphConstants.ARROW_CLASSIC;
    GraphConstants.setLineEnd(edge.getAttributes(), arrow);
    GraphConstants.setEndFill(edge.getAttributes(), true);

    // Insert the cells via the cache, so they get selected
    graph.getGraphLayoutCache().insert(cells);

    // Show in Frame
View Full Code Here

  }

  // Insert a new Edge between source and target
  public void connect(Port source, Port target) {
    // Construct Edge with no label
    DefaultEdge edge = createDefaultEdge();
    if (graph.getModel().acceptsSource(edge, source) &&
        graph.getModel().acceptsTarget(edge, target)) {
      // Create a Map thath holds the attributes for the edge
      edge.getAttributes().applyMap(createEdgeAttributes());
      // Insert the Edge and its Attributes
      graph.getGraphLayoutCache().insertEdge(edge, source, target);
    }
  }
View Full Code Here

    }
  }

  // Hook for subclassers
  protected DefaultEdge createDefaultEdge() {
    return new DefaultEdge();
  }
View Full Code Here

    gm.add(new DefaultPort("GraphModel/Center"));
    DefaultGraphCell dgm = new DefaultGraphCell("DefaultGraphModel");
    attributes.put(dgm, createBounds(new AttributeMap(), 20, 180,
        Color.blue));
    dgm.add(new DefaultPort("DefaultGraphModel/Center"));
    DefaultEdge dgmImplementsGm = new DefaultEdge("implements");
    cs.connect(dgmImplementsGm, gm.getChildAt(0), dgm.getChildAt(0));
    attributes.put(dgmImplementsGm, implementStyle);
    DefaultGraphCell modelGroup = new DefaultGraphCell("ModelGroup");
    modelGroup.add(gm);
    modelGroup.add(dgm);
    modelGroup.add(dgmImplementsGm);
    // JComponent Column
    DefaultGraphCell jc = new DefaultGraphCell("JComponent");
    attributes.put(jc, createBounds(new AttributeMap(), 150, 20,
        Color.green));
    jc.add(new DefaultPort("JComponent/Center"));
    DefaultGraphCell jg = new DefaultGraphCell("JGraph");
    attributes.put(jg, createBounds(new AttributeMap(), 150, 100,
        Color.green));
    jg.add(new DefaultPort("JGraph/Center"));
    DefaultEdge jgExtendsJc = new DefaultEdge("extends");
    cs.connect(jgExtendsJc, jc.getChildAt(0), jg.getChildAt(0));
    attributes.put(jgExtendsJc, extendStyle);
    // UI Column
    DefaultGraphCell cu = new DefaultGraphCell("ComponentUI");
    attributes
        .put(cu, createBounds(new AttributeMap(), 280, 20, Color.red));
    cu.add(new DefaultPort("ComponentUI/Center"));
    DefaultGraphCell gu = new DefaultGraphCell("GraphUI");
    attributes.put(gu,
        createBounds(new AttributeMap(), 280, 100, Color.red));
    gu.add(new DefaultPort("GraphUI/Center"));
    DefaultGraphCell dgu = new DefaultGraphCell("BasicGraphUI");
    attributes.put(dgu, createBounds(new AttributeMap(), 280, 180,
        Color.red));
    dgu.add(new DefaultPort("BasicGraphUI/Center"));
    DefaultEdge guExtendsCu = new DefaultEdge("extends");
    cs.connect(guExtendsCu, cu.getChildAt(0), gu.getChildAt(0));
    attributes.put(guExtendsCu, extendStyle);
    DefaultEdge dguImplementsDu = new DefaultEdge("implements");
    cs.connect(dguImplementsDu, gu.getChildAt(0), dgu.getChildAt(0));
    attributes.put(dguImplementsDu, implementStyle);
    DefaultGraphCell uiGroup = new DefaultGraphCell("UIGroup");
    uiGroup.add(cu);
    uiGroup.add(gu);
    uiGroup.add(dgu);
    uiGroup.add(dguImplementsDu);
    uiGroup.add(guExtendsCu);
    // Aggregations
    DefaultEdge jgAggregatesGm = new DefaultEdge("model");
    cs.connect(jgAggregatesGm, jg.getChildAt(0), gm.getChildAt(0));
    attributes.put(jgAggregatesGm, aggregateStyle);
    DefaultEdge jcAggregatesCu = new DefaultEdge("ui");
    cs.connect(jcAggregatesCu, jc.getChildAt(0), cu.getChildAt(0));
    attributes.put(jcAggregatesCu, aggregateStyle);
    // Insert Cells into model
    Object[] cells = new Object[] { jgAggregatesGm, jcAggregatesCu,
        modelGroup, jc, jg, jgExtendsJc, uiGroup };
View Full Code Here

      cells[index] = createVertex(wsArry[index].getName(), 20+100*(index-1), 140, 50, 50,
            Color.GRAY, true,0);
    }
   
    // Create Edge
    DefaultEdge edge = new DefaultEdge();
    // Fetch the ports from the new vertices,
    // and connect them with the edge
    edge.setSource(cells[0].getChildAt(0));
    edge.setTarget(cells[1].getChildAt(0));
   
    cells[wsArry.length] = edge;

    // Set Arrow Style for edge
    int arrow = GraphConstants.ARROW_CLASSIC;
    GraphConstants.setLineEnd(edge.getAttributes(), arrow);
    GraphConstants.setEndFill(edge.getAttributes(), true);
    setLineAttribs(edge);

    // Insert the cells via the cache, so they get selected   
    jGraphMain.getGraphLayoutCache().setSelectsAllInsertedCells(false);
    jGraphMain.getGraphLayoutCache().insert(cells);
View Full Code Here

TOP

Related Classes of org.jgraph.graph.DefaultEdge$DefaultRouting

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.