Package com.mxgraph.view

Examples of com.mxgraph.view.mxCellState


      mxGraphView view = graph.getView();
      mxPoint sourceConstraint = null;
      mxPoint targetConstraint = null;
      if (view != null)
      {
        mxCellState edgeState = view.getState(edge);
        mxCellState sourceState = view.getState(source);
        mxConnectionConstraint scc = graph.getConnectionConstraint(
            edgeState, sourceState, true);
        if (scc != null)
        {
          sourceConstraint = scc.getPoint();
        }

        mxCellState targetState = view.getState(target);
        mxConnectionConstraint tcc = graph.getConnectionConstraint(
            edgeState, targetState, false);
        if (tcc != null)
        {
          targetConstraint = tcc.getPoint();
View Full Code Here


    mxGraph graph = graphComponent.getGraph();
    Collection<mxCellState> result = new LinkedList<mxCellState>();

    for (Object cell : movingCells)
    {
      mxCellState cellState = graph.getView().getState(cell);

      if (cellState != null)
      {
        result.add(cellState);

        // Terminates early if too many cells
        if (result.size() >= threshold)
        {
          return null;
        }

        if (isContextPreview())
        {
          Object[] edges = graph.getAllEdges(new Object[] { cell });

          for (Object edge : edges)
          {
            if (!graph.isCellSelected(edge))
            {
              mxCellState edgeState = graph.getView().getState(
                  edge);

              if (edgeState != null)
              {
                // Terminates early if too many cells
View Full Code Here

   * color. The state is returned regardless of the marker color and
   * valid state.
   */
  public mxCellState process(MouseEvent e)
  {
    mxCellState state = null;

    if (isEnabled())
    {
      state = getState(e);
      boolean isValid = (state != null) ? isValidState(state) : false;
View Full Code Here

   */
  protected mxCellState getState(MouseEvent e)
  {
    Object cell = getCell(e);
    mxGraphView view = graphComponent.getGraph().getView();
    mxCellState state = getStateToMark(view.getState(cell));

    return (state != null && intersects(state, e)) ? state : null;
  }
View Full Code Here

          {
            dx = 0;
          }
        }

        mxCellState markedState = marker.getMarkedState();
        Object target = (markedState != null) ? markedState.getCell()
            : null;

        // FIXME: Cell is null if selection was carried out, need other variable
        //trace("cell", cell);

        if (target == null
            && isRemoveCellsFromParent()
            && shouldRemoveCellFromParent(graph.getModel()
                .getParent(initialCell), cells, e))
        {
          target = graph.getDefaultParent();
        }

        boolean clone = isCloneEnabled()
            && graphComponent.isCloneEvent(e);
        Object[] result = movePreview.stop(true, e, dx, dy, clone,
            target);

        if (cells != result)
        {
          graph.setSelectionCells(result);
        }

        e.consume();
      }
      else if (isVisible())
      {
        if (constrainedEvent)
        {
          if (Math.abs(dx) > Math.abs(dy))
          {
            dy = 0;
          }
          else
          {
            dx = 0;
          }
        }

        mxCellState targetState = marker.getValidState();
        Object target = (targetState != null) ? targetState.getCell()
            : null;

        if (graph.isSplitEnabled()
            && graph.isSplitTarget(target, cells))
        {
View Full Code Here

  protected boolean shouldRemoveCellFromParent(Object parent, Object[] cells,
      MouseEvent e)
  {
    if (graphComponent.getGraph().getModel().isVertex(parent))
    {
      mxCellState pState = graphComponent.getGraph().getView()
          .getState(parent);

      return pState != null && !pState.contains(e.getX(), e.getY());
    }

    return false;
  }
View Full Code Here

    boolean handlesVisible = tmp.length <= getMaxHandlers();
    Rectangle handleBounds = null;

    for (int i = 0; i < tmp.length; i++)
    {
      mxCellState state = graph.getView().getState(tmp[i]);

      if (state != null)
      {
        mxCellHandler handler = oldHandlers.get(tmp[i]);
View Full Code Here

   *
   */
  public void revalidate(mxCellState pState, Object cell)
  {
    mxGraph graph = graphComponent.getGraph();
    mxCellState tmp = graph.getView().getState(cell);
    tmp.setInvalid(true);

    graph.getView().validateBounds(pState, cell);
    graph.getView().validatePoints(pState, cell);

    mxIGraphModel model = graph.getModel();
View Full Code Here

        e.consume();
      }
      else if (currentState == null
          || !currentState.getRectangle().contains(e.getPoint()))
      {
        mxCellState eventState = graphComponent
            .getGraph()
            .getView()
            .getState(
                graphComponent.getCellAt(e.getX(), e.getY(),
                    false));
        mxCellState state = null;

        if (eventState != null && isStateHandled(eventState))
        {
          state = eventState;
        }
View Full Code Here

        // Clones the cell state and updates the absolute points using
        // the current state of this handle. This is required for
        // computing the correct perimeter points and edge style.
        mxGeometry geometry = graphComponent.getGraph()
            .getCellGeometry(state.getCell());
        mxCellState clone = (mxCellState) state.clone();
        List<mxPoint> points = geometry.getPoints();
        mxGraphView view = clone.getView();

        if (isSource || isTarget)
        {
          marker.process(e);
          mxCellState currentState = marker.getValidState();

          target = view
              .getVisibleTerminal(state.getCell(), !isSource);

          if (currentState != null)
          {
            source = currentState.getCell();
          }
          else
          {
            mxPoint pt = new mxPoint(e.getPoint());

            if (gridEnabledEvent)
            {
              pt = graphComponent.snapScaledPoint(pt);
            }

            clone.setAbsoluteTerminalPoint(pt, isSource);
          }

          if (!isSource)
          {
            Object tmp = source;
            source = target;
            target = tmp;
          }
        }
        else
        {
          mxPoint point = convertPoint(new mxPoint(e.getPoint()),
              gridEnabledEvent);

          if (points == null)
          {
            points = Arrays.asList(new mxPoint[] { point });
          }
          else if (index - 1 < points.size())
          {
            points = new ArrayList<mxPoint>(points);
            points.set(index - 1, point);
          }

          source = view.getVisibleTerminal(state.getCell(), true);
          target = view.getVisibleTerminal(state.getCell(), false);
        }

        // Computes the points for the edge style and terminals
        mxCellState sourceState = view.getState(source);
        mxCellState targetState = view.getState(target);

        mxConnectionConstraint sourceConstraint = graphComponent
            .getGraph().getConnectionConstraint(clone, sourceState,
                true);
        mxConnectionConstraint targetConstraint = graphComponent
View Full Code Here

TOP

Related Classes of com.mxgraph.view.mxCellState

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.