Package com.mxgraph.model

Examples of com.mxgraph.model.mxIGraphModel$mxAtomicGraphModelChange


    if (state != null)
    {
      result.add((mxCellState) state.clone());

      mxGraph graph = graphComponent.getGraph();
      mxIGraphModel model = graph.getModel();
      Object cell = state.getCell();
      int childCount = model.getChildCount(cell);

      for (int i = 0; i < childCount; i++)
      {
        result.addAll(snapshot(graph.getView().getState(
            model.getChildAt(cell, i))));
      }
    }

    return result;
  }
View Full Code Here


      double dx, double dy)
  {
    if (state != null)
    {
      mxGraph graph = graphComponent.getGraph();
      mxIGraphModel model = graph.getModel();
      Object cell = state.getCell();

      if (model.isVertex(cell))
      {
        state.getView().updateCellState(state);
        mxGeometry geo = graph.getCellGeometry(cell);

        // Moves selection cells and non-relative vertices in
        // the first phase so that edge terminal points will
        // be updated in the second phase
        if ((dx != 0 || dy != 0) && geo != null
            && (!geo.isRelative() || deltas.get(state) != null))
        {
          state.setX(state.getX() + dx);
          state.setY(state.getY() + dy);
        }
      }

      int childCount = model.getChildCount(cell);

      for (int i = 0; i < childCount; i++)
      {
        translateState(state,
            graph.getView().getState(model.getChildAt(cell, i)),
            dx, dy);
      }
    }
  }
View Full Code Here

    mxRectangle dirty = null;

    if (state != null)
    {
      mxGraph graph = graphComponent.getGraph();
      mxIGraphModel model = graph.getModel();
      Object cell = state.getCell();
     
      // Updates the edge terminal points and restores the
      // (relative) positions of any (relative) children
      if (model.isEdge(cell))
      {
        state.getView().updateCellState(state);
      }
     
      dirty = state.getView().getBoundingBox(state, false);

      // Moves selection vertices which are relative
      mxGeometry geo = graph.getCellGeometry(cell);

      if ((dx != 0 || dy != 0)
          && geo != null
          && geo.isRelative()
          && model.isVertex(cell)
          && (parentState == null
              || model.isVertex(parentState.getCell()) || deltas
              .get(state) != null))
      {
        state.setX(state.getX() + dx);
        state.setY(state.getY() + dy);

        // TODO: Check this change
        dirty.setX(dirty.getX() + dx);
        dirty.setY(dirty.getY() + dy);

        graph.getView().updateLabelBounds(state);
      }

      int childCount = model.getChildCount(cell);

      for (int i = 0; i < childCount; i++)
      {
        mxRectangle tmp = revalidateState(state, graph.getView()
            .getState(model.getChildAt(cell, i)), dx, dy);

        if (dirty != null)
        {
          dirty.add(tmp);
        }
View Full Code Here

   *
   */
  public void addEdges(mxCellState state)
  {
    mxGraph graph = graphComponent.getGraph();
    mxIGraphModel model = graph.getModel();
    Object cell = state.getCell();
    int edgeCount = model.getEdgeCount(cell);

    for (int i = 0; i < edgeCount; i++)
    {
      mxCellState state2 = graph.getView().getState(
          model.getEdgeAt(cell, i));

      if (state2 != null)
      {
        moveState(state2, 0, 0);
      }
View Full Code Here

    boolean source = isSource(index);

    if (source || isTarget(index))
    {
      mxGraph graph = graphComponent.getGraph();
      mxIGraphModel model = graph.getModel();
      Object terminal = model.getTerminal(state.getCell(), source);

      if ((terminal == null && !graph.isTerminalPointMovable(
          state.getCell(), source))
          || (terminal != null && !graph.isCellDisconnectable(
              state.getCell(), terminal, source)))
View Full Code Here

  /**
   * Moves the edges control point with the given index to the given point.
   */
  protected void movePoint(Object edge, int pointIndex, mxPoint point)
  {
    mxIGraphModel model = graphComponent.getGraph().getModel();
    mxGeometry geometry = model.getGeometry(edge);

    if (geometry != null)
    {
      model.beginUpdate();
      try
      {
        geometry = (mxGeometry) geometry.clone();

        if (isSource(index) || isTarget(index))
        {
          connect(edge, null, isSource(index), false);
          geometry.setTerminalPoint(point, isSource(index));
        }
        else
        {
          List<mxPoint> pts = geometry.getPoints();

          if (pts == null)
          {
            pts = new ArrayList<mxPoint>();
            geometry.setPoints(pts);
          }

          if (pts != null)
          {
            if (pointIndex <= pts.size())
            {
              pts.set(pointIndex - 1, point);
            }
            else if (pointIndex - 1 <= pts.size())
            {
              pts.add(pointIndex - 1, point);
            }
          }
        }

        model.setGeometry(edge, geometry);
      }
      finally
      {
        model.endUpdate();
      }
    }
  }
View Full Code Here

      this.up = (root == null);

      if (!up)
      {
        Object tmp = view.getCurrentRoot();
        mxIGraphModel model = view.graph.getModel();

        while (tmp != null)
        {
          if (tmp == root)
          {
            up = true;
            break;
          }

          tmp = model.getParent(tmp);
        }
      }
    }
View Full Code Here

  {
    mxRectangle result = null;

    if (cells != null && cells.length > 0)
    {
      mxIGraphModel model = graph.getModel();

      for (int i = 0; i < cells.length; i++)
      {
        if (model.isVertex(cells[i]) || model.isEdge(cells[i]))
        {
          mxCellState state = getState(cells[i]);

          if (state != null)
          {
View Full Code Here

  {
    removeState(cell);

    if (recurse && (force || cell != currentRoot))
    {
      mxIGraphModel model = graph.getModel();
      int childCount = model.getChildCount(cell);

      for (int i = 0; i < childCount; i++)
      {
        clear(model.getChildAt(cell, i), force, recurse);
      }
    }
    else
    {
      invalidate(cell);
View Full Code Here

   * Invalidates the state of the given cell, all its descendants and
   * connected edges.
   */
  public void invalidate(Object cell)
  {
    mxIGraphModel model = graph.getModel();
    cell = (cell != null) ? cell : model.getRoot();
    mxCellState state = getState(cell);

    if (state == null || !state.isInvalid())
    {
      if (state != null)
      {
        state.setInvalid(true);
      }

      // Recursively invalidates all descendants
      int childCount = model.getChildCount(cell);

      for (int i = 0; i < childCount; i++)
      {
        Object child = model.getChildAt(cell, i);
        invalidate(child);
      }

      // Propagates invalidation to all connected edges
      int edgeCount = model.getEdgeCount(cell);

      for (int i = 0; i < edgeCount; i++)
      {
        invalidate(model.getEdgeAt(cell, i));
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.mxgraph.model.mxIGraphModel$mxAtomicGraphModelChange

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.