Package com.mxgraph.view

Examples of com.mxgraph.view.mxGraph


    /**
     *
     */
    public void actionPerformed(ActionEvent e)
    {
      mxGraph graph = mxGraphActions.getGraph(e);

      if (graph != null && !graph.isSelectionEmpty())
      {
        Object[] cells = graph.getSelectionCells();
        mxIGraphModel model = graph.getModel();

        model.beginUpdate();
        try
        {
          for (int i = 0; i < cells.length; i++)
          {
            graph.updateCellSize(cells[i]);
          }
        }
        finally
        {
          model.endUpdate();
View Full Code Here


    {
      if (e.getSource() instanceof mxGraphComponent)
      {
        mxGraphComponent graphComponent = (mxGraphComponent) e
            .getSource();
        mxGraph graph = graphComponent.getGraph();

        if (!graph.isSelectionEmpty())
        {
          Color newColor = JColorChooser.showDialog(graphComponent,
              name, null);

          if (newColor != null)
          {
            graph.setCellStyles(key, mxUtils.hexString(newColor));
          }
        }
      }
    }
View Full Code Here

    {
      if (e.getSource() instanceof mxGraphComponent)
      {
        mxGraphComponent graphComponent = (mxGraphComponent) e
            .getSource();
        mxGraph graph = graphComponent.getGraph();
        mxIGraphModel model = graph.getModel();

        Object parent = graph.getDefaultParent();
        Object[] cells = graph.getSelectionCells();

        for (int i = 0; i < cells.length; i++)
        {
          if (model.getChildCount(cells[i]) > 0)
          {
            parent = cells[i];
            break;
          }
        }

        Object[] v = graph.getChildVertices(parent);
        Object[] mst = mxGraphAnalysis.getInstance()
            .getMinimumSpanningTree(graph, v,
                new mxDistanceCostFunction(), directed);
        graph.setSelectionCells(mst);
      }
    }
View Full Code Here

            setSelected(value);
          }

          if (refresh)
          {
            mxGraph graph = null;

            if (target instanceof mxGraph)
            {
              graph = (mxGraph) target;
            }
            else if (target instanceof mxGraphComponent)
            {
              graph = ((mxGraphComponent) target).getGraph();
            }

            graph.refresh();
          }
        }
        catch (Exception e)
        {
          // ignore
View Full Code Here

      {
        if (!editor.isModified()
            || JOptionPane.showConfirmDialog(editor,
                mxResources.get("loseChanges")) == JOptionPane.YES_OPTION)
        {
          mxGraph graph = editor.getGraphComponent().getGraph();

          // Check modified flag and display save dialog
          mxCell root = new mxCell();
          root.insert(new mxCell());
          graph.getModel().setRoot(root);

          editor.setModified(false);
          editor.setCurrentFile(null);
          editor.getGraphComponent().zoomAndCenter();
        }
View Full Code Here

  private void addPreviewGraph(JPanel previewGroupBox) {
    GridBagLayout previewLay = new GridBagLayout();
    previewLay.columnWidths = new int[]{150};
    previewLay.rowHeights = new int[]{150};

    previewWidget = new TLSView(new mxGraph());

    GridBagConstraints previewConstraints = new GridBagConstraints();
    previewConstraints.gridx = 0;
    previewConstraints.gridy = 0;
    previewConstraints.gridwidth = 1;
View Full Code Here

    super("Hello, World!");
    getContentPane().add(getGraphComponent());
  }
 
  public Component getGraphComponent(){
    graph = new mxGraph();
    graph.getModel().beginUpdate();
    try
    {
      /*
      String[] mapList = (String[]) maps.keySet().toArray(new String[0]);
View Full Code Here

        g.addEdge(v2, v3);
        g.addEdge(v3, v4);
        g.addEdge(v4, v3);
       
        //graphx
        final mxGraph graph = new mxGraph();
        Object parent = graph.getDefaultParent();
        graph.getModel().beginUpdate();
       
        HashMap<String, Object> jgraphVertices = new HashMap<String, Object>();
       
        try
        {
          for(Object o : g.vertexSet())
          {
            Object o1 = graph.insertVertex(parent,((Node)o).m_name, ((Node)o).m_name, 20, 20, 80, 30);
            jgraphVertices.put(((Node)o).m_name, o1);
           
          }
          for(Object o : g.edgeSet())
          {
            Node src = ((TEdge)o).m_src;
            Node sink = ((TEdge)o).m_sink;
            graph.insertEdge(parent, null, "edge", jgraphVertices.get(src.m_name), jgraphVertices.get(sink.m_name));
          }
        }finally
        {
          graph.getModel().endUpdate();
        }
       
    final mxGraphComponent graphComponent = new mxGraphComponent(graph);
    getContentPane().add(graphComponent);
   
    graphComponent.getGraphControl().addMouseListener(new MouseAdapter()
    {
   
      public void mouseReleased(MouseEvent e)
      {
        Object cell = graphComponent.getCellAt(e.getX(), e.getY());
       
        if (cell != null)
        {
          System.out.println("cell="+graph.getLabel(cell));
        }
      }
    });

  }
View Full Code Here

    init();
  }
 
  private void init()
  {
    m_graph = new mxGraph();
    m_graph.setMinimumGraphSize(new mxRectangle(0,0,400,400));
    layout = new mxOrganicLayout (m_graph);
    m_graph.setCellsDeletable(false);
    m_graph.setCellsDisconnectable(false);
    m_graph.setCellsEditable(false);
View Full Code Here

  private long time;

  SkelFrame(Controller cont) throws HeadlessException {
    super("Skandium Visualizer");
    this.controller = cont;
    graph = new mxGraph();
  }
View Full Code Here

TOP

Related Classes of com.mxgraph.view.mxGraph

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.