bandfactory.java
来自「swing编写的库存管理程序。毕业设计类」· Java 代码 · 共 559 行 · 第 1/2 页
JAVA
559 行
}
final String halign = attr.getValue(ALIGNMENT_ATT);
if (halign != null)
{
reportFooter.getBandDefaults().setStyleProperty(ElementStyleSheet.ALIGNMENT,
ReportParserUtil.parseHorizontalElementAlignment(halign));
}
getParser().pushFactory(new ElementFactory(getReportParser(), 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 org.jfree.report.PageHeader
*/
private void startPageHeader(final Attributes attr)
throws SAXException
{
// create the page header...
final PageHeader pageHeader = getReport().getPageHeader();
// get the height...
final String heightAttr = attr.getValue("height");
if (heightAttr != null)
{
final float height = ParserUtil.parseFloat(heightAttr, 0);
pageHeader.getStyle().setStyleProperty(ElementStyleSheet.MINIMUMSIZE,
new FloatDimension(0, height));
}
final String firstPageAttr = attr.getValue("onfirstpage");
if (firstPageAttr != null)
{
final boolean firstPage = ParserUtil.parseBoolean(firstPageAttr, true);
pageHeader.setDisplayOnFirstPage(firstPage);
}
final String lastPageAttr = attr.getValue("onlastpage");
if (lastPageAttr != null)
{
final boolean lastPage = ParserUtil.parseBoolean(lastPageAttr, true);
pageHeader.setDisplayOnLastPage(lastPage);
}
final FontFactory.FontInformation fi = FontFactory.createFont(attr);
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));
}
getParser().pushFactory(new ElementFactory(getReportParser(), 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 org.jfree.report.PageFooter
*/
private void startPageFooter(final Attributes attr)
throws SAXException
{
// create the page header...
final PageFooter pageFooter = getReport().getPageFooter();
// get the height...
final String heightAttr = attr.getValue("height");
if (heightAttr != null)
{
final float height = ParserUtil.parseFloat(heightAttr, 0);
pageFooter.getStyle().setStyleProperty(ElementStyleSheet.MINIMUMSIZE,
new FloatDimension(0, height));
}
final String firstPageAttr = attr.getValue("onfirstpage");
if (firstPageAttr != null)
{
final boolean firstPage = ParserUtil.parseBoolean(firstPageAttr, true);
pageFooter.setDisplayOnFirstPage(firstPage);
}
final String lastPageAttr = attr.getValue("onlastpage");
if (lastPageAttr != null)
{
final boolean lastPage = ParserUtil.parseBoolean(lastPageAttr, true);
pageFooter.setDisplayOnLastPage(lastPage);
}
final FontFactory.FontInformation fi = FontFactory.createFont(attr);
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(getReportParser(), PAGE_FOOTER_TAG, pageFooter));
}
/**
* Handles the start of an Watermark definition.
*
* @param attr the element attributes.
*
* @throws SAXException if there is a parsing problem.
*
* @see org.jfree.report.Watermark
*/
private void startWatermark(final Attributes attr)
throws SAXException
{
final Band watermark = getReport().getWatermark();
final String heightAttr = attr.getValue("height");
if (heightAttr != null)
{
// get the height...
final float height = ParserUtil.parseFloat(heightAttr, 0);
watermark.getStyle().setStyleProperty
(ElementStyleSheet.MINIMUMSIZE, new FloatDimension(0, height));
}
final FontFactory.FontInformation fi = FontFactory.createFont(attr);
FontFactory.applyFontInformation(watermark.getBandDefaults(), fi);
final String valign = attr.getValue(VALIGNMENT_ATT);
if (valign != null)
{
watermark.getBandDefaults().setStyleProperty
(ElementStyleSheet.VALIGNMENT, ReportParserUtil.parseVerticalElementAlignment(valign));
}
final String halign = attr.getValue(ALIGNMENT_ATT);
if (halign != null)
{
watermark.getBandDefaults().setStyleProperty
(ElementStyleSheet.ALIGNMENT, ReportParserUtil.parseHorizontalElementAlignment(halign));
}
getParser().pushFactory(new ElementFactory(getReportParser(), WATERMARK_TAG, watermark));
}
/**
* Handles the start of an ItemBand definition.
*
* @param attr the element attributes.
*
* @throws SAXException if there is a parsing problem.
*
* @see org.jfree.report.ItemBand
*/
private void startItems(final Attributes attr)
throws SAXException
{
final ItemBand items = getReport().getItemBand();
final String heightAttr = attr.getValue("height");
if (heightAttr != null)
{
// get the height...
final float height = ParserUtil.parseFloat(heightAttr, 0);
items.getStyle().setStyleProperty
(ElementStyleSheet.MINIMUMSIZE, new FloatDimension(0, height));
}
final FontFactory.FontInformation fi = FontFactory.createFont(attr);
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));
}
getParser().pushFactory(new ElementFactory(getReportParser(), ITEMS_TAG, items));
}
/**
* Handles the end of an Watermark definition.
*
* @throws SAXException if a Parser error occurs.
*/
private void endWatermark() throws SAXException
{
getParser().popFactory().endElement(WATERMARK_TAG);
}
/**
* Handles the end of an ItemBand definition.
*
* @see org.jfree.report.ItemBand
*
* @throws SAXException if a Parser error occurs.
*/
private void endItems() throws SAXException
{
getParser().popFactory().endElement(ITEMS_TAG);
}
/**
* Handles the end of a PageHeader definition.
*
* @see org.jfree.report.PageHeader
*
* @throws SAXException if a parser error occurs.
*/
private void endPageHeader() throws SAXException
{
getParser().popFactory().endElement(PAGE_HEADER_TAG);
}
/**
* Handles the end of a PageFooter definition.
*
* @see org.jfree.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 org.jfree.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 org.jfree.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 + =
减小字号Ctrl + -
显示快捷键?