0001: /*
0002: * ============================================================================
0003: * GNU Lesser General Public License
0004: * ============================================================================
0005: *
0006: * JasperReports - Free Java report-generating library.
0007: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
0008: *
0009: * This library is free software; you can redistribute it and/or
0010: * modify it under the terms of the GNU Lesser General Public
0011: * License as published by the Free Software Foundation; either
0012: * version 2.1 of the License, or (at your option) any later version.
0013: *
0014: * This library is distributed in the hope that it will be useful,
0015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0017: * Lesser General Public License for more details.
0018: *
0019: * You should have received a copy of the GNU Lesser General Public
0020: * License along with this library; if not, write to the Free Software
0021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
0022: *
0023: * JasperSoft Corporation
0024: * 303 Second Street, Suite 450 North
0025: * San Francisco, CA 94107
0026: * http://www.jaspersoft.com
0027: */
0028: package net.sf.jasperreports.engine.xml;
0029:
0030: import javax.xml.parsers.ParserConfigurationException;
0031:
0032: import net.sf.jasperreports.charts.JRChartAxis;
0033: import net.sf.jasperreports.charts.design.JRDesignCategorySeries;
0034: import net.sf.jasperreports.charts.design.JRDesignDataRange;
0035: import net.sf.jasperreports.charts.design.JRDesignTimePeriodSeries;
0036: import net.sf.jasperreports.charts.design.JRDesignTimeSeries;
0037: import net.sf.jasperreports.charts.design.JRDesignValueDisplay;
0038: import net.sf.jasperreports.charts.design.JRDesignXySeries;
0039: import net.sf.jasperreports.charts.design.JRDesignXyzSeries;
0040: import net.sf.jasperreports.charts.util.JRAxisFormat;
0041: import net.sf.jasperreports.charts.util.JRMeterInterval;
0042: import net.sf.jasperreports.charts.xml.JRAreaChartFactory;
0043: import net.sf.jasperreports.charts.xml.JRAreaPlotFactory;
0044: import net.sf.jasperreports.charts.xml.JRBar3DChartFactory;
0045: import net.sf.jasperreports.charts.xml.JRBar3DPlotFactory;
0046: import net.sf.jasperreports.charts.xml.JRBarChartFactory;
0047: import net.sf.jasperreports.charts.xml.JRBarPlotFactory;
0048: import net.sf.jasperreports.charts.xml.JRBubbleChartFactory;
0049: import net.sf.jasperreports.charts.xml.JRBubblePlotFactory;
0050: import net.sf.jasperreports.charts.xml.JRCandlestickChartFactory;
0051: import net.sf.jasperreports.charts.xml.JRCandlestickPlotFactory;
0052: import net.sf.jasperreports.charts.xml.JRCategoryDatasetFactory;
0053: import net.sf.jasperreports.charts.xml.JRCategorySeriesFactory;
0054: import net.sf.jasperreports.charts.xml.JRChartAxisFactory;
0055: import net.sf.jasperreports.charts.xml.JRDataRangeFactory;
0056: import net.sf.jasperreports.charts.xml.JRHighLowChartFactory;
0057: import net.sf.jasperreports.charts.xml.JRHighLowDatasetFactory;
0058: import net.sf.jasperreports.charts.xml.JRHighLowPlotFactory;
0059: import net.sf.jasperreports.charts.xml.JRLineChartFactory;
0060: import net.sf.jasperreports.charts.xml.JRLinePlotFactory;
0061: import net.sf.jasperreports.charts.xml.JRMeterChartFactory;
0062: import net.sf.jasperreports.charts.xml.JRMeterIntervalFactory;
0063: import net.sf.jasperreports.charts.xml.JRMeterPlotFactory;
0064: import net.sf.jasperreports.charts.xml.JRMultiAxisChartFactory;
0065: import net.sf.jasperreports.charts.xml.JRMultiAxisPlotFactory;
0066: import net.sf.jasperreports.charts.xml.JRPie3DChartFactory;
0067: import net.sf.jasperreports.charts.xml.JRPie3DPlotFactory;
0068: import net.sf.jasperreports.charts.xml.JRPieChartFactory;
0069: import net.sf.jasperreports.charts.xml.JRPieDatasetFactory;
0070: import net.sf.jasperreports.charts.xml.JRPiePlotFactory;
0071: import net.sf.jasperreports.charts.xml.JRScatterChartFactory;
0072: import net.sf.jasperreports.charts.xml.JRScatterPlotFactory;
0073: import net.sf.jasperreports.charts.xml.JRStackedAreaChartFactory;
0074: import net.sf.jasperreports.charts.xml.JRStackedBar3DChartFactory;
0075: import net.sf.jasperreports.charts.xml.JRStackedBarChartFactory;
0076: import net.sf.jasperreports.charts.xml.JRThermometerChartFactory;
0077: import net.sf.jasperreports.charts.xml.JRThermometerPlotFactory;
0078: import net.sf.jasperreports.charts.xml.JRTimePeriodDatasetFactory;
0079: import net.sf.jasperreports.charts.xml.JRTimePeriodSeriesFactory;
0080: import net.sf.jasperreports.charts.xml.JRTimeSeriesChartFactory;
0081: import net.sf.jasperreports.charts.xml.JRTimeSeriesDatasetFactory;
0082: import net.sf.jasperreports.charts.xml.JRTimeSeriesFactory;
0083: import net.sf.jasperreports.charts.xml.JRTimeSeriesPlotFactory;
0084: import net.sf.jasperreports.charts.xml.JRValueDatasetFactory;
0085: import net.sf.jasperreports.charts.xml.JRValueDisplayFactory;
0086: import net.sf.jasperreports.charts.xml.JRXyAreaChartFactory;
0087: import net.sf.jasperreports.charts.xml.JRXyBarChartFactory;
0088: import net.sf.jasperreports.charts.xml.JRXyDatasetFactory;
0089: import net.sf.jasperreports.charts.xml.JRXyLineChartFactory;
0090: import net.sf.jasperreports.charts.xml.JRXySeriesFactory;
0091: import net.sf.jasperreports.charts.xml.JRXyzDatasetFactory;
0092: import net.sf.jasperreports.charts.xml.JRXyzSeriesFactory;
0093: import net.sf.jasperreports.crosstabs.JRCrosstabParameter;
0094: import net.sf.jasperreports.crosstabs.design.JRDesignCellContents;
0095: import net.sf.jasperreports.crosstabs.design.JRDesignCrosstabBucket;
0096: import net.sf.jasperreports.crosstabs.design.JRDesignCrosstabCell;
0097: import net.sf.jasperreports.crosstabs.design.JRDesignCrosstabColumnGroup;
0098: import net.sf.jasperreports.crosstabs.design.JRDesignCrosstabMeasure;
0099: import net.sf.jasperreports.crosstabs.design.JRDesignCrosstabRowGroup;
0100: import net.sf.jasperreports.crosstabs.xml.JRCellContentsFactory;
0101: import net.sf.jasperreports.crosstabs.xml.JRCrosstabBucketExpressionFactory;
0102: import net.sf.jasperreports.crosstabs.xml.JRCrosstabBucketFactory;
0103: import net.sf.jasperreports.crosstabs.xml.JRCrosstabCellFactory;
0104: import net.sf.jasperreports.crosstabs.xml.JRCrosstabColumnGroupFactory;
0105: import net.sf.jasperreports.crosstabs.xml.JRCrosstabDatasetFactory;
0106: import net.sf.jasperreports.crosstabs.xml.JRCrosstabFactory;
0107: import net.sf.jasperreports.crosstabs.xml.JRCrosstabMeasureExpressionFactory;
0108: import net.sf.jasperreports.crosstabs.xml.JRCrosstabMeasureFactory;
0109: import net.sf.jasperreports.crosstabs.xml.JRCrosstabParameterFactory;
0110: import net.sf.jasperreports.crosstabs.xml.JRCrosstabParameterValueExpressionFactory;
0111: import net.sf.jasperreports.crosstabs.xml.JRCrosstabRowGroupFactory;
0112: import net.sf.jasperreports.engine.JRBand;
0113: import net.sf.jasperreports.engine.JRBox;
0114: import net.sf.jasperreports.engine.JRChartPlot;
0115: import net.sf.jasperreports.engine.JRDatasetParameter;
0116: import net.sf.jasperreports.engine.JRDatasetRun;
0117: import net.sf.jasperreports.engine.JRExpression;
0118: import net.sf.jasperreports.engine.JRField;
0119: import net.sf.jasperreports.engine.JRFont;
0120: import net.sf.jasperreports.engine.JRHyperlink;
0121: import net.sf.jasperreports.engine.JRHyperlinkParameter;
0122: import net.sf.jasperreports.engine.JRParameter;
0123: import net.sf.jasperreports.engine.JRReportFont;
0124: import net.sf.jasperreports.engine.JRReportTemplate;
0125: import net.sf.jasperreports.engine.JRSortField;
0126: import net.sf.jasperreports.engine.JRStyle;
0127: import net.sf.jasperreports.engine.JRSubreportParameter;
0128: import net.sf.jasperreports.engine.JRSubreportReturnValue;
0129: import net.sf.jasperreports.engine.design.JRDesignDataset;
0130: import net.sf.jasperreports.engine.design.JRDesignElement;
0131: import net.sf.jasperreports.engine.design.JRDesignElementGroup;
0132: import net.sf.jasperreports.engine.design.JRDesignExpression;
0133: import net.sf.jasperreports.engine.design.JRDesignGroup;
0134: import net.sf.jasperreports.engine.design.JRDesignQuery;
0135: import net.sf.jasperreports.engine.design.JRDesignReportTemplate;
0136: import net.sf.jasperreports.engine.design.JRDesignVariable;
0137: import net.sf.jasperreports.engine.design.JasperDesign;
0138: import net.sf.jasperreports.engine.util.JRProperties;
0139:
0140: import org.apache.commons.digester.Digester;
0141: import org.apache.commons.digester.SetNestedPropertiesRule;
0142: import org.xml.sax.ErrorHandler;
0143: import org.xml.sax.SAXException;
0144: import org.xml.sax.SAXParseException;
0145:
0146: /**
0147: * JRXmlDigesterFactory encapsulates the code necessary to construct and configure
0148: * a digester in order to prepare it for parsing JasperReports xml definition files.
0149: *
0150: * @author Peter Severin (peter_p_s@users.sourceforge.net)
0151: * @version $Id: JRXmlDigesterFactory.java 1797 2007-07-30 09:38:35Z teodord $
0152: */
0153: public class JRXmlDigesterFactory {
0154:
0155: /**
0156: *
0157: */
0158: private JRXmlDigesterFactory() {
0159: super ();
0160: }
0161:
0162: /**
0163: * Configures the given digester for parsing jasperreport xml report definition files.
0164: */
0165: public static void configureDigester(Digester digester)
0166: throws SAXException, ParserConfigurationException {
0167: boolean validating = JRProperties
0168: .getBooleanProperty(JRProperties.COMPILER_XML_VALIDATION);
0169:
0170: digester.setErrorHandler(new ErrorHandlerImpl());
0171: digester.setValidating(validating);
0172: digester.setFeature("http://xml.org/sax/features/validation",
0173: validating);
0174:
0175: /* */
0176: digester.addFactoryCreate("jasperReport",
0177: JasperDesignFactory.class.getName());
0178: digester.addSetNext("jasperReport", "setJasperDesign",
0179: JasperDesign.class.getName());
0180:
0181: /* */
0182: digester.addRule("*/property", new JRPropertyDigesterRule());
0183:
0184: /* */
0185: digester.addCallMethod("jasperReport/import", "addImport", 1);
0186: digester.addCallParam("jasperReport/import", 0, "value");
0187:
0188: addTemplateRules(digester);
0189:
0190: /* */
0191: digester.addFactoryCreate("jasperReport/reportFont",
0192: JRReportFontFactory.class.getName());
0193: digester.addSetNext("jasperReport/reportFont", "addFont",
0194: JRReportFont.class.getName());
0195:
0196: /* */
0197: digester.addFactoryCreate("jasperReport/style",
0198: JRDesignStyleFactory.class.getName());
0199: digester.addSetNext("jasperReport/style", "addStyle",
0200: JRStyle.class.getName());
0201:
0202: digester.addFactoryCreate(
0203: "jasperReport/style/conditionalStyle",
0204: JRConditionalStyleFactory.class.getName());
0205: digester
0206: .addFactoryCreate(
0207: "jasperReport/style/conditionalStyle/conditionExpression",
0208: JRExpressionFactory.BooleanExpressionFactory.class
0209: .getName());
0210: digester
0211: .addSetNext(
0212: "jasperReport/style/conditionalStyle/conditionExpression",
0213: "setConditionExpression", JRExpression.class
0214: .getName());
0215: digester
0216: .addCallMethod(
0217: "jasperReport/style/conditionalStyle/conditionExpression",
0218: "setText", 0);
0219: digester.addFactoryCreate(
0220: "jasperReport/style/conditionalStyle/style",
0221: JRConditionalStyleFillerFactory.class.getName());
0222:
0223: /* */
0224: digester.addFactoryCreate("*/parameter",
0225: JRParameterFactory.class.getName());
0226: digester.addSetNext("*/parameter", "addParameter",
0227: JRParameter.class.getName());
0228: digester.addCallMethod("*/parameter/parameterDescription",
0229: "setDescription", 0);
0230:
0231: /* */
0232: digester.addFactoryCreate("*/parameter/defaultValueExpression",
0233: JRDefaultValueExpressionFactory.class.getName());
0234: digester.addSetNext("*/parameter/defaultValueExpression",
0235: "setDefaultValueExpression", JRExpression.class
0236: .getName());
0237: digester.addCallMethod("*/parameter/defaultValueExpression",
0238: "setText", 0);
0239:
0240: /* */
0241: digester.addFactoryCreate("*/queryString", JRQueryFactory.class
0242: .getName());
0243: digester.addSetNext("*/queryString", "setQuery",
0244: JRDesignQuery.class.getName());
0245: digester.addCallMethod("*/queryString", "setText", 0);
0246:
0247: /* */
0248: digester.addFactoryCreate("*/field", JRFieldFactory.class
0249: .getName());
0250: digester.addSetNext("*/field", "addField", JRField.class
0251: .getName());
0252: digester.addCallMethod("*/field/fieldDescription",
0253: "setDescription", 0);
0254:
0255: /* */
0256: digester.addFactoryCreate("*/sortField",
0257: JRSortFieldFactory.class.getName());
0258: digester.addSetNext("*/sortField", "addSortField",
0259: JRSortField.class.getName());
0260:
0261: /* */
0262: digester.addFactoryCreate("*/variable", JRVariableFactory.class
0263: .getName());
0264: digester.addSetNext("*/variable", "addVariable",
0265: JRDesignVariable.class.getName());
0266:
0267: /* */
0268: digester.addFactoryCreate("*/variable/variableExpression",
0269: JRVariableExpressionFactory.class.getName());
0270: digester.addSetNext("*/variable/variableExpression",
0271: "setExpression", JRExpression.class.getName());
0272: digester.addCallMethod("*/variable/variableExpression",
0273: "setText", 0);
0274:
0275: /* */
0276: digester.addFactoryCreate("*/variable/initialValueExpression",
0277: JRInitialValueExpressionFactory.class.getName());
0278: digester.addSetNext("*/variable/initialValueExpression",
0279: "setInitialValueExpression", JRExpression.class
0280: .getName());
0281: digester.addCallMethod("*/variable/initialValueExpression",
0282: "setText", 0);
0283:
0284: String filterExpressionPath = "*/"
0285: + JRXmlConstants.ELEMENT_filterExpression;
0286: digester.addFactoryCreate(filterExpressionPath,
0287: JRExpressionFactory.BooleanExpressionFactory.class
0288: .getName());
0289: digester.addSetNext(filterExpressionPath,
0290: "setFilterExpression", JRExpression.class.getName());
0291: digester.addCallMethod(filterExpressionPath, "setText", 0);
0292:
0293: /* */
0294: digester.addFactoryCreate("*/group", JRGroupFactory.class
0295: .getName());
0296: digester.addSetNext("*/group", "addGroup", JRDesignGroup.class
0297: .getName());
0298:
0299: /* */
0300: digester.addFactoryCreate("*/group/groupExpression",
0301: JRExpressionFactory.ObjectExpressionFactory.class
0302: .getName());
0303: digester.addSetNext("*/group/groupExpression", "setExpression",
0304: JRExpression.class.getName());
0305: digester.addCallMethod("*/group/groupExpression", "setText", 0);
0306:
0307: /* */
0308: digester.addFactoryCreate("jasperReport/background/band",
0309: JRBandFactory.class.getName());
0310: digester.addSetNext("jasperReport/background/band",
0311: "setBackground", JRBand.class.getName());
0312: digester.addFactoryCreate("jasperReport/title/band",
0313: JRBandFactory.class.getName());
0314: digester.addSetNext("jasperReport/title/band", "setTitle",
0315: JRBand.class.getName());
0316: digester.addFactoryCreate("jasperReport/pageHeader/band",
0317: JRBandFactory.class.getName());
0318: digester.addSetNext("jasperReport/pageHeader/band",
0319: "setPageHeader", JRBand.class.getName());
0320: digester.addFactoryCreate("jasperReport/columnHeader/band",
0321: JRBandFactory.class.getName());
0322: digester.addSetNext("jasperReport/columnHeader/band",
0323: "setColumnHeader", JRBand.class.getName());
0324: digester.addFactoryCreate(
0325: "jasperReport/group/groupHeader/band",
0326: JRBandFactory.class.getName());
0327: digester.addSetNext("jasperReport/group/groupHeader/band",
0328: "setGroupHeader", JRBand.class.getName());
0329: digester.addFactoryCreate("jasperReport/detail/band",
0330: JRBandFactory.class.getName());
0331: digester.addSetNext("jasperReport/detail/band", "setDetail",
0332: JRBand.class.getName());
0333: digester.addFactoryCreate(
0334: "jasperReport/group/groupFooter/band",
0335: JRBandFactory.class.getName());
0336: digester.addSetNext("jasperReport/group/groupFooter/band",
0337: "setGroupFooter", JRBand.class.getName());
0338: digester.addFactoryCreate("jasperReport/columnFooter/band",
0339: JRBandFactory.class.getName());
0340: digester.addSetNext("jasperReport/columnFooter/band",
0341: "setColumnFooter", JRBand.class.getName());
0342: digester.addFactoryCreate("jasperReport/pageFooter/band",
0343: JRBandFactory.class.getName());
0344: digester.addSetNext("jasperReport/pageFooter/band",
0345: "setPageFooter", JRBand.class.getName());
0346: digester.addFactoryCreate("jasperReport/lastPageFooter/band",
0347: JRBandFactory.class.getName());
0348: digester.addSetNext("jasperReport/lastPageFooter/band",
0349: "setLastPageFooter", JRBand.class.getName());
0350: digester.addFactoryCreate("jasperReport/summary/band",
0351: JRBandFactory.class.getName());
0352: digester.addSetNext("jasperReport/summary/band", "setSummary",
0353: JRBand.class.getName());
0354: digester.addFactoryCreate("jasperReport/noData/band",
0355: JRBandFactory.class.getName());
0356: digester.addSetNext("jasperReport/noData/band", "setNoData",
0357: JRBand.class.getName());
0358:
0359: /* */
0360: digester.addFactoryCreate("*/band/printWhenExpression",
0361: JRExpressionFactory.BooleanExpressionFactory.class
0362: .getName());
0363: digester.addSetNext("*/band/printWhenExpression",
0364: "setPrintWhenExpression", JRExpression.class.getName());
0365: digester.addCallMethod("*/band/printWhenExpression", "setText",
0366: 0);
0367:
0368: /* */
0369: digester.addFactoryCreate("*/break", JRBreakFactory.class
0370: .getName());
0371: digester.addSetNext("*/break", "addElement",
0372: JRDesignElement.class.getName());
0373:
0374: /* */
0375: digester.addFactoryCreate("*/line", JRLineFactory.class
0376: .getName());
0377: digester.addSetNext("*/line", "addElement",
0378: JRDesignElement.class.getName());
0379:
0380: /* */
0381: digester.addFactoryCreate("*/reportElement",
0382: JRElementFactory.class.getName());
0383:
0384: /* */
0385: digester.addFactoryCreate(
0386: "*/reportElement/printWhenExpression",
0387: JRExpressionFactory.BooleanExpressionFactory.class
0388: .getName());
0389: digester.addSetNext("*/reportElement/printWhenExpression",
0390: "setPrintWhenExpression", JRExpression.class.getName());
0391: digester.addCallMethod("*/reportElement/printWhenExpression",
0392: "setText", 0);
0393:
0394: /* */
0395: digester.addFactoryCreate("*/graphicElement",
0396: JRGraphicElementFactory.class.getName());
0397:
0398: /* */
0399: digester.addFactoryCreate("*/rectangle",
0400: JRRectangleFactory.class.getName());
0401: digester.addSetNext("*/rectangle", "addElement",
0402: JRDesignElement.class.getName());
0403:
0404: /* */
0405: digester.addFactoryCreate("*/ellipse", JREllipseFactory.class
0406: .getName());
0407: digester.addSetNext("*/ellipse", "addElement",
0408: JRDesignElement.class.getName());
0409:
0410: /* */
0411: digester.addFactoryCreate("*/image", JRImageFactory.class
0412: .getName());
0413: digester.addSetNext("*/image", "addElement",
0414: JRDesignElement.class.getName());
0415:
0416: /* */
0417: digester
0418: .addFactoryCreate("*/box", JRBoxFactory.class.getName());
0419: // digester.addSetNext("*/box", "setBox", JRBox.class.getName());
0420:
0421: /* */
0422: digester.addFactoryCreate("*/image/imageExpression",
0423: JRStringExpressionFactory.class.getName());
0424: digester.addSetNext("*/image/imageExpression", "setExpression",
0425: JRExpression.class.getName());
0426: digester.addCallMethod("*/image/imageExpression", "setText", 0);
0427:
0428: /* */
0429: digester.addFactoryCreate("*/staticText",
0430: JRStaticTextFactory.class.getName());
0431: digester.addSetNext("*/staticText", "addElement",
0432: JRDesignElement.class.getName());
0433: SetNestedPropertiesRule textRule = new SetNestedPropertiesRule(
0434: new String[] { "text", "reportElement", "box",
0435: "textElement" }, new String[] { "text" });
0436: textRule.setTrimData(false);
0437: textRule.setAllowUnknownChildElements(true);
0438: digester.addRule("*/staticText", textRule);
0439:
0440: /* */
0441: digester.addFactoryCreate("*/textElement",
0442: JRTextElementFactory.class.getName());
0443:
0444: /* */
0445: digester.addFactoryCreate("*/textElement/font",
0446: JRFontFactory.TextElementFontFactory.class.getName());
0447: // digester.addSetNext("*/textElement/font", "setFont", JRFont.class.getName());
0448:
0449: /* */
0450: digester.addFactoryCreate("*/textField",
0451: JRTextFieldFactory.class.getName());
0452: digester.addSetNext("*/textField", "addElement",
0453: JRDesignElement.class.getName());
0454:
0455: /* */
0456: digester.addFactoryCreate("*/textField/textFieldExpression",
0457: JRStringExpressionFactory.class.getName());
0458: digester.addSetNext("*/textField/textFieldExpression",
0459: "setExpression", JRExpression.class.getName());
0460: digester.addCallMethod("*/textField/textFieldExpression",
0461: "setText", 0);
0462:
0463: /* */
0464: digester.addFactoryCreate("*/anchorNameExpression",
0465: JRExpressionFactory.StringExpressionFactory.class
0466: .getName());
0467: digester
0468: .addSetNext("*/anchorNameExpression",
0469: "setAnchorNameExpression", JRExpression.class
0470: .getName());
0471: digester.addCallMethod("*/anchorNameExpression", "setText", 0);
0472: digester.addFactoryCreate("*/hyperlinkReferenceExpression",
0473: JRExpressionFactory.StringExpressionFactory.class
0474: .getName());
0475: digester.addSetNext("*/hyperlinkReferenceExpression",
0476: "setHyperlinkReferenceExpression", JRExpression.class
0477: .getName());
0478: digester.addCallMethod("*/hyperlinkReferenceExpression",
0479: "setText", 0);
0480: digester.addFactoryCreate("*/hyperlinkAnchorExpression",
0481: JRExpressionFactory.StringExpressionFactory.class
0482: .getName());
0483: digester.addSetNext("*/hyperlinkAnchorExpression",
0484: "setHyperlinkAnchorExpression", JRExpression.class
0485: .getName());
0486: digester.addCallMethod("*/hyperlinkAnchorExpression",
0487: "setText", 0);
0488: digester.addFactoryCreate("*/hyperlinkPageExpression",
0489: JRExpressionFactory.IntegerExpressionFactory.class
0490: .getName());
0491: digester.addSetNext("*/hyperlinkPageExpression",
0492: "setHyperlinkPageExpression", JRExpression.class
0493: .getName());
0494: digester.addCallMethod("*/hyperlinkPageExpression", "setText",
0495: 0);
0496:
0497: String hyperlinkTooltipExpressionPattern = "*/"
0498: + JRXmlConstants.ELEMENT_hyperlinkTooltipExpression;
0499: digester.addFactoryCreate(hyperlinkTooltipExpressionPattern,
0500: JRExpressionFactory.StringExpressionFactory.class
0501: .getName());
0502: digester.addSetNext(hyperlinkTooltipExpressionPattern,
0503: "setHyperlinkTooltipExpression", JRExpression.class
0504: .getName());
0505: digester.addCallMethod(hyperlinkTooltipExpressionPattern,
0506: "setText", 0);
0507:
0508: addHyperlinkParameterRules(digester);
0509:
0510: /* */
0511: digester.addFactoryCreate("*/subreport",
0512: JRSubreportFactory.class.getName());
0513: digester.addSetNext("*/subreport", "addElement",
0514: JRDesignElement.class.getName());
0515:
0516: /* */
0517: digester.addFactoryCreate("*/subreport/subreportParameter",
0518: JRSubreportParameterFactory.class.getName());
0519: digester.addSetNext("*/subreport/subreportParameter",
0520: "addParameter", JRSubreportParameter.class.getName());
0521:
0522: /* */
0523: digester.addFactoryCreate("*/subreport/returnValue",
0524: JRSubreportReturnValueFactory.class.getName());
0525: digester.addSetNext("*/subreport/returnValue",
0526: "addReturnValue", JRSubreportReturnValue.class
0527: .getName());
0528:
0529: /* */
0530: digester.addFactoryCreate("*/parametersMapExpression",
0531: JRExpressionFactory.MapExpressionFactory.class
0532: .getName());
0533: digester.addSetNext("*/parametersMapExpression",
0534: "setParametersMapExpression", JRExpression.class
0535: .getName());
0536: digester.addCallMethod("*/parametersMapExpression", "setText",
0537: 0);
0538:
0539: /* */
0540: digester
0541: .addFactoryCreate(
0542: "*/subreport/subreportParameter/subreportParameterExpression",
0543: JRExpressionFactory.ObjectExpressionFactory.class
0544: .getName());
0545: digester
0546: .addSetNext(
0547: "*/subreport/subreportParameter/subreportParameterExpression",
0548: "setExpression", JRExpression.class.getName());
0549: digester
0550: .addCallMethod(
0551: "*/subreport/subreportParameter/subreportParameterExpression",
0552: "setText", 0);
0553:
0554: /* */
0555: digester.addFactoryCreate("*/connectionExpression",
0556: JRExpressionFactory.ConnectionExpressionFactory.class
0557: .getName());
0558: digester
0559: .addSetNext("*/connectionExpression",
0560: "setConnectionExpression", JRExpression.class
0561: .getName());
0562: digester.addCallMethod("*/connectionExpression", "setText", 0);
0563:
0564: /* */
0565: digester.addFactoryCreate("*/dataSourceExpression",
0566: JRExpressionFactory.DataSourceExpressionFactory.class
0567: .getName());
0568: digester
0569: .addSetNext("*/dataSourceExpression",
0570: "setDataSourceExpression", JRExpression.class
0571: .getName());
0572: digester.addCallMethod("*/dataSourceExpression", "setText", 0);
0573:
0574: /* */
0575: digester.addFactoryCreate("*/subreport/subreportExpression",
0576: JRSubreportExpressionFactory.class.getName());
0577: digester.addSetNext("*/subreport/subreportExpression",
0578: "setExpression", JRExpression.class.getName());
0579: digester.addCallMethod("*/subreport/subreportExpression",
0580: "setText", 0);
0581:
0582: /* */
0583: digester.addFactoryCreate("*/elementGroup",
0584: JRElementGroupFactory.class.getName());
0585: digester.addSetNext("*/elementGroup", "addElementGroup",
0586: JRDesignElementGroup.class.getName());
0587:
0588: addChartRules(digester);
0589:
0590: addDatasetRules(digester);
0591:
0592: addCrosstabRules(digester);
0593:
0594: addFrameRules(digester);
0595: }
0596:
0597: protected static void addTemplateRules(Digester digester) {
0598: String templatePattern = JRXmlConstants.ELEMENT_jasperReport
0599: + "/" + JRXmlConstants.ELEMENT_template;
0600: //do not change the order
0601: digester.addObjectCreate(templatePattern,
0602: JRDesignReportTemplate.class);
0603: digester.addSetNext(templatePattern, "addTemplate",
0604: JRReportTemplate.class.getName());
0605: digester.addFactoryCreate(templatePattern,
0606: JRStringExpressionFactory.class);
0607: digester.addCallMethod(templatePattern, "setText", 0);
0608: digester.addSetNext(templatePattern, "setSourceExpression",
0609: JRExpression.class.getName());
0610: }
0611:
0612: /**
0613: *
0614: */
0615: private static void addChartRules(Digester digester) {
0616: digester.addFactoryCreate("*/dataset",
0617: JRElementDatasetFactory.class.getName());
0618:
0619: String datasetIncrementWhenExpressionPath = "*/dataset/"
0620: + JRXmlConstants.ELEMENT_incrementWhenExpression;
0621: digester.addFactoryCreate(datasetIncrementWhenExpressionPath,
0622: JRExpressionFactory.BooleanExpressionFactory.class
0623: .getName());
0624: digester.addSetNext(datasetIncrementWhenExpressionPath,
0625: "setIncrementWhenExpression", JRExpression.class
0626: .getName());
0627: digester.addCallMethod(datasetIncrementWhenExpressionPath,
0628: "setText", 0);
0629:
0630: digester.addFactoryCreate("*/plot", JRChartPlotFactory.class
0631: .getName());
0632: digester
0633: .addFactoryCreate("*/plot/seriesColor",
0634: JRChartPlotFactory.JRSeriesColorFactory.class
0635: .getName());
0636: digester.addSetNext("*/plot/seriesColor", "addSeriesColor",
0637: JRChartPlot.JRSeriesColor.class.getName());
0638:
0639: digester.addFactoryCreate("*/chart", JRChartFactory.class
0640: .getName());
0641: digester.addFactoryCreate("*/chart/chartTitle",
0642: JRChartFactory.JRChartTitleFactory.class.getName());
0643: digester.addFactoryCreate("*/chart/chartTitle/font",
0644: JRFontFactory.ChartFontFactory.class.getName());
0645: digester.addSetNext("*/chart/chartTitle/font", "setTitleFont",
0646: JRFont.class.getName());
0647: digester.addFactoryCreate("*/chart/chartTitle/titleExpression",
0648: JRExpressionFactory.StringExpressionFactory.class);
0649: digester.addSetNext("*/chart/chartTitle/titleExpression",
0650: "setTitleExpression", JRDesignExpression.class
0651: .getName());
0652: digester.addCallMethod("*/chart/chartTitle/titleExpression",
0653: "setText", 0);
0654: digester.addFactoryCreate("*/chart/chartSubtitle",
0655: JRChartFactory.JRChartSubtitleFactory.class.getName());
0656: digester.addFactoryCreate("*/chart/chartSubtitle/font",
0657: JRFontFactory.ChartFontFactory.class.getName());
0658: digester.addSetNext("*/chart/chartSubtitle/font",
0659: "setSubtitleFont", JRFont.class.getName());
0660: digester.addFactoryCreate(
0661: "*/chart/chartSubtitle/subtitleExpression",
0662: JRExpressionFactory.StringExpressionFactory.class);
0663: digester.addSetNext("*/chart/chartSubtitle/subtitleExpression",
0664: "setSubtitleExpression", JRDesignExpression.class
0665: .getName());
0666: digester.addCallMethod(
0667: "*/chart/chartSubtitle/subtitleExpression", "setText",
0668: 0);
0669: digester.addFactoryCreate("*/chart/chartLegend",
0670: JRChartFactory.JRChartLegendFactory.class.getName());
0671: digester.addFactoryCreate("*/chart/chartLegend/font",
0672: JRFontFactory.ChartFontFactory.class.getName());
0673: digester.addSetNext("*/chart/chartLegend/font",
0674: "setLegendFont", JRFont.class.getName());
0675:
0676: // axis labels
0677: digester
0678: .addFactoryCreate("*/categoryAxisFormat/axisFormat",
0679: JRChartFactory.JRChartAxisFormatFactory.class
0680: .getName());
0681: digester.addSetNext("*/categoryAxisFormat/axisFormat",
0682: "setCategoryAxisFormat", JRAxisFormat.class.getName());
0683: digester.addFactoryCreate(
0684: "*/categoryAxisFormat/axisFormat/labelFont/font",
0685: JRFontFactory.ChartFontFactory.class.getName());
0686: digester.addSetNext(
0687: "*/categoryAxisFormat/axisFormat/labelFont/font",
0688: "setLabelFont", JRFont.class.getName());
0689: digester.addFactoryCreate(
0690: "*/categoryAxisFormat/axisFormat/tickLabelFont/font",
0691: JRFontFactory.ChartFontFactory.class.getName());
0692: digester.addSetNext(
0693: "*/categoryAxisFormat/axisFormat/tickLabelFont/font",
0694: "setTickLabelFont", JRFont.class.getName());
0695:
0696: digester
0697: .addFactoryCreate("*/valueAxisFormat/axisFormat",
0698: JRChartFactory.JRChartAxisFormatFactory.class
0699: .getName());
0700: digester.addSetNext("*/valueAxisFormat/axisFormat",
0701: "setValueAxisFormat", JRAxisFormat.class.getName());
0702: digester.addFactoryCreate(
0703: "*/valueAxisFormat/axisFormat/labelFont/font",
0704: JRFontFactory.ChartFontFactory.class.getName());
0705: digester.addSetNext(
0706: "*/valueAxisFormat/axisFormat/labelFont/font",
0707: "setLabelFont", JRFont.class.getName());
0708: digester.addFactoryCreate(
0709: "*/valueAxisFormat/axisFormat/tickLabelFont/font",
0710: JRFontFactory.ChartFontFactory.class.getName());
0711: digester.addSetNext(
0712: "*/valueAxisFormat/axisFormat/tickLabelFont/font",
0713: "setTickLabelFont", JRFont.class.getName());
0714:
0715: digester
0716: .addFactoryCreate("*/timeAxisFormat/axisFormat",
0717: JRChartFactory.JRChartAxisFormatFactory.class
0718: .getName());
0719: digester.addSetNext("*/timeAxisFormat/axisFormat",
0720: "setTimeAxisFormat", JRAxisFormat.class.getName());
0721: digester.addFactoryCreate(
0722: "*/timeAxisFormat/axisFormat/labelFont/font",
0723: JRFontFactory.ChartFontFactory.class.getName());
0724: digester.addSetNext(
0725: "*/timeAxisFormat/axisFormat/labelFont/font",
0726: "setLabelFont", JRFont.class.getName());
0727: digester.addFactoryCreate(
0728: "*/timeAxisFormat/axisFormat/tickLabelFont/font",
0729: JRFontFactory.ChartFontFactory.class.getName());
0730: digester.addSetNext(
0731: "*/timeAxisFormat/axisFormat/tickLabelFont/font",
0732: "setTickLabelFont", JRFont.class.getName());
0733:
0734: digester
0735: .addFactoryCreate("*/xAxisFormat/axisFormat",
0736: JRChartFactory.JRChartAxisFormatFactory.class
0737: .getName());
0738: digester.addSetNext("*/xAxisFormat/axisFormat",
0739: "setXAxisFormat", JRAxisFormat.class.getName());
0740: digester.addFactoryCreate(
0741: "*/xAxisFormat/axisFormat/labelFont/font",
0742: JRFontFactory.ChartFontFactory.class.getName());
0743: digester.addSetNext("*/xAxisFormat/axisFormat/labelFont/font",
0744: "setLabelFont", JRFont.class.getName());
0745: digester.addFactoryCreate(
0746: "*/xAxisFormat/axisFormat/tickLabelFont/font",
0747: JRFontFactory.ChartFontFactory.class.getName());
0748: digester.addSetNext(
0749: "*/xAxisFormat/axisFormat/tickLabelFont/font",
0750: "setTickLabelFont", JRFont.class.getName());
0751:
0752: digester
0753: .addFactoryCreate("*/yAxisFormat/axisFormat",
0754: JRChartFactory.JRChartAxisFormatFactory.class
0755: .getName());
0756: digester.addSetNext("*/yAxisFormat/axisFormat",
0757: "setYAxisFormat", JRAxisFormat.class.getName());
0758: digester.addFactoryCreate(
0759: "*/yAxisFormat/axisFormat/labelFont/font",
0760: JRFontFactory.ChartFontFactory.class.getName());
0761: digester.addSetNext("*/yAxisFormat/axisFormat/labelFont/font",
0762: "setLabelFont", JRFont.class.getName());
0763: digester.addFactoryCreate(
0764: "*/yAxisFormat/axisFormat/tickLabelFont/font",
0765: JRFontFactory.ChartFontFactory.class.getName());
0766: digester.addSetNext(
0767: "*/yAxisFormat/axisFormat/tickLabelFont/font",
0768: "setTickLabelFont", JRFont.class.getName());
0769:
0770: // pie charts
0771: digester.addFactoryCreate("*/pieChart", JRPieChartFactory.class
0772: .getName());
0773: digester.addSetNext("*/pieChart", "addElement",
0774: JRDesignElement.class.getName());
0775: digester.addFactoryCreate("*/pieChart/piePlot",
0776: JRPiePlotFactory.class.getName());
0777:
0778: digester.addFactoryCreate("*/pieDataset",
0779: JRPieDatasetFactory.class.getName());
0780: digester.addFactoryCreate("*/pieDataset/keyExpression",
0781: JRExpressionFactory.ComparableExpressionFactory.class);
0782: digester.addSetNext("*/pieDataset/keyExpression",
0783: "setKeyExpression", JRDesignExpression.class.getName());
0784: digester.addCallMethod("*/pieDataset/keyExpression", "setText",
0785: 0);
0786: digester.addFactoryCreate("*/pieDataset/labelExpression",
0787: JRExpressionFactory.StringExpressionFactory.class);
0788: digester.addSetNext("*/pieDataset/labelExpression",
0789: "setLabelExpression", JRDesignExpression.class
0790: .getName());
0791: digester.addCallMethod("*/pieDataset/labelExpression",
0792: "setText", 0);
0793: digester.addFactoryCreate("*/pieDataset/valueExpression",
0794: JRExpressionFactory.NumberExpressionFactory.class);
0795: digester.addSetNext("*/pieDataset/valueExpression",
0796: "setValueExpression", JRDesignExpression.class
0797: .getName());
0798: digester.addCallMethod("*/pieDataset/valueExpression",
0799: "setText", 0);
0800:
0801: String sectionHyperlinkPattern = "*/pieDataset/"
0802: + JRXmlConstants.ELEMENT_sectionHyperlink;
0803: digester.addFactoryCreate(sectionHyperlinkPattern,
0804: JRHyperlinkFactory.class);
0805: digester.addSetNext(sectionHyperlinkPattern,
0806: "setSectionHyperlink", JRHyperlink.class.getName());
0807:
0808: // pie 3D charts
0809: digester.addFactoryCreate("*/pie3DChart",
0810: JRPie3DChartFactory.class.getName());
0811: digester.addSetNext("*/pie3DChart", "addElement",
0812: JRDesignElement.class.getName());
0813: digester.addFactoryCreate("*/pie3DPlot",
0814: JRPie3DPlotFactory.class.getName());
0815:
0816: // bar charts
0817: digester.addFactoryCreate("*/barChart", JRBarChartFactory.class
0818: .getName());
0819: digester.addSetNext("*/barChart", "addElement",
0820: JRDesignElement.class.getName());
0821: digester.addFactoryCreate("*/barChart/barPlot",
0822: JRBarPlotFactory.class.getName());
0823:
0824: digester.addFactoryCreate(
0825: "*/barPlot/categoryAxisLabelExpression",
0826: JRExpressionFactory.ComparableExpressionFactory.class);
0827: digester.addSetNext("*/barPlot/categoryAxisLabelExpression",
0828: "setCategoryAxisLabelExpression",
0829: JRDesignExpression.class.getName());
0830: digester.addCallMethod("*/barPlot/categoryAxisLabelExpression",
0831: "setText", 0);
0832:
0833: digester.addFactoryCreate("*/barPlot/valueAxisLabelExpression",
0834: JRExpressionFactory.ComparableExpressionFactory.class);
0835: digester.addSetNext("*/barPlot/valueAxisLabelExpression",
0836: "setValueAxisLabelExpression", JRDesignExpression.class
0837: .getName());
0838: digester.addCallMethod("*/barPlot/valueAxisLabelExpression",
0839: "setText", 0);
0840:
0841: // area charts
0842: digester.addFactoryCreate("*/areaChart",
0843: JRAreaChartFactory.class.getName());
0844: digester.addSetNext("*/areaChart", "addElement",
0845: JRDesignElement.class.getName());
0846: digester.addFactoryCreate("*/areaChart/areaPlot",
0847: JRAreaPlotFactory.class.getName());
0848:
0849: digester.addFactoryCreate("*/xyAreaChart",
0850: JRXyAreaChartFactory.class.getName());
0851: digester.addSetNext("*/xyAreaChart", "addElement",
0852: JRDesignElement.class.getName());
0853: digester.addFactoryCreate("*/xyAreaChart/areaPlot",
0854: JRAreaPlotFactory.class.getName());
0855:
0856: digester.addFactoryCreate(
0857: "*/areaPlot/categoryAxisLabelExpression",
0858: JRExpressionFactory.ComparableExpressionFactory.class);
0859: digester.addSetNext("*/areaPlot/categoryAxisLabelExpression",
0860: "setCategoryAxisLabelExpression",
0861: JRDesignExpression.class.getName());
0862: digester.addCallMethod(
0863: "*/areaPlot/categoryAxisLabelExpression", "setText", 0);
0864:
0865: digester.addFactoryCreate(
0866: "*/areaPlot/valueAxisLabelExpression",
0867: JRExpressionFactory.ComparableExpressionFactory.class);
0868: digester.addSetNext("*/areaPlot/valueAxisLabelExpression",
0869: "setValueAxisLabelExpression", JRDesignExpression.class
0870: .getName());
0871: digester.addCallMethod("*/areaPlot/valueAxisLabelExpression",
0872: "setText", 0);
0873:
0874: // bar3d charts
0875: digester.addFactoryCreate("*/bar3DChart",
0876: JRBar3DChartFactory.class.getName());
0877: digester.addSetNext("*/bar3DChart", "addElement",
0878: JRDesignElement.class.getName());
0879: digester.addFactoryCreate("*/bar3DChart/bar3DPlot",
0880: JRBar3DPlotFactory.class.getName());
0881:
0882: digester.addFactoryCreate(
0883: "*/bar3DPlot/categoryAxisLabelExpression",
0884: JRExpressionFactory.ComparableExpressionFactory.class);
0885: digester.addSetNext("*/bar3DPlot/categoryAxisLabelExpression",
0886: "setCategoryAxisLabelExpression",
0887: JRDesignExpression.class.getName());
0888: digester
0889: .addCallMethod(
0890: "*/bar3DPlot/categoryAxisLabelExpression",
0891: "setText", 0);
0892:
0893: digester.addFactoryCreate(
0894: "*/bar3DPlot/valueAxisLabelExpression",
0895: JRExpressionFactory.ComparableExpressionFactory.class);
0896: digester.addSetNext("*/bar3DPlot/valueAxisLabelExpression",
0897: "setValueAxisLabelExpression", JRDesignExpression.class
0898: .getName());
0899: digester.addCallMethod("*/bar3DPlot/valueAxisLabelExpression",
0900: "setText", 0);
0901:
0902: digester.addFactoryCreate("*/categoryDataset",
0903: JRCategoryDatasetFactory.class.getName());
0904: digester.addFactoryCreate("*/categoryDataset/categorySeries",
0905: JRCategorySeriesFactory.class.getName());
0906: digester.addSetNext("*/categoryDataset/categorySeries",
0907: "addCategorySeries", JRDesignCategorySeries.class
0908: .getName());
0909:
0910: //digester.addFactoryCreate("*/categorySeries", JRCategoryDatasetFactory.class.getName());
0911: digester.addFactoryCreate("*/categorySeries/seriesExpression",
0912: JRExpressionFactory.ComparableExpressionFactory.class);
0913: digester.addSetNext("*/categorySeries/seriesExpression",
0914: "setSeriesExpression", JRDesignExpression.class
0915: .getName());
0916: digester.addCallMethod("*/categorySeries/seriesExpression",
0917: "setText", 0);
0918: digester.addFactoryCreate(
0919: "*/categorySeries/categoryExpression",
0920: JRExpressionFactory.ComparableExpressionFactory.class);
0921: digester.addSetNext("*/categorySeries/categoryExpression",
0922: "setCategoryExpression", JRDesignExpression.class
0923: .getName());
0924: digester.addCallMethod("*/categorySeries/categoryExpression",
0925: "setText", 0);
0926: digester.addFactoryCreate("*/categorySeries/labelExpression",
0927: JRExpressionFactory.StringExpressionFactory.class);
0928: digester.addSetNext("*/categorySeries/labelExpression",
0929: "setLabelExpression", JRDesignExpression.class
0930: .getName());
0931: digester.addCallMethod("*/categorySeries/labelExpression",
0932: "setText", 0);
0933: digester.addFactoryCreate("*/categorySeries/valueExpression",
0934: JRExpressionFactory.NumberExpressionFactory.class);
0935: digester.addSetNext("*/categorySeries/valueExpression",
0936: "setValueExpression", JRDesignExpression.class
0937: .getName());
0938: digester.addCallMethod("*/categorySeries/valueExpression",
0939: "setText", 0);
0940:
0941: String itemHyperlinkPattern = "*/"
0942: + JRXmlConstants.ELEMENT_itemHyperlink;
0943: digester.addFactoryCreate(itemHyperlinkPattern,
0944: JRHyperlinkFactory.class);
0945: digester.addSetNext(itemHyperlinkPattern, "setItemHyperlink",
0946: JRHyperlink.class.getName());
0947:
0948: digester.addFactoryCreate("*/xyzDataset",
0949: JRXyzDatasetFactory.class.getName());
0950: digester.addFactoryCreate("*/xyzDataset/xyzSeries",
0951: JRXyzSeriesFactory.class.getName());
0952: digester.addSetNext("*/xyzDataset/xyzSeries", "addXyzSeries",
0953: JRDesignXyzSeries.class.getName());
0954:
0955: digester.addFactoryCreate("*/xyzSeries/seriesExpression",
0956: JRExpressionFactory.ComparableExpressionFactory.class);
0957: digester.addSetNext("*/xyzSeries/seriesExpression",
0958: "setSeriesExpression", JRDesignExpression.class
0959: .getName());
0960: digester.addCallMethod("*/xyzSeries/seriesExpression",
0961: "setText", 0);
0962: digester.addFactoryCreate("*/xyzSeries",
0963: JRXyzDatasetFactory.class.getName());
0964: digester.addFactoryCreate("*/xyzSeries/xValueExpression",
0965: JRExpressionFactory.NumberExpressionFactory.class);
0966: digester.addSetNext("*/xyzSeries/xValueExpression",
0967: "setXValueExpression", JRDesignExpression.class
0968: .getName());
0969: digester.addCallMethod("*/xyzSeries/xValueExpression",
0970: "setText", 0);
0971: digester.addFactoryCreate("*/xyzSeries/yValueExpression",
0972: JRExpressionFactory.NumberExpressionFactory.class);
0973: digester.addSetNext("*/xyzSeries/yValueExpression",
0974: "setYValueExpression", JRDesignExpression.class
0975: .getName());
0976: digester.addCallMethod("*/xyzSeries/yValueExpression",
0977: "setText", 0);
0978: digester.addFactoryCreate("*/xyzSeries/zValueExpression",
0979: JRExpressionFactory.NumberExpressionFactory.class);
0980: digester.addSetNext("*/xyzSeries/zValueExpression",
0981: "setZValueExpression", JRDesignExpression.class
0982: .getName());
0983: digester.addCallMethod("*/xyzSeries/zValueExpression",
0984: "setText", 0);
0985:
0986: // time period dataset
0987: digester.addFactoryCreate("*/timePeriodDataset",
0988: JRTimePeriodDatasetFactory.class.getName());
0989: digester.addFactoryCreate(
0990: "*/timePeriodDataset/timePeriodSeries",
0991: JRTimePeriodSeriesFactory.class.getName());
0992: digester.addSetNext("*/timePeriodDataset/timePeriodSeries",
0993: "addTimePeriodSeries", JRDesignTimePeriodSeries.class
0994: .getName());
0995:
0996: digester.addFactoryCreate(
0997: "*/timePeriodSeries/seriesExpression",
0998: JRExpressionFactory.ComparableExpressionFactory.class);
0999: digester.addSetNext("*/timePeriodSeries/seriesExpression",
1000: "setSeriesExpression", JRDesignExpression.class
1001: .getName());
1002: digester.addCallMethod("*/timePeriodSeries/seriesExpression",
1003: "setText", 0);
1004: digester.addFactoryCreate(
1005: "*/timePeriodSeries/startDateExpression",
1006: JRExpressionFactory.DateExpressionFactory.class);
1007: digester.addSetNext("*/timePeriodSeries/startDateExpression",
1008: "setStartDateExpression", JRDesignExpression.class
1009: .getName());
1010: digester.addCallMethod(
1011: "*/timePeriodSeries/startDateExpression", "setText", 0);
1012: digester.addFactoryCreate(
1013: "*/timePeriodSeries/endDateExpression",
1014: JRExpressionFactory.DateExpressionFactory.class);
1015: digester.addSetNext("*/timePeriodSeries/endDateExpression",
1016: "setEndDateExpression", JRDesignExpression.class
1017: .getName());
1018: digester.addCallMethod("*/timePeriodSeries/endDateExpression",
1019: "setText", 0);
1020: digester.addFactoryCreate("*/timePeriodSeries/valueExpression",
1021: JRExpressionFactory.NumberExpressionFactory.class);
1022: digester.addSetNext("*/timePeriodSeries/valueExpression",
1023: "setValueExpression", JRDesignExpression.class
1024: .getName());
1025: digester.addCallMethod("*/timePeriodSeries/valueExpression",
1026: "setText", 0);
1027: digester.addFactoryCreate("*/timePeriodSeries/labelExpression",
1028: JRExpressionFactory.StringExpressionFactory.class);
1029: digester.addSetNext("*/timePeriodSeries/labelExpression",
1030: "setLabelExpression", JRDesignExpression.class
1031: .getName());
1032: digester.addCallMethod("*/timePeriodSeries/labelExpression",
1033: "setText", 0);
1034:
1035: digester.addFactoryCreate("*/timeSeriesChart",
1036: JRTimeSeriesChartFactory.class.getName());
1037: digester.addFactoryCreate("*/timeSeriesChart/timeSeriesPlot",
1038: JRTimeSeriesPlotFactory.class.getName());
1039: digester.addSetNext("*/timeSeriesChart", "addElement",
1040: JRDesignElement.class.getName());
1041:
1042: // add plot labels
1043: digester.addFactoryCreate(
1044: "*/timeSeriesPlot/timeAxisLabelExpression",
1045: JRExpressionFactory.ComparableExpressionFactory.class);
1046: digester.addSetNext("*/timeSeriesPlot/timeAxisLabelExpression",
1047: "setTimeAxisLabelExpression", JRDesignExpression.class
1048: .getName());
1049: digester.addCallMethod(
1050: "*/timeSeriesPlot/timeAxisLabelExpression", "setText",
1051: 0);
1052:
1053: digester.addFactoryCreate(
1054: "*/timeSeriesPlot/valueAxisLabelExpression",
1055: JRExpressionFactory.ComparableExpressionFactory.class);
1056: digester.addSetNext(
1057: "*/timeSeriesPlot/valueAxisLabelExpression",
1058: "setValueAxisLabelExpression", JRDesignExpression.class
1059: .getName());
1060: digester.addCallMethod(
1061: "*/timeSeriesPlot/valueAxisLabelExpression", "setText",
1062: 0);
1063:
1064: // XY bar charts
1065: digester.addFactoryCreate("*/xyBarChart",
1066: JRXyBarChartFactory.class.getName());
1067: digester.addSetNext("*/xyBarChart", "addElement",
1068: JRDesignElement.class.getName());
1069: digester.addFactoryCreate("*/xyBarChart/barPlot",
1070: JRBarPlotFactory.class.getName());
1071:
1072: // time series dataset
1073: digester.addFactoryCreate("*/timeSeriesDataset",
1074: JRTimeSeriesDatasetFactory.class.getName());
1075: digester.addFactoryCreate("*/timeSeriesDataset/timeSeries",
1076: JRTimeSeriesFactory.class.getName());
1077: digester.addSetNext("*/timeSeriesDataset/timeSeries",
1078: "addTimeSeries", JRDesignTimeSeries.class.getName());
1079:
1080: digester.addFactoryCreate("*/timeSeries/seriesExpression",
1081: JRExpressionFactory.ComparableExpressionFactory.class);
1082: digester.addSetNext("*/timeSeries/seriesExpression",
1083: "setSeriesExpression", JRDesignExpression.class
1084: .getName());
1085: digester.addCallMethod("*/timeSeries/seriesExpression",
1086: "setText", 0);
1087: digester.addFactoryCreate("*/timeSeries/timePeriodExpression",
1088: JRExpressionFactory.DateExpressionFactory.class);
1089: digester.addSetNext("*/timeSeries/timePeriodExpression",
1090: "setTimePeriodExpression", JRDesignExpression.class
1091: .getName());
1092: digester.addCallMethod("*/timeSeries/timePeriodExpression",
1093: "setText", 0);
1094: digester.addFactoryCreate("*/timeSeries/labelExpression",
1095: JRExpressionFactory.StringExpressionFactory.class);
1096: digester.addSetNext("*/timeSeries/labelExpression",
1097: "setLabelExpression", JRDesignExpression.class
1098: .getName());
1099: digester.addCallMethod("*/timeSeries/labelExpression",
1100: "setText", 0);
1101: digester.addFactoryCreate("*/timeSeries/valueExpression",
1102: JRExpressionFactory.NumberExpressionFactory.class);
1103: digester.addSetNext("*/timeSeries/valueExpression",
1104: "setValueExpression", JRDesignExpression.class
1105: .getName());
1106: digester.addCallMethod("*/timeSeries/valueExpression",
1107: "setText", 0);
1108:
1109: digester.addFactoryCreate("*/stackedBarChart",
1110: JRStackedBarChartFactory.class.getName());
1111: digester.addSetNext("*/stackedBarChart", "addElement",
1112: JRDesignElement.class.getName());
1113: digester.addFactoryCreate("*/stackedBarChart/barPlot",
1114: JRBarPlotFactory.class.getName());
1115:
1116: digester.addFactoryCreate("*/lineChart",
1117: JRLineChartFactory.class.getName());
1118: digester.addSetNext("*/lineChart", "addElement",
1119: JRDesignElement.class.getName());
1120: digester.addFactoryCreate("*/linePlot", JRLinePlotFactory.class
1121: .getName());
1122:
1123: //add plot labels
1124: digester.addFactoryCreate(
1125: "*/linePlot/categoryAxisLabelExpression",
1126: JRExpressionFactory.ComparableExpressionFactory.class);
1127: digester.addSetNext("*/linePlot/categoryAxisLabelExpression",
1128: "setCategoryAxisLabelExpression",
1129: JRDesignExpression.class.getName());
1130: digester.addCallMethod(
1131: "*/linePlot/categoryAxisLabelExpression", "setText", 0);
1132:
1133: digester.addFactoryCreate(
1134: "*/linePlot/valueAxisLabelExpression",
1135: JRExpressionFactory.ComparableExpressionFactory.class);
1136: digester.addSetNext("*/linePlot/valueAxisLabelExpression",
1137: "setValueAxisLabelExpression", JRDesignExpression.class
1138: .getName());
1139: digester.addCallMethod("*/linePlot/valueAxisLabelExpression",
1140: "setText", 0);
1141:
1142: digester.addFactoryCreate("*/xyLineChart",
1143: JRXyLineChartFactory.class.getName());
1144: digester.addSetNext("*/xyLineChart", "addElement",
1145: JRDesignElement.class.getName());
1146:
1147: digester.addFactoryCreate("*/scatterChart",
1148: JRScatterChartFactory.class.getName());
1149: digester.addSetNext("*/scatterChart", "addElement",
1150: JRDesignElement.class.getName());
1151: digester.addFactoryCreate("*/scatterPlot",
1152: JRScatterPlotFactory.class.getName());
1153:
1154: // add plot labels
1155: digester.addFactoryCreate("*/scatterPlot/xAxisLabelExpression",
1156: JRExpressionFactory.ComparableExpressionFactory.class);
1157: digester.addSetNext("*/scatterPlot/xAxisLabelExpression",
1158: "setXAxisLabelExpression", JRDesignExpression.class
1159: .getName());
1160: digester.addCallMethod("*/scatterPlot/xAxisLabelExpression",
1161: "setText", 0);
1162:
1163: digester.addFactoryCreate("*/scatterPlot/yAxisLabelExpression",
1164: JRExpressionFactory.ComparableExpressionFactory.class);
1165: digester.addSetNext("*/scatterPlot/yAxisLabelExpression",
1166: "setYAxisLabelExpression", JRDesignExpression.class
1167: .getName());
1168: digester.addCallMethod("*/scatterPlot/yAxisLabelExpression",
1169: "setText", 0);
1170:
1171: digester.addFactoryCreate("*/xyDataset",
1172: JRXyDatasetFactory.class.getName());
1173: digester.addFactoryCreate("*/xyDataset/xySeries",
1174: JRXySeriesFactory.class.getName());
1175: digester.addSetNext("*/xyDataset/xySeries", "addXySeries",
1176: JRDesignXySeries.class.getName());
1177:
1178: digester.addFactoryCreate("*/xySeries",
1179: JRXyDatasetFactory.class.getName());
1180: digester.addFactoryCreate("*/xySeries/seriesExpression",
1181: JRExpressionFactory.ComparableExpressionFactory.class);
1182: digester.addSetNext("*/xySeries/seriesExpression",
1183: "setSeriesExpression", JRDesignExpression.class
1184: .getName());
1185: digester.addCallMethod("*/xySeries/seriesExpression",
1186: "setText", 0);
1187: digester.addFactoryCreate("*/xySeries/xValueExpression",
1188: JRExpressionFactory.NumberExpressionFactory.class);
1189: digester.addSetNext("*/xySeries/xValueExpression",
1190: "setXValueExpression", JRDesignExpression.class
1191: .getName());
1192: digester.addCallMethod("*/xySeries/xValueExpression",
1193: "setText", 0);
1194: digester.addFactoryCreate("*/xySeries/yValueExpression",
1195: JRExpressionFactory.NumberExpressionFactory.class);
1196: digester.addSetNext("*/xySeries/yValueExpression",
1197: "setYValueExpression", JRDesignExpression.class
1198: .getName());
1199: digester.addCallMethod("*/xySeries/yValueExpression",
1200: "setText", 0);
1201: digester.addFactoryCreate("*/xySeries/labelExpression",
1202: JRExpressionFactory.StringExpressionFactory.class);
1203: digester.addSetNext("*/xySeries/labelExpression",
1204: "setLabelExpression", JRDesignExpression.class
1205: .getName());
1206: digester.addCallMethod("*/xySeries/labelExpression", "setText",
1207: 0);
1208:
1209: digester.addFactoryCreate("*/stackedBar3DChart",
1210: JRStackedBar3DChartFactory.class.getName());
1211: digester.addSetNext("*/stackedBar3DChart", "addElement",
1212: JRDesignElement.class.getName());
1213: digester.addFactoryCreate("*/stackedBar3DChart/bar3DPlot",
1214: JRBar3DPlotFactory.class.getName());
1215:
1216: digester.addFactoryCreate("*/bubbleChart",
1217: JRBubbleChartFactory.class.getName());
1218: digester.addSetNext("*/bubbleChart", "addElement",
1219: JRDesignElement.class.getName());
1220: digester.addFactoryCreate("*/bubblePlot",
1221: JRBubblePlotFactory.class.getName());
1222:
1223: // add plot labels
1224: digester.addFactoryCreate("*/bubblePlot/xAxisLabelExpression",
1225: JRExpressionFactory.ComparableExpressionFactory.class);
1226: digester.addSetNext("*/bubblePlot/xAxisLabelExpression",
1227: "setXAxisLabelExpression", JRDesignExpression.class
1228: .getName());
1229: digester.addCallMethod("*/bubblePlot/xAxisLabelExpression",
1230: "setText", 0);
1231:
1232: digester.addFactoryCreate("*/bubblePlot/yAxisLabelExpression",
1233: JRExpressionFactory.ComparableExpressionFactory.class);
1234: digester.addSetNext("*/bubblePlot/yAxisLabelExpression",
1235: "setYAxisLabelExpression", JRDesignExpression.class
1236: .getName());
1237: digester.addCallMethod("*/bubblePlot/yAxisLabelExpression",
1238: "setText", 0);
1239:
1240: // high-low charts
1241: digester.addFactoryCreate("*/highLowChart",
1242: JRHighLowChartFactory.class.getName());
1243: digester.addSetNext("*/highLowChart", "addElement",
1244: JRDesignElement.class.getName());
1245: digester.addFactoryCreate("*/highLowChart/highLowPlot",
1246: JRHighLowPlotFactory.class.getName());
1247:
1248: digester.addFactoryCreate(
1249: "*/highLowPlot/timeAxisLabelExpression",
1250: JRExpressionFactory.ComparableExpressionFactory.class);
1251: digester.addSetNext("*/highLowPlot/timeAxisLabelExpression",
1252: "setTimeAxisLabelExpression", JRDesignExpression.class
1253: .getName());
1254: digester.addCallMethod("*/highLowPlot/timeAxisLabelExpression",
1255: "setText", 0);
1256:
1257: digester.addFactoryCreate(
1258: "*/highLowPlot/valueAxisLabelExpression",
1259: JRExpressionFactory.ComparableExpressionFactory.class);
1260: digester.addSetNext("*/highLowPlot/valueAxisLabelExpression",
1261: "setValueAxisLabelExpression", JRDesignExpression.class
1262: .getName());
1263: digester.addCallMethod(
1264: "*/highLowPlot/valueAxisLabelExpression", "setText", 0);
1265:
1266: digester.addFactoryCreate("*/highLowDataset",
1267: JRHighLowDatasetFactory.class.getName());
1268: digester.addFactoryCreate("*/highLowDataset/seriesExpression",
1269: JRExpressionFactory.ComparableExpressionFactory.class);
1270: digester.addSetNext("*/highLowDataset/seriesExpression",
1271: "setSeriesExpression", JRDesignExpression.class
1272: .getName());
1273: digester.addCallMethod("*/highLowDataset/seriesExpression",
1274: "setText", 0);
1275: digester.addFactoryCreate("*/highLowDataset/dateExpression",
1276: JRExpressionFactory.DateExpressionFactory.class);
1277: digester
1278: .addSetNext("*/highLowDataset/dateExpression",
1279: "setDateExpression", JRDesignExpression.class
1280: .getName());
1281: digester.addCallMethod("*/highLowDataset/dateExpression",
1282: "setText", 0);
1283: digester.addFactoryCreate("*/highLowDataset/highExpression",
1284: JRExpressionFactory.NumberExpressionFactory.class);
1285: digester
1286: .addSetNext("*/highLowDataset/highExpression",
1287: "setHighExpression", JRDesignExpression.class
1288: .getName());
1289: digester.addCallMethod("*/highLowDataset/highExpression",
1290: "setText", 0);
1291: digester.addFactoryCreate("*/highLowDataset/lowExpression",
1292: JRExpressionFactory.NumberExpressionFactory.class);
1293: digester.addSetNext("*/highLowDataset/lowExpression",
1294: "setLowExpression", JRDesignExpression.class.getName());
1295: digester.addCallMethod("*/highLowDataset/lowExpression",
1296: "setText", 0);
1297: digester.addFactoryCreate("*/highLowDataset/openExpression",
1298: JRExpressionFactory.NumberExpressionFactory.class);
1299: digester
1300: .addSetNext("*/highLowDataset/openExpression",
1301: "setOpenExpression", JRDesignExpression.class
1302: .getName());
1303: digester.addCallMethod("*/highLowDataset/openExpression",
1304: "setText", 0);
1305: digester.addFactoryCreate("*/highLowDataset/closeExpression",
1306: JRExpressionFactory.NumberExpressionFactory.class);
1307: digester.addSetNext("*/highLowDataset/closeExpression",
1308: "setCloseExpression", JRDesignExpression.class
1309: .getName());
1310: digester.addCallMethod("*/highLowDataset/closeExpression",
1311: "setText", 0);
1312: digester.addFactoryCreate("*/highLowDataset/volumeExpression",
1313: JRExpressionFactory.NumberExpressionFactory.class);
1314: digester.addSetNext("*/highLowDataset/volumeExpression",
1315: "setVolumeExpression", JRDesignExpression.class
1316: .getName());
1317: digester.addCallMethod("*/highLowDataset/volumeExpression",
1318: "setText", 0);
1319:
1320: // candlestick charts
1321: digester.addFactoryCreate("*/candlestickChart",
1322: JRCandlestickChartFactory.class);
1323: digester.addSetNext("*/candlestickChart", "addElement",
1324: JRDesignElement.class.getName());
1325: digester.addFactoryCreate("*/candlestickChart/candlestickPlot",
1326: JRCandlestickPlotFactory.class);
1327:
1328: digester.addFactoryCreate(
1329: "*/candlestickPlot/timeAxisLabelExpression",
1330: JRExpressionFactory.ComparableExpressionFactory.class);
1331: digester.addSetNext(
1332: "*/candlestickPlot/timeAxisLabelExpression",
1333: "setTimeAxisLabelExpression", JRDesignExpression.class
1334: .getName());
1335: digester.addCallMethod(
1336: "*/candlestickPlot/timeAxisLabelExpression", "setText",
1337: 0);
1338:
1339: digester.addFactoryCreate(
1340: "*/candlestickPlot/valueAxisLabelExpression",
1341: JRExpressionFactory.ComparableExpressionFactory.class);
1342: digester.addSetNext(
1343: "*/candlestickPlot/valueAxisLabelExpression",
1344: "setValueAxisLabelExpression", JRDesignExpression.class
1345: .getName());
1346: digester.addCallMethod(
1347: "*/candlestickPlot/valueAxisLabelExpression",
1348: "setText", 0);
1349:
1350: // value datasets
1351: digester.addFactoryCreate("*/valueDataset",
1352: JRValueDatasetFactory.class.getName());
1353: digester.addFactoryCreate("*/valueDataset/valueExpression",
1354: JRExpressionFactory.NumberExpressionFactory.class);
1355: digester.addSetNext("*/valueDataset/valueExpression",
1356: "setValueExpression", JRDesignExpression.class
1357: .getName());
1358: digester.addCallMethod("*/valueDataset/valueExpression",
1359: "setText", 0);
1360:
1361: // data ranges - anything that contains a data range must have a "setDataRange" method.
1362: digester.addFactoryCreate("*/dataRange",
1363: JRDataRangeFactory.class.getName());
1364: digester.addSetNext("*/dataRange", "setDataRange",
1365: JRDesignDataRange.class.getName());
1366: digester.addFactoryCreate("*/dataRange/lowExpression",
1367: JRExpressionFactory.NumberExpressionFactory.class);
1368: digester.addSetNext("*/dataRange/lowExpression",
1369: "setLowExpression", JRDesignExpression.class.getName());
1370: digester.addCallMethod("*/dataRange/lowExpression", "setText",
1371: 0);
1372: digester.addFactoryCreate("*/dataRange/highExpression",
1373: JRExpressionFactory.NumberExpressionFactory.class);
1374: digester
1375: .addSetNext("*/dataRange/highExpression",
1376: "setHighExpression", JRDesignExpression.class
1377: .getName());
1378: digester.addCallMethod("*/dataRange/highExpression", "setText",
1379: 0);
1380:
1381: // value displays - anything that contains a display value must have a "setValueDisplay" method.
1382: digester.addFactoryCreate("*/valueDisplay",
1383: JRValueDisplayFactory.class.getName());
1384: digester.addSetNext("*/valueDisplay", "setValueDisplay",
1385: JRDesignValueDisplay.class.getName());
1386: digester.addFactoryCreate("*/valueDisplay/font",
1387: JRFontFactory.ChartFontFactory.class.getName());
1388: digester.addSetNext("*/valueDisplay/font", "setFont",
1389: JRFont.class.getName());
1390:
1391: // meter charts
1392: digester.addFactoryCreate("*/meterChart",
1393: JRMeterChartFactory.class.getName());
1394: digester.addSetNext("*/meterChart", "addElement",
1395: JRDesignElement.class.getName());
1396: digester.addFactoryCreate("*/meterChart/meterPlot",
1397: JRMeterPlotFactory.class.getName());
1398:
1399: digester.addFactoryCreate("*/meterPlot/lowExpression",
1400: JRExpressionFactory.NumberExpressionFactory.class);
1401: digester.addSetNext("*/meterPlot/lowExpression",
1402: "setLowExpression", JRDesignExpression.class.getName());
1403: digester.addCallMethod("*/meterPlot/lowExpression", "setText",
1404: 0);
1405: digester.addFactoryCreate("*/meterPlot/highExpression",
1406: JRExpressionFactory.NumberExpressionFactory.class);
1407: digester
1408: .addSetNext("*/meterPlot/highExpression",
1409: "setHighExpression", JRDesignExpression.class
1410: .getName());
1411: digester.addCallMethod("*/meterPlot/highExpression", "setText",
1412: 0);
1413:
1414: digester.addFactoryCreate("*/meterPlot/meterInterval",
1415: JRMeterIntervalFactory.class.getName());
1416: digester.addSetNext("*/meterPlot/meterInterval", "addInterval",
1417: JRMeterInterval.class.getName());
1418:
1419: // thermometer charts
1420: digester.addFactoryCreate("*/thermometerChart",
1421: JRThermometerChartFactory.class.getName());
1422: digester.addSetNext("*/thermometerChart", "addElement",
1423: JRDesignElement.class.getName());
1424: digester.addFactoryCreate("*/thermometerChart/thermometerPlot",
1425: JRThermometerPlotFactory.class.getName());
1426:
1427: digester.addFactoryCreate(
1428: "*/thermometerPlot/lowRange/dataRange",
1429: JRDataRangeFactory.class.getName());
1430: digester.addSetNext("*/thermometerPlot/lowRange/dataRange",
1431: "setLowRange", JRDesignDataRange.class.getName());
1432: digester.addFactoryCreate(
1433: "*/thermometerPlot/mediumRange/dataRange",
1434: JRDataRangeFactory.class.getName());
1435: digester.addSetNext("*/thermometerPlot/mediumRange/dataRange",
1436: "setMediumRange", JRDesignDataRange.class.getName());
1437: digester.addFactoryCreate(
1438: "*/thermometerPlot/highRange/dataRange",
1439: JRDataRangeFactory.class.getName());
1440: digester.addSetNext("*/thermometerPlot/highRange/dataRange",
1441: "setHighRange", JRDesignDataRange.class.getName());
1442:
1443: //multi axis charts
1444: digester.addFactoryCreate("*/multiAxisChart",
1445: JRMultiAxisChartFactory.class.getName());
1446: digester.addSetNext("*/multiAxisChart", "addElement",
1447: JRDesignElement.class.getName());
1448: digester.addFactoryCreate("*/multiAxisChart/multiAxisPlot",
1449: JRMultiAxisPlotFactory.class.getName());
1450: digester.addFactoryCreate("*/axis", JRChartAxisFactory.class
1451: .getName());
1452: digester.addSetNext("*/axis", "addAxis", JRChartAxis.class
1453: .getName());
1454:
1455: digester.addFactoryCreate("*/stackedAreaChart",
1456: JRStackedAreaChartFactory.class.getName());
1457: digester.addSetNext("*/stackedAreaChart", "addElement",
1458: JRDesignElement.class.getName());
1459: digester.addFactoryCreate("*/stackedAreaChart/areaPlot",
1460: JRAreaPlotFactory.class.getName());
1461:
1462: }
1463:
1464: private static void addDatasetRules(Digester digester) {
1465: String subDatasetPattern = "jasperReport/"
1466: + JRXmlConstants.ELEMENT_subDataset;
1467: digester.addFactoryCreate(subDatasetPattern,
1468: JRDatasetFactory.class.getName());
1469: digester.addSetNext(subDatasetPattern, "addDataset",
1470: JRDesignDataset.class.getName());
1471:
1472: String datasetRunPattern = "*/dataset/"
1473: + JRXmlConstants.ELEMENT_datasetRun;
1474: digester.addFactoryCreate(datasetRunPattern,
1475: JRDatasetRunFactory.class.getName());
1476: digester.addSetNext(datasetRunPattern, "setDatasetRun",
1477: JRDatasetRun.class.getName());
1478:
1479: String datasetParamPattern = datasetRunPattern + "/"
1480: + JRXmlConstants.ELEMENT_datasetParameter;
1481: digester.addFactoryCreate(datasetParamPattern,
1482: JRDatasetRunParameterFactory.class.getName());
1483: digester.addSetNext(datasetParamPattern, "addParameter",
1484: JRDatasetParameter.class.getName());
1485:
1486: String datasetParamExprPattern = datasetParamPattern + "/"
1487: + JRXmlConstants.ELEMENT_datasetParameterExpression;
1488: digester.addFactoryCreate(datasetParamExprPattern,
1489: JRDatasetRunParameterExpressionFactory.class.getName());
1490: digester.addSetNext(datasetParamExprPattern, "setExpression",
1491: JRExpression.class.getName());
1492: digester.addCallMethod(datasetParamExprPattern, "setText", 0);
1493: }
1494:
1495: private static void addCrosstabRules(Digester digester) {
1496: digester.addFactoryCreate("*/crosstab", JRCrosstabFactory.class
1497: .getName());
1498: digester.addSetNext("*/crosstab", "addElement",
1499: JRDesignElement.class.getName());
1500:
1501: digester.addFactoryCreate("*/crosstab/crosstabParameter",
1502: JRCrosstabParameterFactory.class.getName());
1503: digester.addSetNext("*/crosstab/crosstabParameter",
1504: "addParameter", JRCrosstabParameter.class.getName());
1505:
1506: digester
1507: .addFactoryCreate(
1508: "*/crosstab/crosstabParameter/parameterValueExpression",
1509: JRCrosstabParameterValueExpressionFactory.class
1510: .getName());
1511: digester
1512: .addSetNext(
1513: "*/crosstab/crosstabParameter/parameterValueExpression",
1514: "setExpression", JRExpression.class.getName());
1515: digester
1516: .addCallMethod(
1517: "*/crosstab/crosstabParameter/parameterValueExpression",
1518: "setText", 0);
1519:
1520: digester.addFactoryCreate("*/crosstab/crosstabDataset",
1521: JRCrosstabDatasetFactory.class.getName());
1522:
1523: digester.addFactoryCreate("*/crosstab/rowGroup",
1524: JRCrosstabRowGroupFactory.class.getName());
1525: digester.addSetNext("*/crosstab/rowGroup", "addRowGroup",
1526: JRDesignCrosstabRowGroup.class.getName());
1527:
1528: digester.addFactoryCreate(
1529: "*/crosstab/rowGroup/crosstabRowHeader/cellContents",
1530: JRCellContentsFactory.class.getName());
1531: digester.addSetNext(
1532: "*/crosstab/rowGroup/crosstabRowHeader/cellContents",
1533: "setHeader", JRDesignCellContents.class.getName());
1534:
1535: digester
1536: .addFactoryCreate(
1537: "*/crosstab/rowGroup/crosstabTotalRowHeader/cellContents",
1538: JRCellContentsFactory.class.getName());
1539: digester
1540: .addSetNext(
1541: "*/crosstab/rowGroup/crosstabTotalRowHeader/cellContents",
1542: "setTotalHeader", JRDesignCellContents.class
1543: .getName());
1544:
1545: digester.addFactoryCreate("*/crosstab/columnGroup",
1546: JRCrosstabColumnGroupFactory.class.getName());
1547: digester.addSetNext("*/crosstab/columnGroup", "addColumnGroup",
1548: JRDesignCrosstabColumnGroup.class.getName());
1549:
1550: digester
1551: .addFactoryCreate(
1552: "*/crosstab/columnGroup/crosstabColumnHeader/cellContents",
1553: JRCellContentsFactory.class.getName());
1554: digester
1555: .addSetNext(
1556: "*/crosstab/columnGroup/crosstabColumnHeader/cellContents",
1557: "setHeader", JRDesignCellContents.class
1558: .getName());
1559:
1560: digester
1561: .addFactoryCreate(
1562: "*/crosstab/columnGroup/crosstabTotalColumnHeader/cellContents",
1563: JRCellContentsFactory.class.getName());
1564: digester
1565: .addSetNext(
1566: "*/crosstab/columnGroup/crosstabTotalColumnHeader/cellContents",
1567: "setTotalHeader", JRDesignCellContents.class
1568: .getName());
1569:
1570: digester.addFactoryCreate("*/bucket",
1571: JRCrosstabBucketFactory.class.getName());
1572: digester.addSetNext("*/bucket", "setBucket",
1573: JRDesignCrosstabBucket.class.getName());
1574:
1575: digester.addFactoryCreate("*/bucket/bucketExpression",
1576: JRCrosstabBucketExpressionFactory.class.getName());
1577: digester.addSetNext("*/bucket/bucketExpression",
1578: "setExpression", JRDesignExpression.class.getName());
1579: digester.addCallMethod("*/bucket/bucketExpression", "setText",
1580: 0);
1581:
1582: digester.addFactoryCreate("*/bucket/comparatorExpression",
1583: JRExpressionFactory.ComparatorExpressionFactory.class
1584: .getName());
1585: digester
1586: .addSetNext("*/bucket/comparatorExpression",
1587: "setComparatorExpression", JRExpression.class
1588: .getName());
1589: digester.addCallMethod("*/bucket/comparatorExpression",
1590: "setText", 0);
1591:
1592: digester.addFactoryCreate("*/crosstab/measure",
1593: JRCrosstabMeasureFactory.class.getName());
1594: digester.addSetNext("*/crosstab/measure", "addMeasure",
1595: JRDesignCrosstabMeasure.class.getName());
1596:
1597: digester.addFactoryCreate(
1598: "*/crosstab/measure/measureExpression",
1599: JRCrosstabMeasureExpressionFactory.class.getName());
1600: digester.addSetNext("*/crosstab/measure/measureExpression",
1601: "setValueExpression", JRExpression.class.getName());
1602: digester.addCallMethod("*/crosstab/measure/measureExpression",
1603: "setText", 0);
1604:
1605: digester.addFactoryCreate("*/crosstab/crosstabCell",
1606: JRCrosstabCellFactory.class.getName());
1607: digester.addSetNext("*/crosstab/crosstabCell", "addCell",
1608: JRDesignCrosstabCell.class.getName());
1609: digester.addFactoryCreate(
1610: "*/crosstab/crosstabCell/cellContents",
1611: JRCellContentsFactory.class.getName());
1612: digester.addSetNext("*/crosstab/crosstabCell/cellContents",
1613: "setContents", JRDesignCellContents.class.getName());
1614:
1615: digester.addFactoryCreate(
1616: "*/crosstab/whenNoDataCell/cellContents",
1617: JRCellContentsFactory.class.getName());
1618: digester.addSetNext("*/crosstab/whenNoDataCell/cellContents",
1619: "setWhenNoDataCell", JRDesignCellContents.class
1620: .getName());
1621:
1622: digester.addFactoryCreate(
1623: "*/crosstab/crosstabHeaderCell/cellContents",
1624: JRCellContentsFactory.class.getName());
1625: digester.addSetNext(
1626: "*/crosstab/crosstabHeaderCell/cellContents",
1627: "setHeaderCell", JRDesignCellContents.class.getName());
1628:
1629: digester.addFactoryCreate("*/cellContents/box",
1630: JRBaseBoxFactory.class.getName());
1631: digester.addSetNext("*/cellContents/box", "setBox", JRBox.class
1632: .getName());
1633: }
1634:
1635: private static void addFrameRules(Digester digester) {
1636: String framePattern = "*/" + JRXmlConstants.ELEMENT_frame;
1637: digester.addFactoryCreate(framePattern, JRFrameFactory.class
1638: .getName());
1639: digester.addSetNext(framePattern, "addElement",
1640: JRDesignElement.class.getName());
1641: }
1642:
1643: private static void addHyperlinkParameterRules(Digester digester) {
1644: String hyperlinkParameterPattern = "*/"
1645: + JRXmlConstants.ELEMENT_hyperlinkParameter;
1646: digester.addFactoryCreate(hyperlinkParameterPattern,
1647: JRHyperlinkParameterFactory.class.getName());
1648: digester.addSetNext(hyperlinkParameterPattern,
1649: "addHyperlinkParameter", JRHyperlinkParameter.class
1650: .getName());
1651:
1652: String hyperlinkParameterExpressionPattern = hyperlinkParameterPattern
1653: + '/'
1654: + JRXmlConstants.ELEMENT_hyperlinkParameterExpression;
1655: digester.addFactoryCreate(hyperlinkParameterExpressionPattern,
1656: JRStringExpressionFactory.class.getName());
1657: digester.addSetNext(hyperlinkParameterExpressionPattern,
1658: "setValueExpression", JRExpression.class.getName());
1659: digester.addCallMethod(hyperlinkParameterExpressionPattern,
1660: "setText", 0);
1661:
1662: }
1663:
1664: /**
1665: * Creates a new instance of digester. The created digester is ready for
1666: * parsing report definition files.
1667: */
1668: public static JRXmlDigester createDigester()
1669: throws ParserConfigurationException, SAXException {
1670: JRXmlDigester digester = new JRXmlDigester();
1671: configureDigester(digester);
1672: return digester;
1673: }
1674:
1675: /**
1676: *
1677: */
1678: private static class ErrorHandlerImpl implements ErrorHandler {
1679: /**
1680: * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
1681: */
1682: public void error(SAXParseException exception)
1683: throws SAXException {
1684: throw exception;
1685: }
1686:
1687: /**
1688: * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
1689: */
1690: public void fatalError(SAXParseException exception)
1691: throws SAXException {
1692: throw exception;
1693: }
1694:
1695: /**
1696: * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
1697: */
1698: public void warning(SAXParseException exception)
1699: throws SAXException {
1700: throw exception;
1701: }
1702: }
1703:
1704: }
|