Examples of mxTemporaryCellStates


Examples of com.mxgraph.view.mxTemporaryCellStates

    // repaint or update of the original graph while pages
    // are being printed
    view.setEventsEnabled(false);

    // Uses the view to create temporary cell states for each cell
    mxTemporaryCellStates tempStates = new mxTemporaryCellStates(view,
        1 / pageScale);

    try
    {
      view.setTranslate(new mxPoint(0, 0));

      mxGraphics2DCanvas canvas = createCanvas();
      canvas.setGraphics((Graphics2D) g);
      canvas.setScale(1 / pageScale);

      view.revalidate();

      mxRectangle graphBounds = graph.getGraphBounds();
      Dimension pSize = new Dimension((int) Math.ceil(graphBounds.getX()
          + graphBounds.getWidth()) + 1, (int) Math.ceil(graphBounds
          .getY() + graphBounds.getHeight()) + 1);

      int w = (int) (printFormat.getImageableWidth());
      int h = (int) (printFormat.getImageableHeight());
      int cols = (int) Math.max(
          Math.ceil((double) (pSize.width - 5) / (double) w), 1);
      int rows = (int) Math.max(
          Math.ceil((double) (pSize.height - 5) / (double) h), 1);

      if (page < cols * rows)
      {
        int dx = (int) ((page % cols) * printFormat.getImageableWidth());
        int dy = (int) (Math.floor(page / cols) * printFormat
            .getImageableHeight());

        g.translate(-dx + (int) printFormat.getImageableX(), -dy
            + (int) printFormat.getImageableY());
        g.setClip(dx, dy, (int) (dx + printFormat.getWidth()),
            (int) (dy + printFormat.getHeight()));

        graph.drawGraph(canvas);

        result = PAGE_EXISTS;
      }
    }
    finally
    {
      view.setTranslate(translate);

      tempStates.destroy();
      view.setEventsEnabled(eventsEnabled);

      // Enables double-buffering after printing
      currentManager.setDoubleBufferingEnabled(true);
    }
View Full Code Here

Examples of com.mxgraph.view.mxTemporaryCellStates

    // repaint or update of the original graph while pages
    // are being printed
    view.setEventsEnabled(false);

    // Uses the view to create temporary cell states for each cell
    mxTemporaryCellStates tempStates = new mxTemporaryCellStates(view,
        1 / pageScale);

    try
    {
      view.setTranslate(new mxPoint(0, 0));

      mxGraphics2DCanvas canvas = createCanvas();
      canvas.setGraphics((Graphics2D) g);
      canvas.setScale(1 / pageScale);

      view.revalidate();

      mxRectangle graphBounds = graph.getGraphBounds();
      Dimension pSize = new Dimension((int) Math.ceil(graphBounds.getX()
          + graphBounds.getWidth()) + 1, (int) Math.ceil(graphBounds
          .getY() + graphBounds.getHeight()) + 1);

      int w = (int) (printFormat.getImageableWidth());
      int h = (int) (printFormat.getImageableHeight());
      int cols = (int) Math.max(
          Math.ceil((double) (pSize.width - 5) / (double) w), 1);
      int rows = (int) Math.max(
          Math.ceil((double) (pSize.height - 5) / (double) h), 1);

      if (page < cols * rows)
      {
        int dx = (int) ((page % cols) * printFormat.getImageableWidth());
        int dy = (int) (Math.floor(page / cols) * printFormat
            .getImageableHeight());

        g.translate(-dx + (int) printFormat.getImageableX(), -dy
            + (int) printFormat.getImageableY());
        g.setClip(dx, dy, (int) (dx + printFormat.getWidth()),
            (int) (dy + printFormat.getHeight()));

        graph.drawGraph(canvas);

        result = PAGE_EXISTS;
      }
    }
    finally
    {
      view.setTranslate(translate);

      tempStates.destroy();
      view.setEventsEnabled(eventsEnabled);

      // Enables double-buffering after printing
      currentManager.setDoubleBufferingEnabled(true);
    }
View Full Code Here

