Examples of mxCellState


Examples of com.mxgraph.view.mxCellState

      previousStates = new LinkedList<mxCellState>();
      Iterator<mxCellState> it = deltas.keySet().iterator();

      while (it.hasNext())
      {
        mxCellState state = it.next();
        previousStates.addAll(snapshot(state));
      }
    }

    // Translates the states in step
    Iterator<mxCellState> it = deltas.keySet().iterator();

    while (it.hasNext())
    {
      mxCellState state = it.next();
      mxPoint delta = deltas.get(state);
      mxCellState parentState = graph.getView().getState(
          model.getParent(state.getCell()));
      translateState(parentState, state, delta.getX(), delta.getY());
    }

    // Revalidates the states in step
    mxRectangle dirty = null;
    it = deltas.keySet().iterator();

    while (it.hasNext())
    {
      mxCellState state = it.next();
      mxPoint delta = deltas.get(state);
      mxCellState parentState = graph.getView().getState(
          model.getParent(state.getCell()));
      mxRectangle tmp = revalidateState(parentState, state, delta.getX(),
          delta.getY());

      if (dirty != null)
      {
        dirty.add(tmp);
      }
      else
      {
        dirty = tmp;
      }
    }

    // Takes a snapshot of the states for later drawing. If the states
    // are not cloned then this does nothing and just expects a repaint
    // of the dirty rectangle.
    if (previousStates != null)
    {
      cellStates = new LinkedList<mxCellState>();
      it = deltas.keySet().iterator();

      while (it.hasNext())
      {
        mxCellState state = it.next();
        cellStates.addAll(snapshot(state));
      }

      // Restores the previous states
      restore(previousStates);
View Full Code Here

Examples of com.mxgraph.view.mxCellState

    mxGraph graph = graphComponent.getGraph();
    Iterator<mxCellState> it = snapshot.iterator();

    while (it.hasNext())
    {
      mxCellState state = it.next();
      mxCellState orig = graph.getView().getState(state.getCell());

      if (orig != null && orig != state)
      {
        restoreState(orig, state);
      }
View Full Code Here

Examples of com.mxgraph.view.mxCellState

    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

Examples of com.mxgraph.view.mxCellState

    // Paints the preview states
    Iterator<mxCellState> it = cellStates.iterator();

    while (it.hasNext())
    {
      mxCellState state = it.next();
      canvas.getGraphics().setComposite(
          AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
              getOpacityForCell(state.getCell())));
      paintPreviewState(canvas, state);
    }

    canvas.getGraphics().setComposite(previousComposite);
  }
View Full Code Here

Examples of com.mxgraph.view.mxCellState

    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 && state.getCell() != graph.getView().getCurrentRoot())
      {
        mxCellHandler handler = oldHandlers.remove(tmp[i]);

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

Examples of com.mxgraph.view.mxCellState

        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

Examples of com.mxgraph.view.mxCellState

          {
            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

Examples of com.mxgraph.view.mxCellState

  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

Examples of com.mxgraph.view.mxCellState

     */
    public String getToolTipForCell(Object cell)
    {
      String tip = "<html>";
      mxGeometry geo = getModel().getGeometry(cell);
      mxCellState state = getView().getState(cell);

      if (getModel().isEdge(cell))
      {
        tip += "points={";

        if (geo != null)
        {
          List<mxPoint> points = geo.getPoints();

          if (points != null)
          {
            Iterator<mxPoint> it = points.iterator();

            while (it.hasNext())
            {
              mxPoint point = it.next();
              tip += "[x=" + numberFormat.format(point.getX())
                  + ",y=" + numberFormat.format(point.getY())
                  + "],";
            }

            tip = tip.substring(0, tip.length() - 1);
          }
        }

        tip += "}<br>";
        tip += "absPoints={";

        if (state != null)
        {

          for (int i = 0; i < state.getAbsolutePointCount(); i++)
          {
            mxPoint point = state.getAbsolutePoint(i);
            tip += "[x=" + numberFormat.format(point.getX())
                + ",y=" + numberFormat.format(point.getY())
                + "],";
          }

          tip = tip.substring(0, tip.length() - 1);
        }

        tip += "}";
      }
      else
      {
        tip += "geo=[";

        if (geo != null)
        {
          tip += "x=" + numberFormat.format(geo.getX()) + ",y="
              + numberFormat.format(geo.getY()) + ",width="
              + numberFormat.format(geo.getWidth()) + ",height="
              + numberFormat.format(geo.getHeight());
        }

        tip += "]<br>";
        tip += "state=[";

        if (state != null)
        {
          tip += "x=" + numberFormat.format(state.getX()) + ",y="
              + numberFormat.format(state.getY()) + ",width="
              + numberFormat.format(state.getWidth())
              + ",height="
              + numberFormat.format(state.getHeight());
        }

        tip += "]";
      }

View Full Code Here

Examples of com.mxgraph.view.mxCellState

          || ((vertex || group) && attrs.containsKey("x")
              && attrs.containsKey("y")
              && attrs.containsKey("width") && attrs
              .containsKey("height")))
      {
        mxCellState state = new mxCellState(null, null, attrs);

        String label = parseState(state, edge);
        canvas.drawCell(state);
        canvas.drawLabel(label, state, isHtmlLabels());
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.