Package org.pentaho.reporting.engine.classic.core.util

Examples of org.pentaho.reporting.engine.classic.core.util.PageFormatFactory


  }

  private MasterReport createReport(final boolean wrap)
  {
    final MasterReport report = new MasterReport();
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper paper = pff.createPaper(PageSize.A4);
    pff.setBorders(paper, 36.0f, 36.0f, 36.0f, 36.0f);
    final PageFormat format = pff.createPageFormat(paper, PageFormat.PORTRAIT);
    report.setPageDefinition(new SimplePageDefinition(format));

    final Band pageHeader = report.getPageHeader();
    pageHeader.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT, 10.0f);
View Full Code Here


    ClassicEngineBoot.getInstance().start();
  }

  public void testLandscapeLoadSave() throws Exception
  {
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper format = pff.createPaper(PageSize.LETTER);
    pff.setBorders(format, 10, 20, 30, 40);

    final MasterReport orgReport = new MasterReport();
    orgReport.setPageDefinition(new SimplePageDefinition(pff.createPageFormat(format, PageFormat.LANDSCAPE)));

    final MasterReport savedReport = postProcess(orgReport);
    assertEquals(orgReport.getPageDefinition(), savedReport.getPageDefinition());
  }
View Full Code Here

    assertEquals(orgReport.getPageDefinition(), savedReport.getPageDefinition());
  }

  public void testReverseLandscapeLoadSave() throws Exception
  {
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper format = pff.createPaper(PageSize.LETTER);
    pff.setBorders(format, 10, 20, 30, 40);

    final MasterReport orgReport = new MasterReport();
    orgReport.setPageDefinition(new SimplePageDefinition(pff.createPageFormat(format, PageFormat.REVERSE_LANDSCAPE)));

    final MasterReport savedReport = postProcess(orgReport);
    assertEquals(orgReport.getPageDefinition(), savedReport.getPageDefinition());
  }
View Full Code Here

    assertEquals(orgReport.getPageDefinition(), savedReport.getPageDefinition());
  }

  public void testPortraitLoadSave() throws Exception
  {
    final PageFormatFactory pff = PageFormatFactory.getInstance();
    final Paper format = pff.createPaper(PageSize.LETTER);
    pff.setBorders(format, 10, 20, 30, 40);

    final MasterReport orgReport = new MasterReport();
    orgReport.setPageDefinition(new SimplePageDefinition(pff.createPageFormat(format, PageFormat.PORTRAIT)));

    final MasterReport savedReport = postProcess(orgReport);
    assertEquals(orgReport.getPageDefinition(), savedReport.getPageDefinition());
  }