Examples of com.mxgraph.view.mxTemporaryCellStates

    // Disables firing of scale events so that there is no
    // repaint or update of the original graph
    view.setEventsEnabled(false);

    // Uses the view to create temporary cell states for each cell
    mxTemporaryCellStates temp = new mxTemporaryCellStates(view, scale,
        cells);

    try
    {
      if (clip == null)
      {
        clip = graph.getPaintBounds(cells);
      }

      if (clip != null && clip.getWidth() > 0 && clip.getHeight() > 0)
      {
        Rectangle rect = clip.getRectangle();
        canvas = factory.createCanvas(rect.width + 1, rect.height + 1);

        if (canvas != null)
        {
          double previousScale = canvas.getScale();
          Point previousTranslate = canvas.getTranslate();

          try
          {
            canvas.setTranslate(-rect.x, -rect.y);
            canvas.setScale(view.getScale());

            for (int i = 0; i < cells.length; i++)
            {
              graph.drawCell(canvas, cells[i]);
            }
          }
          finally
          {
            canvas.setScale(previousScale);
            canvas.setTranslate(previousTranslate.x,
                previousTranslate.y);
          }
        }
      }
    }
    finally
    {
      temp.destroy();
      view.setEventsEnabled(eventsEnabled);
    }

    return canvas;
  }
View Full Code Here

Examples of com.mxgraph.view.mxTemporaryCellStates

    // repaint or update of the original graph while pages
    // are being printed
    view.setEventsEnabled(false);

    // Uses the view to create temporary cell states for each cell
    mxTemporaryCellStates tempStates = new mxTemporaryCellStates(view,
        1 / pageScale);

    try
    {
      view.setTranslate(new mxPoint(0, 0));

      mxGraphics2DCanvas canvas = createCanvas();
      canvas.setGraphics((Graphics2D) g);

      view.revalidate();

      mxRectangle graphBounds = graph.getGraphBounds();
      Dimension pSize = new Dimension((int) Math.ceil(graphBounds.getX()
          + graphBounds.getWidth()) + 1, (int) Math.ceil(graphBounds
          .getY() + graphBounds.getHeight()) + 1);

      int w = (int) (printFormat.getImageableWidth());
      int h = (int) (printFormat.getImageableHeight());
      int cols = (int) Math.max(
          Math.ceil((double) (pSize.width - 5) / (double) w), 1);
      int rows = (int) Math.max(
          Math.ceil((double) (pSize.height - 5) / (double) h), 1);

      if (page < cols * rows)
      {
        int dx = (int) ((page % cols) * printFormat.getImageableWidth());
        int dy = (int) (Math.floor(page / cols) * printFormat
            .getImageableHeight());

        g.translate(-dx + (int) printFormat.getImageableX(), -dy
            + (int) printFormat.getImageableY());
        g.setClip(dx, dy, (int) (dx + printFormat.getWidth()),
            (int) (dy + printFormat.getHeight()));

        graph.drawGraph(canvas);

        result = PAGE_EXISTS;
      }
    }
    finally
    {
      view.setTranslate(translate);

      tempStates.destroy();
      view.setEventsEnabled(eventsEnabled);

      // Enables double-buffering after printing
      currentManager.setDoubleBufferingEnabled(true);
    }
View Full Code Here

Examples of com.mxgraph.view.mxTemporaryCellStates

    // Disables firing of scale events so that there is no
    // repaint or update of the original graph
    view.setEventsEnabled(false);

    // Uses the view to create temporary cell states for each cell
    mxTemporaryCellStates temp = new mxTemporaryCellStates(view, scale,
        cells);

    try
    {
      if (clip == null)
      {
        clip = graph.getPaintBounds(cells);
      }

      if (clip != null && clip.getWidth() > 0 && clip.getHeight() > 0)
      {
        Rectangle rect = clip.getRectangle();
        canvas = factory.createCanvas(rect.width + 1, rect.height + 1);

        if (canvas != null)
        {
          double previousScale = canvas.getScale();
          Point previousTranslate = canvas.getTranslate();

          try
          {
            canvas.setTranslate(-rect.x, -rect.y);
            canvas.setScale(view.getScale());

            for (int i = 0; i < cells.length; i++)
            {
              graph.drawCell(canvas, cells[i]);
            }
          }
          finally
          {
            canvas.setScale(previousScale);
            canvas.setTranslate(previousTranslate.x,
                previousTranslate.y);
          }
        }
      }
    }
    finally
    {
      temp.destroy();
      view.setEventsEnabled(eventsEnabled);
    }

    return canvas;
  }
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.