Package org.jgraph

Examples of org.jgraph.JGraph$GraphSelectionRedirector


        sourceExprMap.clear();
        visitedVarNames.clear();
    }

    public void showInFrame() {
        JGraph jgraph = createJGraph();
        //jgraph.setPreferredSize(DEFAULT_SIZE);
        jgraph.setBackground(Color.decode(DEFAULT_BG_COLOR));
        // Show in Frame
        this.frame = new JFrame(APPLT_TITLE);
        // add menu bar
        MyMenuChooser menuBar = new MyMenuChooser(frame);
        frame.setJMenuBar(menuBar);
View Full Code Here


    }

    private JGraph createJGraph() {
        // create a visualization using JGraph, via an adapter
        JGraphModelAdapter m_jgAdapter = new JGraphModelAdapter(graph, JGraphModelAdapter.createDefaultVertexAttributes(), createDefaultEdgeAttributes());
        this.jgraph = new JGraph(m_jgAdapter);
        // layout setting
        JGraphUtils.applyOrderedTreeLayout(graph, m_jgAdapter, jgraph);
        // vertex color setting
        Iterator vertexIter = graph.vertexSet().iterator();
        while(vertexIter.hasNext()) {
View Full Code Here

                        StaticContext sc = t.getStaticContext();
                        sc.setSystemBaseURI(statEnv.getSystemBaseURI());
                        m.staticAnalysis(sc);
                        m.visit(GraphConstructionVisitor.this, sc);
                        // create panel
                        final JGraph jgraph = createJGraph();
                        jgraph.setBackground(Color.decode(DEFAULT_BG_COLOR));
                        final JScrollPane panel = new JScrollPane(jgraph);
                        panel.setPreferredSize(DEFAULT_SIZE);
                        _frame.getContentPane().add(panel);
                        _frame.pack();
                    } catch (Exception err) {
View Full Code Here

    directedGraph = new ObservableGraph<ModelNode, IdentifiableEdge>(
        new DirectedSparseGraph<ModelNode, IdentifiableEdge>());
    m_jgAdapter = new JungJGraphModelAdapter(directedGraph);

    jgraph = new JGraph(m_jgAdapter);
    for (MouseListener ml : jgraph.getMouseListeners())
      jgraph.removeMouseListener(ml);
    for (MouseMotionListener ml : jgraph.getMouseMotionListeners())
      jgraph.removeMouseMotionListener(ml);
    for (MouseWheelListener ml : jgraph.getMouseWheelListeners())
View Full Code Here

    return button;
  }

  void editCell() throws Exception {
    if (SelectedCell.isSelectedCellActionCell()) {
      JGraph graph = Util.getCurrentGraph();
      if (graph == null)
        return;

      ActionPropertiesPanel actionPropertiesPanel = new ActionPropertiesPanel(graph);
      if (actionPropertiesPanel.getReady() == false)
View Full Code Here

    else
      defautEdit();
  }

  void setToolAndCursor(JGraphEditorTool tool) {
    JGraph graph = diagramPane.getGraph();
    toolbox.setSelectionTool(tool, graph);
    graph.requestFocus();
  }
View Full Code Here

import org.jgraph.graph.DefaultGraphCell;
import org.jgraph.graph.DefaultPort;

public class SelectedCell {
  public static boolean isDefaultGraphCellSelected() {
    JGraph graph = Util.getCurrentGraph();
    return isDefaultGraphCellSelected(graph);
  }
View Full Code Here

        return false;
    return true;
  }

  public static boolean isSelectedCellActionCell() {
    JGraph graph = Util.getCurrentGraph();
    return isSelectedCellActionCell(graph);
  }
View Full Code Here

   *
   * @see #createFactory(JGraphEditor)
   */
  protected JGraph createGraph(JGraphEditor editor,
      GraphLayoutCache graphLayoutCache) {
    JGraph graph = new JGraphpadGraph(graphLayoutCache);
    configureGraph(editor, graph);
    return graph;
  }
View Full Code Here

  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);

    // Enable edit without final RETURN keystroke
    graph.setInvokesStopCellEditing(true);

    // When over a cell, jump to its default port (we only have one, anyway)
    graph.setJumpToDefaultPort(true);

    // Insert all three cells in one call, so we need an array to store them
    DefaultGraphCell[] cells = new DefaultGraphCell[3];

    // Create Hello Vertex
    cells[0] = createVertex("Hello", 20, 20, 40, 20, null, false);

    // 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
    JFrame frame = new JFrame();
    frame.getContentPane().add(new JScrollPane(graph));
    //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
View Full Code Here

TOP

Related Classes of org.jgraph.JGraph$GraphSelectionRedirector

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.