Package com.mxgraph.model

Examples of com.mxgraph.model.mxIGraphModel


        bbox = (mxRectangle) state.getBoundingBox().clone();
      }

      if (recurse)
      {
        mxIGraphModel model = graph.getModel();
        int childCount = model.getChildCount(state.getCell());

        for (int i = 0; i < childCount; i++)
        {
          mxRectangle bounds = getBoundingBox(
              getState(model.getChildAt(state.getCell(), i)), true);

          if (bounds != null)
          {
            if (bbox == null)
            {
View Full Code Here


      {
        removeState(cell);
      }
      else
      {
        mxIGraphModel model = graph.getModel();
        int childCount = model.getChildCount(cell);

        for (int i = 0; i < childCount; i++)
        {
          validateCell(
              model.getChildAt(cell, i),
              visible
                  && (!graph.isCellCollapsed(cell) || cell == currentRoot));
        }
      }
    }
View Full Code Here

    {
      state = getState(cell);

      if (state != null)
      {
        mxIGraphModel model = graph.getModel();

        if (state.isInvalid())
        {
          state.setInvalid(false);

          if (cell != currentRoot)
          {
            validateCellState(model.getParent(cell), false);
          }

          state.setVisibleTerminalState(
              validateCellState(getVisibleTerminal(cell, true),
                  false), true);
          state.setVisibleTerminalState(
              validateCellState(getVisibleTerminal(cell, false),
                  false), false);
         
          updateCellState(state);

          if (model.isEdge(cell) || model.isVertex(cell))
          {
            updateLabelBounds(state);
            updateBoundingBox(state);
          }
        }

        if (recurse)
        {
          int childCount = model.getChildCount(cell);

          for (int i = 0; i < childCount; i++)
          {
            validateCellState(model.getChildAt(cell, i));
          }
        }
      }
    }
View Full Code Here

    state.getOrigin().setY(0);
    state.setLength(0);

    if (state.getCell() != currentRoot)
    {
      mxIGraphModel model = graph.getModel();
      mxCellState pState = getState(model.getParent(state.getCell()));

      if (pState != null && pState.getCell() != currentRoot)
      {
        state.getOrigin().setX(
            state.getOrigin().getX() + pState.getOrigin().getX());
        state.getOrigin().setY(
            state.getOrigin().getY() + pState.getOrigin().getY());
      }

      mxPoint offset = graph.getChildOffsetForCell(state.getCell());

      if (offset != null)
      {
        state.getOrigin()
            .setX(state.getOrigin().getX() + offset.getX());
        state.getOrigin()
            .setY(state.getOrigin().getY() + offset.getY());
      }

      mxGeometry geo = graph.getCellGeometry(state.getCell());

      if (geo != null)
      {
        if (!model.isEdge(state.getCell()))
        {
          mxPoint origin = state.getOrigin();
          offset = geo.getOffset();

          if (offset == null)
          {
            offset = EMPTY_POINT;
          }

          if (geo.isRelative() && pState != null)
          {
            if (model.isEdge(pState.getCell()))
            {
              mxPoint orig = getPoint(pState, geo);
             
              if (orig != null)
              {
                origin.setX(origin.getX()
                    + (orig.getX() / scale) - pState.getOrigin().getX()
                    - translate.getX());
                origin.setY(origin.getY()
                    + (orig.getY() / scale) - pState.getOrigin().getY()
                    - translate.getY());
              }
            }
            else
            {
              origin.setX(origin.getX() + geo.getX()
                  * pState.getWidth() / scale + offset.getX());
              origin.setY(origin.getY() + geo.getY()
                  * pState.getHeight() / scale
                  + offset.getY());
            }
          }
          else
          {
            state.setAbsoluteOffset(new mxPoint(scale
                * offset.getX(), scale * offset.getY()));
            origin.setX(origin.getX() + geo.getX());
            origin.setY(origin.getY() + geo.getY());
          }
        }

        state.setX(scale
            * (translate.getX() + state.getOrigin().getX()));
        state.setY(scale
            * (translate.getY() + state.getOrigin().getY()));
        state.setWidth(scale * geo.getWidth());
        state.setHeight(scale * geo.getHeight());

        if (model.isVertex(state.getCell()))
        {
          updateVertexState(state, geo);
        }

        if (model.isEdge(state.getCell()))
        {
          updateEdgeState(state, geo);
        }

        // Updates the cached label
View Full Code Here

   *            be returned.
   * @return Returns the visible source or target terminal.
   */
  public Object getVisibleTerminal(Object edge, boolean source)
  {
    mxIGraphModel model = graph.getModel();
    Object result = model.getTerminal(edge, source);
    Object best = result;

    while (result != null && result != currentRoot)
    {
      if (!graph.isCellVisible(best) || graph.isCellCollapsed(result))
      {
        best = result;
      }

      result = model.getParent(result);
    }

    // Checks if the result is not a layer
    if (model.getParent(best) == model.getRoot())
    {
      best = null;
    }

    return best;
View Full Code Here

   * Gets the relative point that describes the given, absolute label position
   * for the given edge state.
   */
  public mxPoint getRelativePoint(mxCellState edgeState, double x, double y)
  {
    mxIGraphModel model = graph.getModel();
    mxGeometry geometry = model.getGeometry(edgeState.getCell());

    if (geometry != null)
    {
      int pointCount = edgeState.getAbsolutePointCount();

View Full Code Here

      /**
       *
       */
      public Object getCell(MouseEvent e)
      {
        mxIGraphModel model = graphComponent.getGraph().getModel();
        TransferHandler th = graphComponent.getTransferHandler();
        boolean isLocal = th instanceof mxGraphTransferHandler
            && ((mxGraphTransferHandler) th).isLocalDrag();

        mxGraph graph = graphComponent.getGraph();
        Object cell = super.getCell(e);
        Object[] cells = (isLocal) ? graph.getSelectionCells()
            : dragCells;
        cell = graph.getDropTarget(cells, e.getPoint(), cell);

        // Checks if parent is dropped into child
        Object parent = cell;

        while (parent != null)
        {
          if (mxUtils.contains(cells, parent))
          {
            return null;
          }

          parent = model.getParent(parent);
        }

        boolean clone = graphComponent.isCloneEvent(e)
            && isCloneEnabled();

View Full Code Here

          mxICell dropCell = (mxICell) cells[0];

          if (targetCell.isVertex() == dropCell.isVertex()
              || targetCell.isEdge() == dropCell.isEdge())
          {
            mxIGraphModel model = graph.getModel();
            model.setStyle(target, model.getStyle(cells[0]));
            graph.setSelectionCell(target);

            return null;
          }
        }
View Full Code Here

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

        Object source = null;
        Object target = null;

        Object[] cells = graph.getSelectionCells();

        for (int i = 0; i < cells.length; i++)
        {
          if (model.isVertex(cells[i]))
          {
            if (source == null)
            {
              source = cells[i];
            }
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;
          }
        }
View Full Code Here

TOP

Related Classes of com.mxgraph.model.mxIGraphModel

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.