Source Code Cross Referenced for ReportWriter.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » iReport 2.0.5 » it.businesslogic.ireport 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Report.java
0003:         *
0004:         *  iReport  --  Visual designer for generating JasperReports Documents
0005:         *  Copyright (C) 2002  Giulio Toffoli gt@businesslogic.it
0006:         *
0007:         *  This program is free software; you can redistribute it and/or modify
0008:         *  it under the terms of the GNU General Public License as published by
0009:         *  the Free Software Foundation; either version 2 of the License, or
0010:         *  (at your option) any later version.Styl
0011:         *
0012:         *  This program is distributed in the hope that it will be useful,
0013:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0014:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015:         *  GNU General Public License for more details.
0016:         *
0017:         *  You should have received a copy of the GNU General Public License
0018:         *  along with this program; if not, write to the Free Software
0019:         *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0020:         *
0021:         *  Giulio Toffoli
0022:         *  Via T.Aspetti, 233
0023:         *  35100 Padova ITALY
0024:         *  gt@businesslogic.it
0025:         *
0026:         * Created on 10 febbraio 2003, 19.32
0027:         *
0028:         * Updated by Robert Lamping:
0029:         * dtd updated with the new package path net/sf/  etc...
0030:         * Added Try catch to catch a missing dtd.
0031:         * Changed Mainframe.openFile to catch this exception and stop opening a file in case of an exception.
0032:         */
0033:
0034:        package it.businesslogic.ireport;
0035:
0036:        //import java.util.*;
0037:        import it.businesslogic.ireport.chart.SectionItemHyperlink;
0038:        import it.businesslogic.ireport.crosstab.CrosstabParameter;
0039:        import it.businesslogic.ireport.gui.event.ReportDocumentStatusChangedEvent;
0040:        import it.businesslogic.ireport.gui.event.ReportSubDatasetChangedEvent;
0041:        import it.businesslogic.ireport.chart.Axis;
0042:        import it.businesslogic.ireport.util.I18n;
0043:        import java.io.ByteArrayInputStream;
0044:        import java.util.Vector;
0045:        import java.util.Iterator;
0046:        import java.util.Properties;
0047:        import java.util.Enumeration;
0048:
0049:        //import it.businesslogic.ireport.util.*;
0050:        import it.businesslogic.ireport.util.Misc;
0051:        import it.businesslogic.ireport.util.PageSize;
0052:        import it.businesslogic.ireport.gui.JReportFrame;
0053:        import it.businesslogic.ireport.chart.*;
0054:        import it.businesslogic.ireport.crosstab.CrosstabCell;
0055:        import it.businesslogic.ireport.crosstab.CrosstabColumnGroup;
0056:        import it.businesslogic.ireport.crosstab.CrosstabGroup;
0057:        import it.businesslogic.ireport.crosstab.CrosstabRowGroup;
0058:        import it.businesslogic.ireport.crosstab.Measure;
0059:        import it.businesslogic.ireport.gui.event.StyleChangedEvent;
0060:        import it.businesslogic.ireport.gui.event.SubDatasetObjectChangedListener;
0061:
0062:        import org.apache.xerces.parsers.DOMParser;
0063:
0064:        //import org.w3c.dom.*;
0065:        import org.w3c.dom.Document;
0066:        import org.w3c.dom.NamedNodeMap;
0067:        import org.w3c.dom.Node;
0068:        import org.w3c.dom.NodeList;
0069:
0070:        import org.xml.sax.SAXException;
0071:
0072:        import java.io.IOException;
0073:        import java.io.File;
0074:        import java.io.PrintWriter;
0075:
0076:        /**
0077:         *
0078:         * @author  Administrator
0079:         */
0080:        public class ReportWriter {
0081:
0082:            private Report report = null;
0083:
0084:            public ReportWriter(Report report) {
0085:                this .setReport(report);
0086:            }
0087:
0088:            public void saveXMLFile(String aFilename) {
0089:
0090:                String scriptletFileName = getReport().getScriptletFileName(
0091:                        aFilename);
0092:
0093:                String className = "";
0094:                java.io.File classFile = new java.io.File(scriptletFileName);
0095:
0096:                className = classFile.getName().substring(0,
0097:                        classFile.getName().length() - 5);
0098:
0099:                if (getReport().getScriptletHandling() == getReport().SCRIPTLET_IREPORT_INTERNAL_HANDLING) {
0100:                    getReport().setScriptletClass(className);
0101:                }
0102:
0103:                for (int pk = 0; pk < getReport().getJRproperties().size(); ++pk) {
0104:                    JRProperty prop = (JRProperty) getReport()
0105:                            .getJRproperties().elementAt(pk);
0106:                    if (prop.getName().equals("ireport.scriptlethandling")
0107:                            || prop.getName().equals("ireport.encoding")) {
0108:                        getReport().getJRproperties().remove(prop);
0109:                        pk--;
0110:                    }
0111:                }
0112:
0113:                JRProperty prop = new JRProperty();
0114:                prop.setName("ireport.scriptlethandling");
0115:                prop.setValue("" + getReport().getScriptletHandling());
0116:                getReport().getJRproperties().add(prop);
0117:
0118:                prop = new JRProperty();
0119:                prop.setName("ireport.encoding");
0120:                prop.setValue("" + getReport().getEncoding());
0121:                getReport().getJRproperties().add(prop);
0122:
0123:                try {
0124:
0125:                    // Default file encoding
0126:                    String fileencoding = "UTF-8";
0127:                    if (getReport().getEncoding() != null
0128:                            && !getReport().getEncoding().trim().equals("")) {
0129:                        fileencoding = getReport().getEncoding();
0130:                        if (fileencoding.equalsIgnoreCase("UTF-8")) {
0131:                            fileencoding = "UTF8"; // Hack for J++
0132:                        }
0133:                    } else {
0134:                        getReport().setEncoding("UTF-8"); // Default XML encoding
0135:                    }
0136:
0137:                    writeToOutputStream(
0138:                            new java.io.FileOutputStream(aFilename),
0139:                            fileencoding); //Changed by Felix Firgau
0140:
0141:                    //getReport().setCursor(Cursor.DEFAULT);
0142:                    getReport().setLoadTime(
0143:                            Misc.getLastWriteTime(getReport().getFilename()));
0144:
0145:                    getReport().setReportChanges(0);
0146:
0147:                    // saving the scriptlet...
0148:                    if (getReport().getScriptletHandling() == getReport().SCRIPTLET_IREPORT_INTERNAL_HANDLING) {
0149:                        try {
0150:
0151:                            String allcode = new String(getReport()
0152:                                    .getScripletCode().getAll()
0153:                                    + "");
0154:
0155:                            allcode = Misc.string_replace(className,
0156:                                    "<ScriptletClassName>", allcode);
0157:                            java.io.FileOutputStream fos = new java.io.FileOutputStream(
0158:                                    scriptletFileName);
0159:                            fos.write(allcode.getBytes());
0160:                            fos.close();
0161:
0162:                        } catch (Exception ex) {
0163:                            java.io.StringWriter s = new java.io.StringWriter();
0164:                            ex.printStackTrace(new java.io.PrintWriter(s));
0165:                            javax.swing.JOptionPane
0166:                                    .showMessageDialog(
0167:                                            getReport().getReportFrame()
0168:                                                    .getMainFrame(),
0169:                                            ex.getMessage() + " " + s,
0170:                                            I18n.getString(
0171:                                                    "message.title.exception",
0172:                                                    "Exception"),
0173:                                            javax.swing.JOptionPane.ERROR_MESSAGE);
0174:                        }
0175:                    }
0176:
0177:                    if (aFilename != null) { /*
0178:                                                com.ms.wfc.io.File f = new com.ms.wfc.io.File(filename, com.ms.wfc.io.FileMode.OPEN);
0179:                                                getReport().loadTime = f.getLastWriteTime().toLong();
0180:                                                f.close();
0181:                     */
0182:                    }
0183:                } catch (Exception ex) {
0184:                    //getReport().setCursor(Cursor.DEFAULT);
0185:                    //MessageBox.show(ex.getMessage());
0186:
0187:                    java.io.StringWriter s = new java.io.StringWriter();
0188:                    ex.printStackTrace(new java.io.PrintWriter(s));
0189:                    javax.swing.JOptionPane.showMessageDialog(getReport()
0190:                            .getReportFrame().getMainFrame(), ex.getMessage()
0191:                            + " " + s, I18n.getString(
0192:                            "message.title.exception", "Exception"),
0193:                            javax.swing.JOptionPane.ERROR_MESSAGE);
0194:                }
0195:            }
0196:
0197:            /**
0198:             * saveToOutputStream
0199:             * saves a Report to an OutputStream
0200:             * Does not support Scriptlet-saving
0201:             *
0202:             * save time and dirty status is not updated automatically.
0203:             *
0204:             * Author: Felix Firgau
0205:             *
0206:             * @param outputStream OutputStream
0207:             * @param fileencoding String
0208:             */
0209:            public void writeToOutputStream(java.io.OutputStream outputStream) {
0210:                writeToOutputStream(outputStream, "UTF-8");
0211:            }
0212:
0213:            /**
0214:             * saveToOutputStream
0215:             * saves a Report to an OutputStream
0216:             * Does not support Scriptlet-saving
0217:             *
0218:             * save time and dirty status is not updated automatically.
0219:             *
0220:             * Author: Felix Firgau
0221:             *
0222:             * @param outputStream OutputStream
0223:             * @param fileencoding String
0224:             */
0225:            public void writeToOutputStream(java.io.OutputStream outputStream,
0226:                    String fileencoding) {
0227:                try {
0228:                    //getReport().setCursor(Cursor.WAIT );
0229:                    //java.io.PrintWriter pw = new java.io.PrintWriter( new java.io.FileOutputStream( filename ));
0230:                    PrintWriter pw = new PrintWriter(
0231:                            new java.io.OutputStreamWriter(outputStream,
0232:                                    fileencoding)); //UTF8
0233:
0234:                    pw.print("<?xml version=\"1.0\"");
0235:                    if (getReport().getEncoding() != null
0236:                            && getReport().getEncoding().length() > 0) {
0237:                        pw.print(" encoding=\"" + getReport().getEncoding()
0238:                                + "\" ");
0239:                    }
0240:                    pw.println(" ?>");
0241:                    pw
0242:                            .println("<!-- Created with iReport - A designer for JasperReports -->");
0243:                    pw
0244:                            .println("<!DOCTYPE jasperReport PUBLIC \"//JasperReports//DTD Report Design//EN\" \"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd\">");
0245:                    //pw.println("-->");
0246:                    // Jasper report element...
0247:                    pw.println("<jasperReport");
0248:                    pw.println("\t\t name=\"" + getReport().getName() + "\"");
0249:
0250:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR066
0251:                            && getReport().getLanguage() != null
0252:                            && !getReport().getLanguage().trim().equals("")
0253:                            && !getReport().getLanguage().equals("java")) {
0254:                        pw.print("\n\t\t language=\""
0255:                                + getReport().getLanguage().trim() + "\"");
0256:                    }
0257:
0258:                    pw.println("\t\t columnCount=\""
0259:                            + getReport().getColumnCount() + "\"");
0260:                    pw.println("\t\t printOrder=\""
0261:                            + getReport().getPrintOrder() + "\"");
0262:                    pw.println("\t\t orientation=\""
0263:                            + getReport().getOrientation() + "\"");
0264:                    pw.println("\t\t pageWidth=\"" + getReport().getWidth()
0265:                            + "\"");
0266:                    pw.println("\t\t pageHeight=\"" + getReport().getHeight()
0267:                            + "\"");
0268:                    pw.println("\t\t columnWidth=\""
0269:                            + getReport().getColumnWidth() + "\"");
0270:                    pw.println("\t\t columnSpacing=\""
0271:                            + getReport().getColumnSpacing() + "\"");
0272:                    pw.println("\t\t leftMargin=\""
0273:                            + getReport().getLeftMargin() + "\"");
0274:                    pw.println("\t\t rightMargin=\""
0275:                            + getReport().getRightMargin() + "\"");
0276:                    pw.println("\t\t topMargin=\"" + getReport().getTopMargin()
0277:                            + "\"");
0278:                    pw.println("\t\t bottomMargin=\""
0279:                            + getReport().getBottomMargin() + "\"");
0280:                    pw.println("\t\t whenNoDataType=\""
0281:                            + getReport().getWhenNoDataType() + "\"");
0282:
0283:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR063
0284:                            && getReport().isFloatColumnFooter()) {
0285:                        pw.println("\t\t isFloatColumnFooter=\"true\"");
0286:                    }
0287:
0288:                    if (getReport().getScriptletHandling() != Report.SCRIPTLET_NOT_USED
0289:                            && getReport().getScriptletClass() != null
0290:                            && getReport().getScriptletClass().length() > 0) {
0291:                        pw.println("\t\t scriptletClass=\""
0292:                                + getReport().getScriptletClass() + "\"");
0293:                    }
0294:
0295:                    pw.println("\t\t isTitleNewPage=\""
0296:                            + getReport().isIsTitleNewPage() + "\"");
0297:                    pw.print("\t\t isSummaryNewPage=\""
0298:                            + getReport().isIsSummaryNewPage() + "\"");
0299:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR062
0300:                            && getReport().getResourceBundleBaseName() != null
0301:                            && !getReport().getResourceBundleBaseName().trim()
0302:                                    .equals("")) {
0303:                        pw.print("\n\t\t resourceBundle=\""
0304:                                + getReport().getResourceBundleBaseName()
0305:                                        .trim() + "\"");
0306:                    }
0307:
0308:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR100
0309:                            && getReport().getWhenResourceMissingType() != null
0310:                            && !getReport().getWhenResourceMissingType().trim()
0311:                                    .equals("Null")) {
0312:                        pw.print("\n\t\t whenResourceMissingType=\""
0313:                                + getReport().getWhenResourceMissingType()
0314:                                        .trim() + "\"");
0315:                    }
0316:
0317:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR111
0318:                            && getReport().isIgnorePagination()) {
0319:                        pw.print("\n\t\t isIgnorePagination=\"true\"");
0320:                    }
0321:
0322:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR128
0323:                            && getReport().getFormatFactoryClass() != null
0324:                            && getReport().getFormatFactoryClass().trim()
0325:                                    .length() > 0) {
0326:                        pw
0327:                                .print("\n\t\t formatFactoryClass=\""
0328:                                        + Misc
0329:                                                .xmlEscape(getReport()
0330:                                                        .getFormatFactoryClass()
0331:                                                        .trim()) + "\"");
0332:                    }
0333:
0334:                    pw.println(">");
0335:
0336:                    // Properties...
0337:                    Enumeration e = null;
0338:
0339:                    writeXMLProperties(getReport().getJRproperties(), true, pw,
0340:                            "\t");
0341:
0342:                    // For any chart element...
0343:                    Enumeration enum_chartElements = getReport().getElements()
0344:                            .elements();
0345:                    while (enum_chartElements.hasMoreElements()) {
0346:                        ReportElement re = (ReportElement) enum_chartElements
0347:                                .nextElement();
0348:                        if (re instanceof  ChartReportElement) {
0349:                            Properties props = ((ChartReportElement) re)
0350:                                    .getProps();
0351:                            String name = re.getName();
0352:
0353:                            Iterator keys = props.keySet().iterator();
0354:                            int i = 0;
0355:                            while (keys.hasNext()) {
0356:                                String key = "" + keys.next();
0357:                                String val = props.getProperty(key);
0358:                                pw.print("\t<property name=\"" + "chart."
0359:                                        + name + "." + key + "\" ");
0360:                                pw.println("value=\"" + Misc.xmlEscape(val)
0361:                                        + "\" />");
0362:                            }
0363:                        }
0364:                    }
0365:
0366:                    // For IMPORTS..
0367:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR062) {
0368:                        e = getReport().getImports().elements();
0369:                        while (e.hasMoreElements()) {
0370:                            String _import = (String) e.nextElement();
0371:                            pw.print("\t<import ");
0372:                            pw.println("value=\"" + _import + "\" />");
0373:                        }
0374:                    }
0375:
0376:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR200) {
0377:                        e = getReport().getTemplates().elements();
0378:                        while (e.hasMoreElements()) {
0379:                            Template template = (Template) e.nextElement();
0380:                            pw.print("\t<template");
0381:                            if (template.getExpressionClass() != null
0382:                                    && !template.getExpressionClass().equals(
0383:                                            "java.lang.String")) {
0384:                                pw.print(" class=\""
0385:                                        + template.getExpressionClass() + "\"");
0386:                            }
0387:                            pw.print(">");
0388:                            pw.println("<![CDATA[" + template.getExpression()
0389:                                    + "]]></template>");
0390:                        }
0391:                    }
0392:
0393:                    e = getReport().getFonts().elements();
0394:
0395:                    while (e.hasMoreElements()) {
0396:                        IReportFont font = (IReportFont) e.nextElement();
0397:                        pw.print("\t<reportFont name=\"" + font.getReportFont()
0398:                                + "\" ");
0399:                        pw.print("isDefault=\"" + font.isDefaultFont() + "\" ");
0400:                        pw.print("fontName=\"" + font.getFontName() + "\" ");
0401:                        pw.print("size=\"" + font.getFontSize() + "\" ");
0402:                        pw.print("isBold=\"" + font.isBold() + "\" ");
0403:                        pw.print("isItalic=\"" + font.isItalic() + "\" ");
0404:                        pw.print("isUnderline=\"" + font.isUnderline() + "\" ");
0405:                        pw.print("isStrikeThrough=\"" + font.isStrikeTrought()
0406:                                + "\" ");
0407:                        if (Misc.nvl(font.getPDFFontName(), "").indexOf("TTF") > 0)
0408:                            //TODO: this line cause write "" to xml when pdfFontName terminate with "TTF".
0409:                            //this error was solved in IReportFont.setPDFFontName() take a look.
0410:                            pw.print("pdfFontName=\"" + font.getTTFFont()
0411:                                    + "\" ");
0412:                        else
0413:                            pw.print("pdfFontName=\"" + font.getPDFFontName()
0414:                                    + "\" ");
0415:                        pw.print("pdfEncoding=\"" + font.getPdfEncoding()
0416:                                + "\" ");
0417:                        pw.println("isPdfEmbedded=\"" + font.isPdfEmbedded()
0418:                                + "\"/>");
0419:                    }
0420:
0421:                    // Styles
0422:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR111) {
0423:                        writeXMLStyles(getReport().getStyles(), pw, "\t");
0424:                    }
0425:
0426:                    // SubDataset...
0427:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR110) {
0428:                        writeXMLSubDatasets(getReport().getSubDatasets(), pw,
0429:                                "\t");
0430:                    }
0431:
0432:                    // Parameters
0433:                    writeXMLParameters(getReport().getParameters(), pw, "\t");
0434:
0435:                    // QueryString
0436:                    if (getReport().getQuery() != null
0437:                            && getReport().getQuery().trim().length() > 0) {
0438:
0439:                        pw.print("\t<queryString");
0440:
0441:                        if (CompatibilitySupport.version >= CompatibilitySupport.JR120
0442:                                && !getReport().getQueryLanguage()
0443:                                        .equals("sql")) {
0444:                            pw.print(" language=\""
0445:                                    + getReport().getQueryLanguage() + "\"");
0446:                        }
0447:                        pw.println(">"
0448:                                + getCDATAString(getReport().getQuery(), 1)
0449:                                + "</queryString>");
0450:                    }
0451:
0452:                    // fileds...
0453:                    writeXMLFields(getReport().getFields(), pw, "\t");
0454:
0455:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR128) {
0456:                        writeXMLSortFields(getReport().getSortFields(), pw,
0457:                                "\t");
0458:                    }
0459:
0460:                    // variables...
0461:                    writeXMLVariables(getReport().getVariables(), pw, "\t");
0462:
0463:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR125
0464:                            && getReport().getFilterExpression() != null
0465:                            && getReport().getFilterExpression().trim()
0466:                                    .length() > 0) {
0467:
0468:                        pw.println("\t<filterExpression>"
0469:                                + getCDATAString(getReport()
0470:                                        .getFilterExpression(), 1)
0471:                                + "</filterExpression>");
0472:                    }
0473:
0474:                    // groups...
0475:                    writeXMLGroups(getReport().getGroups(), pw, true, 2);
0476:
0477:                    // if ( CompatibilitySupport.saveBackground)
0478:                    {
0479:                        writeXMLSection("background", pw);
0480:                    }
0481:
0482:                    writeXMLSection("title", pw);
0483:                    writeXMLSection("pageHeader", pw);
0484:                    writeXMLSection("columnHeader", pw);
0485:                    writeXMLSection("detail", pw);
0486:                    writeXMLSection("columnFooter", pw);
0487:                    writeXMLSection("pageFooter", pw);
0488:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR061) {
0489:                        writeXMLSection("lastPageFooter", pw);
0490:                    }
0491:                    writeXMLSection("summary", pw);
0492:
0493:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR200) {
0494:                        writeXMLSection("noData", pw);
0495:                    }
0496:
0497:                    pw.println("</jasperReport>");
0498:                    pw.close();
0499:
0500:                } catch (Exception ex) {
0501:                    //getReport().setCursor(Cursor.DEFAULT);
0502:                    //MessageBox.show(ex.getMessage());
0503:
0504:                    java.io.StringWriter s = new java.io.StringWriter();
0505:                    ex.printStackTrace(new java.io.PrintWriter(s));
0506:                    javax.swing.JOptionPane.showMessageDialog(getReport()
0507:                            .getReportFrame().getMainFrame(), ex.getMessage()
0508:                            + " " + s, I18n.getString(
0509:                            "message.title.exception", "Exception"),
0510:                            javax.swing.JOptionPane.ERROR_MESSAGE);
0511:                }
0512:
0513:            }
0514:
0515:            void writeXMLSection(String section, PrintWriter pw) {
0516:                // Find band...
0517:                Band band = null;
0518:
0519:                for (Iterator i = getReport().getBands().iterator(); i
0520:                        .hasNext();) {
0521:                    band = (Band) i.next();
0522:                    if (band.getName().equalsIgnoreCase(section)) {
0523:                        break;
0524:                    }
0525:                }
0526:                if (band == null) {
0527:                    return;
0528:                }
0529:
0530:                if (section.equals("lastPageFooter") && band.getHeight() == 0)
0531:                    return;
0532:
0533:                if (section.equals("noData") && band.getHeight() == 0)
0534:                    return;
0535:
0536:                pw.println("\t\t<" + section + ">");
0537:                writeXMLBand(band, pw);
0538:                pw.println("\t\t</" + section + ">");
0539:            }
0540:
0541:            void writeXMLSubDatasets(Vector subDatasets, PrintWriter pw,
0542:                    String tabs) {
0543:                Enumeration e = subDatasets.elements();
0544:
0545:                while (e.hasMoreElements()) {
0546:
0547:                    pw.println("");
0548:
0549:                    it.businesslogic.ireport.SubDataset subDataset = (it.businesslogic.ireport.SubDataset) e
0550:                            .nextElement();
0551:
0552:                    pw.print(tabs + "<subDataset name=\""
0553:                            + subDataset.getName() + "\" ");
0554:                    if (subDataset.getScriptletClass() != null
0555:                            && subDataset.getScriptletClass().length() > 0) {
0556:                        pw.println(tabs + "\t scriptletClass=\""
0557:                                + subDataset.getScriptletClass() + "\"");
0558:                    }
0559:
0560:                    if (subDataset.getResourceBundleBaseName() != null
0561:                            && !subDataset.getResourceBundleBaseName().trim()
0562:                                    .equals("")) {
0563:                        pw.print("\n"
0564:                                + tabs
0565:                                + "\t resourceBundle=\""
0566:                                + getReport().getResourceBundleBaseName()
0567:                                        .trim() + "\"");
0568:                    }
0569:
0570:                    if (subDataset.getWhenResourceMissingType() != null
0571:                            && !subDataset.getWhenResourceMissingType().trim()
0572:                                    .equals("Null")) {
0573:                        pw.print("\n"
0574:                                + tabs
0575:                                + "\t whenResourceMissingType=\""
0576:                                + getReport().getWhenResourceMissingType()
0577:                                        .trim() + "\"");
0578:                    }
0579:                    pw.println(">");
0580:
0581:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR120) {
0582:                        writeXMLProperties(subDataset.getJRproperties(), false,
0583:                                pw, tabs + "\t");
0584:                    }
0585:
0586:                    // Parameters
0587:                    writeXMLParameters(subDataset.getParameters(), pw, "\t\t");
0588:
0589:                    // QueryString
0590:                    if (subDataset.getQuery() != null
0591:                            && subDataset.getQuery().trim().length() > 0) {
0592:                        pw.print(tabs + "\t<queryString");
0593:
0594:                        if (CompatibilitySupport.version >= CompatibilitySupport.JR120
0595:                                && !subDataset.getQueryLanguage().equals("sql")) {
0596:                            pw.print(" language=\""
0597:                                    + subDataset.getQueryLanguage() + "\"");
0598:                        }
0599:                        pw.println(">"
0600:                                + getCDATAString(subDataset.getQuery(), 1)
0601:                                + "</queryString>");
0602:                    }
0603:
0604:                    // fileds...
0605:
0606:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR110) {
0607:                        writeXMLFields(subDataset.getFields(), pw, "\t\t");
0608:                    }
0609:
0610:                    writeXMLSortFields(subDataset.getSortFields(), pw, "\t\t");
0611:                    // variables...
0612:                    writeXMLVariables(subDataset.getVariables(), pw, "\t\t");
0613:
0614:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR125
0615:                            && subDataset.getFilterExpression() != null
0616:                            && subDataset.getFilterExpression().trim().length() > 0) {
0617:
0618:                        pw.println("\t\t<filterExpression>"
0619:                                + getCDATAString(subDataset
0620:                                        .getFilterExpression(), 2)
0621:                                + "</filterExpression>");
0622:                    }
0623:
0624:                    // groups...
0625:                    writeXMLGroups(subDataset.getGroups(), pw, false, 2);
0626:                    pw.println(tabs + "</subDataset>");
0627:                }
0628:            }
0629:
0630:            void writeXMLParameters(Vector parameters, PrintWriter pw,
0631:                    String tabs) {
0632:                Enumeration e = parameters.elements();
0633:                if (parameters.size() > 0)
0634:                    pw.println("");
0635:                while (e.hasMoreElements()) {
0636:                    it.businesslogic.ireport.JRParameter p = (it.businesslogic.ireport.JRParameter) e
0637:                            .nextElement();
0638:                    if (p.isBuiltin())
0639:                        continue;
0640:
0641:                    pw.print(tabs + "<parameter name=\"" + p.getName() + "\" ");
0642:                    if (p.getClassType() == null)
0643:                        p.setClassType("java.lang.String");
0644:                    pw
0645:                            .print("isForPrompting=\"" + p.isIsForPrompting()
0646:                                    + "\" ");
0647:                    pw.print("class=\"" + p.getClassType() + "\"");
0648:
0649:                    if (p.getDefaultValueExpression().trim().length() > 0
0650:                            || p.getDescription().trim().length() > 0
0651:                            || p.getProperties().size() > 0) {
0652:                        pw.println(">");
0653:
0654:                        if (p.getProperties().size() > 0
0655:                                && CompatibilitySupport.version >= CompatibilitySupport.JR132) {
0656:                            writeXMLProperties(p.getProperties(), false, pw,
0657:                                    tabs + "\t");
0658:                        }
0659:
0660:                        if (p.getDescription().trim().length() > 0)
0661:                            pw.println(tabs + "\t<parameterDescription>"
0662:                                    + getCDATAString(p.getDescription(), 2)
0663:                                    + "</parameterDescription>");
0664:                        if (p.getDefaultValueExpression().trim().length() > 0) {
0665:                            pw.print(tabs + "\t<defaultValueExpression ");
0666:                            /*
0667:                            if( getReport().isUsingMultiLineExpressions() ) {
0668:                                    pw.print(" isCode=\"true\" ");
0669:                            }
0670:                             */
0671:                            pw.println(">"
0672:                                    + getCDATAString(p
0673:                                            .getDefaultValueExpression(), 2)
0674:                                    + "</defaultValueExpression>");
0675:                        }
0676:                        pw.println(tabs + "</parameter>");
0677:                    } else
0678:                        pw.println("/>");
0679:
0680:                }
0681:
0682:                // reset dirty operations...
0683:
0684:            }
0685:
0686:            void writeXMLFields(Vector fields, PrintWriter pw, String tabs) {
0687:                Enumeration e = fields.elements();
0688:                if (fields.size() > 0)
0689:                    pw.println("");
0690:                while (e.hasMoreElements()) {
0691:                    Object o = e.nextElement();
0692:                    if (!(o instanceof  it.businesslogic.ireport.JRField))
0693:                        continue;
0694:
0695:                    it.businesslogic.ireport.JRField f = (it.businesslogic.ireport.JRField) o;
0696:                    pw.print(tabs + "<field name=\"" + f.getName() + "\" ");
0697:                    if (f.getClassType() == null)
0698:                        f.setClassType("java.lang.String");
0699:                    pw.print("class=\"" + f.getClassType() + "\"");
0700:
0701:                    if ((f.getDescription() != null && f.getDescription()
0702:                            .trim().length() > 0)
0703:                            || f.getProperties().size() > 0) {
0704:                        pw.println(">");
0705:
0706:                        if (f.getProperties().size() > 0
0707:                                && CompatibilitySupport.version >= CompatibilitySupport.JR132) {
0708:                            writeXMLProperties(f.getProperties(), false, pw,
0709:                                    tabs + "\t");
0710:                        }
0711:
0712:                        if (f.getDescription().trim().length() > 0)
0713:                            pw.println(tabs + "\t<fieldDescription>"
0714:                                    + getCDATAString(f.getDescription(), 2)
0715:                                    + "</fieldDescription>");
0716:                        pw.println(tabs + "</field>");
0717:                    } else
0718:                        pw.println("/>");
0719:                }
0720:            }
0721:
0722:            void writeXMLSortFields(Vector fields, PrintWriter pw, String tabs) {
0723:                Enumeration e = fields.elements();
0724:                if (fields.size() > 0)
0725:                    pw.println("");
0726:                while (e.hasMoreElements()) {
0727:                    SortField f = (SortField) e.nextElement();
0728:                    pw.print(tabs + "<sortField name=\""
0729:                            + Misc.xmlEscape(f.getFieldName()) + "\" ");
0730:                    if (f.isDesc()) {
0731:                        pw.print("order=\"Descending\" ");
0732:                    }
0733:                    pw.println("/>");
0734:                }
0735:            }
0736:
0737:            void writeXMLVariables(Vector variables, PrintWriter pw, String tabs) {
0738:                Enumeration e = variables.elements();
0739:                if (variables.size() > 0)
0740:                    pw.println("");
0741:                while (e.hasMoreElements()) {
0742:                    it.businesslogic.ireport.JRVariable f = (it.businesslogic.ireport.JRVariable) e
0743:                            .nextElement();
0744:                    if (f.isBuiltin())
0745:                        continue;
0746:                    pw.print(tabs + "<variable name=\"" + f.getName() + "\" ");
0747:                    if (f.getClassType() == null)
0748:                        f.setClassType("java.lang.String");
0749:                    pw.print("class=\"" + f.getClassType() + "\" ");
0750:                    pw.print("resetType=\"" + f.getResetType() + "\" ");
0751:
0752:                    // From JasperReport 0.5.3
0753:                    if (f.getIncrementerFactoryClass() != null
0754:                            && f.getIncrementerFactoryClass().trim().length() > 0) {
0755:                        pw.print("incrementerFactoryClass=\""
0756:                                + f.getIncrementerFactoryClass() + "\" ");
0757:                    }
0758:
0759:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR066
0760:                            && f.getIncrementType() != null
0761:                            && !f.getIncrementType().trim().equals("None")) {
0762:                        pw.print("incrementType=\""
0763:                                + f.getIncrementType().trim() + "\" ");
0764:                        if (f.getIncrementType().equals("Group")) {
0765:                            pw.print("incrementGroup=\""
0766:                                    + f.getIncrementGroup().trim() + "\" ");
0767:                        }
0768:                    }
0769:
0770:                    if (f.getResetGroup().length() > 0)
0771:                        pw.print("resetGroup=\"" + f.getResetGroup() + "\" ");
0772:                    pw.println("calculation=\"" + f.getCalculation() + "\">");
0773:                    if (f.getExpression().length() > 0) {
0774:                        pw.print(tabs + "\t<variableExpression");
0775:                        /*
0776:                        if(getReport().isUsingMultiLineExpressions()) {
0777:                                pw.print(" isCode=\"true\" ");
0778:                        }
0779:                         */
0780:                        pw.println(">" + getCDATAString(f.getExpression(), 2)
0781:                                + "</variableExpression>");
0782:                    }
0783:                    if (f.getInitialValueExpression().length() > 0) {
0784:                        pw.print(tabs + "\t<initialValueExpression");
0785:                        /*
0786:                        if(getReport().isUsingMultiLineExpressions()) {
0787:                                pw.print(" isCode=\"true\" ");
0788:                        }
0789:                         */
0790:                        pw.println(">"
0791:                                + getCDATAString(f.getInitialValueExpression(),
0792:                                        2) + "</initialValueExpression>");
0793:                    }
0794:                    pw.println(tabs + "</variable>");
0795:                }
0796:            }
0797:
0798:            void writeXMLMeasures(Vector measures, PrintWriter pw, String tabs) {
0799:                Enumeration e = measures.elements();
0800:                if (measures.size() > 0)
0801:                    pw.println("");
0802:                while (e.hasMoreElements()) {
0803:                    it.businesslogic.ireport.crosstab.Measure f = (it.businesslogic.ireport.crosstab.Measure) e
0804:                            .nextElement();
0805:
0806:                    pw.print(tabs + "<measure name=\"" + f.getName() + "\"");
0807:                    if (f.getClassType() == null)
0808:                        f.setClassType("java.lang.String");
0809:                    pw.print(" class=\"" + f.getClassType() + "\"");
0810:                    if (!f.getCalculation().equals("Nothing"))
0811:                        pw.print(" calculation=\"" + f.getCalculation() + "\"");
0812:                    if (f.getIncrementerFactoryClass().trim().length() > 0)
0813:                        pw.print(" incrementerFactoryClass=\""
0814:                                + f.getIncrementerFactoryClass() + "\"");
0815:                    if (!f.getPercentageOf().equals("None"))
0816:                        pw.print(" percentageOf=\"" + f.getPercentageOf()
0817:                                + "\"");
0818:                    if (f.getPercentageCalculatorClass().trim().length() > 0)
0819:                        pw.print(" percentageCalculatorClass=\""
0820:                                + f.getPercentageCalculatorClass() + "\"");
0821:                    pw.println(">");
0822:
0823:                    if (f.getExpression().length() > 0) {
0824:                        pw.print(tabs + "\t<measureExpression>");
0825:                        pw.println(getCDATAString(f.getExpression(), 2)
0826:                                + "</measureExpression>");
0827:                    }
0828:
0829:                    pw.println(tabs + "</measure>");
0830:                }
0831:            }
0832:
0833:            void writeXMLCrosstabParameters(Vector parameters, PrintWriter pw,
0834:                    String tabs) {
0835:                Enumeration e = parameters.elements();
0836:                if (parameters.size() > 0)
0837:                    pw.println("");
0838:                while (e.hasMoreElements()) {
0839:                    it.businesslogic.ireport.crosstab.CrosstabParameter f = (it.businesslogic.ireport.crosstab.CrosstabParameter) e
0840:                            .nextElement();
0841:
0842:                    pw.print(tabs + "<crosstabParameter name=\"" + f.getName()
0843:                            + "\" ");
0844:                    if (f.getClassType() == null)
0845:                        f.setClassType("java.lang.String");
0846:                    pw.print("class=\"" + f.getClassType() + "\" ");
0847:                    pw.print(">");
0848:
0849:                    if (f.getParameterValueExpression().length() > 0) {
0850:                        pw.print(tabs + "\t<parameterValueExpression>");
0851:                        pw.println(""
0852:                                + getCDATAString(f
0853:                                        .getParameterValueExpression(), tabs
0854:                                        .length() + 1)
0855:                                + "</parameterValueExpression>");
0856:                    }
0857:
0858:                    pw.println(tabs + "</crosstabParameter>");
0859:                }
0860:            }
0861:
0862:            void writeXMLHyperlinkParameters(java.util.List parameters,
0863:                    PrintWriter pw, String tabs) {
0864:                Iterator e = parameters.iterator();
0865:                if (parameters.size() > 0)
0866:                    pw.println("");
0867:                while (e.hasNext()) {
0868:                    it.businesslogic.ireport.JRLinkParameter f = (it.businesslogic.ireport.JRLinkParameter) e
0869:                            .next();
0870:
0871:                    pw.println(tabs + "<hyperlinkParameter name=\""
0872:                            + f.getName() + "\">");
0873:                    pw.print(tabs + "\t<hyperlinkParameterExpression>");
0874:                    pw.println(""
0875:                            + getCDATAString(f.getExpression(),
0876:                                    tabs.length() + 1)
0877:                            + "</hyperlinkParameterExpression>");
0878:                    pw.println(tabs + "</hyperlinkParameter>");
0879:                }
0880:            }
0881:
0882:            void writeXMLGroups(Vector groups, java.io.PrintWriter pw,
0883:                    boolean writeAll, int tabCount) {
0884:                // Find band...
0885:                if (groups.size() > 0)
0886:                    pw.println("");
0887:                for (int i = 0; i < groups.size(); i++) {
0888:                    Group grp = (Group) groups.elementAt(i);
0889:                    for (int t = 0; t < tabCount; ++t)
0890:                        pw.print("\t");
0891:                    pw.print("<group ");
0892:                    pw.print(" name=\"" + grp.getName() + "\"");
0893:                    if (grp.isIsStartNewColumn())
0894:                        pw.print(" isStartNewColumn=\""
0895:                                + grp.isIsStartNewColumn() + "\"");
0896:                    if (grp.isIsStartNewPage())
0897:                        pw.print(" isStartNewPage=\"" + grp.isIsStartNewPage()
0898:                                + "\"");
0899:                    if (grp.isIsResetPageNumber())
0900:                        pw.print(" isResetPageNumber=\""
0901:                                + grp.isIsResetPageNumber() + "\"");
0902:                    if (grp.isIsReprintHeaderOnEachPage())
0903:                        pw.print(" isReprintHeaderOnEachPage=\""
0904:                                + grp.isIsReprintHeaderOnEachPage() + "\"");
0905:                    if (grp.getMinHeightToStartNewPage() != 0)
0906:                        pw.print(" minHeightToStartNewPage=\""
0907:                                + grp.getMinHeightToStartNewPage() + "\"");
0908:                    pw.println(" >");
0909:                    pw.print("\t\t\t<groupExpression");
0910:                    /*
0911:                    if(getReport().isUsingMultiLineExpressions()) {
0912:                            pw.print(" isCode=\"true\" ");
0913:                    }
0914:                     */
0915:                    pw.println(">"
0916:                            + getCDATAString(grp.getGroupExpression(),
0917:                                    tabCount + 1) + "</groupExpression>");
0918:                    if (writeAll) {
0919:                        pw.println("\t\t\t<groupHeader>");
0920:                        writeXMLBand(grp.getGroupHeader(), pw);
0921:                        pw.println("\t\t\t</groupHeader>");
0922:                        pw.println("\t\t\t<groupFooter>");
0923:                        writeXMLBand(grp.getGroupFooter(), pw);
0924:                        pw.println("\t\t\t</groupFooter>");
0925:                    }
0926:                    for (int t = 0; t < tabCount; ++t)
0927:                        pw.print("\t");
0928:                    pw.println("</group>");
0929:                }
0930:            }
0931:
0932:            void writeXMLStyles(Vector styles, java.io.PrintWriter pw,
0933:                    String tabs) {
0934:
0935:                Enumeration e = styles.elements();
0936:                if (styles.size() > 0)
0937:                    pw.println("");
0938:                while (e.hasMoreElements()) {
0939:                    it.businesslogic.ireport.Style style = (it.businesslogic.ireport.Style) e
0940:                            .nextElement();
0941:
0942:                    if (style instanceof  UndefinedStyle) {
0943:                        continue;
0944:                    }
0945:
0946:                    String tabs2 = tabs;
0947:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR120) {
0948:                        if (style instanceof  ConditionedStyle) {
0949:                            pw.println(tabs2 + "<conditionalStyle>");
0950:                            tabs += "\t";
0951:                            pw.print(tabs + "<conditionExpression");
0952:                            pw
0953:                                    .println(">"
0954:                                            + getCDATAString(
0955:                                                    ((ConditionedStyle) style)
0956:                                                            .getCondition(),
0957:                                                    tabs2.length() + 1)
0958:                                            + "</conditionExpression>");
0959:                        }
0960:
0961:                    }
0962:
0963:                    pw.println(tabs + "<style ");
0964:                    for (int i = 0; i < Style.JRXMLStyleAttributes.length; ++i) {
0965:                        if (style.getAttributes().containsKey(
0966:                                Style.JRXMLStyleAttributes[i])
0967:                                && style.getAttributes().get(
0968:                                        Style.JRXMLStyleAttributes[i]) != null) {
0969:
0970:                            if (Style.JRXMLStyleAttributes[i].equals("markup")
0971:                                    && CompatibilitySupport.version < CompatibilitySupport.JR205) {
0972:                                continue;
0973:                            }
0974:
0975:                            if (CompatibilitySupport.version < CompatibilitySupport.JR204) {
0976:                                if (Style.JRXMLStyleAttributes[i]
0977:                                        .equals("border")
0978:                                        || Style.JRXMLStyleAttributes[i]
0979:                                                .equals("borderColor")
0980:                                        || Style.JRXMLStyleAttributes[i]
0981:                                                .equals("padding")
0982:                                        || Style.JRXMLStyleAttributes[i]
0983:                                                .equals("topBorder")
0984:                                        || Style.JRXMLStyleAttributes[i]
0985:                                                .equals("topBorderColor")
0986:                                        || Style.JRXMLStyleAttributes[i]
0987:                                                .equals("topPadding")
0988:                                        || Style.JRXMLStyleAttributes[i]
0989:                                                .equals("leftBorder")
0990:                                        || Style.JRXMLStyleAttributes[i]
0991:                                                .equals("leftBorderColor")
0992:                                        || Style.JRXMLStyleAttributes[i]
0993:                                                .equals("leftPadding")
0994:                                        || Style.JRXMLStyleAttributes[i]
0995:                                                .equals("bottomBorder")
0996:                                        || Style.JRXMLStyleAttributes[i]
0997:                                                .equals("bottomBorderColor")
0998:                                        || Style.JRXMLStyleAttributes[i]
0999:                                                .equals("bottomPadding")
1000:                                        || Style.JRXMLStyleAttributes[i]
1001:                                                .equals("rightBorder")
1002:                                        || Style.JRXMLStyleAttributes[i]
1003:                                                .equals("rightBorderColor")
1004:                                        || Style.JRXMLStyleAttributes[i]
1005:                                                .equals("rightPadding")) {
1006:                                    continue;
1007:                                }
1008:
1009:                            }
1010:
1011:                            Object obj = style.getAttributes().get(
1012:                                    Style.JRXMLStyleAttributes[i]);
1013:                            String value = "" + obj;
1014:                            if (obj instanceof  java.awt.Color) {
1015:                                value = writeEncodedColor((java.awt.Color) obj);
1016:                            }
1017:                            if (Style.JRXMLStyleAttributes[i].toLowerCase()
1018:                                    .endsWith("color")
1019:                                    && value.startsWith("[")) {
1020:                                // The color is in the form [r,g,b]...
1021:                                try {
1022:                                    value = writeEncodedColor(it.businesslogic.ireport.gui.sheet.ColorSelectorPanel
1023:                                            .parseColorString(value));
1024:                                } catch (Exception ex) {
1025:                                    value = "black";
1026:                                }
1027:                            }
1028:                            if (Style.JRXMLStyleAttributes[i].equals("style")) {
1029:                                if (value == null || value.trim().length() == 0)
1030:                                    continue;
1031:                            }
1032:                            if (Style.JRXMLStyleAttributes[i].equals("markup")) {
1033:                                if (value == null || value.trim().length() == 0)
1034:                                    continue;
1035:                            }
1036:                            pw.println(tabs + "\t"
1037:                                    + Style.JRXMLStyleAttributes[i] + "=\""
1038:                                    + value + "\"");
1039:                        }
1040:                    }
1041:
1042:                    if (CompatibilitySupport.version < CompatibilitySupport.JR120) {
1043:                        pw.println(tabs + "/>");
1044:                    } else {
1045:                        pw.println(tabs + ">");
1046:
1047:                        if (CompatibilitySupport.version >= CompatibilitySupport.JR204) {
1048:
1049:                            if (style.getPen() != null) {
1050:                                writeXMLPen(style.getPen(), pw);
1051:                            }
1052:                            if (style.getBox() != null) {
1053:                                writeXMLBox(style.getBox(), pw);
1054:                            }
1055:                        }
1056:
1057:                        if (style.getConditionedStyles().size() > 0) {
1058:                            writeXMLStyles(style.getConditionedStyles(), pw,
1059:                                    tabs + "\t");
1060:                        }
1061:                        pw.println(tabs + "</style>");
1062:                    }
1063:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR120) {
1064:                        if (style instanceof  ConditionedStyle) {
1065:                            pw.println(tabs2 + "</conditionalStyle>");
1066:                        }
1067:                    }
1068:                }
1069:            }
1070:
1071:            void writeXMLBand(Band band, PrintWriter pw) {
1072:                pw.print("\t\t\t<band height=\"" + band.getHeight() + "\" ");
1073:
1074:                //if () //JasperReports 0.5.0 is supported...
1075:                {
1076:                    pw.print(" isSplitAllowed=\"" + band.isSplitAllowed()
1077:                            + "\" ");
1078:                }
1079:                pw.println(">");
1080:
1081:                if (band.getPrintWhenExpression().trim().length() > 0) {
1082:                    pw.print("\t\t\t\t<printWhenExpression");
1083:                    /*
1084:                    if(getReport().isUsingMultiLineExpressions()) {
1085:                            pw.print(" isCode=\"true\" ");
1086:                    }
1087:                     */
1088:                    pw.println(">"
1089:                            + getCDATAString(band.getPrintWhenExpression(), 4)
1090:                            + "</printWhenExpression>");
1091:                }
1092:
1093:                writeBandElements(pw, band, null);
1094:                pw.println("\t\t\t</band>");
1095:            }
1096:
1097:            public void writeBandElements(PrintWriter pw, Band band,
1098:                    ReportElement parent) {
1099:                String actualElementGroup = "";
1100:                for (Iterator i = getReport().getElements().iterator(); i
1101:                        .hasNext();) {
1102:                    ReportElement re = (ReportElement) i.next();
1103:                    if (re.band == band && re.getParentElement() == parent) {
1104:                        actualElementGroup = writeOpenCloseGroup(pw, re
1105:                                .getElementGroup(), actualElementGroup);
1106:                        writeXMLReportElement(re, pw);
1107:                    }
1108:                }
1109:                writeOpenCloseGroup(pw, "", actualElementGroup);
1110:            }
1111:
1112:            public String writeOpenCloseGroup(PrintWriter pw, String newGroup,
1113:                    String oldGroup) {
1114:                if (oldGroup.equals(newGroup))
1115:                    return newGroup;
1116:                while (!newGroup.startsWith(oldGroup) && oldGroup.length() > 0) {
1117:                    pw.println("\t\t\t\t</elementGroup><!-- End " + oldGroup
1118:                            + " !-->");
1119:                    if (oldGroup.lastIndexOf(".") >= 0) {
1120:                        oldGroup = oldGroup.substring(0, oldGroup
1121:                                .lastIndexOf("."));
1122:                    } else {
1123:                        oldGroup = "";
1124:                    }
1125:                }
1126:
1127:                String remainNewGroup = newGroup;
1128:                if (oldGroup.length() > 0 && newGroup.startsWith(oldGroup)) {
1129:                    remainNewGroup = newGroup.substring(oldGroup.length());
1130:                    while (remainNewGroup.startsWith(".")) {
1131:                        remainNewGroup = remainNewGroup.substring(1);
1132:                    }
1133:
1134:                }
1135:
1136:                String groupName = remainNewGroup;
1137:                while (remainNewGroup.length() > 0) {
1138:                    pw.print("\t\t\t\t<elementGroup>");
1139:
1140:                    if (remainNewGroup.indexOf(".") >= 0) {
1141:                        groupName = ((oldGroup.length() > 0) ? oldGroup + "."
1142:                                : "")
1143:                                + remainNewGroup.substring(0, remainNewGroup
1144:                                        .indexOf("."));
1145:                        oldGroup = remainNewGroup.substring(0, remainNewGroup
1146:                                .indexOf("."));
1147:                        remainNewGroup = remainNewGroup
1148:                                .substring(remainNewGroup.indexOf(".") + 1);
1149:                    } else {
1150:                        groupName = ((oldGroup.length() > 0) ? oldGroup + "."
1151:                                : "")
1152:                                + remainNewGroup;
1153:                        remainNewGroup = "";
1154:                    }
1155:                    pw.println("<!--  Start: " + groupName + " !-->");
1156:                }
1157:
1158:                return newGroup;
1159:            }
1160:
1161:            void writeXMLReportElement(ReportElement re, PrintWriter pw) {
1162:                if (re instanceof  StaticTextReportElement) {
1163:                    pw.println("\t\t\t\t<staticText>");
1164:
1165:                    writeXMLReportElementElement(re, pw);
1166:                    writeXMLBox(((TextReportElement) re).getBox(), pw);
1167:                    writeXMLTextElementElement((TextReportElement) re, pw);
1168:                    pw.println("\t\t\t\t<text>"
1169:                            + getCDATAString(((StaticTextReportElement) re)
1170:                                    .getText(), 4) + "</text>");
1171:                    pw.println("\t\t\t\t</staticText>");
1172:
1173:                } else if (re instanceof  FrameReportElement) {
1174:                    FrameReportElement fre = (FrameReportElement) re;
1175:                    pw.print("\t\t\t\t<frame>");
1176:                    writeXMLReportElementElement(fre, pw);
1177:                    writeXMLBox(((BoxElement) fre).getBox(), pw);
1178:                    if (re instanceof  FrameReportElement) {
1179:                        writeBandElements(pw, re.getBand(), re);
1180:                    }
1181:                    pw.print("\t\t\t\t</frame>");
1182:                } else if (re instanceof  TextFieldReportElement) {
1183:                    TextFieldReportElement tfre = (TextFieldReportElement) re;
1184:                    pw.print("\t\t\t\t<textField");
1185:                    pw.print(" isStretchWithOverflow=\""
1186:                            + tfre.isStretchWithOverflow() + "\"");
1187:
1188:                    if (tfre.getPropertyValue(tfre.PATTERN) != null) {
1189:                        pw.print(" pattern=\"" + tfre.getPattern() + "\"");
1190:                    }
1191:
1192:                    pw.print(" isBlankWhenNull=\"" + tfre.isBlankWhenNull()
1193:                            + "\"");
1194:                    pw.print(" evaluationTime=\"" + tfre.getEvaluationTime()
1195:                            + "\"");
1196:                    if (tfre.getEvaluationTime().equals("Group")) {
1197:                        pw.print(" evaluationGroup=\"" + tfre.getGroup()
1198:                                + "\" ");
1199:                    }
1200:                    pw.print(" hyperlinkType=\"" + tfre.getHyperlinkType()
1201:                            + "\" ");
1202:
1203:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR062) {
1204:                        pw.print(" hyperlinkTarget=\""
1205:                                + tfre.getHyperlinkTarget() + "\" ");
1206:                    }
1207:
1208:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR100) {
1209:                        if (tfre.getBookmarkLevel() != 0)
1210:                            pw.print(" bookmarkLevel=\""
1211:                                    + tfre.getBookmarkLevel() + "\" ");
1212:                    }
1213:
1214:                    pw.println(">");
1215:
1216:                    writeXMLReportElementElement(tfre, pw);
1217:                    writeXMLBox(((TextReportElement) re).getBox(), pw);
1218:                    writeXMLTextElementElement(tfre, pw);
1219:                    pw.print("\t\t\t\t<textFieldExpression ");
1220:                    if (tfre.getClassExpression().length() > 0) {
1221:                        pw.print("  class=\"" + tfre.getClassExpression()
1222:                                + "\"");
1223:                    }
1224:                    /*
1225:                    if(getReport().isUsingMultiLineExpressions()) {
1226:                            pw.print(" isCode=\"true\" ");
1227:                    }
1228:                     */
1229:                    pw.println(">"
1230:                            + getCDATAString(((TextFieldReportElement) re)
1231:                                    .getText(), 4) + "</textFieldExpression>");
1232:
1233:                    writeHyperLinkExpressions(tfre, pw);
1234:
1235:                    pw.println("\t\t\t\t</textField>");
1236:                } else if (re instanceof  ImageReportElement) {
1237:                    ImageReportElement ire = (ImageReportElement) re;
1238:                    pw.print("\t\t\t\t<image ");
1239:
1240:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(ire.getScaleImage()+"",Style.ATTRIBUTE_scaleImage,re.getStyle(), getDefaultStyle()))
1241:                    if (ire.getPropertyValue(ire.SCALE) != null) {
1242:                        pw.print(" scaleImage=\"" + ire.getScaleImage() + "\"");
1243:                    }
1244:
1245:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(ire.getVerticalAlignment()+"",Style.ATTRIBUTE_vAlign,re.getStyle(), getDefaultStyle()))
1246:                    if (ire.getPropertyValue(ire.VERTICAL_ALIGN) != null) {
1247:                        pw.print(" vAlign=\"" + ire.getVerticalAlignment()
1248:                                + "\"");
1249:                    }
1250:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(ire.getHorizontalAlignment()+"",Style.ATTRIBUTE_hAlign,re.getStyle(), getDefaultStyle()))
1251:                    if (ire.getPropertyValue(ire.HORIZONTAL_ALIGN) != null) {
1252:                        pw.print(" hAlign=\"" + ire.getHorizontalAlignment()
1253:                                + "\"");
1254:                    }
1255:
1256:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR065
1257:                            && ire.isIsLazy() == true) {
1258:                        pw.print(" isLazy=\"" + ire.isIsLazy() + "\"");
1259:                    }
1260:
1261:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR103
1262:                            && !ire.getOnErrorType().equals("Error")) {
1263:                        pw.print(" onErrorType=\"" + ire.getOnErrorType()
1264:                                + "\"");
1265:                    }
1266:
1267:                    if (ire.getPropertyValue(ire.USING_CACHE) != null) {
1268:                        pw.print(" isUsingCache=\"" + ire.isIsUsingCache()
1269:                                + "\"");
1270:                    }
1271:
1272:                    pw.print(" evaluationTime=\"" + ire.getEvaluationTime()
1273:                            + "\"");
1274:
1275:                    if (((ImageReportElement) re).getEvaluationTime().equals(
1276:                            "Group")) {
1277:                        pw.print(" evaluationGroup=\""
1278:                                + ire.getEvaluationGroup() + "\" ");
1279:                    }
1280:
1281:                    pw.print(" hyperlinkType=\"" + ire.getHyperlinkType()
1282:                            + "\" ");
1283:
1284:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR062) {
1285:                        pw.print(" hyperlinkTarget=\""
1286:                                + ire.getHyperlinkTarget() + "\" ");
1287:                    }
1288:
1289:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR100) {
1290:                        if (ire.getBookmarkLevel() != 0)
1291:                            pw.print(" bookmarkLevel=\""
1292:                                    + ire.getBookmarkLevel() + "\" ");
1293:                    }
1294:
1295:                    pw.println(">");
1296:
1297:                    writeXMLReportElementElement(re, pw);
1298:                    writeXMLBox(((ImageReportElement) re).getBox(), pw);
1299:                    writeXMLGraphicElement(ire, pw);
1300:
1301:                    if (re instanceof  ChartReportElement) {
1302:                        pw
1303:                                .print("\t\t\t\t\t<imageExpression class=\"java.awt.Image\"");
1304:                        /*
1305:                        if(getReport().isUsingMultiLineExpressions()) {
1306:                                pw.print(" isCode=\"true\" ");
1307:                        }
1308:                         */
1309:                        pw
1310:                                .print(">"
1311:                                // + getCDATAString( getExpressionString( ire.getImageClass(), ire.getImageExpression() ), 5) +
1312:                                        + getCDATAString(
1313:                                                writeChartExpression((ChartReportElement) re),
1314:                                                5) + "</imageExpression>\n");
1315:                    } else {
1316:                        pw.print("\t\t\t\t\t<imageExpression class=\""
1317:                                + ire.getImageClass() + "\"");
1318:                        /*
1319:                        if(getReport().isUsingMultiLineExpressions()) {
1320:                                pw.print(" isCode=\"true\" ");
1321:                        }
1322:                         */
1323:                        pw.println(">"
1324:                                // + getCDATAString( getExpressionString( ire.getImageClass(), ire.getImageExpression() ), 5) +
1325:                                + getCDATAString(ire.getImageExpression(), 5)
1326:                                + "</imageExpression>");
1327:                    }
1328:
1329:                    writeHyperLinkExpressions(ire, pw);
1330:                    pw.println("\t\t\t\t</image>");
1331:
1332:                } else if (re instanceof  LineReportElement) {
1333:                    LineReportElement lre = (LineReportElement) re;
1334:                    pw.println("\t\t\t\t<line direction=\""
1335:                            + lre.getDirection() + "\">");
1336:                    writeXMLReportElementElement(re, pw);
1337:                    writeXMLGraphicElement(lre, pw);
1338:                    pw.println("\t\t\t\t</line>");
1339:
1340:                } else if (re instanceof  BreakReportElement) {
1341:
1342:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR129) {
1343:                        BreakReportElement lre = (BreakReportElement) re;
1344:                        pw.print("\t\t\t\t<break");
1345:                        if (!lre.getType().equals("Page")) {
1346:                            pw.print(" type=\"" + lre.getType() + "\"");
1347:                        }
1348:                        pw.println(">");
1349:                        writeXMLReportElementElement(re, pw);
1350:                        pw.println("\t\t\t\t</break>");
1351:                    }
1352:
1353:                } else if (re instanceof  RectangleReportElement) {
1354:                    RectangleReportElement rre = (RectangleReportElement) re;
1355:                    pw.print("\t\t\t\t<rectangle");
1356:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(rre.getRadius()+"",Style.ATTRIBUTE_radius,re.getStyle(), getDefaultStyle()))
1357:                    if (rre.getPropertyValue(rre.RADIUS) != null) {
1358:                        pw.print(" radius=\"" + rre.getRadius() + "\" ");
1359:                    }
1360:                    pw.println(">");
1361:                    writeXMLReportElementElement(re, pw);
1362:                    writeXMLGraphicElement(rre, pw);
1363:                    pw.println("\t\t\t\t</rectangle>");
1364:
1365:                } else if (re instanceof  EllipseReportElement) {
1366:                    //if ( CompatibilitySupport.saveEllipse )
1367:                    {
1368:                        EllipseReportElement ere = (EllipseReportElement) re;
1369:                        pw.println("\t\t\t\t<ellipse>");
1370:                        writeXMLReportElementElement(ere, pw);
1371:                        writeXMLGraphicElement(ere, pw);
1372:                        pw.println("\t\t\t\t</ellipse>");
1373:                    }
1374:                } else if (re instanceof  SubReportElement) {
1375:                    SubReportElement sre = (SubReportElement) re;
1376:                    pw.println("\t\t\t\t<subreport  isUsingCache=\""
1377:                            + sre.isIsUsingCache() + "\">");
1378:                    writeXMLReportElementElement(re, pw);
1379:                    if (sre.getParametersMapExpression() != null
1380:                            && sre.getParametersMapExpression().trim().length() > 0) {
1381:                        pw.print("\t\t\t\t\t<parametersMapExpression");
1382:                        /*
1383:                        if(getReport().isUsingMultiLineExpressions()) {
1384:                                pw.print(" isCode=\"true\" ");
1385:                        }
1386:                         */
1387:                        pw.println(">"
1388:                                + getCDATAString(sre
1389:                                        .getParametersMapExpression(), 5)
1390:                                + "</parametersMapExpression>");
1391:                    }
1392:
1393:                    Enumeration e = sre.getSubreportParameters().elements();
1394:                    while (e.hasMoreElements()) {
1395:                        JRSubreportParameter je = (JRSubreportParameter) e
1396:                                .nextElement();
1397:                        pw.println("\t\t\t\t\t<subreportParameter  name=\""
1398:                                + je.getName() + "\">");
1399:                        pw.print("\t\t\t\t\t\t<subreportParameterExpression");
1400:                        /*
1401:                        if(getReport().isUsingMultiLineExpressions()) {
1402:                                pw.print(" isCode=\"true\" ");
1403:                        }
1404:                         */
1405:                        pw.println(">" + getCDATAString(je.getExpression(), 6)
1406:                                + "</subreportParameterExpression>");
1407:                        pw.println("\t\t\t\t\t</subreportParameter>");
1408:                    }
1409:                    if (sre.isUseConnection()
1410:                            && sre.getConnectionExpression().trim().length() > 0) {
1411:                        pw.print("\t\t\t\t\t<connectionExpression");
1412:                        /*
1413:                        if(getReport().isUsingMultiLineExpressions()) {
1414:                                pw.print(" isCode=\"true\" ");
1415:                        }
1416:                         */
1417:                        pw.println(">"
1418:                                + getCDATAString(sre.getConnectionExpression(),
1419:                                        5) + "</connectionExpression>");
1420:                    } else if (!sre.isUseConnection()
1421:                            && sre.getDataSourceExpression().length() > 0) {
1422:                        pw.print("\t\t\t\t\t<dataSourceExpression");
1423:                        /*
1424:                        if(getReport().isUsingMultiLineExpressions()) {
1425:                                pw.print(" isCode=\"true\" ");
1426:                        }
1427:                         */
1428:                        pw.println(">"
1429:                                + getCDATAString(sre.getDataSourceExpression(),
1430:                                        5) + "</dataSourceExpression>");
1431:                    }
1432:
1433:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR100) {
1434:                        Enumeration e_sr = sre.getReturnValues().elements();
1435:                        while (e_sr.hasMoreElements()) {
1436:                            it.businesslogic.ireport.JRSubreportReturnValue jerv = (it.businesslogic.ireport.JRSubreportReturnValue) e_sr
1437:                                    .nextElement();
1438:                            pw.print("\t\t\t\t\t<returnValue");
1439:                            if (jerv.getSubreportVariable() != null
1440:                                    && jerv.getSubreportVariable().length() > 0)
1441:                                pw.print(" subreportVariable=\""
1442:                                        + jerv.getSubreportVariable() + "\"");
1443:                            if (jerv.getToVariable() != null
1444:                                    && jerv.getToVariable().length() > 0)
1445:                                pw.print(" toVariable=\""
1446:                                        + jerv.getToVariable() + "\"");
1447:                            if (jerv.getCalculation() != null
1448:                                    && !jerv.getCalculation().equals("Nothing"))
1449:                                pw.print(" calculation=\""
1450:                                        + jerv.getCalculation() + "\"");
1451:                            if (jerv.getIncrementFactoryClass() != null
1452:                                    && jerv.getIncrementFactoryClass().length() > 0)
1453:                                pw.print(" incrementerFactoryClass=\""
1454:                                        + jerv.getIncrementFactoryClass()
1455:                                        + "\"");
1456:                            pw.println("/>");
1457:                        }
1458:                    }
1459:
1460:                    if (sre.getSubreportExpression() != null
1461:                            && sre.getSubreportExpression().trim().length() > 0) {
1462:                        pw.print("\t\t\t\t\t<subreportExpression  class=\""
1463:                                + sre.getSubreportExpressionClass() + "\"");
1464:                        /*
1465:                        if(getReport().isUsingMultiLineExpressions()) {
1466:                                pw.print(" isCode=\"true\" ");
1467:                        }
1468:                         */
1469:                        pw.println(">"
1470:                                + getCDATAString(sre.getSubreportExpression(),
1471:                                        5) + "</subreportExpression>");
1472:                    }
1473:
1474:                    pw.println("\t\t\t\t</subreport>");
1475:                } else if (re instanceof  ChartReportElement2) {
1476:                    writeChartElement((ChartReportElement2) re, pw);
1477:                } else if (re instanceof  CrosstabReportElement) {
1478:                    CrosstabReportElement cre = (CrosstabReportElement) re;
1479:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR111) {
1480:                        pw.print("\t\t\t\t<crosstab ");
1481:                        if (!cre.isRepeatColumnHeaders())
1482:                            pw.print("isRepeatColumnHeaders=\""
1483:                                    + cre.isRepeatColumnHeaders() + "\" ");
1484:                        if (!cre.isRepeatRowHeaders())
1485:                            pw.print("isRepeatRowHeaders=\""
1486:                                    + cre.isRepeatRowHeaders() + "\" ");
1487:                        if (cre.getColumnBreakOffset() != 10)
1488:                            pw.print("columnBreakOffset=\""
1489:                                    + cre.getColumnBreakOffset() + "\" ");
1490:
1491:                        if (CompatibilitySupport.version >= CompatibilitySupport.JR134
1492:                                && cre.getRunDirection() != null
1493:                                && !cre.getRunDirection().trim().equals("LTR")) {
1494:                            pw.print("runDirection=\""
1495:                                    + cre.getRunDirection().trim() + "\" ");
1496:                        }
1497:                        pw.println(">");
1498:                        writeXMLReportElementElement(re, pw);
1499:                        writeXMLCrosstabParameters(cre.getCrosstabParameters(),
1500:                                pw, "\t\t\t\t\t");
1501:
1502:                        if (cre.getParametersMapExpression() != null
1503:                                && cre.getParametersMapExpression().trim()
1504:                                        .length() > 0) {
1505:                            pw.print("\t\t\t\t\t<parametersMapExpression>");
1506:                            pw.println(getCDATAString(cre
1507:                                    .getParametersMapExpression(), 5)
1508:                                    + "</parametersMapExpression>");
1509:                        }
1510:
1511:                        if (cre.isUseDataset()) {
1512:                            pw.print("\t\t\t\t\t<crosstabDataset");
1513:                            if (cre.isPreSorted())
1514:                                pw.print(" isDataPreSorted=\""
1515:                                        + cre.isPreSorted() + "\" ");
1516:                            pw.println(">");
1517:                            if (cre.getDataset() != null) {
1518:                                writeDatasetDataset(cre.getDataset(), pw);
1519:                            }
1520:                            pw.println("\t\t\t\t\t</crosstabDataset>");
1521:                        }
1522:
1523:                        if (CompatibilitySupport.version >= CompatibilitySupport.JR120) {
1524:                            for (int i = 0; i < cre.getCells().size(); ++i) {
1525:                                CrosstabCell cell = (CrosstabCell) cre
1526:                                        .getCells().elementAt(i);
1527:                                if (cell.getType() == cell.CT_HEADER_CELL) {
1528:                                    pw.print("\t\t\t\t\t<crosstabHeaderCell>");
1529:                                    writeXMLCrosstabCellcontents(cell, cre
1530:                                            .getElements(), pw, "\t\t\t\t\t\t");
1531:                                    pw.print("\t\t\t\t\t</crosstabHeaderCell>");
1532:                                }
1533:                            }
1534:                        }
1535:
1536:                        writeXMLCrosstabRowGroups(cre.getRowGroups(), cre
1537:                                .getElements(), pw);
1538:                        writeXMLCrosstabColumnGroups(cre.getColumnGroups(), cre
1539:                                .getElements(), pw);
1540:                        writeXMLMeasures(cre.getMeasures(), pw, "\t\t\t\t\t");
1541:                        writeXMLCrosstabCells(cre.getCells(),
1542:                                cre.getElements(), pw, "\t\t\t\t\t");
1543:
1544:                        for (int i = 0; i < cre.getCells().size(); ++i) {
1545:                            CrosstabCell cell = (CrosstabCell) cre.getCells()
1546:                                    .elementAt(i);
1547:                            if (cell.getType() == cell.NODATA_CELL) {
1548:                                pw.print("\t\t\t\t\t<whenNoDataCell>");
1549:                                writeXMLCrosstabCellcontents(cell, cre
1550:                                        .getElements(), pw, "\t\t\t\t\t\t");
1551:                                pw.print("\t\t\t\t\t</whenNoDataCell>");
1552:                            }
1553:                        }
1554:
1555:                        pw.println("\t\t\t\t\t</crosstab>");
1556:                    }
1557:                }
1558:
1559:            }
1560:
1561:            void writeXMLBox(Box box, PrintWriter pw) {
1562:
1563:                if (CompatibilitySupport.version >= CompatibilitySupport.JR063) {
1564:                    if (box == null)
1565:                        return;
1566:                    pw.print("\t\t\t\t\t<box");
1567:
1568:                    if (box.getLeftPadding() > 0)
1569:                        pw.print(" leftPadding=\"" + box.getLeftPadding()
1570:                                + "\"");
1571:                    if (box.getRightPadding() > 0)
1572:                        pw.print(" rightPadding=\"" + box.getRightPadding()
1573:                                + "\"");
1574:                    if (box.getTopPadding() > 0)
1575:                        pw.print(" topPadding=\"" + box.getTopPadding() + "\"");
1576:                    if (box.getBottomPadding() > 0)
1577:                        pw.print(" bottomPadding=\"" + box.getBottomPadding()
1578:                                + "\"");
1579:
1580:                    if (CompatibilitySupport.version < CompatibilitySupport.JR204) {
1581:                        if (box.getTopBorder() != null)
1582:                            pw.print(" topBorder=\"" + box.getTopBorder()
1583:                                    + "\"");
1584:                        if (box.getTopBorderColor() != null)
1585:                            pw
1586:                                    .print(" topBorderColor=\""
1587:                                            + writeEncodedColor(box
1588:                                                    .getTopBorderColor())
1589:                                            + "\"");
1590:
1591:                        if (box.getLeftBorder() != null)
1592:                            pw.print(" leftBorder=\"" + box.getLeftBorder()
1593:                                    + "\"");
1594:                        if (box.getLeftBorderColor() != null)
1595:                            pw.print(" leftBorderColor=\""
1596:                                    + writeEncodedColor(box
1597:                                            .getLeftBorderColor()) + "\"");
1598:
1599:                        if (box.getRightBorder() != null)
1600:                            pw.print(" rightBorder=\"" + box.getRightBorder()
1601:                                    + "\"");
1602:                        if (box.getRightBorderColor() != null)
1603:                            pw.print(" rightBorderColor=\""
1604:                                    + writeEncodedColor(box
1605:                                            .getRightBorderColor()) + "\"");
1606:
1607:                        if (box.getBottomBorder() != null)
1608:                            pw.print(" bottomBorder=\"" + box.getBottomBorder()
1609:                                    + "\"");
1610:                        if (box.getBottomBorderColor() != null)
1611:                            pw.print(" bottomBorderColor=\""
1612:                                    + writeEncodedColor(box
1613:                                            .getBottomBorderColor()) + "\"");
1614:                    }
1615:
1616:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR204) {
1617:                        pw.print(">");
1618:                        if (box.getPen() != null)
1619:                            writeXMLPen(box.getPen(), pw);
1620:                        if (box.getTopPen() != null)
1621:                            writeXMLPen(box.getTopPen(), pw, "topPen");
1622:                        if (box.getLeftPen() != null)
1623:                            writeXMLPen(box.getLeftPen(), pw, "leftPen");
1624:                        if (box.getBottomPen() != null)
1625:                            writeXMLPen(box.getBottomPen(), pw, "bottomPen");
1626:                        if (box.getRightPen() != null)
1627:                            writeXMLPen(box.getRightPen(), pw, "rightPen");
1628:
1629:                        pw.println("</box>");
1630:                    } else {
1631:
1632:                        pw.println("/>");
1633:                    }
1634:
1635:                }
1636:            }
1637:
1638:            void writeFontElement(IReportFont font, PrintWriter pw) {
1639:
1640:                if (font == null)
1641:                    return;
1642:                pw.print("\t\t\t\t\t<font");
1643:
1644:                IReportFont base = getReport().getReportFontByName(
1645:                        font.getReportFont());
1646:
1647:                if (font.getReportFont() != null
1648:                        && font.getReportFont().length() > 0)
1649:                    pw.print(" reportFont=\"" + font.getReportFont() + "\"");
1650:
1651:                if (base != null
1652:                        && base.getFontName().equals(font.getFontName())) { /* use default value */
1653:                } else if (font.getFontName() != null
1654:                        && font.getFontName().length() > 0)
1655:                    pw.print(" fontName=\"" + font.getFontName() + "\"");
1656:
1657:                if (base != null
1658:                        && base.getPDFFontName().equals(font.getPDFFontName())) { /* use default value */
1659:                } else if (font.getPDFFontName() != null
1660:                        && font.getPDFFontName().length() > 0)
1661:                    pw.print(" pdfFontName=\"" + font.getPDFFontName() + "\"");
1662:
1663:                if (base != null && base.getFontSize() == font.getFontSize()) { /* use default value */
1664:                } else
1665:                    pw.print(" size=\"" + font.getFontSize() + "\"");
1666:
1667:                if (base != null && base.isBold() == font.isBold()) { /* use default value */
1668:                } else
1669:                    pw.print(" isBold=\""
1670:                            + ((font.isBold()) ? "true" : "false") + "\"");
1671:
1672:                if (base != null && base.isItalic() == font.isItalic()) { /* use default value */
1673:                } else
1674:                    pw.print(" isItalic=\""
1675:                            + ((font.isItalic()) ? "true" : "false") + "\"");
1676:
1677:                if (base != null && base.isUnderline() == font.isUnderline()) { /* use default value */
1678:                } else
1679:                    pw.print(" isUnderline=\""
1680:                            + ((font.isUnderline()) ? "true" : "false") + "\"");
1681:
1682:                if (base != null
1683:                        && base.isStrikeTrought() == font.isStrikeTrought()) { /* use default value */
1684:                } else
1685:                    pw.print(" isStrikeThrough=\""
1686:                            + ((font.isStrikeTrought()) ? "true" : "false")
1687:                            + "\"");
1688:
1689:                if (base != null
1690:                        && base.isPdfEmbedded() == font.isPdfEmbedded()) { /* use default value */
1691:                } else
1692:                    pw.print(" isPdfEmbedded=\""
1693:                            + ((font.isPdfEmbedded()) ? "true" : "false")
1694:                            + "\"");
1695:
1696:                if (base != null
1697:                        && base.getPdfEncoding().equals(font.getPdfEncoding())) { /* use default value */
1698:                } else if (font.getPdfEncoding() != null
1699:                        && font.getPdfEncoding().length() > 0)
1700:                    pw.print(" pdfEncoding=\"" + font.getPdfEncoding() + "\"");
1701:
1702:                pw.println("/>");
1703:            }
1704:
1705:            void writeXMLReportElementElement(ReportElement re, PrintWriter pw) {
1706:                pw.print("\t\t\t\t\t<reportElement");
1707:
1708:                if (CompatibilitySupport.version >= CompatibilitySupport.JR111) {
1709:                    if (re.getStyle() != null)
1710:                        pw.print("\n\t\t\t\t\t\tstyle=\"" + re.getStyle()
1711:                                + "\"");
1712:                }
1713:
1714:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getTransparent(),Style.ATTRIBUTE_mode,re.getStyle(), getDefaultStyle()))
1715:                {
1716:                    if (re.getPropertyValue(re.MODE) != null) {
1717:                        pw.print("\n\t\t\t\t\t\tmode=\"" + re.getTransparent()
1718:                                + "\"");
1719:                    }
1720:                }
1721:
1722:                int position_x = re.getPosition().x;
1723:
1724:                if (re.getParentElement() != null)
1725:                    position_x -= re.getParentElement().getPosition().x;
1726:                else if (re.getCell() != null)
1727:                    position_x = position_x - re.getCell().getLeft() - 10;
1728:                else
1729:                    position_x = position_x - getReport().getLeftMargin() - 10;
1730:
1731:                pw.print("\n\t\t\t\t\t\tx=\"" + position_x + "\"");
1732:
1733:                int position_y = re.getPosition().y;
1734:                if (re.getParentElement() != null)
1735:                    position_y -= re.getParentElement().getPosition().y;
1736:                else if (re.getCell() != null)
1737:                    position_y = position_y - re.getCell().getTop() - 10;
1738:                else
1739:                    position_y = position_y - 10
1740:                            - getReport().getBandYLocation(re.getBand());
1741:
1742:                pw.print("\n\t\t\t\t\t\ty=\"" + position_y + "\"");
1743:
1744:                pw.print("\n\t\t\t\t\t\twidth=\"" + re.getWidth() + "\"");
1745:                pw.print("\n\t\t\t\t\t\theight=\"" + re.getHeight() + "\"");
1746:
1747:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getFgcolor(),Style.ATTRIBUTE_forecolor,re.getStyle(), getDefaultStyle()))
1748:                {
1749:                    if (re.getColorValue(re.FGCOLOR, null) != null) {
1750:                        pw.print("\n\t\t\t\t\t\tforecolor=\""
1751:                                + writeEncodedColor(re.getColorValue(
1752:                                        re.FGCOLOR, null)) + "\"");
1753:                    }
1754:                }
1755:
1756:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 || !Style.isDefaultValue(re.getBgcolor(),Style.ATTRIBUTE_backcolor,re.getStyle(), getDefaultStyle()) )
1757:                {
1758:                    if (re.getColorValue(re.BGCOLOR, null) != null) {
1759:                        pw.print("\n\t\t\t\t\t\tbackcolor=\""
1760:                                + writeEncodedColor(re.getColorValue(
1761:                                        re.BGCOLOR, null)) + "\"");
1762:                    }
1763:                }
1764:
1765:                // if =052 compatibility....
1766:                if (!re.getKey().equals("")) {
1767:                    pw.print("\n\t\t\t\t\t\tkey=\"" + re.getKey() + "\"");
1768:                }
1769:
1770:                if (!re.getStretchType().equals("NoStretch")) {
1771:                    pw.print("\n\t\t\t\t\t\tstretchType=\""
1772:                            + re.getStretchType() + "\"");
1773:                }
1774:
1775:                if (!re.getPositionType().equals("FixRelativeToTop")) {
1776:                    pw.print("\n\t\t\t\t\t\tpositionType=\""
1777:                            + re.getPositionType() + "\"");
1778:                }
1779:
1780:                if (re.isIsPrintRepeatedValues() != true) {
1781:                    pw.print("\n\t\t\t\t\t\tisPrintRepeatedValues=\""
1782:                            + re.isIsPrintRepeatedValues() + "\"");
1783:                }
1784:                if (re.isIsRemoveLineWhenBlank() != false) {
1785:                    pw.print("\n\t\t\t\t\t\tisRemoveLineWhenBlank=\""
1786:                            + re.isIsRemoveLineWhenBlank() + "\"");
1787:                }
1788:                if (re.isIsPrintInFirstWholeBand() != false) {
1789:                    pw.print("\n\t\t\t\t\t\tisPrintInFirstWholeBand=\""
1790:                            + re.isIsPrintInFirstWholeBand() + "\"");
1791:                }
1792:
1793:                if (re.getPrintWhenGroupChanges() != null
1794:                        && re.getPrintWhenGroupChanges().trim().length() > 0)
1795:                    pw.print("\n\t\t\t\t\t\tprintWhenGroupChanges=\""
1796:                            + re.getPrintWhenGroupChanges() + "\"");
1797:
1798:                if (re.isIsPrintWhenDetailOverflows() != false) {
1799:                    pw.print("\n\t\t\t\t\t\tisPrintWhenDetailOverflows=\""
1800:                            + re.isIsPrintWhenDetailOverflows() + "\"");
1801:                }
1802:
1803:                boolean closeTag = false;
1804:                if (re.getPrintWhenExpression().length() > 0) {
1805:                    pw.println(">");
1806:                    pw.print("\t\t\t\t\t\t\t<printWhenExpression");
1807:                    /*
1808:                    if(getReport().isUsingMultiLineExpressions()) {
1809:                            pw.print(" isCode=\"true\" ");
1810:                    }
1811:                     */
1812:                    pw.println(">"
1813:                            + getCDATAString(re.getPrintWhenExpression(), 7)
1814:                            + "</printWhenExpression>");
1815:                    closeTag = true;
1816:                }
1817:
1818:                if (CompatibilitySupport.version >= CompatibilitySupport.JR203
1819:                        && re.getElementProperties() != null
1820:                        && re.getElementProperties().size() > 0) {
1821:                    if (!closeTag)
1822:                        pw.println(">");
1823:                    writeXMLProperties(re.getElementProperties(), false, pw,
1824:                            "\t\t\t\t\t\t\t");
1825:                    closeTag = true;
1826:                }
1827:
1828:                if (closeTag) {
1829:                    pw.println("\t\t\t\t\t\t</reportElement>");
1830:                } else {
1831:                    pw.println("/>");
1832:                }
1833:
1834:            }
1835:
1836:            public static String getCDATAString(String string, int tabCount) {
1837:                //if ( ! Utils.needToBeInsideCDATA( string ) )
1838:                //	return string;
1839:                String CRLF = System.getProperty("line.separator");
1840:                String tab = "";
1841:                for (int i = 0; i < tabCount; i++) {
1842:                    tab += "\t";
1843:                }
1844:                return "<![CDATA[" + string + "]]>"; // + CRLF + tab ;
1845:            }
1846:
1847:            void writeXMLGraphicElement(GraphicReportElement re, PrintWriter pw) {
1848:                pw.print("\t\t\t\t\t<graphicElement");
1849:
1850:                pw.print(" stretchType=\"" + re.getStretchType() + "\"");
1851:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getGraphicElementPen(),Style.ATTRIBUTE_pen,re.getStyle(), getDefaultStyle()))
1852:                if (CompatibilitySupport.version < CompatibilitySupport.JR204) {
1853:                    if (re.getPropertyValue(re.PEN) != null) {
1854:                        pw.print(" pen=\"" + re.getGraphicElementPen() + "\"");
1855:                    }
1856:                }
1857:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getFill(),Style.ATTRIBUTE_fill,re.getStyle(), getDefaultStyle()))
1858:
1859:                if (re.getPropertyValue(GraphicReportElement.FILL) != null) {
1860:                    pw.print(" fill=\"" + re.getFill() + "\" ");
1861:                }
1862:
1863:                if (CompatibilitySupport.version >= CompatibilitySupport.JR204) {
1864:                    if (re.getPen() != null) {
1865:                        pw.println(">");
1866:                        writeXMLPen(re.getPen(), pw);
1867:                        pw.println("</graphicElement>");
1868:                    } else {
1869:                        pw.println("/>");
1870:                    }
1871:                } else {
1872:
1873:                    pw.println("/>");
1874:                }
1875:            }
1876:
1877:            public void writeXMLPen(Pen pen, PrintWriter pw) {
1878:                writeXMLPen(pen, pw, "pen");
1879:            }
1880:
1881:            public void writeXMLPen(Pen pen, PrintWriter pw, String tagName) {
1882:                pw.print("\t\t\t\t\t<" + tagName);
1883:                pw.print(" lineWidth=\"" + pen.getLineWidth() + "\"");
1884:                if (pen.getLineStyle() != null
1885:                        && !pen.getLineStyle().equals("null")) {
1886:                    pw.print(" lineStyle=\"" + pen.getLineStyle() + "\"");
1887:                }
1888:                if (pen.getLineColor() != null)
1889:                    pw.print(" lineColor=\""
1890:                            + writeEncodedColor(pen.getLineColor()) + "\"");
1891:                pw.println("/>");
1892:            }
1893:
1894:            void writeXMLCrosstabRowGroups(Vector crosstabRowGroups,
1895:                    Vector crosstabElements, PrintWriter pw) {
1896:
1897:                for (int i = 0; i < crosstabRowGroups.size(); ++i) {
1898:                    CrosstabRowGroup group = (CrosstabRowGroup) crosstabRowGroups
1899:                            .elementAt(i);
1900:
1901:                    pw.print("\t\t\t\t\t<rowGroup");
1902:                    pw.print(" name=\"" + group.getName() + "\"");
1903:                    pw.print(" width=\"" + group.getWidth() + "\"");
1904:                    if (!group.getTotalPosition().equals("None"))
1905:                        pw.print(" totalPosition=\"" + group.getTotalPosition()
1906:                                + "\"");
1907:                    if (!group.getHeaderPosition().equals("Top"))
1908:                        pw.print(" headerPosition=\""
1909:                                + group.getHeaderPosition() + "\"");
1910:                    pw.println(">");
1911:
1912:                    // BUCKET
1913:                    writeXMLBucket(group, pw);
1914:
1915:                    if (group.getHeaderCell().getHeight() > 0
1916:                            && group.getHeaderCell().getWidth() > 0) {
1917:                        pw.println("\t\t\t\t\t\t<crosstabRowHeader>");
1918:                        writeXMLCrosstabCellcontents(group.getHeaderCell(),
1919:                                crosstabElements, pw, "\t\t\t\t\t\t\t");
1920:                        pw.println("\t\t\t\t\t\t</crosstabRowHeader>");
1921:                    }
1922:
1923:                    if (group.getTotalCell().getHeight() > 0
1924:                            && group.getTotalCell().getWidth() > 0) {
1925:                        pw.println("\t\t\t\t\t\t<crosstabTotalRowHeader>");
1926:                        writeXMLCrosstabCellcontents(group.getTotalCell(),
1927:                                crosstabElements, pw, "\t\t\t\t\t\t\t");
1928:                        pw.println("\t\t\t\t\t\t</crosstabTotalRowHeader>");
1929:                    }
1930:
1931:                    pw.println("\t\t\t\t\t</rowGroup>");
1932:                }
1933:
1934:            }
1935:
1936:            void writeXMLCrosstabColumnGroups(Vector crosstabColumnGroups,
1937:                    Vector crosstabElements, PrintWriter pw) {
1938:
1939:                for (int i = 0; i < crosstabColumnGroups.size(); ++i) {
1940:                    CrosstabColumnGroup group = (CrosstabColumnGroup) crosstabColumnGroups
1941:                            .elementAt(i);
1942:
1943:                    pw.print("\t\t\t\t\t<columnGroup");
1944:                    pw.print(" name=\"" + group.getName() + "\"");
1945:                    pw.print(" height=\"" + group.getHeight() + "\"");
1946:                    if (!group.getTotalPosition().equals("None"))
1947:                        pw.print(" totalPosition=\"" + group.getTotalPosition()
1948:                                + "\"");
1949:                    if (!group.getHeaderPosition().equals("Left"))
1950:                        pw.print(" headerPosition=\""
1951:                                + group.getHeaderPosition() + "\"");
1952:                    pw.println(">");
1953:
1954:                    // BUCKET
1955:                    writeXMLBucket(group, pw);
1956:
1957:                    if (group.getHeaderCell().getHeight() > 0
1958:                            && group.getHeaderCell().getWidth() > 0) {
1959:                        pw.println("\t\t\t\t\t\t<crosstabColumnHeader>");
1960:                        writeXMLCrosstabCellcontents(group.getHeaderCell(),
1961:                                crosstabElements, pw, "\t\t\t\t\t\t\t");
1962:                        pw.println("\t\t\t\t\t\t</crosstabColumnHeader>");
1963:                    }
1964:
1965:                    if (group.getTotalCell().getHeight() > 0
1966:                            && group.getTotalCell().getWidth() > 0) {
1967:                        pw.println("\t\t\t\t\t\t<crosstabTotalColumnHeader>");
1968:                        writeXMLCrosstabCellcontents(group.getTotalCell(),
1969:                                crosstabElements, pw, "\t\t\t\t\t\t\t");
1970:                        pw.println("\t\t\t\t\t\t</crosstabTotalColumnHeader>");
1971:                    }
1972:
1973:                    pw.println("\t\t\t\t\t</columnGroup>");
1974:                }
1975:
1976:            }
1977:
1978:            void writeXMLCrosstabCellcontents(CrosstabCell cell,
1979:                    Vector elements, PrintWriter pw, String tabs) {
1980:
1981:                pw.print("\t\t\t\t\t\t<cellContents");
1982:                if (cell.getBackcolor() != null)
1983:                    pw.print(" backcolor=\""
1984:                            + writeEncodedColor(cell.getBackcolor()) + "\"");
1985:                if (CompatibilitySupport.version >= CompatibilitySupport.JR120) {
1986:                    pw.print(" mode=\"" + cell.getMode() + "\"");
1987:                }
1988:
1989:                if (CompatibilitySupport.version >= CompatibilitySupport.JR120
1990:                        && cell.getStyle() != null) {
1991:                    pw.print(" style=\"" + cell.getStyle() + "\"");
1992:                }
1993:
1994:                pw.println(">");
1995:
1996:                if (cell.getBox() != null) {
1997:                    writeXMLBox(cell.getBox(), pw);
1998:                }
1999:
2000:                for (int i = 0; i < elements.size(); ++i) {
2001:                    ReportElement re = (ReportElement) elements.elementAt(i);
2002:                    if (re.getCell() == cell) {
2003:                        writeXMLReportElement(re, pw);
2004:                    }
2005:                }
2006:                pw.println("\t\t\t\t\t\t</cellContents>");
2007:            }
2008:
2009:            void writeXMLCrosstabCells(Vector cells, Vector elements,
2010:                    PrintWriter pw, String tabs) {
2011:
2012:                for (int i = 0; i < cells.size(); ++i) {
2013:                    CrosstabCell cell = (CrosstabCell) cells.elementAt(i);
2014:                    // Write the cell only if it is a DETAIL cell and if at least one of this expressions is true:
2015:                    // height>0 and width > 0
2016:                    // is the pure detail cell (columnTotal and RowTotal are blank)
2017:                    if (cell.getType() == cell.DETAIL_CELL)
2018:                    //&& ( (cell.getWidth() > 0 && cell.getHeight()>0) ||
2019:                    //  (cell.getColumnTotalGroup().equals("") && cell.getRowTotalGroup().equals(""))))
2020:                    {
2021:                        pw.print(tabs + "<crosstabCell");
2022:                        pw.print(" width=\"" + cell.getWidth() + "\"");
2023:                        pw.print(" height=\"" + cell.getHeight() + "\"");
2024:                        if (cell.getRowTotalGroup().trim().length() > 0)
2025:                            pw.print(" rowTotalGroup=\""
2026:                                    + cell.getRowTotalGroup() + "\"");
2027:                        if (cell.getColumnTotalGroup().trim().length() > 0)
2028:                            pw.print(" columnTotalGroup=\""
2029:                                    + cell.getColumnTotalGroup() + "\"");
2030:                        pw.println(">");
2031:                        writeXMLCrosstabCellcontents(cell, elements, pw, tabs
2032:                                + "\t");
2033:
2034:                        pw.println(tabs + "</crosstabCell>");
2035:                    }
2036:                }
2037:            }
2038:
2039:            void writeXMLBucket(CrosstabGroup group, PrintWriter pw) {
2040:
2041:                pw.print("\t\t\t\t\t\t<bucket");
2042:                if (!group.getBucketOrder().equals("Ascending"))
2043:                    pw.print(" order=\"" + group.getBucketOrder() + "\"");
2044:                pw.println(">");
2045:                pw.print("\t\t\t\t\t\t\t<bucketExpression");
2046:                pw.print(" class=\"" + group.getBucketExpressionClass() + "\"");
2047:                pw.print(">");
2048:                pw.print(getCDATAString(group.getBucketExpression(), 8));
2049:                pw.println("</bucketExpression>");
2050:
2051:                if (group.getBucketComparatorExpression().trim().length() > 0) {
2052:                    pw.print("\t\t\t\t\t\t\t<comparatorExpression>");
2053:                    pw.print(getCDATAString(group
2054:                            .getBucketComparatorExpression(), 8));
2055:                    pw.println("</comparatorExpression>");
2056:                }
2057:                pw.println("\t\t\t\t\t\t</bucket>");
2058:            }
2059:
2060:            void writeXMLTextElementElement(TextReportElement re, PrintWriter pw) {
2061:                java.text.NumberFormat nf = java.text.NumberFormat
2062:                        .getInstance();
2063:                nf.setGroupingUsed(false);
2064:                nf.setMaximumFractionDigits(0);
2065:
2066:                pw.print("\t\t\t\t\t<textElement");
2067:
2068:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getAlign()+"",Style.ATTRIBUTE_hAlign,re.getStyle(), getDefaultStyle()))
2069:                if (re.getPropertyValue(re.ALIGN) != null) {
2070:                    pw.print(" textAlignment=\"" + re.getAlign() + "\"");
2071:                }
2072:
2073:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getVerticalAlign()+"",Style.ATTRIBUTE_vAlign,re.getStyle(), getDefaultStyle()))
2074:                if (re.getPropertyValue(re.VERTICAL_ALIGN) != null) {
2075:                    pw.print(" verticalAlignment=\"" + re.getVerticalAlign()
2076:                            + "\"");
2077:                }
2078:
2079:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getRotate()+"",Style.ATTRIBUTE_rotation,re.getStyle(), getDefaultStyle()))
2080:                if (re.getPropertyValue(re.ROTATE) != null) {
2081:                    pw.print(" rotation=\"" + re.getRotate() + "\"");
2082:                }
2083:
2084:                // From JasperReport 0.5.3
2085:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.isIsStyledText()+"",Style.ATTRIBUTE_isStyledText,re.getStyle(), getDefaultStyle()))
2086:                if (re.getPropertyValue(re.IS_STYLED_TEXT) != null) {
2087:                    if (re.isIsStyledText()) {
2088:                        pw.print(" isStyledText=\"true\"");
2089:                    }
2090:                }
2091:
2092:                if (CompatibilitySupport.version >= CompatibilitySupport.JR205) {
2093:                    if (re.getMarkup() != null && !re.getMarkup().equals("")) {
2094:                        pw.print(" markup=\"" + re.getMarkup() + "\"");
2095:                    }
2096:
2097:                }
2098:
2099:                //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getLineSpacing()+"",Style.ATTRIBUTE_lineSpacing,re.getStyle(), getDefaultStyle()))
2100:                if (re.getPropertyValue(re.LINE_SPACING) != null) {
2101:                    pw.print(" lineSpacing=\"" + re.getLineSpacing() + "\"");
2102:                }
2103:                // FONT SECTION. This code saves only difference between
2104:                // the report font (if sepcified)...
2105:
2106:                pw.println(">");
2107:                pw.print("\t\t\t\t\t\t<font");
2108:
2109:                IReportFont font = null;
2110:                if (re.getReportFont() != null
2111:                        && re.getReportFont().length() > 0) {
2112:                    // Search the right font structure...
2113:                    for (int fn = 0; fn < getReport().getFonts().size(); ++fn) {
2114:                        font = (IReportFont) getReport().getFonts().elementAt(
2115:                                fn);
2116:                        if (font != null
2117:                                && font.getReportFont().equals(
2118:                                        re.getReportFont())) {
2119:                            break;
2120:                        } else {
2121:                            font = null;
2122:                        }
2123:                    }
2124:                    pw.print(" reportFont=\"" + re.getReportFont() + "\"");
2125:                }
2126:
2127:                if (font == null
2128:                        || !font.getFontName().equals(re.getFontName())) {
2129:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getFontName()+"",Style.ATTRIBUTE_fontName,re.getStyle(), getDefaultStyle()))
2130:                    if (re.getIReportFont().getPropertyValue(
2131:                            IReportFont.FONT_NAME) != null) {
2132:                        pw.print(" fontName=\"" + re.getFontName() + "\"");
2133:                    }
2134:                }
2135:
2136:                if (font == null
2137:                        || !font.getPDFFontName().equalsIgnoreCase(
2138:                                re.getPDFFontName())) {
2139:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getPDFFontName()+"",Style.ATTRIBUTE_pdfFontName,re.getStyle(), getDefaultStyle()))
2140:                    if (re.getIReportFont().getPropertyValue(
2141:                            IReportFont.PDF_FONT_NAME) != null) {
2142:                        pw
2143:                                .print(" pdfFontName=\"" + re.getPDFFontName()
2144:                                        + "\"");
2145:                    }
2146:                }
2147:
2148:                //pw.print(" pdfEncoding=\"Times-Roman\"");
2149:                if (font == null || font.getFontSize() != re.getFontSize()) {
2150:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getFontSize()+"",Style.ATTRIBUTE_fontSize,re.getStyle(), getDefaultStyle()))
2151:                    if (re.getIReportFont().getPropertyValue(
2152:                            IReportFont.FONT_SIZE) != null) {
2153:                        pw.print(" size=\"" + re.getFontSize() + "\"");
2154:                    }
2155:                }
2156:
2157:                if (font == null || font.isBold() != re.isBold()) {
2158:
2159:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.isBold()+"",Style.ATTRIBUTE_isBold,re.getStyle(), getDefaultStyle()))
2160:                    if (re.getIReportFont().getPropertyValue(
2161:                            IReportFont.IS_BOLD) != null) {
2162:                        pw.print(" isBold=\""
2163:                                + ((re.isBold()) ? "true" : "false") + "\"");
2164:                    }
2165:                }
2166:
2167:                if (font == null || font.isItalic() != re.isItalic()) {
2168:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.isItalic()+"",Style.ATTRIBUTE_isItalic,re.getStyle(), getDefaultStyle()))
2169:                    if (re.getIReportFont().getPropertyValue(
2170:                            IReportFont.IS_ITALIC) != null) {
2171:                        pw.print(" isItalic=\""
2172:                                + ((re.isItalic()) ? "true" : "false") + "\"");
2173:                    }
2174:                }
2175:
2176:                if (font == null || font.isUnderline() != re.isUnderline()) {
2177:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.isUnderline()+"",Style.ATTRIBUTE_isUnderline,re.getStyle(), getDefaultStyle()))
2178:                    if (re.getIReportFont().getPropertyValue(
2179:                            IReportFont.IS_UNDERLINE) != null) {
2180:                        pw.print(" isUnderline=\""
2181:                                + ((re.isUnderline()) ? "true" : "false")
2182:                                + "\"");
2183:                    }
2184:                }
2185:
2186:                if (font == null || font.isPdfEmbedded() != re.isPdfEmbedded()) {
2187:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.isPdfEmbedded()+"",Style.ATTRIBUTE_isPdfEmbedded,re.getStyle(), getDefaultStyle()))
2188:                    if (re.getIReportFont().getPropertyValue(
2189:                            IReportFont.IS_PDF_EMBEDDED) != null) {
2190:                        pw.print(" isPdfEmbedded =\""
2191:                                + ((re.isPdfEmbedded()) ? "true" : "false")
2192:                                + "\"");
2193:                    }
2194:                }
2195:
2196:                if (font == null || font.getPdfEncoding() == null
2197:                        || font.getPdfEncoding().length() == 0) {
2198:                    //if (re.getPdfEncoding() != null && re.getPdfEncoding().length() > 0) {
2199:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.getPdfEncoding()+"",Style.ATTRIBUTE_pdfEncoding,re.getStyle(), getDefaultStyle()))
2200:                    if (re.getIReportFont().getPropertyValue(
2201:                            IReportFont.PDF_ENCODING) != null
2202:                            && re.getPdfEncoding().length() > 0) {
2203:                        pw.print(" pdfEncoding =\"" + re.getPdfEncoding()
2204:                                + "\"");
2205:                    }
2206:                    //}
2207:                }
2208:                if (font == null
2209:                        || font.isStrikeTrought() != re.isStrikeTrought()) {
2210:                    //if (CompatibilitySupport.version < CompatibilitySupport.JR111 ||  !Style.isDefaultValue(re.isStrikeTrought()+"",Style.ATTRIBUTE_isStrikeThrough,re.getStyle(), getDefaultStyle()))
2211:                    if (re.getIReportFont().getPropertyValue(
2212:                            IReportFont.IS_STRIKETROUGHT) != null) {
2213:                        pw.print(" isStrikeThrough=\""
2214:                                + ((re.isStrikeTrought()) ? "true" : "false")
2215:                                + "\" ");
2216:                    }
2217:                }
2218:
2219:                pw.println("/>");
2220:                pw.println("\t\t\t\t\t</textElement>");
2221:            }
2222:
2223:            public static String writeEncodedColor(java.awt.Color c) {
2224:                String nums = "0123456789ABCDEF";
2225:                String s = "#";
2226:                s += nums.charAt(c.getRed() / 16);
2227:                s += nums.charAt(c.getRed() % 16);
2228:                s += nums.charAt(c.getGreen() / 16);
2229:                s += nums.charAt(c.getGreen() % 16);
2230:                s += nums.charAt(c.getBlue() / 16);
2231:                s += nums.charAt(c.getBlue() % 16);
2232:                return s;
2233:            }
2234:
2235:            private String writeChartExpression(ChartReportElement chartElement) {
2236:                String expression = "";
2237:
2238:                expression = "(java.awt.Image)it.businesslogic.ireport.chart.DefaultChartFactory.drawChart(new String[]{";
2239:
2240:                Properties props = chartElement.getProps();
2241:                Iterator keys = props.keySet().iterator();
2242:                int i = 0;
2243:                while (keys.hasNext()) {
2244:                    String key = "" + keys.next();
2245:                    String val = props.getProperty(key);
2246:                    if (i > 0)
2247:                        expression += ",";
2248:                    val = Misc.string_replace("\\\"", "\"", val);
2249:                    expression += "\"" + key + "=" + val + "\"";
2250:                    i++;
2251:                }
2252:                expression += "}, (it.businesslogic.ireport.IReportScriptlet)$P{REPORT_SCRIPTLET})";
2253:
2254:                return expression;
2255:            }
2256:
2257:            private void writeChartElement(ChartReportElement2 chartElement,
2258:                    PrintWriter pw) {
2259:
2260:                if (CompatibilitySupport.version >= CompatibilitySupport.JR100) {
2261:                    String chartType = "";
2262:                    if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.PieChart)
2263:                        chartType = "pieChart";
2264:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.Pie3DChart)
2265:                        chartType = "pie3DChart";
2266:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.BarChart)
2267:                        chartType = "barChart";
2268:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.Bar3DChart)
2269:                        chartType = "bar3DChart";
2270:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.XYBarChart)
2271:                        chartType = "xyBarChart";
2272:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.StackedBarChart)
2273:                        chartType = "stackedBarChart";
2274:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.StackedBar3DChart)
2275:                        chartType = "stackedBar3DChart";
2276:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.LineChart)
2277:                        chartType = "lineChart";
2278:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.XYLineChart)
2279:                        chartType = "xyLineChart";
2280:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.AreaChart)
2281:                        chartType = "areaChart";
2282:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.StackedAreaChart)
2283:                        chartType = "stackedAreaChart";
2284:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.XYAreaChart)
2285:                        chartType = "xyAreaChart";
2286:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.ScatterChart)
2287:                        chartType = "scatterChart";
2288:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.BubbleChart)
2289:                        chartType = "bubbleChart";
2290:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.TimeSeriesChart)
2291:                        chartType = "timeSeriesChart";
2292:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.HighLowChart)
2293:                        chartType = "highLowChart";
2294:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.CandlestickChart)
2295:                        chartType = "candlestickChart";
2296:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.MeterChart)
2297:                        chartType = "meterChart";
2298:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.ThermometerChart)
2299:                        chartType = "thermometerChart";
2300:                    else if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.MultiAxisChart)
2301:                        chartType = "multiAxisChart";
2302:
2303:                    if (chartElement.getChart() instanceof  it.businesslogic.ireport.chart.StackedAreaChart
2304:                            && CompatibilitySupport.version < CompatibilitySupport.JR131) {
2305:                        return;
2306:                    }
2307:
2308:                    pw.println("\t\t\t\t<" + chartType + ">");
2309:                    writeChartNode(chartElement, pw);
2310:                    writeDataset(chartElement, pw);
2311:                    writePlot(chartElement, pw);
2312:                    pw.println("\t\t\t\t</" + chartType + ">");
2313:                }
2314:            }
2315:
2316:            private void writeChartNode(ChartReportElement2 chartElement,
2317:                    PrintWriter pw) {
2318:                pw.print("\t\t\t\t\t<chart ");
2319:                if (!chartElement.getChart().isShowLegend())
2320:                    pw.print("isShowLegend=\"false\" ");
2321:                if (!chartElement.getEvaluationTime().equals("Now"))
2322:                    pw.print("evaluationTime=\""
2323:                            + chartElement.getEvaluationTime() + "\" ");
2324:                if (!chartElement.getEvaluationGroup().equals(""))
2325:                    pw.print("evaluationGroup=\""
2326:                            + chartElement.getEvaluationGroup() + "\" ");
2327:                if (!chartElement.getChart().getHyperlinkType().equals("None"))
2328:                    pw.print(" hyperlinkType=\""
2329:                            + chartElement.getChart().getHyperlinkType()
2330:                            + "\" ");
2331:                if (!chartElement.getChart().getHyperlinkTarget()
2332:                        .equals("None"))
2333:                    pw.print(" hyperlinkTarget=\""
2334:                            + chartElement.getChart().getHyperlinkTarget()
2335:                            + "\" ");
2336:                if (chartElement.getChart().getBookmarkLevel() != 0)
2337:                    pw.print(" bookmarkLevel=\""
2338:                            + chartElement.getChart().getBookmarkLevel()
2339:                            + "\" ");
2340:                if (chartElement.getChart().getCustomizerClass().length() != 0)
2341:                    pw.print(" customizerClass=\""
2342:                            + chartElement.getChart().getCustomizerClass()
2343:                            + "\" ");
2344:
2345:                if (CompatibilitySupport.version >= CompatibilitySupport.JR205) {
2346:                    if (chartElement.getRenderType() != null
2347:                            && chartElement.getRenderType().length() != 0)
2348:                        pw.print(" renderType=\""
2349:                                + chartElement.getRenderType() + "\" ");
2350:                }
2351:
2352:                pw.println(">");
2353:                writeXMLReportElementElement(chartElement, pw);
2354:                writeXMLBox(chartElement.getBox(), pw);
2355:                writeChartTitleNode(chartElement, pw);
2356:                writeChartSubTitleNode(chartElement, pw);
2357:
2358:                //if (chartElement.getChart().isShowLegend())
2359:                if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
2360:                    writeChartLegendNode(chartElement, pw);
2361:                }
2362:
2363:                writeHyperLinkExpressions(chartElement.getChart(), pw);
2364:                pw.println("\t\t\t\t\t</chart>");
2365:            }
2366:
2367:            private void writeSectionItemHyperLinkExpressions(
2368:                    SectionItemHyperlink hlink, boolean isItem, PrintWriter pw) {
2369:                String tag = "sectionHyperlink";
2370:                if (isItem)
2371:                    tag = "itemHyperlink";
2372:
2373:                if (CompatibilitySupport.version >= CompatibilitySupport.JR126) {
2374:                    pw.print("\t\t\t\t<" + tag + " ");
2375:                    if (hlink.getHyperlinkType() != null
2376:                            && !hlink.getHyperlinkType().equals("None")
2377:                            && hlink.getHyperlinkType().length() > 0) {
2378:                        pw.print("  hyperlinkType=\""
2379:                                + hlink.getHyperlinkType() + "\"");
2380:                    }
2381:                    if (hlink.getHyperlinkTarget() != null
2382:                            && !hlink.getHyperlinkTarget().equals("Self")) {
2383:                        pw.print("  hyperlinkTarget=\""
2384:                                + hlink.getHyperlinkTarget() + "\"");
2385:                    }
2386:                    pw.println(">");
2387:
2388:                    if (hlink.getHyperlinkType() != null
2389:                            && hlink.getHyperlinkType().length() > 0) {
2390:                        if (hlink.getHyperlinkReferenceExpression().length() > 0) {
2391:                            pw
2392:                                    .println("\t\t\t\t\t\t<hyperlinkReferenceExpression>"
2393:                                            + getCDATAString(
2394:                                                    hlink
2395:                                                            .getHyperlinkReferenceExpression(),
2396:                                                    6)
2397:                                            + "</hyperlinkReferenceExpression>");
2398:                        }
2399:
2400:                        if (hlink.getHyperlinkAnchorExpression().length() > 0) {
2401:                            pw
2402:                                    .println("\t\t\t\t\t\t<hyperlinkAnchorExpression>"
2403:                                            + getCDATAString(
2404:                                                    hlink
2405:                                                            .getHyperlinkAnchorExpression(),
2406:                                                    6)
2407:                                            + "</hyperlinkAnchorExpression>");
2408:                        }
2409:
2410:                        if (hlink.getHyperlinkPageExpression().length() > 0) {
2411:                            pw.println("\t\t\t\t\t\t<hyperlinkPageExpression>"
2412:                                    + getCDATAString(hlink
2413:                                            .getHyperlinkPageExpression(), 6)
2414:                                    + "</hyperlinkPageExpression>");
2415:                        }
2416:
2417:                        if (hlink.getHyperlinkTooltipExpression().length() > 0) {
2418:                            pw
2419:                                    .println("\t\t\t\t\t\t<hyperlinkTooltipExpression>"
2420:                                            + getCDATAString(
2421:                                                    hlink
2422:                                                            .getHyperlinkTooltipExpression(),
2423:                                                    6)
2424:                                            + "</hyperlinkTooltipExpression>");
2425:                        }
2426:
2427:                        writeXMLHyperlinkParameters(hlink
2428:                                .getHyperlinkParameters(), pw, "\t\t\t\t\t\t");
2429:                    }
2430:
2431:                    pw.println("\t\t\t\t</" + tag + ">");
2432:                }
2433:            }
2434:
2435:            private void writeHyperLinkExpressions(
2436:                    HyperLinkableReportElement hlink, PrintWriter pw) {
2437:                if (hlink.getAnchorNameExpression() != null
2438:                        && hlink.getAnchorNameExpression().length() > 0) {
2439:                    pw
2440:                            .println("\t\t\t\t\t\t<anchorNameExpression>"
2441:                                    + getCDATAString(hlink
2442:                                            .getAnchorNameExpression(), 6)
2443:                                    + "</anchorNameExpression>");
2444:                }
2445:                if (hlink.getHyperlinkType() != null
2446:                        && hlink.getHyperlinkType().length() > 0) {
2447:
2448:                    if (hlink.getHyperlinkReferenceExpression().length() > 0) {
2449:                        pw.println("\t\t\t\t\t\t<hyperlinkReferenceExpression>"
2450:                                + getCDATAString(hlink
2451:                                        .getHyperlinkReferenceExpression(), 6)
2452:                                + "</hyperlinkReferenceExpression>");
2453:                    }
2454:
2455:                    if (hlink.getHyperlinkAnchorExpression().length() > 0) {
2456:                        pw.println("\t\t\t\t\t\t<hyperlinkAnchorExpression>"
2457:                                + getCDATAString(hlink
2458:                                        .getHyperlinkAnchorExpression(), 6)
2459:                                + "</hyperlinkAnchorExpression>");
2460:                    }
2461:
2462:                    if (hlink.getHyperlinkPageExpression().length() > 0) {
2463:                        pw.println("\t\t\t\t\t\t<hyperlinkPageExpression>"
2464:                                + getCDATAString(hlink
2465:                                        .getHyperlinkPageExpression(), 6)
2466:                                + "</hyperlinkPageExpression>");
2467:                    }
2468:
2469:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR126) {
2470:                        if (hlink.getTooltipExpression().length() > 0) {
2471:                            pw
2472:                                    .println("\t\t\t\t\t\t<hyperlinkTooltipExpression>"
2473:                                            + getCDATAString(hlink
2474:                                                    .getTooltipExpression(), 6)
2475:                                            + "</hyperlinkTooltipExpression>");
2476:                        }
2477:                        writeXMLHyperlinkParameters(hlink.getLinkParameters(),
2478:                                pw, "\t\t\t\t\t\t");
2479:                    }
2480:                }
2481:            }
2482:
2483:            private void writeChartTitleNode(ChartReportElement2 chartElement,
2484:                    PrintWriter pw) {
2485:                if (chartElement.getChart().getTitle().getTitleExpression()
2486:                        .trim().length() > 0) {
2487:                    pw.print("\t\t\t\t\t\t<chartTitle ");
2488:                    if (!chartElement.getChart().getTitle().getPosition()
2489:                            .equals("Top"))
2490:                        pw.print("position=\""
2491:                                + chartElement.getChart().getTitle()
2492:                                        .getPosition() + "\" ");
2493:                    if (chartElement.getChart().getTitle().getColor() != null)
2494:                        pw.print("color=\""
2495:                                + writeEncodedColor(chartElement.getChart()
2496:                                        .getTitle().getColor()) + "\" ");
2497:                    pw.println(">");
2498:                    writeFontElement(chartElement.getChart().getTitle()
2499:                            .getFont(), pw);
2500:                    pw.println("\t\t\t\t\t\t\t\t<titleExpression>"
2501:                            + getCDATAString(chartElement.getChart().getTitle()
2502:                                    .getTitleExpression(), 8)
2503:                            + "</titleExpression>");
2504:                    pw.println("\t\t\t\t\t</chartTitle>");
2505:                }
2506:            }
2507:
2508:            private void writeChartSubTitleNode(
2509:                    ChartReportElement2 chartElement, PrintWriter pw) {
2510:                if (chartElement.getChart().getSubTitle().getTitleExpression()
2511:                        .trim().length() > 0) {
2512:                    pw.print("\t\t\t\t\t\t<chartSubtitle ");
2513:                    if (chartElement.getChart().getSubTitle().getColor() != null)
2514:                        pw.print("color=\""
2515:                                + writeEncodedColor(chartElement.getChart()
2516:                                        .getSubTitle().getColor()) + "\" ");
2517:                    pw.println(">");
2518:                    writeFontElement(chartElement.getChart().getSubTitle()
2519:                            .getFont(), pw);
2520:                    pw.println("\t\t\t\t\t\t\t\t<subtitleExpression>"
2521:                            + getCDATAString(chartElement.getChart()
2522:                                    .getSubTitle().getTitleExpression(), 8)
2523:                            + "</subtitleExpression>");
2524:                    pw.println("\t\t\t\t\t</chartSubtitle>");
2525:                }
2526:            }
2527:
2528:            private void writeChartLegendNode(ChartReportElement2 chartElement,
2529:                    PrintWriter pw) {
2530:                if (chartElement.getChart().isShowLegend()) {
2531:                    pw.print("\t\t\t\t\t\t<chartLegend ");
2532:                    if (chartElement.getChart().getLegend().getTextColor() != null)
2533:                        pw.print("textColor=\""
2534:                                + writeEncodedColor(chartElement.getChart()
2535:                                        .getLegend().getTextColor()) + "\" ");
2536:                    if (chartElement.getChart().getLegend()
2537:                            .getBackgroundColor() != null)
2538:                        pw.print("backgroundColor=\""
2539:                                + writeEncodedColor(chartElement.getChart()
2540:                                        .getLegend().getBackgroundColor())
2541:                                + "\" ");
2542:                    pw.println(">");
2543:                    writeFontElement(chartElement.getChart().getLegend()
2544:                            .getFont(), pw);
2545:                    pw.println("\t\t\t\t\t</chartLegend>");
2546:                }
2547:            }
2548:
2549:            private void writeDataset(ChartReportElement2 chartElement,
2550:                    PrintWriter pw) {
2551:                if (chartElement.getChart().getDataset() instanceof  it.businesslogic.ireport.chart.PieDataset) {
2552:                    it.businesslogic.ireport.chart.PieDataset pdataset = (it.businesslogic.ireport.chart.PieDataset) chartElement
2553:                            .getChart().getDataset();
2554:                    pw.println("\t\t\t\t\t<pieDataset>");
2555:                    writeDatasetDataset(chartElement.getChart().getDataset(),
2556:                            pw);
2557:                    pw.println("\t\t\t\t\t\t<keyExpression>"
2558:                            + getCDATAString(pdataset.getKeyExpression(), 6)
2559:                            + "</keyExpression>");
2560:                    pw.println("\t\t\t\t\t\t<valueExpression>"
2561:                            + getCDATAString(pdataset.getValueExpression(), 6)
2562:                            + "</valueExpression>");
2563:                    if (pdataset.getLabelExpression().trim().length() > 0) {
2564:                        pw.println("\t\t\t\t\t\t<labelExpression>"
2565:                                + getCDATAString(pdataset.getLabelExpression(),
2566:                                        6) + "</labelExpression>");
2567:                    }
2568:                    writeSectionItemHyperLinkExpressions(pdataset
2569:                            .getSectionHyperLink(), false, pw);
2570:                    pw.println("\t\t\t\t\t</pieDataset>");
2571:                } else if (chartElement.getChart().getDataset() instanceof  it.businesslogic.ireport.chart.CategoryDataset) {
2572:                    it.businesslogic.ireport.chart.CategoryDataset pdataset = (it.businesslogic.ireport.chart.CategoryDataset) chartElement
2573:                            .getChart().getDataset();
2574:                    pw.println("\t\t\t\t\t<categoryDataset>");
2575:                    writeDatasetDataset(chartElement.getChart().getDataset(),
2576:                            pw);
2577:                    for (int i = 0; i < pdataset.getCategorySeries().size(); ++i) {
2578:                        writeCategorySeries((CategorySeries) pdataset
2579:                                .getCategorySeries().elementAt(i), pw);
2580:                    }
2581:                    pw.println("\t\t\t\t\t</categoryDataset>");
2582:                } else if (chartElement.getChart().getDataset() instanceof  it.businesslogic.ireport.chart.TimePeriodDataset) {
2583:                    it.businesslogic.ireport.chart.TimePeriodDataset pdataset = (it.businesslogic.ireport.chart.TimePeriodDataset) chartElement
2584:                            .getChart().getDataset();
2585:                    pw.println("\t\t\t\t\t<timePeriodDataset>");
2586:                    writeDatasetDataset(chartElement.getChart().getDataset(),
2587:                            pw);
2588:                    for (int i = 0; i < pdataset.getTimePeriodSeries().size(); ++i) {
2589:                        writeTimePeriodSeries((TimePeriodSeries) pdataset
2590:                                .getTimePeriodSeries().elementAt(i), pw);
2591:                    }
2592:                    pw.println("\t\t\t\t\t</timePeriodDataset>");
2593:                } else if (chartElement.getChart().getDataset() instanceof  it.businesslogic.ireport.chart.TimeSeriesDataset) {
2594:                    it.businesslogic.ireport.chart.TimeSeriesDataset pdataset = (it.businesslogic.ireport.chart.TimeSeriesDataset) chartElement
2595:                            .getChart().getDataset();
2596:                    pw.print("\t\t\t\t\t<timeSeriesDataset");
2597:                    if (!pdataset.getTimePeriod().equals("Day"))
2598:                        pw.println(" timePeriod=\"" + pdataset.getTimePeriod()
2599:                                + "\"");
2600:                    pw.println(">");
2601:                    writeDatasetDataset(chartElement.getChart().getDataset(),
2602:                            pw);
2603:                    for (int i = 0; i < pdataset.getTimeSeries().size(); ++i) {
2604:                        writeTimeSeries((TimeSeries) pdataset.getTimeSeries()
2605:                                .elementAt(i), pw);
2606:                    }
2607:                    pw.println("\t\t\t\t\t</timeSeriesDataset>");
2608:                } else if (chartElement.getChart().getDataset() instanceof  it.businesslogic.ireport.chart.XYDataset) {
2609:                    it.businesslogic.ireport.chart.XYDataset pdataset = (it.businesslogic.ireport.chart.XYDataset) chartElement
2610:                            .getChart().getDataset();
2611:                    pw.println("\t\t\t\t\t<xyDataset>");
2612:                    writeDatasetDataset(chartElement.getChart().getDataset(),
2613:                            pw);
2614:                    for (int i = 0; i < pdataset.getXYSeries().size(); ++i) {
2615:                        writeXYSeries((XYSeries) pdataset.getXYSeries()
2616:                                .elementAt(i), pw);
2617:                    }
2618:                    pw.println("\t\t\t\t\t</xyDataset>");
2619:                } else if (chartElement.getChart().getDataset() instanceof  it.businesslogic.ireport.chart.XYZDataset) {
2620:                    it.businesslogic.ireport.chart.XYZDataset pdataset = (it.businesslogic.ireport.chart.XYZDataset) chartElement
2621:                            .getChart().getDataset();
2622:                    pw.println("\t\t\t\t\t<xyzDataset>");
2623:                    writeDatasetDataset(chartElement.getChart().getDataset(),
2624:                            pw);
2625:                    for (int i = 0; i < pdataset.getXYZSeries().size(); ++i) {
2626:                        writeXYZSeries((XYZSeries) pdataset.getXYZSeries()
2627:                                .elementAt(i), pw);
2628:                    }
2629:                    pw.println("\t\t\t\t\t</xyzDataset>");
2630:                } else if (chartElement.getChart().getDataset() instanceof  it.businesslogic.ireport.chart.HighLowDataset) {
2631:                    it.businesslogic.ireport.chart.HighLowDataset pdataset = (it.businesslogic.ireport.chart.HighLowDataset) chartElement
2632:                            .getChart().getDataset();
2633:                    pw.println("\t\t\t\t\t<highLowDataset>");
2634:                    writeDatasetDataset(chartElement.getChart().getDataset(),
2635:                            pw);
2636:                    pw.println("\t\t\t\t\t\t<seriesExpression>"
2637:                            + getCDATAString(pdataset.getSeriesExpression(), 6)
2638:                            + "</seriesExpression>");
2639:                    pw.println("\t\t\t\t\t\t<dateExpression>"
2640:                            + getCDATAString(pdataset.getDateExpression(), 6)
2641:                            + "</dateExpression>");
2642:                    pw.println("\t\t\t\t\t\t<highExpression>"
2643:                            + getCDATAString(pdataset.getHighExpression(), 6)
2644:                            + "</highExpression>");
2645:                    pw.println("\t\t\t\t\t\t<lowExpression>"
2646:                            + getCDATAString(pdataset.getLowExpression(), 6)
2647:                            + "</lowExpression>");
2648:                    pw.println("\t\t\t\t\t\t<openExpression>"
2649:                            + getCDATAString(pdataset.getOpenExpression(), 6)
2650:                            + "</openExpression>");
2651:                    pw.println("\t\t\t\t\t\t<closeExpression>"
2652:                            + getCDATAString(pdataset.getCloseExpression(), 6)
2653:                            + "</closeExpression>");
2654:                    pw.println("\t\t\t\t\t\t<volumeExpression>"
2655:                            + getCDATAString(pdataset.getVolumeExpression(), 6)
2656:                            + "</volumeExpression>");
2657:                    writeSectionItemHyperLinkExpressions(pdataset
2658:                            .getItemHyperLink(), true, pw);
2659:                    pw.println("\t\t\t\t\t</highLowDataset>");
2660:                } else if (chartElement.getChart().getDataset() instanceof  it.businesslogic.ireport.chart.ValueDataset) {
2661:                    it.businesslogic.ireport.chart.ValueDataset pdataset = (it.businesslogic.ireport.chart.ValueDataset) chartElement
2662:                            .getChart().getDataset();
2663:                    pw.println("\t\t\t\t\t<valueDataset>");
2664:                    writeDatasetDataset(chartElement.getChart().getDataset(),
2665:                            pw);
2666:                    pw.println("\t\t\t\t\t\t<valueExpression>"
2667:                            + getCDATAString(pdataset.getValueExpression(), 6)
2668:                            + "</valueExpression>");
2669:                    pw.println("\t\t\t\t\t</valueDataset>");
2670:                }
2671:            }
2672:
2673:            private void writeCategorySeries(CategorySeries cs, PrintWriter pw) {
2674:                pw.println("\t\t\t\t\t\t<categorySeries>");
2675:                pw.println("\t\t\t\t\t\t\t<seriesExpression>"
2676:                        + getCDATAString(cs.getSeriesExpression(), 7)
2677:                        + "</seriesExpression>");
2678:                pw.println("\t\t\t\t\t\t\t<categoryExpression>"
2679:                        + getCDATAString(cs.getCategoryExpression(), 7)
2680:                        + "</categoryExpression>");
2681:                pw.println("\t\t\t\t\t\t\t<valueExpression>"
2682:                        + getCDATAString(cs.getValueExpression(), 7)
2683:                        + "</valueExpression>");
2684:                if (cs.getLabelExpression().trim().length() != 0)
2685:                    pw.println("\t\t\t\t\t\t\t<labelExpression>"
2686:                            + getCDATAString(cs.getLabelExpression(), 7)
2687:                            + "</labelExpression>");
2688:                writeSectionItemHyperLinkExpressions(cs
2689:                        .getSectionItemHyperlink(), true, pw);
2690:                pw.println("\t\t\t\t\t\t</categorySeries>");
2691:            }
2692:
2693:            private void writeXYSeries(XYSeries cs, PrintWriter pw) {
2694:                pw.println("\t\t\t\t\t\t<xySeries>");
2695:                pw.println("\t\t\t\t\t\t\t<seriesExpression>"
2696:                        + getCDATAString(cs.getSeriesExpression(), 7)
2697:                        + "</seriesExpression>");
2698:                pw.println("\t\t\t\t\t\t\t<xValueExpression>"
2699:                        + getCDATAString(cs.getXValueExpression(), 7)
2700:                        + "</xValueExpression>");
2701:                pw.println("\t\t\t\t\t\t\t<yValueExpression>"
2702:                        + getCDATAString(cs.getYValueExpression(), 7)
2703:                        + "</yValueExpression>");
2704:                if (cs.getLabelExpression().trim().length() != 0)
2705:                    pw.println("\t\t\t\t\t\t\t<labelExpression>"
2706:                            + getCDATAString(cs.getLabelExpression(), 7)
2707:                            + "</labelExpression>");
2708:                writeSectionItemHyperLinkExpressions(cs
2709:                        .getSectionItemHyperlink(), true, pw);
2710:                pw.println("\t\t\t\t\t\t</xySeries>");
2711:            }
2712:
2713:            private void writeXYZSeries(XYZSeries cs, PrintWriter pw) {
2714:                pw.println("\t\t\t\t\t\t<xyzSeries>");
2715:                pw.println("\t\t\t\t\t\t\t<seriesExpression>"
2716:                        + getCDATAString(cs.getSeriesExpression(), 7)
2717:                        + "</seriesExpression>");
2718:                pw.println("\t\t\t\t\t\t\t<xValueExpression>"
2719:                        + getCDATAString(cs.getXValueExpression(), 7)
2720:                        + "</xValueExpression>");
2721:                pw.println("\t\t\t\t\t\t\t<yValueExpression>"
2722:                        + getCDATAString(cs.getYValueExpression(), 7)
2723:                        + "</yValueExpression>");
2724:                if (cs.getZValueExpression().trim().length() != 0)
2725:                    pw.println("\t\t\t\t\t\t\t<zValueExpression>"
2726:                            + getCDATAString(cs.getZValueExpression(), 7)
2727:                            + "</zValueExpression>");
2728:                writeSectionItemHyperLinkExpressions(cs
2729:                        .getSectionItemHyperlink(), true, pw);
2730:                pw.println("\t\t\t\t\t\t</xyzSeries>");
2731:            }
2732:
2733:            private void writeTimePeriodSeries(TimePeriodSeries cs,
2734:                    PrintWriter pw) {
2735:                pw.println("\t\t\t\t\t\t<timePeriodSeries>");
2736:                pw.println("\t\t\t\t\t\t\t<seriesExpression>"
2737:                        + getCDATAString(cs.getSeriesExpression(), 7)
2738:                        + "</seriesExpression>");
2739:                pw.println("\t\t\t\t\t\t\t<startDateExpression>"
2740:                        + getCDATAString(cs.getStartDateExpression(), 7)
2741:                        + "</startDateExpression>");
2742:                pw.println("\t\t\t\t\t\t\t<endDateExpression>"
2743:                        + getCDATAString(cs.getEndDateExpression(), 7)
2744:                        + "</endDateExpression>");
2745:                pw.println("\t\t\t\t\t\t\t<valueExpression>"
2746:                        + getCDATAString(cs.getValueExpression(), 7)
2747:                        + "</valueExpression>");
2748:                if (cs.getLabelExpression().trim().length() != 0)
2749:                    pw.println("\t\t\t\t\t\t\t<labelExpression>"
2750:                            + getCDATAString(cs.getLabelExpression(), 7)
2751:                            + "</labelExpression>");
2752:                writeSectionItemHyperLinkExpressions(cs
2753:                        .getSectionItemHyperlink(), true, pw);
2754:                pw.println("\t\t\t\t\t\t</timePeriodSeries>");
2755:            }
2756:
2757:            private void writeTimeSeries(TimeSeries cs, PrintWriter pw) {
2758:                pw.println("\t\t\t\t\t\t<timeSeries>");
2759:                pw.println("\t\t\t\t\t\t\t<seriesExpression>"
2760:                        + getCDATAString(cs.getSeriesExpression(), 7)
2761:                        + "</seriesExpression>");
2762:                pw.println("\t\t\t\t\t\t\t<timePeriodExpression>"
2763:                        + getCDATAString(cs.getTimePeriodExpression(), 7)
2764:                        + "</timePeriodExpression>");
2765:                pw.println("\t\t\t\t\t\t\t<valueExpression>"
2766:                        + getCDATAString(cs.getValueExpression(), 7)
2767:                        + "</valueExpression>");
2768:                if (cs.getLabelExpression().trim().length() != 0)
2769:                    pw.println("\t\t\t\t\t\t\t<labelExpression>"
2770:                            + getCDATAString(cs.getLabelExpression(), 7)
2771:                            + "</labelExpression>");
2772:                writeSectionItemHyperLinkExpressions(cs
2773:                        .getSectionItemHyperlink(), true, pw);
2774:                pw.println("\t\t\t\t\t\t</timeSeries>");
2775:            }
2776:
2777:            private void writeDatasetDataset(Dataset dataset, PrintWriter pw) {
2778:                pw.print("\t\t\t\t\t\t<dataset ");
2779:                if (!dataset.getResetType().equals("Report"))
2780:                    pw.print("resetType=\"" + dataset.getResetType() + "\" ");
2781:                if (!dataset.getResetGroup().equals(""))
2782:                    pw.print("resetGroup=\"" + dataset.getResetGroup() + "\" ");
2783:                if (!dataset.getIncrementType().equals("None"))
2784:                    pw.print("incrementType=\"" + dataset.getIncrementType()
2785:                            + "\" ");
2786:                if (!dataset.getIncrementGroup().equals(""))
2787:                    pw.print("incrementGroup=\"" + dataset.getIncrementGroup()
2788:                            + "\" ");
2789:                pw.println(">");
2790:
2791:                if (CompatibilitySupport.version >= CompatibilitySupport.JR125
2792:                        && dataset.getIncrementWhenExpression().length() > 0) {
2793:                    pw.println("\t\t\t\t\t\t\t<incrementWhenExpression>"
2794:                            + getCDATAString(dataset
2795:                                    .getIncrementWhenExpression().trim(), 9)
2796:                            + "</incrementWhenExpression>");
2797:
2798:                }
2799:                if (CompatibilitySupport.version >= CompatibilitySupport.JR110) {
2800:                    if (dataset.getSubDataset() != null) {
2801:                        pw.println("\t\t\t\t\t\t\t<datasetRun subDataset=\""
2802:                                + dataset.getSubDataset().getName() + "\">");
2803:                        if (dataset.getParametersMapExpression() != null
2804:                                && dataset.getParametersMapExpression().trim()
2805:                                        .length() > 0) {
2806:                            pw
2807:                                    .println("\t\t\t\t\t\t\t\t<parametersMapExpression>"
2808:                                            + getCDATAString(
2809:                                                    dataset
2810:                                                            .getParametersMapExpression()
2811:                                                            .trim(), 9)
2812:                                            + "</parametersMapExpression>");
2813:                        }
2814:
2815:                        Enumeration e = dataset.getSubreportParameters()
2816:                                .elements();
2817:                        while (e.hasMoreElements()) {
2818:                            JRSubreportParameter je = (JRSubreportParameter) e
2819:                                    .nextElement();
2820:                            pw
2821:                                    .println("\t\t\t\t\t\t\t\t<datasetParameter  name=\""
2822:                                            + je.getName() + "\">");
2823:                            pw
2824:                                    .print("\t\t\t\t\t\t\t\t\t<datasetParameterExpression");
2825:                            pw.println(">"
2826:                                    + getCDATAString(je.getExpression(), 9)
2827:                                    + "</datasetParameterExpression>");
2828:                            pw.println("\t\t\t\t\t\t\t\t</datasetParameter>");
2829:                        }
2830:
2831:                        if (dataset.isUseConnection()
2832:                                && dataset.getConnectionExpression().trim()
2833:                                        .length() > 0) {
2834:                            pw.print("\t\t\t\t\t\t\t\t<connectionExpression");
2835:                            pw.println(">"
2836:                                    + getCDATAString(dataset
2837:                                            .getConnectionExpression(), 8)
2838:                                    + "</connectionExpression>");
2839:                        } else if (!dataset.isUseConnection()
2840:                                && dataset.getDataSourceExpression().length() > 0) {
2841:                            pw.print("\t\t\t\t\t<dataSourceExpression");
2842:                            pw.println(">"
2843:                                    + getCDATAString(dataset
2844:                                            .getDataSourceExpression(), 8)
2845:                                    + "</dataSourceExpression>");
2846:                        }
2847:
2848:                        pw.println("\t\t\t\t\t\t\t</datasetRun>");
2849:                    }
2850:                }
2851:
2852:                pw.println("\t\t\t\t\t\t</dataset>");
2853:            }
2854:
2855:            private void writePlot(ChartReportElement2 chartElement,
2856:                    PrintWriter pw) {
2857:                if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.PiePlot) {
2858:                    it.businesslogic.ireport.chart.PiePlot plot = (it.businesslogic.ireport.chart.PiePlot) chartElement
2859:                            .getChart().getPlot();
2860:                    pw.println("\t\t\t\t\t<piePlot ");
2861:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR200
2862:                            && plot.isCircular()) {
2863:                        pw.print("isCircular=\"" + plot.isCircular() + "\" ");
2864:                    }
2865:                    pw.println(">");
2866:                    writePlotPlot(chartElement, pw);
2867:                    pw.println("\t\t\t\t\t</piePlot>");
2868:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.Pie3DPlot) {
2869:                    it.businesslogic.ireport.chart.Pie3DPlot plot = (it.businesslogic.ireport.chart.Pie3DPlot) chartElement
2870:                            .getChart().getPlot();
2871:                    pw.print("\t\t\t\t\t<pie3DPlot ");
2872:
2873:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR200
2874:                            && plot.isCircular()) {
2875:                        pw.print("isCircular=\"" + plot.isCircular() + "\" ");
2876:                    }
2877:
2878:                    if (plot.getDepthFactor() != 0.2)
2879:                        pw.print("depthFactor=\"" + plot.getDepthFactor()
2880:                                + "\" ");
2881:                    pw.println(">");
2882:                    writePlotPlot(chartElement, pw);
2883:                    pw.println("\t\t\t\t\t</pie3DPlot>");
2884:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.BarPlot) {
2885:                    it.businesslogic.ireport.chart.BarPlot plot = (it.businesslogic.ireport.chart.BarPlot) chartElement
2886:                            .getChart().getPlot();
2887:                    pw.print("\t\t\t\t\t<barPlot ");
2888:                    if (plot.isShowLabels())
2889:                        pw.print("isShowLabels=\"" + plot.isShowLabels()
2890:                                + "\" ");
2891:                    if (!plot.isShowTickMarks())
2892:                        pw.print("isShowTickMarks=\"" + plot.isShowTickMarks()
2893:                                + "\" ");
2894:                    if (!plot.isShowTickLabels())
2895:                        pw.print("isShowTickLabels=\""
2896:                                + plot.isShowTickLabels() + "\" ");
2897:                    pw.println(">");
2898:
2899:                    writePlotPlot(chartElement, pw);
2900:
2901:                    if (plot.getCategoryAxisLabelExpression().trim().length() != 0)
2902:                        pw.println("\t\t\t\t\t<categoryAxisLabelExpression>"
2903:                                + getCDATAString(plot
2904:                                        .getCategoryAxisLabelExpression(), 6)
2905:                                + "</categoryAxisLabelExpression>");
2906:
2907:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
2908:                        writeAxisFormat("categoryAxisFormat", plot
2909:                                .getCategoryAxisFormat(), pw);
2910:                    }
2911:
2912:                    if (plot.getValueAxisLabelExpression().trim().length() != 0)
2913:                        pw.println("\t\t\t\t\t<valueAxisLabelExpression>"
2914:                                + getCDATAString(plot
2915:                                        .getValueAxisLabelExpression(), 6)
2916:                                + "</valueAxisLabelExpression>");
2917:
2918:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
2919:                        writeAxisFormat("valueAxisFormat", plot
2920:                                .getValueAxisFormat(), pw);
2921:                    }
2922:
2923:                    pw.println("\t\t\t\t\t</barPlot>");
2924:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.Bar3DPlot) {
2925:                    it.businesslogic.ireport.chart.Bar3DPlot plot = (it.businesslogic.ireport.chart.Bar3DPlot) chartElement
2926:                            .getChart().getPlot();
2927:                    pw.print("\t\t\t\t\t<bar3DPlot ");
2928:                    if (plot.isShowLabels())
2929:                        pw.print("isShowLabels=\"" + plot.isShowLabels()
2930:                                + "\" ");
2931:                    if (plot.getXOffset() != org.jfree.chart.renderer.category.BarRenderer3D.DEFAULT_X_OFFSET)
2932:                        pw.print("xOffset=\"" + plot.getXOffset() + "\" ");
2933:                    if (plot.getYOffset() != org.jfree.chart.renderer.category.BarRenderer3D.DEFAULT_Y_OFFSET)
2934:                        pw.print("yOffset=\"" + plot.getYOffset() + "\" ");
2935:                    pw.println(">");
2936:
2937:                    writePlotPlot(chartElement, pw);
2938:
2939:                    if (plot.getCategoryAxisLabelExpression().trim().length() != 0)
2940:                        pw.println("\t\t\t\t\t<categoryAxisLabelExpression>"
2941:                                + getCDATAString(plot
2942:                                        .getCategoryAxisLabelExpression(), 6)
2943:                                + "</categoryAxisLabelExpression>");
2944:
2945:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
2946:                        writeAxisFormat("categoryAxisFormat", plot
2947:                                .getCategoryAxisFormat(), pw);
2948:                    }
2949:
2950:                    if (plot.getValueAxisLabelExpression().trim().length() != 0)
2951:                        pw.println("\t\t\t\t\t<valueAxisLabelExpression>"
2952:                                + getCDATAString(plot
2953:                                        .getValueAxisLabelExpression(), 6)
2954:                                + "</valueAxisLabelExpression>");
2955:
2956:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
2957:                        writeAxisFormat("valueAxisFormat", plot
2958:                                .getValueAxisFormat(), pw);
2959:                    }
2960:
2961:                    pw.println("\t\t\t\t\t</bar3DPlot>");
2962:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.LinePlot) {
2963:                    it.businesslogic.ireport.chart.LinePlot plot = (it.businesslogic.ireport.chart.LinePlot) chartElement
2964:                            .getChart().getPlot();
2965:                    pw.print("\t\t\t\t\t<linePlot ");
2966:                    if (!plot.isShowLines())
2967:                        pw.print("isShowLines=\"" + plot.isShowLines() + "\" ");
2968:                    if (!plot.isShowShapes())
2969:                        pw.print("isShowShapes=\"" + plot.isShowShapes()
2970:                                + "\" ");
2971:                    pw.println(">");
2972:
2973:                    writePlotPlot(chartElement, pw);
2974:
2975:                    if (plot.getCategoryAxisLabelExpression().trim().length() != 0)
2976:                        pw.println("\t\t\t\t\t<categoryAxisLabelExpression>"
2977:                                + getCDATAString(plot
2978:                                        .getCategoryAxisLabelExpression(), 6)
2979:                                + "</categoryAxisLabelExpression>");
2980:
2981:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
2982:                        writeAxisFormat("categoryAxisFormat", plot
2983:                                .getCategoryAxisFormat(), pw);
2984:                    }
2985:
2986:                    if (plot.getValueAxisLabelExpression().trim().length() != 0)
2987:                        pw.println("\t\t\t\t\t<valueAxisLabelExpression>"
2988:                                + getCDATAString(plot
2989:                                        .getValueAxisLabelExpression(), 6)
2990:                                + "</valueAxisLabelExpression>");
2991:
2992:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
2993:                        writeAxisFormat("valueAxisFormat", plot
2994:                                .getValueAxisFormat(), pw);
2995:                    }
2996:
2997:                    pw.println("\t\t\t\t\t</linePlot>");
2998:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.AreaPlot) {
2999:                    it.businesslogic.ireport.chart.AreaPlot plot = (it.businesslogic.ireport.chart.AreaPlot) chartElement
3000:                            .getChart().getPlot();
3001:                    pw.print("\t\t\t\t\t<areaPlot>");
3002:
3003:                    writePlotPlot(chartElement, pw);
3004:
3005:                    if (plot.getCategoryAxisLabelExpression().trim().length() != 0)
3006:                        pw.println("\t\t\t\t\t<categoryAxisLabelExpression>"
3007:                                + getCDATAString(plot
3008:                                        .getCategoryAxisLabelExpression(), 6)
3009:                                + "</categoryAxisLabelExpression>");
3010:
3011:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3012:                        writeAxisFormat("categoryAxisFormat", plot
3013:                                .getCategoryAxisFormat(), pw);
3014:                    }
3015:
3016:                    if (plot.getValueAxisLabelExpression().trim().length() != 0)
3017:                        pw.println("\t\t\t\t\t<valueAxisLabelExpression>"
3018:                                + getCDATAString(plot
3019:                                        .getValueAxisLabelExpression(), 6)
3020:                                + "</valueAxisLabelExpression>");
3021:
3022:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3023:                        writeAxisFormat("valueAxisFormat", plot
3024:                                .getValueAxisFormat(), pw);
3025:                    }
3026:
3027:                    pw.println("\t\t\t\t\t</areaPlot>");
3028:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.ScatterPlot) {
3029:                    it.businesslogic.ireport.chart.ScatterPlot plot = (it.businesslogic.ireport.chart.ScatterPlot) chartElement
3030:                            .getChart().getPlot();
3031:                    pw.print("\t\t\t\t\t<scatterPlot ");
3032:                    if (!plot.isShowLines())
3033:                        pw.print("isShowLines=\"" + plot.isShowLines() + "\" ");
3034:                    if (!plot.isShowShapes())
3035:                        pw.print("isShowShapes=\"" + plot.isShowShapes()
3036:                                + "\" ");
3037:                    pw.println(">");
3038:
3039:                    writePlotPlot(chartElement, pw);
3040:
3041:                    if (plot.getXAxisLabelExpression().trim().length() != 0)
3042:                        pw.println("\t\t\t\t\t<xAxisLabelExpression>"
3043:                                + getCDATAString(
3044:                                        plot.getXAxisLabelExpression(), 6)
3045:                                + "</xAxisLabelExpression>");
3046:
3047:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3048:                        writeAxisFormat("xAxisFormat", plot.getXAxisFormat(),
3049:                                pw);
3050:                    }
3051:
3052:                    if (plot.getYAxisLabelExpression().trim().length() != 0)
3053:                        pw.println("\t\t\t\t\t<yAxisLabelExpression>"
3054:                                + getCDATAString(
3055:                                        plot.getYAxisLabelExpression(), 6)
3056:                                + "</yAxisLabelExpression>");
3057:
3058:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3059:                        writeAxisFormat("yAxisFormat", plot.getYAxisFormat(),
3060:                                pw);
3061:                    }
3062:
3063:                    pw.println("\t\t\t\t\t</scatterPlot>");
3064:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.BubblePlot) {
3065:                    it.businesslogic.ireport.chart.BubblePlot plot = (it.businesslogic.ireport.chart.BubblePlot) chartElement
3066:                            .getChart().getPlot();
3067:                    pw.print("\t\t\t\t\t<bubblePlot ");
3068:                    if (!plot.getScaleType().equals("RangeAxis"))
3069:                        pw.print("scaleType=\"" + plot.getScaleType() + "\" ");
3070:                    pw.println(">");
3071:
3072:                    writePlotPlot(chartElement, pw);
3073:
3074:                    if (plot.getXAxisLabelExpression().trim().length() != 0)
3075:                        pw.println("\t\t\t\t\t<xAxisLabelExpression>"
3076:                                + getCDATAString(
3077:                                        plot.getXAxisLabelExpression(), 6)
3078:                                + "</xAxisLabelExpression>");
3079:
3080:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3081:                        writeAxisFormat("xAxisFormat", plot.getXAxisFormat(),
3082:                                pw);
3083:                    }
3084:
3085:                    if (plot.getYAxisLabelExpression().trim().length() != 0)
3086:                        pw.println("\t\t\t\t\t<yAxisLabelExpression>"
3087:                                + getCDATAString(
3088:                                        plot.getYAxisLabelExpression(), 6)
3089:                                + "</yAxisLabelExpression>");
3090:
3091:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3092:                        writeAxisFormat("yAxisFormat", plot.getYAxisFormat(),
3093:                                pw);
3094:                    }
3095:
3096:                    pw.println("\t\t\t\t\t</bubblePlot>");
3097:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.TimeSeriesPlot) {
3098:                    it.businesslogic.ireport.chart.TimeSeriesPlot plot = (it.businesslogic.ireport.chart.TimeSeriesPlot) chartElement
3099:                            .getChart().getPlot();
3100:                    pw.print("\t\t\t\t\t<timeSeriesPlot ");
3101:                    if (!plot.isShowLines())
3102:                        pw.print("isShowLines=\"" + plot.isShowLines() + "\" ");
3103:                    if (!plot.isShowShapes())
3104:                        pw.print("isShowShapes=\"" + plot.isShowShapes()
3105:                                + "\" ");
3106:                    pw.println(">");
3107:
3108:                    writePlotPlot(chartElement, pw);
3109:
3110:                    if (plot.getTimeAxisLabelExpression().trim().length() != 0)
3111:                        pw.println("\t\t\t\t\t<timeAxisLabelExpression>"
3112:                                + getCDATAString(plot
3113:                                        .getTimeAxisLabelExpression(), 6)
3114:                                + "</timeAxisLabelExpression>");
3115:
3116:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3117:                        writeAxisFormat("timeAxisFormat", plot
3118:                                .getTimeAxisFormat(), pw);
3119:                    }
3120:
3121:                    if (plot.getValueAxisLabelExpression().trim().length() != 0)
3122:                        pw.println("\t\t\t\t\t<valueAxisLabelExpression>"
3123:                                + getCDATAString(plot
3124:                                        .getValueAxisLabelExpression(), 6)
3125:                                + "</valueAxisLabelExpression>");
3126:
3127:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3128:                        writeAxisFormat("valueAxisFormat", plot
3129:                                .getValueAxisFormat(), pw);
3130:                    }
3131:
3132:                    pw.println("\t\t\t\t\t</timeSeriesPlot>");
3133:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.HighLowPlot) {
3134:                    it.businesslogic.ireport.chart.HighLowPlot plot = (it.businesslogic.ireport.chart.HighLowPlot) chartElement
3135:                            .getChart().getPlot();
3136:                    pw.print("\t\t\t\t\t<highLowPlot ");
3137:                    if (!plot.isShowCloseTicks())
3138:                        pw.print("isShowCloseTicks=\""
3139:                                + plot.isShowCloseTicks() + "\" ");
3140:                    if (!plot.isShowOpenTicks())
3141:                        pw.print("isShowOpenTicks=\"" + plot.isShowOpenTicks()
3142:                                + "\" ");
3143:                    pw.println(">");
3144:
3145:                    writePlotPlot(chartElement, pw);
3146:
3147:                    if (plot.getTimeAxisLabelExpression().trim().length() != 0)
3148:                        pw.println("\t\t\t\t\t<timeAxisLabelExpression>"
3149:                                + getCDATAString(plot
3150:                                        .getTimeAxisLabelExpression(), 6)
3151:                                + "</timeAxisLabelExpression>");
3152:
3153:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3154:                        writeAxisFormat("timeAxisFormat", plot
3155:                                .getTimeAxisFormat(), pw);
3156:                    }
3157:
3158:                    if (plot.getValueAxisLabelExpression().trim().length() != 0)
3159:                        pw.println("\t\t\t\t\t<valueAxisLabelExpression>"
3160:                                + getCDATAString(plot
3161:                                        .getValueAxisLabelExpression(), 6)
3162:                                + "</valueAxisLabelExpression>");
3163:
3164:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3165:                        writeAxisFormat("valueAxisFormat", plot
3166:                                .getValueAxisFormat(), pw);
3167:                    }
3168:
3169:                    pw.println("\t\t\t\t\t</highLowPlot>");
3170:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.CandlestickPlot) {
3171:                    it.businesslogic.ireport.chart.CandlestickPlot plot = (it.businesslogic.ireport.chart.CandlestickPlot) chartElement
3172:                            .getChart().getPlot();
3173:                    pw.print("\t\t\t\t\t<candlestickPlot ");
3174:                    if (!plot.isShowVolume())
3175:                        pw.print("isShowVolume=\"" + plot.isShowVolume()
3176:                                + "\" ");
3177:                    pw.println(">");
3178:
3179:                    writePlotPlot(chartElement, pw);
3180:
3181:                    if (plot.getTimeAxisLabelExpression().trim().length() != 0)
3182:                        pw.println("\t\t\t\t\t<timeAxisLabelExpression>"
3183:                                + getCDATAString(plot
3184:                                        .getTimeAxisLabelExpression(), 6)
3185:                                + "</timeAxisLabelExpression>");
3186:
3187:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3188:                        writeAxisFormat("timeAxisFormat", plot
3189:                                .getTimeAxisFormat(), pw);
3190:                    }
3191:
3192:                    if (plot.getValueAxisLabelExpression().trim().length() != 0)
3193:                        pw.println("\t\t\t\t\t<valueAxisLabelExpression>"
3194:                                + getCDATAString(plot
3195:                                        .getValueAxisLabelExpression(), 6)
3196:                                + "</valueAxisLabelExpression>");
3197:
3198:                    if (CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3199:                        writeAxisFormat("valueAxisFormat", plot
3200:                                .getValueAxisFormat(), pw);
3201:                    }
3202:                    pw.println("\t\t\t\t\t</candlestickPlot>");
3203:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.MeterPlot
3204:                        && CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3205:                    it.businesslogic.ireport.chart.MeterPlot plot = (it.businesslogic.ireport.chart.MeterPlot) chartElement
3206:                            .getChart().getPlot();
3207:                    pw.print("\t\t\t\t\t<meterPlot ");
3208:
3209:                    if (plot.getShape() != null
3210:                            && !plot.getShape().equals("pie"))
3211:                        pw.print("shape=\"" + plot.getShape() + "\" ");
3212:                    if (plot.getAngle() != 180)
3213:                        pw.print("angle=\"" + plot.getAngle() + "\" ");
3214:                    if (plot.getUnits() != null
3215:                            && plot.getUnits().trim().length() > 0)
3216:                        pw.print("units=\"" + Misc.xmlEscape(plot.getUnits())
3217:                                + "\" ");
3218:                    if (plot.getTickInterval() != 10)
3219:                        pw.print("tickInterval=\"" + plot.getTickInterval()
3220:                                + "\" ");
3221:                    if (plot.getMeterColor() != null)
3222:                        pw.print("meterColor=\""
3223:                                + writeEncodedColor(plot.getMeterColor())
3224:                                + "\" ");
3225:                    if (plot.getNeedleColor() != null)
3226:                        pw.print("needleColor=\""
3227:                                + writeEncodedColor(plot.getNeedleColor())
3228:                                + "\" ");
3229:                    if (plot.getTickColor() != null)
3230:                        pw.print("tickColor=\""
3231:                                + writeEncodedColor(plot.getTickColor())
3232:                                + "\" ");
3233:                    pw.println(">");
3234:
3235:                    writePlotPlot(chartElement, pw);
3236:                    writeValueDisplay(plot.getValueDisplay(), pw);
3237:                    writeDataRange(plot.getDataRange(), pw);
3238:
3239:                    for (int interval_c = 0; interval_c < plot
3240:                            .getMeterIntervals().size(); ++interval_c) {
3241:                        writeMeterInterval((MeterInterval) plot
3242:                                .getMeterIntervals().get(interval_c), pw);
3243:                    }
3244:
3245:                    pw.println("\t\t\t\t\t</meterPlot>");
3246:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.ThermometerPlot
3247:                        && CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3248:                    it.businesslogic.ireport.chart.ThermometerPlot plot = (it.businesslogic.ireport.chart.ThermometerPlot) chartElement
3249:                            .getChart().getPlot();
3250:                    pw.print("\t\t\t\t\t<thermometerPlot ");
3251:
3252:                    if (plot.getValueLocation() != null
3253:                            && !plot.getValueLocation().equals("bulb"))
3254:                        pw.print("valueLocation=\"" + plot.getValueLocation()
3255:                                + "\" ");
3256:                    if (plot.isShowValueLines() != false)
3257:                        pw.print("isShowValueLines=\""
3258:                                + plot.isShowValueLines() + "\" ");
3259:                    if (plot.getMercuryColor() != null)
3260:                        pw.print("mercuryColor=\""
3261:                                + writeEncodedColor(plot.getMercuryColor())
3262:                                + "\" ");
3263:                    pw.println(">");
3264:
3265:                    writePlotPlot(chartElement, pw);
3266:                    writeValueDisplay(plot.getValueDisplay(), pw);
3267:                    writeDataRange(plot.getDataRange(), pw);
3268:                    writeDataRange("lowRange", plot.getLowRange(), pw);
3269:                    writeDataRange("mediumRange", plot.getMediumRange(), pw);
3270:                    writeDataRange("highRange", plot.getHighRange(), pw);
3271:
3272:                    pw.println("\t\t\t\t\t</thermometerPlot>");
3273:                } else if (chartElement.getChart().getPlot() instanceof  it.businesslogic.ireport.chart.MultiAxisPlot
3274:                        && CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3275:                    it.businesslogic.ireport.chart.MultiAxisPlot plot = (it.businesslogic.ireport.chart.MultiAxisPlot) chartElement
3276:                            .getChart().getPlot();
3277:                    pw.println("\t\t\t\t\t<multiAxisPlot>");
3278:
3279:                    writePlotPlot(chartElement, pw);
3280:
3281:                    for (int axis_c = 0; axis_c < plot.getAxis().size(); ++axis_c) {
3282:                        writeAxis((Axis) plot.getAxis().get(axis_c), pw);
3283:                    }
3284:
3285:                    pw.println("\t\t\t\t\t</multiAxisPlot>");
3286:                }
3287:            }
3288:
3289:            private void writePlotPlot(ChartReportElement2 chartElement,
3290:                    PrintWriter pw) {
3291:                pw.print("\t\t\t\t\t\t<plot ");
3292:                if (chartElement.getChart().getPlot().getBackcolor() != null)
3293:                    pw.print("backcolor=\""
3294:                            + writeEncodedColor(chartElement.getChart()
3295:                                    .getPlot().getBackcolor()) + "\" ");
3296:                if (!chartElement.getChart().getPlot().getOrientation().equals(
3297:                        "Vertical"))
3298:                    pw.print("orientation=\""
3299:                            + chartElement.getChart().getPlot()
3300:                                    .getOrientation() + "\" ");
3301:                if (chartElement.getChart().getPlot().getBackgroundAlpha() != 1.0)
3302:                    pw.print("backgroundAlpha=\""
3303:                            + chartElement.getChart().getPlot()
3304:                                    .getBackgroundAlpha() + "\" ");
3305:                if (chartElement.getChart().getPlot().getForegroundAlpha() != 1.0)
3306:                    pw.print("foregroundAlpha=\""
3307:                            + chartElement.getChart().getPlot()
3308:                                    .getForegroundAlpha() + "\" ");
3309:                if (chartElement.getChart().getPlot().getLabelRotation() != 0
3310:                        && CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3311:                    pw.print("labelRotation=\""
3312:                            + chartElement.getChart().getPlot()
3313:                                    .getLabelRotation() + "\" ");
3314:                }
3315:
3316:                if (chartElement.getChart().getPlot().getSeriesColors().size() > 0
3317:                        && CompatibilitySupport.version >= CompatibilitySupport.JR127) {
3318:                    pw.println(">");
3319:
3320:                    for (int i = 0; i < chartElement.getChart().getPlot()
3321:                            .getSeriesColors().size(); ++i) {
3322:                        SeriesColor sc = (SeriesColor) chartElement.getChart()
3323:                                .getPlot().getSeriesColors().get(i);
3324:                        pw.println("\t\t\t\t\t\t\t<seriesColor seriesOrder=\""
3325:                                + sc.getSeriesOrder() + "\" color=\""
3326:                                + writeEncodedColor(sc.getColor()) + "\"/>");
3327:
3328:                    }
3329:
3330:                    pw.println("</plot>");
3331:                } else {
3332:
3333:                    pw.println("/>");
3334:                }
3335:            }
3336:
3337:            private void writeAxisFormat(String axisName,
3338:                    AxisFormat axisFormat, PrintWriter pw) {
3339:
3340:                if (axisFormat == null)
3341:                    return;
3342:                pw.println("\t\t\t\t\t\t<" + axisName + ">");
3343:                pw.print("\t\t\t\t\t\t\t<axisFormat ");
3344:                if (axisFormat.getLabelColor() != null)
3345:                    pw.print("labelColor=\""
3346:                            + writeEncodedColor(axisFormat.getLabelColor())
3347:                            + "\" ");
3348:                if (axisFormat.getTickLabelColor() != null)
3349:                    pw.print("tickLabelColor=\""
3350:                            + writeEncodedColor(axisFormat.getTickLabelColor())
3351:                            + "\" ");
3352:                if (axisFormat.getTickLabelMask().trim().length() > 0)
3353:                    pw.print("tickLabelMask=\""
3354:                            + Misc.xmlEscape(axisFormat.getTickLabelMask())
3355:                            + "\" ");
3356:                if (axisFormat.getAxisLineColor() != null)
3357:                    pw.print("axisLineColor=\""
3358:                            + writeEncodedColor(axisFormat.getAxisLineColor())
3359:                            + "\" ");
3360:                pw.println(">");
3361:
3362:                if (axisFormat.getLabelFont() != null) {
3363:                    pw.println("\t\t\t\t\t\t\t\t<labelFont>");
3364:                    writeFontElement(axisFormat.getLabelFont(), pw);
3365:                    pw.println("\t\t\t\t\t\t\t\t</labelFont>");
3366:                }
3367:                if (axisFormat.getLabelFont() != null) {
3368:                    pw.println("\t\t\t\t\t\t\t\t<tickLabelFont>");
3369:                    writeFontElement(axisFormat.getTickLabelFont(), pw);
3370:                    pw.println("\t\t\t\t\t\t\t\t</tickLabelFont>");
3371:                }
3372:
3373:                pw.println("\t\t\t\t\t\t\t</axisFormat>");
3374:                pw.println("\t\t\t\t\t\t</" + axisName + ">");
3375:            }
3376:
3377:            private void writeValueDisplay(ValueDisplay valueDisplay,
3378:                    PrintWriter pw) {
3379:
3380:                if (valueDisplay == null)
3381:                    return;
3382:
3383:                pw.print("\t\t\t\t\t\t\t<valueDisplay ");
3384:                if (valueDisplay.getColor() != null)
3385:                    pw.print("color=\""
3386:                            + writeEncodedColor(valueDisplay.getColor())
3387:                            + "\" ");
3388:                if (valueDisplay.getMask().trim().length() > 0)
3389:                    pw.print("mask=\"" + Misc.xmlEscape(valueDisplay.getMask())
3390:                            + "\" ");
3391:                pw.println(">");
3392:                writeFontElement(valueDisplay.getFont(), pw);
3393:                pw.println("\t\t\t\t\t\t\t</valueDisplay>");
3394:            }
3395:
3396:            private void writeDataRange(DataRange dataRange, PrintWriter pw) {
3397:                writeDataRange(null, dataRange, pw);
3398:            }
3399:
3400:            private void writeDataRange(String outTagName, DataRange dataRange,
3401:                    PrintWriter pw) {
3402:
3403:                if (dataRange == null)
3404:                    return;
3405:
3406:                if (outTagName != null)
3407:                    pw.println("\t\t\t\t\t\t<" + outTagName + ">");
3408:
3409:                pw.println("\t\t\t\t\t\t\t<dataRange>");
3410:                pw.println("\t\t\t\t\t\t\t\t<lowExpression>"
3411:                        + getCDATAString(dataRange.getLowExpression(), 8)
3412:                        + "</lowExpression>");
3413:                pw.println("\t\t\t\t\t\t\t\t<highExpression>"
3414:                        + getCDATAString(dataRange.getHighExpression(), 8)
3415:                        + "</highExpression>");
3416:                pw.println("\t\t\t\t\t\t\t</dataRange>");
3417:
3418:                if (outTagName != null)
3419:                    pw.println("\t\t\t\t\t\t</" + outTagName + ">");
3420:            }
3421:
3422:            private void writeMeterInterval(MeterInterval meterInterval,
3423:                    PrintWriter pw) {
3424:
3425:                if (meterInterval == null)
3426:                    return;
3427:
3428:                pw.print("\t\t\t\t\t\t\t<meterInterval ");
3429:
3430:                if (meterInterval.getLabel().trim().length() > 0)
3431:                    pw.print("label=\""
3432:                            + Misc.xmlEscape(meterInterval.getLabel()) + "\" ");
3433:                if (meterInterval.getColor() != null)
3434:                    pw.print("color=\""
3435:                            + writeEncodedColor(meterInterval.getColor())
3436:                            + "\" ");
3437:                if (meterInterval.getAlpha() != 1)
3438:                    pw.print("alpha=\"" + meterInterval.getAlpha() + "\" ");
3439:
3440:                pw.println(">");
3441:
3442:                writeDataRange(meterInterval.getDataRange(), pw);
3443:
3444:                pw.println("\t\t\t\t\t\t\t</meterInterval>");
3445:            }
3446:
3447:            private void writeAxis(Axis axis, PrintWriter pw) {
3448:
3449:                if (axis == null)
3450:                    return;
3451:
3452:                pw.print("\t\t\t\t\t\t\t<axis ");
3453:                if (!axis.getPosition().equals("leftOrTop"))
3454:                    pw.print("position=\"" + Misc.xmlEscape(axis.getPosition())
3455:                            + "\" ");
3456:                pw.println(">");
3457:
3458:                writeChartElement(axis.getChartReportElement(), pw);
3459:
3460:                pw.println("\t\t\t\t\t\t\t</axis>");
3461:            }
3462:
3463:            public Report getReport() {
3464:                return report;
3465:            }
3466:
3467:            public void setReport(Report report) {
3468:                this .report = report;
3469:            }
3470:
3471:            public void writeXMLProperties(java.util.Collection collection,
3472:                    boolean filter, PrintWriter pw, String tabs) {
3473:                Iterator iter = collection.iterator();
3474:                while (iter.hasNext()) {
3475:                    JRProperty property = (JRProperty) iter.next();
3476:                    if (filter == false
3477:                            || !property.getName().startsWith("chart.")) {
3478:                        pw.print(tabs + "<property name=\""
3479:                                + Misc.xmlEscape(property.getName()) + "\" ");
3480:                        pw
3481:                                .println("value=\""
3482:                                        + Misc.xmlEscape(property.getValue())
3483:                                        + "\" />");
3484:                    }
3485:
3486:                }
3487:            }
3488:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.