Examples of mxCellState


Examples of com.mxgraph.view.mxCellState

  public void mouseDragged(MouseEvent e)
  {
    if (!e.isConsumed() && graphComponent.isEnabled() && isEnabled()
        && (e.getButton() == 0 || connectPreview.isActive()))
    {
      mxCellState state = marker.process(e);

      if (connectPreview.isActive())
      {
        connectPreview.update(e, marker.getValidState(), e.getX(), e.getY());
        setBounds(null);
View Full Code Here

Examples of com.mxgraph.view.mxCellState

            {
              // Disables edges as drop targets if the target cell was created
              if (dropTarget == null
                  || !graph.getModel().isEdge(dropTarget))
              {
                mxCellState pstate = graph.getView().getState(
                    dropTarget);

                if (pstate != null)
                {
                  mxGeometry geo = graph.getModel()
                      .getGeometry(vertex);

                  mxPoint origin = pstate.getOrigin();
                  geo.setX(geo.getX() - origin.getX());
                  geo.setY(geo.getY() - origin.getY());
                }
              }
              else
              {
                dropTarget = graph.getDefaultParent();
              }

              graph.addCells(new Object[] { vertex }, dropTarget);
            }

            // FIXME: Here we pre-create the state for the vertex to be
            // inserted in order to invoke update in the connectPreview.
            // This means we have a cell state which should be created
            // after the model.update, so this should be fixed.
            mxCellState targetState = graph.getView().getState(
                vertex, true);
            connectPreview.update(e, targetState, e.getX(), e.getY());
          }

          Object cell = connectPreview.stop(
View Full Code Here

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

     * @param cell
     *            Cell that should be drawn onto the canvas.
     */
    public void drawCell(mxICanvas canvas, Object cell)
    {
      mxCellState state = graph.getView().getState(cell);

      if (state != null
          && isCellDisplayable(state.getCell())
          && (!(canvas instanceof mxGraphics2DCanvas) || hitClip(
              (mxGraphics2DCanvas) canvas, state)))
      {
        graph.drawState(canvas, state,
            cell != cellEditor.getEditingCell());
View Full Code Here

Examples of com.mxgraph.view.mxCellState

        // 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 = state.getVisibleTerminal(!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

Examples of com.mxgraph.view.mxCellState

    if (editingCell != null)
    {
      stopEditing(true);
    }

    mxCellState state = graphComponent.getGraph().getView().getState(cell);

    if (state != null)
    {
      editingCell = cell;
      trigger = evt;

      double scale = Math.max(minimumEditorScale, graphComponent
          .getGraph().getView().getScale());
      scrollPane.setBounds(getEditorBounds(state, scale));
      scrollPane.setVisible(true);

      String value = getInitialValue(state, evt);
      JTextComponent currentEditor = null;

      // Configures the style of the in-place editor
      if (graphComponent.getGraph().isHtmlLabel(cell))
      {
        if (isExtractHtmlBody())
        {
          value = mxUtils.getBodyMarkup(value,
              isReplaceHtmlLinefeeds());
        }

        editorPane.setDocument(mxUtils.createHtmlDocumentObject(
            state.getStyle(), scale));
        editorPane.setText(value);

        // Workaround for wordwrapping in editor pane
        // FIXME: Cursor not visible at end of line
        JPanel wrapper = new JPanel(new BorderLayout());
        wrapper.setOpaque(false);
        wrapper.add(editorPane, BorderLayout.CENTER);
        scrollPane.setViewportView(wrapper);

        currentEditor = editorPane;
      }
      else
      {
        textArea.setFont(mxUtils.getFont(state.getStyle(), scale));
        Color fontColor = mxUtils.getColor(state.getStyle(),
            mxConstants.STYLE_FONTCOLOR, Color.black);
        textArea.setForeground(fontColor);
        textArea.setText(value);

        scrollPane.setViewportView(textArea);
View Full Code Here

Examples of com.mxgraph.view.mxCellState

        trigger = null;
        graphComponent.labelChanged(cell, getCurrentValue(), trig);
      }
      else
      {
        mxCellState state = graphComponent.getGraph().getView()
            .getState(cell);
        graphComponent.redraw(state);
      }

      if (scrollPane.getParent() != null)
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.