⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bandfactory.java

📁 Java的Web报表库
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
   *
   * @param attr  the element attributes.
   *
   * @throws SAXException if there is a parsing problem.
   *
   * @see com.jrefinery.report.ReportFooter
   */
  public void startReportFooter(final Attributes attr)
      throws SAXException
  {
    // get the height...
    final float height = ParserUtil.parseFloat(attr.getValue("height"), 0);
    final boolean ownPage = ParserUtil.parseBoolean(attr.getValue("ownpage"), false);

    // create the report footer...
    final ReportFooter reportFooter = new ReportFooter();
    reportFooter.getStyle().setStyleProperty(ElementStyleSheet.MINIMUMSIZE,
        new FloatDimension(0, height));
    reportFooter.getStyle().setBooleanStyleProperty
        (BandStyleSheet.PAGEBREAK_BEFORE, ownPage);
    final FontFactory.FontInformation fi = fontFactory.createFont(attr);
    FontFactory.applyFontInformation(reportFooter.getStyle(), fi);
    FontFactory.applyFontInformation(reportFooter.getBandDefaults(), fi);

    final String valign = attr.getValue(VALIGNMENT_ATT);
    if (valign != null)
    {
      reportFooter.getBandDefaults().setStyleProperty(ElementStyleSheet.VALIGNMENT,
          ReportParserUtil.parseVerticalElementAlignment(valign));
    }
    final String halign = attr.getValue(ALIGNMENT_ATT);
    if (halign != null)
    {
      reportFooter.getBandDefaults().setStyleProperty(ElementStyleSheet.ALIGNMENT,
          ReportParserUtil.parseHorizontalElementAlignment(halign));
    }

    getReport().setReportFooter(reportFooter);
    getParser().pushFactory(new ElementFactory(getParser(), REPORT_FOOTER_TAG, reportFooter));
  }

  /**
   * Handles the start of a pageheader definition.
   *
   * @param attr  the element attributes.
   *
   * @throws SAXException if there is a parsing problem.
   *
   * @see com.jrefinery.report.PageHeader
   */
  public void startPageHeader(final Attributes attr)
      throws SAXException
  {
    // get the height...
    final float height = ParserUtil.parseFloat(attr.getValue("height"), 0);
    final boolean firstPage = ParserUtil.parseBoolean(attr.getValue("onfirstpage"), true);
    final boolean lastPage = ParserUtil.parseBoolean(attr.getValue("onlastpage"), true);

    // create the page header...
    final PageHeader pageHeader = new PageHeader();
    pageHeader.getStyle().setStyleProperty(ElementStyleSheet.MINIMUMSIZE,
        new FloatDimension(0, height));
    pageHeader.setDisplayOnFirstPage(firstPage);
    pageHeader.setDisplayOnLastPage(lastPage);

    final FontFactory.FontInformation fi = fontFactory.createFont(attr);
    FontFactory.applyFontInformation(pageHeader.getStyle(), fi);
    FontFactory.applyFontInformation(pageHeader.getBandDefaults(), fi);

    final String valign = attr.getValue(VALIGNMENT_ATT);
    if (valign != null)
    {
      pageHeader.getBandDefaults().setStyleProperty(ElementStyleSheet.VALIGNMENT,
          ReportParserUtil.parseVerticalElementAlignment(valign));
    }
    final String halign = attr.getValue(ALIGNMENT_ATT);
    if (halign != null)
    {
      pageHeader.getBandDefaults().setStyleProperty(ElementStyleSheet.ALIGNMENT,
          ReportParserUtil.parseHorizontalElementAlignment(halign));
    }

    getReport().setPageHeader(pageHeader);
    getParser().pushFactory(new ElementFactory(getParser(), PAGE_HEADER_TAG, pageHeader));
  }

  /**
   * Handles the start of a pagefooter definition.
   *
   * @param attr  the element attributes.
   *
   * @throws SAXException if there is a parsing problem.
   *
   * @see com.jrefinery.report.PageFooter
   */
  public void startPageFooter(final Attributes attr)
      throws SAXException
  {
    // get the height...
    final float height = ParserUtil.parseFloat(attr.getValue("height"), 0);
    final boolean firstPage = ParserUtil.parseBoolean(attr.getValue("onfirstpage"), true);
    final boolean lastPage = ParserUtil.parseBoolean(attr.getValue("onlastpage"), true);

    // create the page footer...
    final PageFooter pageFooter = new PageFooter();
    pageFooter.getStyle().setStyleProperty(ElementStyleSheet.MINIMUMSIZE,
        new FloatDimension(0, height));
    pageFooter.setDisplayOnFirstPage(firstPage);
    pageFooter.setDisplayOnLastPage(lastPage);

    final FontFactory.FontInformation fi = fontFactory.createFont(attr);
    FontFactory.applyFontInformation(pageFooter.getStyle(), fi);
    FontFactory.applyFontInformation(pageFooter.getBandDefaults(), fi);

    final String valign = attr.getValue(VALIGNMENT_ATT);
    if (valign != null)
    {
      pageFooter.getBandDefaults().setStyleProperty(ElementStyleSheet.VALIGNMENT,
          ReportParserUtil.parseVerticalElementAlignment(valign));
    }
    final String halign = attr.getValue(ALIGNMENT_ATT);
    if (halign != null)
    {
      pageFooter.getBandDefaults().setStyleProperty(ElementStyleSheet.ALIGNMENT,
          ReportParserUtil.parseHorizontalElementAlignment(halign));
    }

    getReport().setPageFooter(pageFooter);
    getParser().pushFactory(new ElementFactory(getParser(), PAGE_FOOTER_TAG, pageFooter));
  }

  /**
   * Handles the start of an ItemBand definition.
   *
   * @param attr  the element attributes.
   *
   * @throws SAXException if there is a parsing problem.
   *
   * @see com.jrefinery.report.ItemBand
   */
  public void startItems(final Attributes attr)
      throws SAXException
  {
    // get the height...
    final float height = ParserUtil.parseFloat(attr.getValue("height"), 0);
    final ItemBand items = new ItemBand();
    items.getStyle().setStyleProperty
        (ElementStyleSheet.MINIMUMSIZE, new FloatDimension(0, height));
    final FontFactory.FontInformation fi = fontFactory.createFont(attr);
    FontFactory.applyFontInformation(items.getStyle(), fi);
    FontFactory.applyFontInformation(items.getBandDefaults(), fi);

    final String valign = attr.getValue(VALIGNMENT_ATT);
    if (valign != null)
    {
      items.getBandDefaults().setStyleProperty
          (ElementStyleSheet.VALIGNMENT, ReportParserUtil.parseVerticalElementAlignment(valign));
    }
    final String halign = attr.getValue(ALIGNMENT_ATT);
    if (halign != null)
    {
      items.getBandDefaults().setStyleProperty
          (ElementStyleSheet.ALIGNMENT, ReportParserUtil.parseHorizontalElementAlignment(halign));
    }

    getReport().setItemBand(items);
    getParser().pushFactory(new ElementFactory(getParser(), ITEMS_TAG, items));
  }

  /**
   * Handles the end of an ItemBand definition.
   *
   * @see com.jrefinery.report.ItemBand
   *
   * @throws SAXException if a Parser error occurs.
   */
  public void endItems() throws SAXException
  {
    getParser().popFactory().endElement(ITEMS_TAG);
  }

  /**
   * Handles the end of a PageHeader definition.
   *
   * @see com.jrefinery.report.PageHeader
   *
   * @throws SAXException if a parser error occurs.
   */
  public void endPageHeader() throws SAXException
  {
    getParser().popFactory().endElement(PAGE_HEADER_TAG);
  }

  /**
   * Handles the end of a PageFooter definition.
   *
   * @see com.jrefinery.report.PageFooter
   *
   * @throws SAXException if a parser error occurs.
   */
  private void endPageFooter() throws SAXException
  {
    getParser().popFactory().endElement(PAGE_FOOTER_TAG);
  }

  /**
   * Handles the end of a ReportHeader definition.
   *
   * @see com.jrefinery.report.ReportHeader
   *
   * @throws SAXException if a parser error occurs.
   */
  private void endReportHeader() throws SAXException
  {
    getParser().popFactory().endElement(REPORT_HEADER_TAG);
  }

  /**
   * Handles the end of a ReportFooter definition.
   *
   * @see com.jrefinery.report.ReportFooter
   *
   * @throws SAXException if a parser error occurs.
   */
  private void endReportFooter() throws SAXException
  {
    getParser().popFactory().endElement(REPORT_FOOTER_TAG);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -