Package com.mxgraph.layout

Examples of com.mxgraph.layout.mxIGraphLayout


   * @return an action that executes the specified layout
   */
  @SuppressWarnings("serial")
  public Action graphLayout(final String key, boolean animate)
  {
    final mxIGraphLayout layout = createLayout(key, animate);

    if (layout != null)
    {
      return new AbstractAction(mxResources.get(key))
      {
        public void actionPerformed(ActionEvent e)
        {
          final mxGraph graph = graphComponent.getGraph();
          Object cell = graph.getSelectionCell();

          if (cell == null
              || graph.getModel().getChildCount(cell) == 0)
          {
            cell = graph.getDefaultParent();
          }

          graph.getModel().beginUpdate();
          try
          {
            long t0 = System.currentTimeMillis();
            layout.execute(cell);
            status("Layout: " + (System.currentTimeMillis() - t0)
                + " ms");
          }
          finally
          {
View Full Code Here


  /**
   * Creates a layout instance for the given identifier.
   */
  protected mxIGraphLayout createLayout(String ident, boolean animate)
  {
    mxIGraphLayout layout = null;

    if (ident != null)
    {
      mxGraph graph = graphComponent.getGraph();

View Full Code Here

   * @return an action that executes the specified layout
   */
  @SuppressWarnings("serial")
  public Action graphLayout(final String key, boolean animate)
  {
    final mxIGraphLayout layout = createLayout(key, animate);

    if (layout != null)
    {
      return new AbstractAction(mxResources.get(key))
      {
        public void actionPerformed(ActionEvent e)
        {
          final mxGraph graph = graphComponent.getGraph();
          Object cell = graph.getSelectionCell();

          if (cell == null
              || graph.getModel().getChildCount(cell) == 0)
          {
            cell = graph.getDefaultParent();
          }

          graph.getModel().beginUpdate();
          try
          {
            long t0 = System.currentTimeMillis();
            layout.execute(cell);
            status("Layout: " + (System.currentTimeMillis() - t0)
                + " ms");
          }
          finally
          {
View Full Code Here

  /**
   * Creates a layout instance for the given identifier.
   */
  protected mxIGraphLayout createLayout(String ident, boolean animate)
  {
    mxIGraphLayout layout = null;

    if (ident != null)
    {
      mxGraph graph = graphComponent.getGraph();

View Full Code Here

      mxIGraphModel model = getGraph().getModel();

      // Checks if a layout exists to take care of the moving
      for (int i = 0; i < cells.length; i++)
      {
        mxIGraphLayout layout = getLayout(model.getParent(cells[i]));

        if (layout != null)
        {
          layout.moveCell(cells[i], location.x, location.y);
        }
      }
    }
  }
View Full Code Here

  public void executeLayout() {
    currentGraph.getModel().beginUpdate();
    Object layout = layoutManager.getDefaultLayout().getLayout(this);
    if (layout instanceof mxIGraphLayout) {
      mxIGraphLayout l = (mxIGraphLayout) layout;
      l.execute(currentGraph.getDefaultParent());
    }

    if (layoutManager.isAnimated()) {
      mxMorphing morph = new mxMorphing(graphComponent, 20, 1.2, 20);
      morph.addListener(mxEvent.DONE, new mxIEventListener() {
View Full Code Here

TOP

Related Classes of com.mxgraph.layout.mxIGraphLayout

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.