Examples of mxGraphView


Examples of com.mxgraph.view.mxGraphView

      mxIGraphModel model = graph.getModel();
      TreeNode prev = null;
      Object[] out = graph.getEdges(cell, parent, invert, !invert, false,
          true);
      mxGraphView view = graph.getView();

      for (int i = 0; i < out.length; i++)
      {
        Object edge = out[i];

        if (!isEdgeIgnored(edge))
        {
          // Resets the points on the traversed edge
          if (resetEdges)
          {
            setEdgePoints(edge, null);
          }

          if (edgeRouting)
          {
            setEdgeStyleEnabled(edge, false);
            setEdgePoints(edge, null);
          }

          // Checks if terminal in same swimlane
          mxCellState state = view.getState(edge);
          Object target = (state != null) ? state
              .getVisibleTerminal(invert) : view
              .getVisibleTerminal(edge, invert);
          TreeNode tmp = dfs(target, parent, visited);

          if (tmp != null && model.getGeometry(target) != null)
          {
View Full Code Here

Examples of com.mxgraph.view.mxGraphView

              List<Map<Object, Object>> bellmanFord = mxTraversal.bellmanFord(aGraph, startVertex);

              Map<Object, Object> distanceMap = bellmanFord.get(0);
              Map<Object, Object> parentMap = bellmanFord.get(1);
              mxCostFunction costFunction = aGraph.getGenerator().getCostFunction();
              mxGraphView view = aGraph.getGraph().getView();

              System.out.println("Bellman-Ford traversal test");
              Object[] vertices = aGraph.getChildVertices(aGraph.getGraph().getDefaultParent());
              int vertexNum = vertices.length;

              System.out.print("Distances from " + costFunction.getCost(view.getState(startVertex)) + " to [ ");

              for (int i = 0; i < vertexNum; i++)
              {
                System.out.print(i + ":" + Math.round((Double) distanceMap.get(vertices[i]) * 100.0) / 100.0 + " ");
              }

              System.out.println("]");

              System.out.print("Parents are [ ");

              for (int i = 0; i < vertexNum; i++)
              {
                System.out.print(i + ":" + costFunction.getCost(view.getState(parentMap.get(vertices[i]))) + " ");
              }

              System.out.println("]");

              if ((Double) distanceMap.get(endVertex) != Double.MAX_VALUE)
              {
                System.out.println("The shortest distance from vertex " + costFunction.getCost(view.getState(startVertex))
                    + " to vertex " + (Double) costFunction.getCost(view.getState(endVertex)) + " is: "
                    + distanceMap.get(endVertex));
              }
              else
              {
                System.out.println("The selected vertices aren't connected.");
View Full Code Here

Examples of com.mxgraph.view.mxGraphView

    graph.getModel().addListener(mxEvent.CHANGE, updateHandler);

    // Repaint after the following events is handled via
    // mxGraph.repaint-events
    // The respective handlers are installed in mxGraph.setView
    mxGraphView view = graph.getView();

    view.addListener(mxEvent.SCALE, updateHandler);
    view.addListener(mxEvent.TRANSLATE, updateHandler);
    view.addListener(mxEvent.SCALE_AND_TRANSLATE, updateHandler);
    view.addListener(mxEvent.UP, updateHandler);
    view.addListener(mxEvent.DOWN, updateHandler);

    graph.addPropertyChangeListener(viewChangeHandler);

    // Resets the zoom policy if the scale changes
    graph.getView().addListener(mxEvent.SCALE, scaleHandler);
View Full Code Here

Examples of com.mxgraph.view.mxGraphView

   */
  public SchemaGraphComponent(mxGraph graph)
  {
    super(graph);

    mxGraphView graphView = new mxGraphView(graph)
    {

      /**
       *
       */
 
View Full Code Here

Examples of com.mxgraph.view.mxGraphView

  /**
   *
   */
  public void zoom(double factor)
  {
    mxGraphView view = graph.getView();
    double newScale = (double) ((int) (view.getScale() * 100 * factor)) / 100;

    if (newScale != view.getScale() && newScale > 0.04)
    {
      mxPoint translate = (pageVisible && centerPage) ? getPageTranslate(newScale)
          : new mxPoint();
      graph.getView().scaleAndTranslate(newScale, translate.getX(),
          translate.getY());

      if (keepSelectionVisibleOnZoom && !graph.isSelectionEmpty())
      {
        getGraphControl().scrollRectToVisible(
            view.getBoundingBox(graph.getSelectionCells())
                .getRectangle());
      }
      else
      {
        maintainScrollBar(true, factor, centerZoom);
View Full Code Here

Examples of com.mxgraph.view.mxGraphView

  /**
   *
   */
  public void zoomTo(final double newScale, final boolean center)
  {
    mxGraphView view = graph.getView();
    final double scale = view.getScale();

    mxPoint translate = (pageVisible && centerPage) ? getPageTranslate(newScale)
        : new mxPoint();
    graph.getView().scaleAndTranslate(newScale, translate.getX(),
        translate.getY());
View Full Code Here

Examples of com.mxgraph.view.mxGraphView

    add(editor.bind("Redo", new HistoryAction(false),
        "/com/mxgraph/examples/swing/images/redo.gif"));

    addSeparator();

    final mxGraphView view = editor.getGraphComponent().getGraph()
        .getView();
    final JComboBox zoomCombo = new JComboBox(new Object[] { "400%",
        "200%", "150%", "100%", "75%", "50%", mxResources.get("page"),
        mxResources.get("width"), mxResources.get("actualSize") });
    zoomCombo.setEditable(true);
    zoomCombo.setMinimumSize(new Dimension(75, 0));
    zoomCombo.setPreferredSize(new Dimension(75, 0));
    zoomCombo.setMaximumSize(new Dimension(75, 100));
    zoomCombo.setMaximumRowCount(9);
    add(zoomCombo);

    // Sets the zoom in the zoom combo the current value
    mxIEventListener scaleTracker = new mxIEventListener()
    {
      /**
       *
       */
      public void invoke(Object sender, mxEventObject evt)
      {
        ignoreZoomChange = true;

        try
        {
          zoomCombo.setSelectedItem((int) Math.round(100 * view
              .getScale())
              + "%");
        }
        finally
        {
          ignoreZoomChange = false;
        }
      }
    };

    // Installs the scale tracker to update the value in the combo box
    // if the zoom is changed from outside the combo box
    view.getGraph().getView().addListener(mxEvent.SCALE, scaleTracker);
    view.getGraph().getView().addListener(mxEvent.SCALE_AND_TRANSLATE,
        scaleTracker);

    // Invokes once to sync with the actual zoom value
    scaleTracker.invoke(null, null);

View Full Code Here

Examples of com.mxgraph.view.mxGraphView

        final double newScale = (double) ((int) (Math.min(scaleX,
            scaleY) * 20)) / 20;

        if (newScale > 0)
        {
          mxGraphView graphView = graph.getView();
          final double scale = graphView.getScale();
          mxPoint translate = (centerPage) ? getPageTranslate(newScale)
              : new mxPoint();
          graphView.scaleAndTranslate(newScale, translate.getX(),
              translate.getY());

          // Causes two repaints, see zoomTo for more details
          final double factor = newScale / scale;

View Full Code Here

Examples of com.mxgraph.view.mxGraphView

      {
        canvas.setScale(graph.getView().getScale());
        canvas.setTranslate(0, 0);

        mxIGraphModel model = graph.getModel();
        mxGraphView view = graph.getView();

        Rectangle hit = new Rectangle(x, y, 1, 1);
        int childCount = model.getChildCount(parent);

        for (int i = childCount - 1; i >= 0; i--)
        {
          Object cell = model.getChildAt(parent, i);
          Object result = getCellAt(x, y, hitSwimlaneContent, cell);

          if (result != null)
          {
            return result;
          }
          else if (graph.isCellVisible(cell))
          {
            mxCellState state = view.getState(cell);

            if (state != null
                && canvas.intersects(this, hit, state)
                && (!graph.isSwimlane(cell)
                    || hitSwimlaneContent || (transparentSwimlaneContent && !canvas
View Full Code Here

Examples of com.mxgraph.view.mxGraphView

        {
          canvas.setScale(graph.getView().getScale());
          canvas.setTranslate(0, 0);

          mxIGraphModel model = graph.getModel();
          mxGraphView view = graph.getView();

          int childCount = model.getChildCount(parent);

          for (int i = 0; i < childCount; i++)
          {
            Object cell = model.getChildAt(parent, i);
            mxCellState state = view.getState(cell);

            if (graph.isCellVisible(cell) && state != null)
            {
              if (canvas.contains(this, rect, state))
              {
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.