View Full Code Here

  public void run(final ValidationSequence sequence,
                  final OutputProcessorMetaData metaData) throws ResourceKeyCreationException, ContentProcessingException, ReportProcessingException
  {
    // Set up the process ..
    final PageFormatFactory fmFactory = PageFormatFactory.getInstance();
    final PageFormat pageFormat = new PageFormat();
    pageFormat.setPaper(fmFactory.createPaper((double) sequence.getPageWidth(), 1000));

    final SimplePageDefinition pageDefinition = new SimplePageDefinition(pageFormat);
    final ProcessingContext processingContext = new DefaultProcessingContext();
    final DebugExpressionRuntime runtime = new DebugExpressionRuntime(new DefaultTableModel(), 0, processingContext);
View Full Code Here

      final EncodingUtilities encodingUtilities = getEncodingUtilities(encoding);
      out.write(encodingUtilities.getEncodingHeader());
      firstPage = false;
    }

    final PageFormatFactory fact = PageFormatFactory.getInstance();
    final float charWidthPoints = 72.0f / getCharactersPerInch();
    borderLeft = (int) (fact.getLeftBorder(paper) / charWidthPoints);

    final float lineHeightPoints = 72.0f / getLinesPerInch();
    final int borderTop = (int) (fact.getTopBorder(paper) / lineHeightPoints);

    for (int i = 0; i < borderTop; i++)
    {
      startLine();
      endLine(false);
View Full Code Here

    final int lines = (int) ((paper.getHeight() / 72.0f) * getLinesPerInch());
    sendDefinePageLengthInLines(lines);

    sendDefineCharacterWidth(getCharactersPerInch());

    final PageFormatFactory fact = PageFormatFactory.getInstance();
    final int borderLeft = (int) (fact.getLeftBorder(paper) / charWidthPoints);
    final int borderRight = (int) (fact.getRightBorder(paper) / charWidthPoints);
    sendDefineHorizontalBorders(borderLeft, borderRight);

    final int borderTop = (int) (fact.getTopBorder(paper) / lineHeightPoints);
    //borderBottom = (int) (fact.getBottomBorder(paper) / lineHeightPoints);

    // print the top margin ..
    for (int i = 0; i < borderTop; i++)
    {
View Full Code Here

    // we redefine it for every page, as we do not assume that the page sizes
    // will be the same for the whole report.
    final int lines = (int) ((paper.getHeight() / 72.0f) * getLinesPerInch());
    sendDefinePageLengthInLines(lines);

    final PageFormatFactory fact = PageFormatFactory.getInstance();
    final int borderLeft = (int) (fact.getLeftBorder(paper) / charWidthPoints);
    final int borderRight = (int) (fact.getRightBorder(paper) / charWidthPoints);

    final int borderTop = (int) (fact.getTopBorder(paper) / lineHeightPoints);
    sendDefineHorizontalBorders(borderLeft, borderRight);

    // print the top margin ..
    for (int i = 0; i < borderTop; i++)
    {
View Full Code Here

        return new PageFormat();
      }

      final PageFormat pageFormat = pageDefinition.getPageFormat();
      final Paper orgPaper = pageFormat.getPaper();
      final PageFormatFactory pff = PageFormatFactory.getInstance();

      final double virtualPaperWidth = orgPaper.getImageableWidth() +
          pff.getLeftBorder(orgPaper) + pff.getRightBorder(orgPaper);
      final double virtualPaperHeight = orgPaper.getImageableHeight() +
          pff.getTopBorder(orgPaper) + pff.getBottomBorder(orgPaper);

      final Paper p = pff.createPaper(virtualPaperWidth, virtualPaperHeight);
      pff.setBorders(p, pff.getTopBorder(orgPaper), pff.getLeftBorder(orgPaper),
          pff.getBottomBorder(orgPaper), pff.getRightBorder(orgPaper));
      return pff.createPageFormat(p, pageFormat.getOrientation());
    }
View Full Code Here

  }

  private void copyPageFormatToFields(final PageFormat pageFormat)
  {
    final Paper paper = pageFormat.getPaper();
    final PageFormatFactory pageFormatFactory = PageFormatFactory.getInstance();
    final String formatName = pageFormatFactory.getPageFormatName(paper.getWidth(), paper.getHeight());
    pageFormatBox.setSelectedItem(formatName);
    pageWidthField.setText(String.valueOf(paper.getWidth()));
    pageHeightField.setText(String.valueOf(paper.getHeight()));
    userDefinedPageSizeBox.setSelected(formatName == null);
    preDefinedPageSizeBox.setSelected(formatName != null);

    final boolean portraitMode = pageFormat.getOrientation() == PageFormat.PORTRAIT;
    portraitModeBox.setSelected(portraitMode);
    landscapeModeBox.setSelected(portraitMode == false);

    if (portraitMode)
    {
      marginLeftField.setText(String.valueOf(pageFormatFactory.getLeftBorder(paper)));
      marginTopField.setText(String.valueOf(pageFormatFactory.getTopBorder(paper)));
      marginRightField.setText(String.valueOf(pageFormatFactory.getRightBorder(paper)));
      marginBottomField.setText(String.valueOf(pageFormatFactory.getBottomBorder(paper)));
    }
    else
    {
      marginTopField.setText(String.valueOf(pageFormatFactory.getLeftBorder(paper)));
      marginLeftField.setText(String.valueOf(pageFormatFactory.getBottomBorder(paper)));
      marginBottomField.setText(String.valueOf(pageFormatFactory.getRightBorder(paper)));
      marginRightField.setText(String.valueOf(pageFormatFactory.getTopBorder(paper)));
    }
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.util.PageFormatFactory

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.