Package org.jgraph.graph

Examples of org.jgraph.graph.DefaultGraphModel


public class HelloWorld {

  public static void main(String[] args) {

    // Construct Model and Graph
    GraphModel model = new DefaultGraphModel();
    JGraph graph = new JGraph(model);

    // Control-drag should clone selection
    graph.setCloneable(true);
View Full Code Here


    setDoubleBuffered(true);
    selectionModel = new DefaultGraphSelectionModel(this);
    setLayout(null);
    marquee = mh;
    if (model == null) {
      model = new DefaultGraphModel();
      setModel(model);
      addSampleData(model);
    } else
      setModel(model);
    if (layoutCache == null)
View Full Code Here

  /**
   *
   */
  private void emptyGraph() {
    //GraphModel model = jGraphMain.getModel();
    GraphModel model = new DefaultGraphModel();
    jGraphMain.setModel(model);       
   
  }
View Full Code Here

  /**
   * @param wc
   */
  public void setModel(IWs[] wsArry) {   
    //GraphModel model = jGraphMain.getModel();
    GraphModel model = new DefaultGraphModel();
    jGraphMain.setModel(model);
   
   
   
    // Insert all three cells in one call, so we need an
View Full Code Here

  /**
   * @param node
   */
  public void updateNode(IWs node) {
    DefaultGraphModel model = (DefaultGraphModel)jGraphMain.getModel();
    List theRoots = model.getRoots();
    DefaultGraphCell selectedElement=null;
    findNode(node.getName());
   
    System.out.println();
  }
View Full Code Here

   * @param node
   * @param theRoots
   */
  public DefaultGraphCell findNode(String nodeName) {
    System.out.println("FindNode "+nodeName);
    DefaultGraphModel model = (DefaultGraphModel)jGraphMain.getModel();
    List theRoots = model.getRoots();
    DefaultGraphCell selectedElement;
    for (Iterator iter = theRoots.iterator(); iter.hasNext();) {
      DefaultGraphCell element = (DefaultGraphCell) iter.next();
        if(element.toString()!=null)
          if(element.toString().equals(nodeName)){
View Full Code Here

   
    DefaultPort zeroChild = (DefaultPort)wcCell.getChildAt(0);
    Set edges = zeroChild.getEdges();
    DefaultEdge edge1=(DefaultEdge)edges.iterator().next();

    DefaultGraphModel model = (DefaultGraphModel)jGraphMain.getModel();
    model.remove(new Object[]{edge1});
   
    // Create Edge
      DefaultEdge edge = new DefaultEdge();
    int arrow = GraphConstants.ARROW_CLASSIC;
    GraphConstants.setLineEnd(edge.getAttributes(), arrow);
    GraphConstants.setEndFill(edge.getAttributes(), true);
    setLineAttribs(edge);

      // Create ConnectionSet for Insertion
      ConnectionSet cs = new ConnectionSet(edge, wcCell.getChildAt(0), wsCell.getChildAt(0));

      // Add Edge and Connections to the Model
      Object[] insert = new Object[]{edge};
      model.insert(insert, null,cs, null, null);

  }
View Full Code Here

    GraphConstants.setLineWidth(edge.getAttributes(), 4);
   
  }
 
  public Object[] getRoots(){
    DefaultGraphModel model = (DefaultGraphModel)jGraphMain.getModel();
    List roots = model.getRoots();
   
    return roots.toArray();   
  }
View Full Code Here

      view = createDefaultGraphView(this);
    }
    setGraphLayoutCache(view);
    updateUI();
    if (model == null) {
      model = new DefaultGraphModel();
      setModel(model);
      addSampleData(model);
    } else {
      setModel(model);
    }
View Full Code Here

    if (checkForSave("<html>Save changes before creating a new model?</html>")) {
      return;
    }
    resetMouseState();
    graph = new JmtJGraph(this);
    graph.setModel(new DefaultGraphModel());

    // Giuseppe De Cicco

    graph.getGraphLayoutCache().setFactory(new JmtDefaultCellViewFactory(this) {
View Full Code Here

TOP

Related Classes of org.jgraph.graph.DefaultGraphModel

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.