Source Code Cross Referenced for ReportReader.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.ReportWriter;
0038:        import it.businesslogic.ireport.chart.SectionItemHyperlink;
0039:        import it.businesslogic.ireport.crosstab.CrosstabParameter;
0040:        import it.businesslogic.ireport.gui.event.ReportDocumentStatusChangedEvent;
0041:        import it.businesslogic.ireport.gui.event.ReportSubDatasetChangedEvent;
0042:        import it.businesslogic.ireport.util.I18n;
0043:        import java.io.ByteArrayInputStream;
0044:        import java.io.FileInputStream;
0045:        import java.io.FileOutputStream;
0046:        import java.util.Vector;
0047:        import java.util.Iterator;
0048:        import java.util.Properties;
0049:        import java.util.Enumeration;
0050:
0051:        //import it.businesslogic.ireport.util.*;
0052:        import it.businesslogic.ireport.util.Misc;
0053:        import it.businesslogic.ireport.util.PageSize;
0054:        import it.businesslogic.ireport.gui.JReportFrame;
0055:        import it.businesslogic.ireport.chart.*;
0056:        import it.businesslogic.ireport.crosstab.CrosstabCell;
0057:        import it.businesslogic.ireport.crosstab.CrosstabColumnGroup;
0058:        import it.businesslogic.ireport.crosstab.CrosstabGroup;
0059:        import it.businesslogic.ireport.crosstab.CrosstabRowGroup;
0060:        import it.businesslogic.ireport.crosstab.Measure;
0061:        import it.businesslogic.ireport.gui.MainFrame;
0062:        import it.businesslogic.ireport.gui.event.StyleChangedEvent;
0063:        import it.businesslogic.ireport.gui.event.SubDatasetObjectChangedListener;
0064:        import net.sf.jasperreports.engine.JRReport;
0065:        import net.sf.jasperreports.engine.JasperReport;
0066:        import net.sf.jasperreports.engine.util.JRLoader;
0067:
0068:        import org.apache.xerces.parsers.DOMParser;
0069:
0070:        //import org.w3c.dom.*;
0071:        import org.w3c.dom.Document;
0072:        import org.w3c.dom.NamedNodeMap;
0073:        import org.w3c.dom.Node;
0074:        import org.w3c.dom.NodeList;
0075:
0076:        import org.xml.sax.SAXException;
0077:
0078:        import java.io.IOException;
0079:        import java.io.File;
0080:        import java.io.PrintWriter;
0081:        import javax.swing.JCheckBox;
0082:        import javax.swing.JDialog;
0083:        import javax.swing.JOptionPane;
0084:        import javax.swing.SwingUtilities;
0085:
0086:        /**
0087:         *
0088:         * @author  Administrator
0089:         */
0090:        public class ReportReader {
0091:
0092:            private Report report = null;
0093:
0094:            private boolean deprecationWarning = false;
0095:
0096:            public ReportReader(Report report) {
0097:                this .report = report;
0098:            }
0099:
0100:            public Report getReport() {
0101:                return report;
0102:            }
0103:
0104:            public void setReport(Report report) {
0105:                this .report = report;
0106:            }
0107:
0108:            public Report readFile(String xmlFile) throws IOException {
0109:
0110:                deprecationWarning = false;
0111:
0112:                // Set the real default...
0113:                getReport().setLanguage("java");
0114:
0115:                //reset bands, prevents page height overflow for unused bands
0116:                for (int i = 0; i < getReport().getBands().size(); i++) {
0117:                    ((Band) getReport().getBands().elementAt(i)).setHeight(0);
0118:                }
0119:
0120:                java.io.InputStream input_source = null;
0121:                try {
0122:                    if (xmlFile.toLowerCase().endsWith(".jasper")) {
0123:                        try {
0124:                            java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
0125:                            // 1. We havo to load the design...
0126:                            JRReport jreport = (JRReport) JRLoader
0127:                                    .loadObject(xmlFile);
0128:
0129:                            net.sf.jasperreports.engine.JasperCompileManager
0130:                                    .writeReportToXmlStream(jreport, bos);
0131:
0132:                            input_source = new ByteArrayInputStream(bos
0133:                                    .toByteArray());
0134:
0135:                        } catch (Throwable t) {
0136:                            t.printStackTrace();
0137:                        }
0138:                    } else {
0139:
0140:                        //  Create a Xerces DOM Parser
0141:                        //  Parse the Document
0142:                        //  and traverse the DOM
0143:
0144:                        getReport().setFilename(xmlFile);
0145:                        getReport().checkReadOnlyFlag();
0146:
0147:                        // set load time...
0148:                        getReport().setLoadTime(Misc.getLastWriteTime(xmlFile));
0149:
0150:                        File ffile = new File(xmlFile);
0151:                        if (ffile.exists()) {
0152:                            input_source = new java.io.FileInputStream(ffile);
0153:
0154:                        } else {
0155:
0156:                            input_source = getReport().getClass()
0157:                                    .getClassLoader().getResourceAsStream(
0158:                                            xmlFile);
0159:                        }
0160:
0161:                        // Change to the file directory...
0162:
0163:                    }
0164:
0165:                    return readFromStream(input_source); //Changed by Felix Firgau
0166:                } catch (IOException e) {
0167:                    System.out.println(e);
0168:                    e.printStackTrace();
0169:                    throw e;
0170:
0171:                    // } catch (net.sf.jasperreports.engine.JRException e) {
0172:                    //     System.out.println(e);
0173:                    //     e.printStackTrace();
0174:
0175:                } catch (Exception e) {
0176:                    System.err.println(e);
0177:                    e.printStackTrace();
0178:                } finally {
0179:                    try {
0180:                        if (input_source != null) {
0181:                            input_source.close();
0182:                        }
0183:                    } catch (Exception ex) {
0184:                    }
0185:                }
0186:
0187:                showWarning();
0188:
0189:                return getReport();
0190:            }
0191:
0192:            private void showWarning() {
0193:                if (deprecationWarning
0194:                        && !MainFrame.getMainInstance().getProperties()
0195:                                .getProperty("showCompatibilityMessageLoad",
0196:                                        "true").equals("false")) {
0197:                    Runnable r = new Runnable() {
0198:
0199:                        public void run() {
0200:                            JOptionPane optionPane = new JOptionPane();
0201:                            JCheckBox checkbox = new JCheckBox(
0202:                                    "Don't show this message again.");
0203:                            checkbox.setEnabled(false);
0204:                            Object msg[] = {
0205:                                    "Warning: this report contains some deprecated tags.\n"
0206:                                            + "iReport will convert them using the appropriate new syntax.\n"
0207:                                            + "You can choose to keep this report compatible with a previous version of JasperReports, instead,\n"
0208:                                            + "but this may result in the loss of formatting information or parts of your report.\n\n",
0209:                                    checkbox };
0210:                            optionPane.setMessage(msg);
0211:                            optionPane
0212:                                    .setOptionType(JOptionPane.DEFAULT_OPTION);
0213:                            optionPane
0214:                                    .setMessageType(JOptionPane.WARNING_MESSAGE);
0215:
0216:                            final JDialog dialog = optionPane.createDialog(
0217:                                    MainFrame.getMainInstance(),
0218:                                    "Compatibility warning");
0219:                            checkbox.setEnabled(true);
0220:
0221:                            dialog.setVisible(true);
0222:
0223:                            Object value = optionPane.getValue();
0224:                            if (checkbox.isSelected()) {
0225:                                MainFrame.getMainInstance().getProperties()
0226:                                        .setProperty(
0227:                                                "showCompatibilityMessageLoad",
0228:                                                "false");
0229:                            }
0230:                        }
0231:                    };
0232:
0233:                    if (SwingUtilities.isEventDispatchThread()) {
0234:                        r.run();
0235:                    } else {
0236:                        SwingUtilities.invokeLater(r);
0237:                    }
0238:                }
0239:            }
0240:
0241:            /**
0242:             * readFromStream
0243:             * reads an report from an InputStream
0244:             *
0245:             * Author: Felix Firgau
0246:             *
0247:             * @param input_source InputStream
0248:             * @return Report
0249:             * @throws IOException
0250:             */
0251:            public Report readFromStream(java.io.InputStream input_source)
0252:                    throws IOException {
0253:                try {
0254:                    DOMParser parser = new DOMParser();
0255:
0256:                    parser.setEntityResolver(new org.xml.sax.EntityResolver() {
0257:
0258:                        /* Code by Teodor Danciu */
0259:                        public org.xml.sax.InputSource resolveEntity(
0260:                                String publicId, String systemId)
0261:                                throws SAXException, IOException {
0262:                            org.xml.sax.InputSource inputSource = null;
0263:
0264:                            //System.out.println("Resolving : " + publicId + " " + systemId);
0265:
0266:                            if (systemId != null) {
0267:                                String dtd = null;
0268:
0269:                                if (systemId
0270:                                        .equals("http://jasperreports.sourceforge.net/dtds/jasperreport.dtd")
0271:                                        || systemId
0272:                                                .equals("http://www.jasperreports.com/dtds/jasperreport.dtd")) {
0273:                                    //dtd = "dori/jasper/engine/dtds/jasperreport.dtd";
0274:                                    dtd = "net/sf/jasperreports/engine/dtds/jasperreport.dtd";
0275:
0276:                                } else if (systemId
0277:                                        .equals("http://jasperreports.sourceforge.net/dtds/jasperprint.dtd")
0278:                                        || systemId
0279:                                                .equals("http://www.jasperreports.com/dtds/jasperprint.dtd")) {
0280:                                    dtd = "net/sf/jasperreports/engine/dtds/jasperprint.dtd";
0281:                                } else {
0282:
0283:                                    return new org.xml.sax.InputSource(systemId);
0284:                                }
0285:
0286:                                ClassLoader classLoader = getReport()
0287:                                        .getClass().getClassLoader();
0288:                                java.net.URL url = null;
0289:
0290:                                if (classLoader != null) {
0291:                                    url = classLoader.getResource(dtd);
0292:                                    if (url == null) {
0293:                                        classLoader = getReport().getClass()
0294:                                                .getClassLoader();
0295:                                    }
0296:
0297:                                } else {
0298:                                    // url is certainly null
0299:                                    // classLoader stays null
0300:                                }
0301:
0302:                                java.io.InputStream is = classLoader
0303:                                        .getResourceAsStream(dtd);
0304:                                if (is != null) {
0305:                                    java.io.InputStreamReader isr = new java.io.InputStreamReader(
0306:                                            is);
0307:                                    inputSource = new org.xml.sax.InputSource(
0308:                                            isr);
0309:                                } else {
0310:                                    // dtd could not be found
0311:                                    // this error occurs e.g. when the package name / path changes to this dtd
0312:                                    // the error will be caught by MainFrame.openFile() en the report file won't open
0313:                                    throw new java.io.IOException(
0314:                                            "iReport Internal error in report.java: Could not find: "
0315:                                                    + dtd + "\n");
0316:                                }
0317:                            }
0318:                            return inputSource;
0319:
0320:                        }
0321:                    });
0322:                    /* End Code by Teodor Danciu */
0323:
0324:                    //String f = new java.io.File(xmlFile).toURI().toString();
0325:                    org.xml.sax.InputSource input_sss = new org.xml.sax.InputSource(
0326:                            input_source);
0327:                    input_sss.setSystemId("file:///"
0328:                            + getReport().getFilename());
0329:
0330:                    parser.parse(input_sss);
0331:
0332:                    //System.out.println(parser.getFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes"));
0333:
0334:                    Document document = parser.getDocument();
0335:                    getReport().setEncoding(
0336:                            Misc.nvl(input_sss.getEncoding(), "UTF-8"));
0337:
0338:                    traverse(document.getDocumentElement());
0339:
0340:                    /* Begin Code by Robert Lamping
0341:                     * 2 July 2004
0342:                     * Now height and width are known and a format can be guessed.
0343:                     * using PageSize.deductPageFormat();
0344:                     */
0345:
0346:                    getReport().setReportFormat(
0347:                            PageSize.deductPageFormat(getReport().getWidth(),
0348:                                    getReport().getHeight()));
0349:
0350:                    for (int i = 0; i < getReport().getGroups().size(); i++) {
0351:                        it.businesslogic.ireport.Group grp = (it.businesslogic.ireport.Group) getReport()
0352:                                .getGroups().elementAt(i);
0353:                        getReport().addGroup(grp, false);
0354:                    }
0355:
0356:                    /*
0357:                    for (int i=0; i<getBands().size(); ++i)
0358:                    {
0359:                        Band b = (Band)getBands().elementAt(i);
0360:                        getReport().elementGroupResort( b );
0361:                    }
0362:                     */
0363:
0364:                    // Translate coords to iReport coord system...
0365:                    for (int i = 0; i < getReport().getElements().size(); ++i) {
0366:                        ReportElement re = (ReportElement) getReport()
0367:                                .getElements().elementAt(i);
0368:
0369:                        if (re.getParentElement() != null) {
0370:                            re.trasform(new java.awt.Point((int) re
0371:                                    .getParentElement().getPosition().getX(),
0372:                                    (int) re.getParentElement().getPosition()
0373:                                            .getY()),
0374:                                    TransformationType.TRANSFORMATION_MOVE);
0375:                        } else {
0376:                            re.trasform(new java.awt.Point(getReport()
0377:                                    .getLeftMargin() + 10, getReport()
0378:                                    .getBandYLocation(re.getBand()) + 10),
0379:                                    TransformationType.TRANSFORMATION_MOVE);
0380:                        }
0381:                    }
0382:
0383:                    // Scriptlet loading....
0384:
0385:                    // Process custom properties (ireport.* properties).
0386:                    // We cut out ireport properties...
0387:                    //System.out.println("Analizing properties...");
0388:                    //System.out.println("Possible file: "+getReport().getScriptletFileName());
0389:
0390:                    if (getReport().getScriptletFileName() != null) {
0391:                        getReport().setScriptletHandling(
0392:                                getReport().SCRIPTLET_CLASSIC_HANDLING);
0393:                    }
0394:
0395:                    for (int pk = 0; pk < getReport().getJRproperties().size(); ++pk) {
0396:                        JRProperty prop = (JRProperty) getReport()
0397:                                .getJRproperties().elementAt(pk);
0398:
0399:                        //System.out.println(""+prop.getName());
0400:
0401:                        if (prop.getName().equals("ireport.scriptlethandling")) {
0402:                            if (prop.getValue().equals("0")) {
0403:                                getReport().setScriptletHandling(0);
0404:                            } else if (prop.getValue().equals("1")) {
0405:                                getReport()
0406:                                        .setScriptletHandling(
0407:                                                getReport().SCRIPTLET_IREPORT_INTERNAL_HANDLING);
0408:                                // Try to load the source file...
0409:                                File scriptletFile = new File(getReport()
0410:                                        .getScriptletFileName());
0411:                                if (scriptletFile.exists()) {
0412:                                    getReport().setScripletCode(
0413:                                            new ScriptletCode(getReport()
0414:                                                    .getScriptletFileName()));
0415:                                    //System.out.println("Caricato scriptlet");
0416:                                }
0417:                            }
0418:                        }
0419:
0420:                        if (prop.getName().equals("ireport.encoding")) {
0421:                            getReport().setEncoding(prop.getValue());
0422:                        }
0423:
0424:                        if (prop.getValue().startsWith("ireport.")) {
0425:                            getReport().getJRproperties().remove(prop);
0426:                            pk--;
0427:                        }
0428:                    }
0429:
0430:                    if (getReport().getScriptletHandling() == 2
0431:                            && (getReport().getScriptletClass() == null || getReport()
0432:                                    .getScriptletClass().equals(""))) {
0433:                        getReport().setScriptletHandling(0);
0434:                    }
0435:
0436:                    // } catch (SAXException e) {
0437:                    //            System.err.println(e);
0438:                } catch (IOException e) {
0439:                    System.out.println(e);
0440:                    e.printStackTrace();
0441:                    throw e;
0442:
0443:                } catch (Exception e) {
0444:                    System.err.println(e);
0445:                    e.printStackTrace();
0446:                }
0447:
0448:                // Set the report status to Unchanged...
0449:                // This will thrown an ReportStateChanged
0450:                getReport().setReportChanges(0);
0451:
0452:                showWarning();
0453:
0454:                return getReport();
0455:            }
0456:
0457:            private void readGraphicsElement(GraphicReportElement re,
0458:                    Node child_child) {
0459:
0460:                NamedNodeMap subNodeAttributes = child_child.getAttributes();
0461:
0462:                NodeList childsOfGraphicElement = child_child.getChildNodes();
0463:                for (int ge_c_count = 0; ge_c_count < childsOfGraphicElement
0464:                        .getLength(); ge_c_count++) {
0465:                    Node geSubNode = (Node) childsOfGraphicElement
0466:                            .item(ge_c_count);
0467:                    if (geSubNode.getNodeType() == Node.ELEMENT_NODE
0468:                            && geSubNode.getNodeName().equals("pen")) {
0469:
0470:                        float defWidth = re instanceof  ImageReportElement ? 0f
0471:                                : 1f;
0472:                        re.setPen(readPen(geSubNode, defWidth));
0473:                    }
0474:                }
0475:
0476:                if (subNodeAttributes.getNamedItem("pen") != null) {
0477:                    re.setGraphicElementPen(""
0478:                            + subNodeAttributes.getNamedItem("pen")
0479:                                    .getNodeValue());
0480:                    deprecationWarning = true;
0481:                    if (re.getPen() == null)
0482:                        re.setPen(new Pen());
0483:                    re.getPen().setLineWidth(
0484:                            getLineWidthByBorder(re.getGraphicElementPen()));
0485:                    re.getPen().setLineStyle(
0486:                            getLineStyleByBorder(re.getGraphicElementPen()));
0487:                }
0488:                if (subNodeAttributes.getNamedItem("fill") != null) {
0489:                    re.setPropertyValue(GraphicReportElement.FILL, ""
0490:                            + subNodeAttributes.getNamedItem("fill")
0491:                                    .getNodeValue());
0492:                }
0493:                if (subNodeAttributes.getNamedItem("stretchType") != null) {
0494:                    re.setStretchType(""
0495:                            + subNodeAttributes.getNamedItem("stretchType")
0496:                                    .getNodeValue());
0497:                }
0498:
0499:            }
0500:
0501:            //  Traverse DOM Tree.  Print out Element Names
0502:            private void traverse(Node node) {
0503:
0504:                boolean seeInside = false;
0505:                if (node.getNodeType() == Node.ELEMENT_NODE
0506:                        && node.getNodeName().equals("jasperReport")) {
0507:
0508:                    seeInside = true;
0509:                    // Find encoding...
0510:                    NamedNodeMap nnm = node.getAttributes();
0511:
0512:                    getReport().setName(
0513:                            ((nnm.getNamedItem("name") != null) ? nnm
0514:                                    .getNamedItem("name").getNodeValue() : ""));
0515:
0516:                    if (nnm.getNamedItem("columnCount") != null) {
0517:                        getReport().setColumnCount(
0518:                                Integer.parseInt(nnm
0519:                                        .getNamedItem("columnCount")
0520:                                        .getNodeValue()));
0521:                    }
0522:                    if (nnm.getNamedItem("printOrder") != null) {
0523:                        getReport().setPrintOrder(
0524:                                nnm.getNamedItem("printOrder").getNodeValue());
0525:                    }
0526:                    if (nnm.getNamedItem("orientation") != null) {
0527:                        getReport().setOrientation(
0528:                                nnm.getNamedItem("orientation").getNodeValue());
0529:                    }
0530:                    if (nnm.getNamedItem("scriptletClass") != null) {
0531:                        getReport().setScriptletClass(
0532:                                nnm.getNamedItem("scriptletClass")
0533:                                        .getNodeValue());
0534:                    }
0535:                    if (nnm.getNamedItem("resourceBundle") != null) {
0536:                        getReport().setResourceBundleBaseName(
0537:                                nnm.getNamedItem("resourceBundle")
0538:                                        .getNodeValue());
0539:                    }
0540:                    if (nnm.getNamedItem("pageWidth") != null) {
0541:                        getReport().setWidth(
0542:                                Integer.parseInt(nnm.getNamedItem("pageWidth")
0543:                                        .getNodeValue()));
0544:                    }
0545:                    if (nnm.getNamedItem("pageHeight") != null) {
0546:                        getReport().setHeight(
0547:                                Integer.parseInt(nnm.getNamedItem("pageHeight")
0548:                                        .getNodeValue()));
0549:                    }
0550:                    if (nnm.getNamedItem("columnWidth") != null) {
0551:                        getReport().setColumnWidth(
0552:                                Integer.parseInt(nnm
0553:                                        .getNamedItem("columnWidth")
0554:                                        .getNodeValue()));
0555:                    }
0556:                    if (nnm.getNamedItem("columnSpacing") != null) {
0557:                        getReport().setColumnSpacing(
0558:                                Integer.parseInt(nnm.getNamedItem(
0559:                                        "columnSpacing").getNodeValue()));
0560:                    }
0561:                    if (nnm.getNamedItem("leftMargin") != null) {
0562:                        getReport().setLeftMargin(
0563:                                Integer.parseInt(nnm.getNamedItem("leftMargin")
0564:                                        .getNodeValue()));
0565:                    }
0566:                    if (nnm.getNamedItem("rightMargin") != null) {
0567:                        getReport().setRightMargin(
0568:                                Integer.parseInt(nnm
0569:                                        .getNamedItem("rightMargin")
0570:                                        .getNodeValue()));
0571:                    }
0572:                    if (nnm.getNamedItem("topMargin") != null) {
0573:                        getReport().setTopMargin(
0574:                                Integer.parseInt(nnm.getNamedItem("topMargin")
0575:                                        .getNodeValue()));
0576:                    }
0577:                    if (nnm.getNamedItem("bottomMargin") != null) {
0578:                        getReport().setBottomMargin(
0579:                                Integer.parseInt(nnm.getNamedItem(
0580:                                        "bottomMargin").getNodeValue()));
0581:                    }
0582:                    if (nnm.getNamedItem("whenNoDataType") != null) {
0583:                        getReport().setWhenNoDataType(
0584:                                nnm.getNamedItem("whenNoDataType")
0585:                                        .getNodeValue());
0586:                    }
0587:                    if (nnm.getNamedItem("isTitleNewPage") != null) {
0588:                        getReport().setIsTitleNewPage(
0589:                                nnm.getNamedItem("isTitleNewPage")
0590:                                        .getNodeValue()
0591:                                        .equalsIgnoreCase("true"));
0592:                    }
0593:                    if (nnm.getNamedItem("isSummaryNewPage") != null) {
0594:                        getReport().setIsSummaryNewPage(
0595:                                nnm.getNamedItem("isSummaryNewPage")
0596:                                        .getNodeValue()
0597:                                        .equalsIgnoreCase("true"));
0598:                    }
0599:
0600:                    if (nnm.getNamedItem("isFloatColumnFooter") != null) {
0601:                        getReport().setFloatColumnFooter(
0602:                                nnm.getNamedItem("isFloatColumnFooter")
0603:                                        .getNodeValue()
0604:                                        .equalsIgnoreCase("true"));
0605:                    }
0606:
0607:                    if (nnm.getNamedItem("language") != null) {
0608:                        getReport().setLanguage(
0609:                                nnm.getNamedItem("language").getNodeValue());
0610:                    }
0611:
0612:                    if (nnm.getNamedItem("whenResourceMissingType") != null) {
0613:                        getReport().setWhenResourceMissingType(
0614:                                nnm.getNamedItem("whenResourceMissingType")
0615:                                        .getNodeValue());
0616:                    }
0617:
0618:                    if (nnm.getNamedItem("isIgnorePagination") != null) {
0619:                        getReport().setIgnorePagination(
0620:                                nnm.getNamedItem("isIgnorePagination")
0621:                                        .getNodeValue()
0622:                                        .equalsIgnoreCase("true"));
0623:                    }
0624:
0625:                    if (nnm.getNamedItem("formatFactoryClass") != null) {
0626:                        getReport().setFormatFactoryClass(
0627:                                nnm.getNamedItem("formatFactoryClass")
0628:                                        .getNodeValue());
0629:                    }
0630:
0631:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0632:                        && node.getNodeName().equals("property")) {
0633:
0634:                    // Load report property...
0635:                    it.businesslogic.ireport.JRProperty property = readPropertyElement(node);
0636:                    if (property.getName() != null
0637:                            && property.getName().length() != 0) {
0638:                        getReport().addJRProperty(property);
0639:                    }
0640:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0641:                        && node.getNodeName().equals("import")) {
0642:
0643:                    // Load report IMPORT...
0644:                    NamedNodeMap nnm = node.getAttributes();
0645:                    if (nnm.getNamedItem("value") != null) {
0646:                        getReport().addImport(
0647:                                nnm.getNamedItem("value").getNodeValue());
0648:                    }
0649:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0650:                        && node.getNodeName().equals("template")) {
0651:
0652:                    // Load report IMPORT...
0653:                    String clazz = "java.lang.String";
0654:                    String exp = readPCDATA(node, true);
0655:
0656:                    NamedNodeMap nnm = node.getAttributes();
0657:                    if (nnm.getNamedItem("class") != null) {
0658:                        clazz = nnm.getNamedItem("class").getNodeValue();
0659:                    }
0660:
0661:                    if (exp.length() > 0) {
0662:                        Template template = new Template(exp, clazz);
0663:                        getReport().getTemplates().add(template);
0664:                    }
0665:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0666:                        && node.getNodeName().equals("reportFont")) {
0667:
0668:                    // Load report font...
0669:                    boolean isDefaultFont = false;
0670:                    IReportFont font = new IReportFont();
0671:
0672:                    NamedNodeMap nnm = node.getAttributes();
0673:
0674:                    for (int kkk = 0; kkk < nnm.getLength(); ++kkk) {
0675:                        //System.out.println( + " " + );
0676:
0677:                        String propName = nnm.item(kkk).getNodeName();
0678:                        String propValue = nnm.item(kkk).getNodeValue();
0679:                        if (propName != null && propValue != null) {
0680:                            if (propName.equals("name"))
0681:                                font.setReportFont(propValue);
0682:                            if (propName.equals("isDefault")) {
0683:                                isDefaultFont = propValue.equals("true");
0684:                                font.setDefaultFont(isDefaultFont);
0685:                            }
0686:                            if (propName.equals("fontName"))
0687:                                font.setFontName(propValue);
0688:                            else if (propName.equals("pdfFontName"))
0689:                                font.setPDFFontName(propValue);
0690:                            else if (propName.equals("size"))
0691:                                font.setFontSize(Integer.parseInt(""
0692:                                        + propValue));
0693:                            else if (propName.equals("isBold"))
0694:                                font.setBold((new String("" + propValue))
0695:                                        .equalsIgnoreCase("true"));
0696:                            else if (propName.equals("isItalic"))
0697:                                font.setItalic((new String("" + propValue))
0698:                                        .equalsIgnoreCase("true"));
0699:                            else if (propName.equals("isUnderline"))
0700:                                font.setUnderline((new String("" + propValue))
0701:                                        .equalsIgnoreCase("true"));
0702:                            else if (propName.equals("isStrikeThrough"))
0703:                                font.setStrikeTrought((new String(""
0704:                                        + propValue)).equalsIgnoreCase("true"));
0705:                            else if (propName.equals("isPdfEmbedded"))
0706:                                font
0707:                                        .setPdfEmbedded((new String(""
0708:                                                + propValue))
0709:                                                .equalsIgnoreCase("true"));
0710:                            else if (propName.equals("pdfEncoding"))
0711:                                font.setPdfEncoding("" + propValue);
0712:                        }
0713:                    }
0714:
0715:                    if (isDefaultFont) {
0716:                        getReport().setDefaultFont((IReportFont) font.clone());
0717:                    }
0718:
0719:                    getReport().getFonts().addElement(font);
0720:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0721:                        && node.getNodeName().equals("style")) {
0722:
0723:                    Style style = readStyle(node);
0724:                    getReport().getStyles().addElement(style);
0725:
0726:                    // Update Styles parents...
0727:                    for (int i = 0; i < getReport().getStyles().size(); ++i) {
0728:                        Style s = (Style) getReport().getStyles().elementAt(i);
0729:                        if (s.getAttribute(s.ATTRIBUTE_style) != null
0730:                                && !(s.getAttribute(s.ATTRIBUTE_style) instanceof  Style)) {
0731:                            for (int j = 0; j < getReport().getStyles().size(); ++j) {
0732:                                Style sparent = (Style) getReport().getStyles()
0733:                                        .elementAt(j);
0734:                                if (sparent.getName().equals(
0735:                                        s.getAttribute(s.ATTRIBUTE_style) + "")) {
0736:                                    s.getAttributes().put(s.ATTRIBUTE_style,
0737:                                            sparent);
0738:                                }
0739:                            }
0740:                        }
0741:                    }
0742:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0743:                        && node.getNodeName().equals("parameter")) {
0744:
0745:                    // Load parameter...
0746:                    it.businesslogic.ireport.JRParameter parameter = readParameterElement(node);
0747:
0748:                    if (parameter.getName() != null
0749:                            && parameter.getName().length() != 0) {
0750:                        getReport().addParameter(parameter);
0751:                    }
0752:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0753:                        && node.getNodeName().equals("queryString")) {
0754:                    // Load queryString
0755:                    NamedNodeMap nnm = node.getAttributes();
0756:                    if (nnm.getNamedItem("language") != null) {
0757:                        getReport().setQueryLanguage(
0758:                                nnm.getNamedItem("language").getNodeValue());
0759:                    }
0760:
0761:                    getReport().setQuery(readPCDATA(node));
0762:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0763:                        && node.getNodeName().equals("filterExpression")) {
0764:                    getReport().setFilterExpression(readPCDATA(node));
0765:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0766:                        && node.getNodeName().equals("field")) {
0767:                    // Load field
0768:                    it.businesslogic.ireport.JRField field = readFieldElement(node);
0769:
0770:                    if (field.getName() != null
0771:                            && field.getName().length() != 0) {
0772:                        getReport().addField(field);
0773:                    }
0774:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0775:                        && node.getNodeName().equals("variable")) {
0776:                    // Load variable
0777:                    it.businesslogic.ireport.JRVariable variable = readVariableElement(node);
0778:
0779:                    if (variable.getName() != null
0780:                            && variable.getName().length() != 0) {
0781:                        getReport().addVariable(variable);
0782:                    }
0783:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0784:                        && node.getNodeName().equals("sortField")) {
0785:                    it.businesslogic.ireport.SortField sortField = readSortFieldElement(node);
0786:                    getReport().addSortField(sortField);
0787:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0788:                        && node.getNodeName().equals("subDataset")) {
0789:                    // Load field
0790:                    it.businesslogic.ireport.SubDataset subDataset = new it.businesslogic.ireport.SubDataset();
0791:
0792:                    NamedNodeMap nnm = node.getAttributes();
0793:                    if (nnm.getNamedItem("scriptletClass") != null) {
0794:                        subDataset.setScriptletClass(nnm.getNamedItem(
0795:                                "scriptletClass").getNodeValue());
0796:                    }
0797:                    if (nnm.getNamedItem("resourceBundle") != null) {
0798:                        subDataset.setResourceBundleBaseName(nnm.getNamedItem(
0799:                                "resourceBundle").getNodeValue());
0800:                    }
0801:                    if (nnm.getNamedItem("whenResourceMissingType") != null) {
0802:                        subDataset.setWhenResourceMissingType(nnm.getNamedItem(
0803:                                "whenResourceMissingType").getNodeValue());
0804:                    }
0805:                    subDataset
0806:                            .setName(((nnm.getNamedItem("name") != null) ? nnm
0807:                                    .getNamedItem("name").getNodeValue()
0808:                                    : "SubDataset"));
0809:
0810:                    NodeList children = node.getChildNodes();
0811:                    if (children != null) {
0812:                        for (int k = 0; k < children.getLength(); k++) {
0813:                            Node nodeChild = (Node) children.item(k);
0814:                            if (nodeChild.getNodeType() == Node.ELEMENT_NODE
0815:                                    && nodeChild.getNodeName().equals(
0816:                                            "property")) {
0817:                                // Take the CDATA...
0818:                                it.businesslogic.ireport.JRProperty property = readPropertyElement(nodeChild);
0819:                                if (property.getName() != null
0820:                                        && property.getName().length() != 0) {
0821:                                    subDataset.addJRProperty(property);
0822:                                }
0823:                            } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
0824:                                    && nodeChild.getNodeName().equals(
0825:                                            "parameter")) {
0826:                                // Take the CDATA...
0827:                                it.businesslogic.ireport.JRParameter parameter = readParameterElement(nodeChild);
0828:                                if (parameter.getName() != null
0829:                                        && parameter.getName().length() != 0) {
0830:                                    subDataset.addParameter(parameter);
0831:                                }
0832:                            } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
0833:                                    && nodeChild.getNodeName().equals("field")) {
0834:                                // Take the CDATA...
0835:                                it.businesslogic.ireport.JRField field = readFieldElement(nodeChild);
0836:
0837:                                if (field.getName() != null
0838:                                        && field.getName().length() != 0) {
0839:                                    subDataset.addField(field);
0840:                                }
0841:                            } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
0842:                                    && nodeChild.getNodeName().equals(
0843:                                            "variable")) {
0844:                                // Take the CDATA...
0845:                                it.businesslogic.ireport.JRVariable variable = readVariableElement(nodeChild);
0846:                                if (variable.getName() != null
0847:                                        && variable.getName().length() != 0) {
0848:                                    subDataset.addVariable(variable);
0849:                                }
0850:                            } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
0851:                                    && nodeChild.getNodeName().equals(
0852:                                            "queryString")) {
0853:                                // Take the CDATA...
0854:                                NamedNodeMap nnmChild = nodeChild
0855:                                        .getAttributes();
0856:                                if (nnmChild.getNamedItem("language") != null) {
0857:                                    subDataset.setQueryLanguage(nnmChild
0858:                                            .getNamedItem("language")
0859:                                            .getNodeValue());
0860:                                }
0861:                                subDataset.setQuery(readPCDATA(nodeChild));
0862:                            } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
0863:                                    && nodeChild.getNodeName().equals(
0864:                                            "filterExpression")) {
0865:                                subDataset
0866:                                        .setFilterExpression(readPCDATA(nodeChild));
0867:                            } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
0868:                                    && nodeChild.getNodeName().equals("group")) {
0869:                                // Take the CDATA...
0870:                                it.businesslogic.ireport.Group group = readGroupElement(
0871:                                        subDataset, nodeChild, false);
0872:                                subDataset.getGroups().add(group);
0873:                            } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
0874:                                    && nodeChild.getNodeName().equals(
0875:                                            "sortField")) {
0876:                                // Take the CDATA...
0877:                                it.businesslogic.ireport.SortField sortField = readSortFieldElement(nodeChild);
0878:                                subDataset.addSortField(sortField);
0879:                            }
0880:                        }
0881:                    }
0882:
0883:                    getReport().addSubDataset(subDataset);
0884:
0885:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0886:                        && node.getNodeName().equals("group")) {
0887:                    // Load group
0888:
0889:                    it.businesslogic.ireport.Group group = readGroupElement(
0890:                            getReport(), node, true);
0891:                    if (group.getName() != null
0892:                            && group.getName().length() != 0) {
0893:                        getReport().getGroups().addElement(group); // We don't use here addGroup method!
0894:                    }
0895:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0896:                        && node.getNodeName().equals("background")) {
0897:                    // Load background band
0898:                    NodeList list_child = node.getChildNodes();
0899:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
0900:                        Node bandNode = (Node) list_child.item(ck);
0901:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
0902:                                && bandNode.getNodeName().equals("band")) {
0903:                            // Read the band...
0904:                            NamedNodeMap bandAttributes = bandNode
0905:                                    .getAttributes();
0906:                            Band b = getReport().getBandByName("background");
0907:                            if (bandAttributes.getNamedItem("height") != null)
0908:                                b
0909:                                        .setHeight(Integer
0910:                                                .parseInt(bandAttributes
0911:                                                        .getNamedItem("height")
0912:                                                        .getNodeValue()));
0913:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
0914:                                b.setSplitAllowed(bandAttributes.getNamedItem(
0915:                                        "isSplitAllowed").getNodeValue()
0916:                                        .equals("true"));
0917:                            readBandElements(bandNode, b);
0918:                        }
0919:                    }
0920:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0921:                        && node.getNodeName().equals("title")) {
0922:                    // Load title band
0923:                    NodeList list_child = node.getChildNodes();
0924:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
0925:                        Node bandNode = (Node) list_child.item(ck);
0926:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
0927:                                && bandNode.getNodeName().equals("band")) {
0928:                            // Read the band...
0929:                            NamedNodeMap bandAttributes = bandNode
0930:                                    .getAttributes();
0931:                            Band b = getReport().getBandByName("title");
0932:                            if (bandAttributes.getNamedItem("height") != null)
0933:                                b
0934:                                        .setHeight(Integer
0935:                                                .parseInt(bandAttributes
0936:                                                        .getNamedItem("height")
0937:                                                        .getNodeValue()));
0938:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
0939:                                b.setSplitAllowed(bandAttributes.getNamedItem(
0940:                                        "isSplitAllowed").getNodeValue()
0941:                                        .equals("true"));
0942:                            readBandElements(bandNode, b);
0943:                        }
0944:                    }
0945:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0946:                        && node.getNodeName().equals("pageHeader")) {
0947:                    // Load pageHeader band
0948:                    NodeList list_child = node.getChildNodes();
0949:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
0950:                        Node bandNode = (Node) list_child.item(ck);
0951:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
0952:                                && bandNode.getNodeName().equals("band")) {
0953:                            // Read the band...
0954:                            NamedNodeMap bandAttributes = bandNode
0955:                                    .getAttributes();
0956:                            Band b = getReport().getBandByName("pageHeader");
0957:                            if (bandAttributes.getNamedItem("height") != null)
0958:                                b
0959:                                        .setHeight(Integer
0960:                                                .parseInt(bandAttributes
0961:                                                        .getNamedItem("height")
0962:                                                        .getNodeValue()));
0963:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
0964:                                b.setSplitAllowed(bandAttributes.getNamedItem(
0965:                                        "isSplitAllowed").getNodeValue()
0966:                                        .equals("true"));
0967:                            readBandElements(bandNode, b);
0968:                        }
0969:                    }
0970:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0971:                        && node.getNodeName().equals("columnHeader")) {
0972:                    // Load columnHeader band
0973:                    NodeList list_child = node.getChildNodes();
0974:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
0975:                        Node bandNode = (Node) list_child.item(ck);
0976:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
0977:                                && bandNode.getNodeName().equals("band")) {
0978:                            // Read the band...
0979:                            NamedNodeMap bandAttributes = bandNode
0980:                                    .getAttributes();
0981:                            Band b = getReport().getBandByName("columnHeader");
0982:                            if (bandAttributes.getNamedItem("height") != null)
0983:                                b
0984:                                        .setHeight(Integer
0985:                                                .parseInt(bandAttributes
0986:                                                        .getNamedItem("height")
0987:                                                        .getNodeValue()));
0988:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
0989:                                b.setSplitAllowed(bandAttributes.getNamedItem(
0990:                                        "isSplitAllowed").getNodeValue()
0991:                                        .equals("true"));
0992:                            readBandElements(bandNode, b);
0993:                        }
0994:                    }
0995:                } else if (node.getNodeType() == Node.ELEMENT_NODE
0996:                        && node.getNodeName().equals("detail")) {
0997:                    // Load detail band
0998:                    NodeList list_child = node.getChildNodes();
0999:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
1000:                        Node bandNode = (Node) list_child.item(ck);
1001:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
1002:                                && bandNode.getNodeName().equals("band")) {
1003:                            // Read the band...
1004:                            NamedNodeMap bandAttributes = bandNode
1005:                                    .getAttributes();
1006:                            Band b = getReport().getBandByName("detail");
1007:                            if (bandAttributes.getNamedItem("height") != null)
1008:                                b
1009:                                        .setHeight(Integer
1010:                                                .parseInt(bandAttributes
1011:                                                        .getNamedItem("height")
1012:                                                        .getNodeValue()));
1013:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
1014:                                b.setSplitAllowed(bandAttributes.getNamedItem(
1015:                                        "isSplitAllowed").getNodeValue()
1016:                                        .equals("true"));
1017:                            readBandElements(bandNode, b);
1018:                        }
1019:                    }
1020:                } else if (node.getNodeType() == Node.ELEMENT_NODE
1021:                        && node.getNodeName().equals("columnFooter")) {
1022:                    // Load columnFooter band
1023:                    NodeList list_child = node.getChildNodes();
1024:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
1025:                        Node bandNode = (Node) list_child.item(ck);
1026:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
1027:                                && bandNode.getNodeName().equals("band")) {
1028:                            // Read the band...
1029:                            NamedNodeMap bandAttributes = bandNode
1030:                                    .getAttributes();
1031:                            Band b = getReport().getBandByName("columnFooter");
1032:                            if (bandAttributes.getNamedItem("height") != null)
1033:                                b
1034:                                        .setHeight(Integer
1035:                                                .parseInt(bandAttributes
1036:                                                        .getNamedItem("height")
1037:                                                        .getNodeValue()));
1038:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
1039:                                b.setSplitAllowed(bandAttributes.getNamedItem(
1040:                                        "isSplitAllowed").getNodeValue()
1041:                                        .equals("true"));
1042:                            readBandElements(bandNode, b);
1043:                        }
1044:                    }
1045:                } else if (node.getNodeType() == Node.ELEMENT_NODE
1046:                        && node.getNodeName().equals("pageFooter")) {
1047:                    // Load pageFooter band
1048:                    NodeList list_child = node.getChildNodes();
1049:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
1050:                        Node bandNode = (Node) list_child.item(ck);
1051:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
1052:                                && bandNode.getNodeName().equals("band")) {
1053:                            // Read the band...
1054:                            NamedNodeMap bandAttributes = bandNode
1055:                                    .getAttributes();
1056:                            Band b = getReport().getBandByName("pageFooter");
1057:                            if (bandAttributes.getNamedItem("height") != null)
1058:                                b
1059:                                        .setHeight(Integer
1060:                                                .parseInt(bandAttributes
1061:                                                        .getNamedItem("height")
1062:                                                        .getNodeValue()));
1063:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
1064:                                b.setSplitAllowed(bandAttributes.getNamedItem(
1065:                                        "isSplitAllowed").getNodeValue()
1066:                                        .equals("true"));
1067:                            readBandElements(bandNode, b);
1068:                        }
1069:                    }
1070:                } else if (node.getNodeType() == Node.ELEMENT_NODE
1071:                        && node.getNodeName().equals("lastPageFooter")) {
1072:                    // Load title band
1073:                    NodeList list_child = node.getChildNodes();
1074:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
1075:                        Node bandNode = (Node) list_child.item(ck);
1076:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
1077:                                && bandNode.getNodeName().equals("band")) {
1078:                            // Read the band...
1079:                            NamedNodeMap bandAttributes = bandNode
1080:                                    .getAttributes();
1081:                            Band b = getReport()
1082:                                    .getBandByName("lastPageFooter");
1083:                            if (bandAttributes.getNamedItem("height") != null)
1084:                                b
1085:                                        .setHeight(Integer
1086:                                                .parseInt(bandAttributes
1087:                                                        .getNamedItem("height")
1088:                                                        .getNodeValue()));
1089:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
1090:                                b.setSplitAllowed(bandAttributes.getNamedItem(
1091:                                        "isSplitAllowed").getNodeValue()
1092:                                        .equals("true"));
1093:                            readBandElements(bandNode, b);
1094:                        }
1095:                    }
1096:                } else if (node.getNodeType() == Node.ELEMENT_NODE
1097:                        && node.getNodeName().equals("summary")) {
1098:                    // Load summary band
1099:                    NodeList list_child = node.getChildNodes();
1100:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
1101:                        Node bandNode = (Node) list_child.item(ck);
1102:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
1103:                                && bandNode.getNodeName().equals("band")) {
1104:                            // Read the band...
1105:                            NamedNodeMap bandAttributes = bandNode
1106:                                    .getAttributes();
1107:                            Band b = getReport().getBandByName("summary");
1108:                            if (bandAttributes.getNamedItem("height") != null)
1109:                                b
1110:                                        .setHeight(Integer
1111:                                                .parseInt(bandAttributes
1112:                                                        .getNamedItem("height")
1113:                                                        .getNodeValue()));
1114:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
1115:                                b.setSplitAllowed(bandAttributes.getNamedItem(
1116:                                        "isSplitAllowed").getNodeValue()
1117:                                        .equals("true"));
1118:
1119:                            readBandElements(bandNode, b);
1120:                        }
1121:                    }
1122:                } else if (node.getNodeType() == Node.ELEMENT_NODE
1123:                        && node.getNodeName().equals("noData")) {
1124:                    // Load summary band
1125:                    NodeList list_child = node.getChildNodes();
1126:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
1127:                        Node bandNode = (Node) list_child.item(ck);
1128:                        if (bandNode.getNodeType() == Node.ELEMENT_NODE
1129:                                && bandNode.getNodeName().equals("band")) {
1130:                            // Read the band...
1131:                            NamedNodeMap bandAttributes = bandNode
1132:                                    .getAttributes();
1133:                            Band b = getReport().getBandByName("noData");
1134:                            if (bandAttributes.getNamedItem("height") != null)
1135:                                b
1136:                                        .setHeight(Integer
1137:                                                .parseInt(bandAttributes
1138:                                                        .getNamedItem("height")
1139:                                                        .getNodeValue()));
1140:                            if (bandAttributes.getNamedItem("isSplitAllowed") != null)
1141:                                b.setSplitAllowed(bandAttributes.getNamedItem(
1142:                                        "isSplitAllowed").getNodeValue()
1143:                                        .equals("true"));
1144:
1145:                            readBandElements(bandNode, b);
1146:                        }
1147:                    }
1148:                } else {
1149:                    if (node.getNodeType() == node.ENTITY_REFERENCE_NODE) {
1150:                        seeInside = true;
1151:                    }
1152:                }
1153:
1154:                if (seeInside) {
1155:                    NodeList children = node.getChildNodes();
1156:                    if (children != null) {
1157:                        for (int i = 0; i < children.getLength(); i++)
1158:                            traverse(children.item(i));
1159:                    }
1160:                }
1161:
1162:            }
1163:
1164:            private void readBandElements(Node bandNode, Band band) {
1165:                readBandElements("", bandNode, band, null, null, null);
1166:            }
1167:
1168:            private void readBandElements(String parentElementGroup,
1169:                    Node bandNode, Band band, ReportElement parent) {
1170:                readBandElements(parentElementGroup, bandNode, band, parent,
1171:                        null, null);
1172:            }
1173:
1174:            private it.businesslogic.ireport.JRParameter readParameterElement(
1175:                    Node parameterNode) {
1176:                // Load parameter...
1177:                it.businesslogic.ireport.JRParameter parameter = new it.businesslogic.ireport.JRParameter(
1178:                        "", "java.lang.String", true, "");
1179:
1180:                NamedNodeMap nnm = parameterNode.getAttributes();
1181:                if (nnm.getNamedItem("name") != null) {
1182:                    parameter.setName(nnm.getNamedItem("name").getNodeValue());
1183:                }
1184:                if (nnm.getNamedItem("class") != null) {
1185:                    parameter.setClassType(nnm.getNamedItem("class")
1186:                            .getNodeValue());
1187:                }
1188:                if (nnm.getNamedItem("isForPrompting") != null) {
1189:                    parameter.setIsForPrompting(nnm.getNamedItem(
1190:                            "isForPrompting").getNodeValue().equalsIgnoreCase(
1191:                            "true"));
1192:                }
1193:
1194:                // Check for description and expression...
1195:                NodeList children = parameterNode.getChildNodes();
1196:                if (children != null) {
1197:                    for (int k = 0; k < children.getLength(); k++) {
1198:                        Node nodeChild = (Node) children.item(k);
1199:                        if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1200:                                && nodeChild.getNodeName().equals(
1201:                                        "parameterDescription")) {
1202:                            // Take the CDATA...
1203:
1204:                            NodeList list_child = nodeChild.getChildNodes();
1205:                            for (int ck = 0; ck < list_child.getLength(); ck++) {
1206:                                Node child_child = (Node) list_child.item(ck);
1207:                                if (child_child.getNodeType() == Node.CDATA_SECTION_NODE
1208:                                        || child_child.getNodeType() == Node.TEXT_NODE) {
1209:                                    parameter.setDescription(child_child
1210:                                            .getNodeValue());
1211:                                }
1212:                            }
1213:                        } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1214:                                && nodeChild.getNodeName().equals(
1215:                                        "defaultValueExpression")) {
1216:                            // Take the CDATA...
1217:                            NodeList list_child = nodeChild.getChildNodes();
1218:                            for (int ck = 0; ck < list_child.getLength(); ck++) {
1219:                                Node child_child = (Node) list_child.item(ck);
1220:                                if (child_child.getNodeType() == Node.CDATA_SECTION_NODE
1221:                                        || child_child.getNodeType() == Node.TEXT_NODE) {
1222:                                    parameter
1223:                                            .setDefaultValueExpression(child_child
1224:                                                    .getNodeValue());
1225:                                }
1226:                            }
1227:                        } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1228:                                && nodeChild.getNodeName().equals("property")) {
1229:
1230:                            parameter.getProperties().add(
1231:                                    readPropertyElement(nodeChild));
1232:
1233:                        }
1234:                    }
1235:                }
1236:
1237:                return parameter;
1238:            }
1239:
1240:            private it.businesslogic.ireport.JRField readFieldElement(
1241:                    Node fieldNode) {
1242:                it.businesslogic.ireport.JRField field = new it.businesslogic.ireport.JRField(
1243:                        "", "java.lang.String");
1244:                field.setDescription("");
1245:
1246:                NamedNodeMap nnm = fieldNode.getAttributes();
1247:                if (nnm.getNamedItem("name") != null) {
1248:                    field.setName(nnm.getNamedItem("name").getNodeValue());
1249:                }
1250:                if (nnm.getNamedItem("class") != null) {
1251:                    field
1252:                            .setClassType(nnm.getNamedItem("class")
1253:                                    .getNodeValue());
1254:                }
1255:
1256:                NodeList children = fieldNode.getChildNodes();
1257:                if (children != null) {
1258:                    for (int k = 0; k < children.getLength(); k++) {
1259:                        Node nodeChild = (Node) children.item(k);
1260:
1261:                        if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1262:                                && nodeChild.getNodeName().equals(
1263:                                        "fieldDescription")) {
1264:                            // Take the CDATA...
1265:                            NodeList list_child = nodeChild.getChildNodes();
1266:
1267:                            for (int ck = 0; ck < list_child.getLength(); ck++) {
1268:
1269:                                Node child_child = (Node) list_child.item(ck);
1270:                                if (child_child.getNodeType() == Node.CDATA_SECTION_NODE
1271:                                        || child_child.getNodeType() == Node.TEXT_NODE) {
1272:                                    field.setDescription(child_child
1273:                                            .getNodeValue());
1274:                                }
1275:                            }
1276:                        } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1277:                                && nodeChild.getNodeName().equals("property")) {
1278:
1279:                            field.getProperties().add(
1280:                                    readPropertyElement(nodeChild));
1281:
1282:                        }
1283:                    }
1284:
1285:                }
1286:
1287:                return field;
1288:            }
1289:
1290:            private SortField readSortFieldElement(Node fieldNode) {
1291:                SortField field = new SortField();
1292:
1293:                NamedNodeMap nnm = fieldNode.getAttributes();
1294:                if (nnm.getNamedItem("name") != null) {
1295:                    field.setFieldName(nnm.getNamedItem("name").getNodeValue());
1296:                }
1297:                if (nnm.getNamedItem("order") != null) {
1298:                    field.setDesc(nnm.getNamedItem("order").getNodeValue()
1299:                            .equals("Descending"));
1300:                }
1301:
1302:                return field;
1303:            }
1304:
1305:            private it.businesslogic.ireport.JRProperty readPropertyElement(
1306:                    Node propertyNode) {
1307:                // Load report property...
1308:                JRProperty property = new JRProperty();
1309:                NamedNodeMap nnm = propertyNode.getAttributes();
1310:                if (nnm.getNamedItem("name") != null) {
1311:                    property.setName(nnm.getNamedItem("name").getNodeValue());
1312:                }
1313:                if (nnm.getNamedItem("value") != null) {
1314:                    property.setValue(nnm.getNamedItem("value").getNodeValue());
1315:                }
1316:
1317:                return property;
1318:            }
1319:
1320:            private it.businesslogic.ireport.JRVariable readVariableElement(
1321:                    Node variableNode) {
1322:                // Load variable
1323:                it.businesslogic.ireport.JRVariable variable = new it.businesslogic.ireport.JRVariable(
1324:                        "", false);
1325:                variable.setResetType("Report"); //Default value...
1326:                variable.setResetGroup(""); //Default value...
1327:
1328:                variable.setIncrementType("None"); //Default value...
1329:                variable.setIncrementGroup(""); //Default value...
1330:
1331:                variable.setCalculation("Nothing"); //Default value...
1332:
1333:                NamedNodeMap nnm = variableNode.getAttributes();
1334:                if (nnm.getNamedItem("name") != null) {
1335:                    variable.setName(nnm.getNamedItem("name").getNodeValue());
1336:                }
1337:                if (nnm.getNamedItem("class") != null) {
1338:                    variable.setClassType(nnm.getNamedItem("class")
1339:                            .getNodeValue());
1340:                }
1341:                if (nnm.getNamedItem("resetType") != null) {
1342:                    variable.setResetType(nnm.getNamedItem("resetType")
1343:                            .getNodeValue());
1344:                }
1345:                if (nnm.getNamedItem("resetGroup") != null) {
1346:                    variable.setResetGroup(nnm.getNamedItem("resetGroup")
1347:                            .getNodeValue());
1348:                }
1349:                if (nnm.getNamedItem("calculation") != null) {
1350:                    variable.setCalculation(nnm.getNamedItem("calculation")
1351:                            .getNodeValue());
1352:                }
1353:                if (nnm.getNamedItem("incrementerFactoryClass") != null) {
1354:                    variable.setIncrementerFactoryClass(nnm.getNamedItem(
1355:                            "incrementerFactoryClass").getNodeValue());
1356:                }
1357:                if (nnm.getNamedItem("incrementType") != null) {
1358:                    variable.setIncrementType(nnm.getNamedItem("incrementType")
1359:                            .getNodeValue());
1360:                }
1361:                if (nnm.getNamedItem("incrementGroup") != null) {
1362:                    variable.setIncrementGroup(nnm.getNamedItem(
1363:                            "incrementGroup").getNodeValue());
1364:                }
1365:
1366:                // Check for description and expression...
1367:                NodeList children = variableNode.getChildNodes();
1368:                if (children != null) {
1369:                    for (int k = 0; k < children.getLength(); k++) {
1370:                        Node nodeChild = (Node) children.item(k);
1371:                        if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1372:                                && nodeChild.getNodeName().equals(
1373:                                        "variableExpression")) {
1374:                            // Take the CDATA...
1375:                            NodeList list_child = nodeChild.getChildNodes();
1376:                            for (int ck = 0; ck < list_child.getLength(); ck++) {
1377:                                Node child_child = (Node) list_child.item(ck);
1378:                                if (child_child.getNodeType() == Node.CDATA_SECTION_NODE
1379:                                        || child_child.getNodeType() == Node.TEXT_NODE) {
1380:                                    variable.setExpression(child_child
1381:                                            .getNodeValue());
1382:                                }
1383:                            }
1384:                        } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1385:                                && nodeChild.getNodeName().equals(
1386:                                        "initialValueExpression")) {
1387:                            // Take the CDATA...
1388:                            NodeList list_child = nodeChild.getChildNodes();
1389:                            for (int ck = 0; ck < list_child.getLength(); ck++) {
1390:                                Node child_child = (Node) list_child.item(ck);
1391:                                if (child_child.getNodeType() == Node.CDATA_SECTION_NODE
1392:                                        || child_child.getNodeType() == Node.TEXT_NODE) {
1393:                                    variable
1394:                                            .setInitialValueExpression(child_child
1395:                                                    .getNodeValue());
1396:                                }
1397:                            }
1398:                        }
1399:                    }
1400:                }
1401:
1402:                return variable;
1403:            }
1404:
1405:            private it.businesslogic.ireport.crosstab.Measure readMeasureElement(
1406:                    Node measureNode) {
1407:                // Load variable
1408:                it.businesslogic.ireport.crosstab.Measure measure = new it.businesslogic.ireport.crosstab.Measure(
1409:                        "");
1410:
1411:                NamedNodeMap nnm = measureNode.getAttributes();
1412:                if (nnm.getNamedItem("name") != null) {
1413:                    measure.setName(nnm.getNamedItem("name").getNodeValue());
1414:                }
1415:                if (nnm.getNamedItem("class") != null) {
1416:                    measure.setClassType(nnm.getNamedItem("class")
1417:                            .getNodeValue());
1418:                }
1419:                if (nnm.getNamedItem("calculation") != null) {
1420:                    measure.setCalculation(nnm.getNamedItem("calculation")
1421:                            .getNodeValue());
1422:                }
1423:                if (nnm.getNamedItem("incrementerFactoryClass") != null) {
1424:                    measure.setIncrementerFactoryClass(nnm.getNamedItem(
1425:                            "incrementerFactoryClass").getNodeValue());
1426:                }
1427:                if (nnm.getNamedItem("percentageOf") != null) {
1428:                    measure.setPercentageOf(nnm.getNamedItem("percentageOf")
1429:                            .getNodeValue());
1430:                }
1431:                if (nnm.getNamedItem("percentageCalculatorClass") != null) {
1432:                    measure.setPercentageCalculatorClass(nnm.getNamedItem(
1433:                            "percentageCalculatorClass").getNodeValue());
1434:                }
1435:
1436:                // Check for description and expression...
1437:                NodeList children = measureNode.getChildNodes();
1438:                if (children != null) {
1439:                    for (int k = 0; k < children.getLength(); k++) {
1440:                        Node nodeChild = (Node) children.item(k);
1441:                        if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1442:                                && nodeChild.getNodeName().equals(
1443:                                        "measureExpression")) {
1444:                            measure.setExpression(readPCDATA(nodeChild));
1445:                        }
1446:                    }
1447:                }
1448:
1449:                return measure;
1450:            }
1451:
1452:            private it.businesslogic.ireport.Style readStyle(Node styleNode) {
1453:                return readStyle(styleNode, null);
1454:            }
1455:
1456:            /**
1457:             * If a ConditionedStyle, the style is interpreted like part of the tag conditionalStyle
1458:             */
1459:            private it.businesslogic.ireport.Style readStyle(Node styleNode,
1460:                    ConditionedStyle cStyle) {
1461:                Style style = new Style();
1462:                if (cStyle != null)
1463:                    style = cStyle;
1464:                NamedNodeMap nnm = styleNode.getAttributes();
1465:
1466:                NodeList children = styleNode.getChildNodes();
1467:                if (children != null) {
1468:                    for (int k = 0; k < children.getLength(); k++) {
1469:                        Node nodeChild = (Node) children.item(k);
1470:                        if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1471:                                && nodeChild.getNodeName().equals(
1472:                                        "conditionalStyle")) {
1473:                            ConditionedStyle childStyle = readConditionalStyle(nodeChild);
1474:                            style.getConditionedStyles().add(childStyle);
1475:                        } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1476:                                && nodeChild.getNodeName().equals("box")) {
1477:                            readBoxElement(nodeChild, style);
1478:                        } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1479:                                && nodeChild.getNodeName().equals("pen")) {
1480:                            Pen p = readPen(nodeChild);
1481:                            style.setPen(p);
1482:                        }
1483:                    }
1484:                }
1485:
1486:                for (int i = 0; i < Style.JRXMLStyleAttributes.length; ++i) {
1487:                    if (nnm.getNamedItem(Style.JRXMLStyleAttributes[i]) != null) {
1488:                        style.getAttributes().put(
1489:                                Style.JRXMLStyleAttributes[i],
1490:                                nnm.getNamedItem(Style.JRXMLStyleAttributes[i])
1491:                                        .getNodeValue());
1492:
1493:                        if (Style.JRXMLStyleAttributes[i].equals("pen")) {
1494:                            deprecationWarning = true;
1495:                            if (style.getPen() == null)
1496:                                style.setPen(new Pen());
1497:                            style.getPen().setLineWidth(
1498:                                    getLineWidthByBorder(nnm.getNamedItem(
1499:                                            Style.JRXMLStyleAttributes[i])
1500:                                            .getNodeValue()));
1501:                            style.getPen().setLineStyle(
1502:                                    getLineStyleByBorder(nnm.getNamedItem(
1503:                                            Style.JRXMLStyleAttributes[i])
1504:                                            .getNodeValue()));
1505:                        } else if (Style.JRXMLStyleAttributes[i]
1506:                                .equals("border")) {
1507:                            deprecationWarning = true;
1508:                            if (style.getBox() == null)
1509:                                style.setBox(new Box());
1510:                            if (style.getBox().getPen() == null)
1511:                                style.getBox().setPen(new Pen());
1512:                            style.getBox().getPen().setLineWidth(
1513:                                    getLineWidthByBorder(nnm.getNamedItem(
1514:                                            Style.JRXMLStyleAttributes[i])
1515:                                            .getNodeValue()));
1516:                            style.getBox().getPen().setLineStyle(
1517:                                    getLineStyleByBorder(nnm.getNamedItem(
1518:                                            Style.JRXMLStyleAttributes[i])
1519:                                            .getNodeValue()));
1520:                        } else if (Style.JRXMLStyleAttributes[i]
1521:                                .equals("borderColor")) {
1522:                            deprecationWarning = true;
1523:                            if (style.getBox() == null)
1524:                                style.setBox(new Box());
1525:                            if (style.getBox().getPen() == null)
1526:                                style.getBox().setPen(new Pen());
1527:                            style.getBox().getPen().setLineColor(
1528:                                    decodeColor(nnm.getNamedItem(
1529:                                            Style.JRXMLStyleAttributes[i])
1530:                                            .getNodeValue()));
1531:                        } else if (Style.JRXMLStyleAttributes[i]
1532:                                .equals("padding")) {
1533:                            deprecationWarning = true;
1534:                            if (style.getBox() == null)
1535:                                style.setBox(new Box());
1536:                            style.getBox().setPadding(
1537:                                    Integer.parseInt(nnm.getNamedItem(
1538:                                            Style.JRXMLStyleAttributes[i])
1539:                                            .getNodeValue()));
1540:                        } else if (Style.JRXMLStyleAttributes[i]
1541:                                .equals("topBorder")) {
1542:                            deprecationWarning = true;
1543:                            if (style.getBox() == null)
1544:                                style.setBox(new Box());
1545:                            if (style.getBox().getTopPen() == null)
1546:                                style.getBox().setTopPen(new Pen());
1547:                            Pen pen = style.getBox().getTopPen();
1548:                            pen
1549:                                    .setLineWidth(getLineWidthByBorder(nnm
1550:                                            .getNamedItem(
1551:                                                    Style.JRXMLStyleAttributes[i])
1552:                                            .getNodeValue()));
1553:                            pen
1554:                                    .setLineStyle(getLineStyleByBorder(nnm
1555:                                            .getNamedItem(
1556:                                                    Style.JRXMLStyleAttributes[i])
1557:                                            .getNodeValue()));
1558:                        } else if (Style.JRXMLStyleAttributes[i]
1559:                                .equals("topBorderColor")) {
1560:                            deprecationWarning = true;
1561:                            if (style.getBox() == null)
1562:                                style.setBox(new Box());
1563:                            if (style.getBox().getTopPen() == null)
1564:                                style.getBox().setTopPen(new Pen());
1565:                            style.getBox().getTopPen().setLineColor(
1566:                                    decodeColor(nnm.getNamedItem(
1567:                                            Style.JRXMLStyleAttributes[i])
1568:                                            .getNodeValue()));
1569:                        } else if (Style.JRXMLStyleAttributes[i]
1570:                                .equals("topPadding")) {
1571:                            deprecationWarning = true;
1572:                            if (style.getBox() == null)
1573:                                style.setBox(new Box());
1574:                            style.getBox().setTopPadding(
1575:                                    Integer.parseInt(nnm.getNamedItem(
1576:                                            Style.JRXMLStyleAttributes[i])
1577:                                            .getNodeValue()));
1578:                        } else if (Style.JRXMLStyleAttributes[i]
1579:                                .equals("leftBorder")) {
1580:                            deprecationWarning = true;
1581:                            if (style.getBox() == null)
1582:                                style.setBox(new Box());
1583:                            if (style.getBox().getLeftPen() == null)
1584:                                style.getBox().setLeftPen(new Pen());
1585:                            Pen pen = style.getBox().getLeftPen();
1586:                            pen
1587:                                    .setLineWidth(getLineWidthByBorder(nnm
1588:                                            .getNamedItem(
1589:                                                    Style.JRXMLStyleAttributes[i])
1590:                                            .getNodeValue()));
1591:                            pen
1592:                                    .setLineStyle(getLineStyleByBorder(nnm
1593:                                            .getNamedItem(
1594:                                                    Style.JRXMLStyleAttributes[i])
1595:                                            .getNodeValue()));
1596:                        } else if (Style.JRXMLStyleAttributes[i]
1597:                                .equals("leftBorderColor")) {
1598:                            deprecationWarning = true;
1599:                            if (style.getBox() == null)
1600:                                style.setBox(new Box());
1601:                            if (style.getBox().getLeftPen() == null)
1602:                                style.getBox().setLeftPen(new Pen());
1603:                            style.getBox().getLeftPen().setLineColor(
1604:                                    decodeColor(nnm.getNamedItem(
1605:                                            Style.JRXMLStyleAttributes[i])
1606:                                            .getNodeValue()));
1607:                        } else if (Style.JRXMLStyleAttributes[i]
1608:                                .equals("leftPadding")) {
1609:                            deprecationWarning = true;
1610:                            if (style.getBox() == null)
1611:                                style.setBox(new Box());
1612:                            style.getBox().setLeftPadding(
1613:                                    Integer.parseInt(nnm.getNamedItem(
1614:                                            Style.JRXMLStyleAttributes[i])
1615:                                            .getNodeValue()));
1616:                        } else if (Style.JRXMLStyleAttributes[i]
1617:                                .equals("bottomBorder")) {
1618:                            deprecationWarning = true;
1619:                            if (style.getBox() == null)
1620:                                style.setBox(new Box());
1621:                            if (style.getBox().getBottomPen() == null)
1622:                                style.getBox().setBottomPen(new Pen());
1623:                            Pen pen = style.getBox().getBottomPen();
1624:                            pen
1625:                                    .setLineWidth(getLineWidthByBorder(nnm
1626:                                            .getNamedItem(
1627:                                                    Style.JRXMLStyleAttributes[i])
1628:                                            .getNodeValue()));
1629:                            pen
1630:                                    .setLineStyle(getLineStyleByBorder(nnm
1631:                                            .getNamedItem(
1632:                                                    Style.JRXMLStyleAttributes[i])
1633:                                            .getNodeValue()));
1634:                        } else if (Style.JRXMLStyleAttributes[i]
1635:                                .equals("bottomBorderColor")) {
1636:                            deprecationWarning = true;
1637:                            if (style.getBox() == null)
1638:                                style.setBox(new Box());
1639:                            if (style.getBox().getBottomPen() == null)
1640:                                style.getBox().setBottomPen(new Pen());
1641:                            style.getBox().getBottomPen().setLineColor(
1642:                                    decodeColor(nnm.getNamedItem(
1643:                                            Style.JRXMLStyleAttributes[i])
1644:                                            .getNodeValue()));
1645:                        } else if (Style.JRXMLStyleAttributes[i]
1646:                                .equals("bottomPadding")) {
1647:                            deprecationWarning = true;
1648:                            if (style.getBox() == null)
1649:                                style.setBox(new Box());
1650:                            style.getBox().setBottomPadding(
1651:                                    Integer.parseInt(nnm.getNamedItem(
1652:                                            Style.JRXMLStyleAttributes[i])
1653:                                            .getNodeValue()));
1654:                        } else if (Style.JRXMLStyleAttributes[i]
1655:                                .equals("rightBorder")) {
1656:                            deprecationWarning = true;
1657:                            if (style.getBox() == null)
1658:                                style.setBox(new Box());
1659:                            if (style.getBox().getRightPen() == null)
1660:                                style.getBox().setRightPen(new Pen());
1661:                            Pen pen = style.getBox().getRightPen();
1662:                            pen
1663:                                    .setLineWidth(getLineWidthByBorder(nnm
1664:                                            .getNamedItem(
1665:                                                    Style.JRXMLStyleAttributes[i])
1666:                                            .getNodeValue()));
1667:                            pen
1668:                                    .setLineStyle(getLineStyleByBorder(nnm
1669:                                            .getNamedItem(
1670:                                                    Style.JRXMLStyleAttributes[i])
1671:                                            .getNodeValue()));
1672:                        } else if (Style.JRXMLStyleAttributes[i]
1673:                                .equals("rightBorderColor")) {
1674:                            deprecationWarning = true;
1675:                            if (style.getBox() == null)
1676:                                style.setBox(new Box());
1677:                            if (style.getBox().getRightPen() == null)
1678:                                style.getBox().setRightPen(new Pen());
1679:                            style.getBox().getRightPen().setLineColor(
1680:                                    decodeColor(nnm.getNamedItem(
1681:                                            Style.JRXMLStyleAttributes[i])
1682:                                            .getNodeValue()));
1683:                        } else if (Style.JRXMLStyleAttributes[i]
1684:                                .equals("rightPadding")) {
1685:                            deprecationWarning = true;
1686:                            if (style.getBox() == null)
1687:                                style.setBox(new Box());
1688:                            style.getBox().setRightPadding(
1689:                                    Integer.parseInt(nnm.getNamedItem(
1690:                                            Style.JRXMLStyleAttributes[i])
1691:                                            .getNodeValue()));
1692:                        }
1693:
1694:                    }
1695:                }
1696:
1697:                //conditionalStyle
1698:                // Check for description and expression...
1699:
1700:                return style;
1701:            }
1702:
1703:            /**
1704:             * If a ConditionedStyle, the style is interpreted like part of the tag conditionalStyle
1705:             */
1706:            private it.businesslogic.ireport.ConditionedStyle readConditionalStyle(
1707:                    Node styleNode) {
1708:                ConditionedStyle style = new ConditionedStyle();
1709:
1710:                //conditionalStyle
1711:                // Check for description and expression...
1712:                NodeList children = styleNode.getChildNodes();
1713:                if (children != null) {
1714:                    for (int k = 0; k < children.getLength(); k++) {
1715:                        Node nodeChild = (Node) children.item(k);
1716:                        if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1717:                                && nodeChild.getNodeName().equals(
1718:                                        "conditionExpression")) {
1719:                            style.setCondition(readPCDATA(nodeChild));
1720:                        } else if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1721:                                && nodeChild.getNodeName().equals("style")) {
1722:                            style = (ConditionedStyle) readStyle(nodeChild,
1723:                                    style);
1724:                        }
1725:                    }
1726:                }
1727:
1728:                return style;
1729:            }
1730:
1731:            private it.businesslogic.ireport.Group readGroupElement(
1732:                    SubDataset ds, Node groupNode, boolean fullRead) {
1733:                NamedNodeMap nnm = groupNode.getAttributes();
1734:                it.businesslogic.ireport.Group group = new it.businesslogic.ireport.Group(
1735:                        ds, "" + nnm.getNamedItem("name").getNodeValue());
1736:
1737:                if (nnm.getNamedItem("isStartNewColumn") != null)
1738:                    group.setIsStartNewColumn(nnm.getNamedItem(
1739:                            "isStartNewColumn").getNodeValue().equals("true"));
1740:                if (nnm.getNamedItem("isStartNewPage") != null)
1741:                    group.setIsStartNewPage(nnm.getNamedItem("isStartNewPage")
1742:                            .getNodeValue().equals("true"));
1743:                if (nnm.getNamedItem("isResetPageNumber") != null)
1744:                    group.setIsResetPageNumber(nnm.getNamedItem(
1745:                            "isResetPageNumber").getNodeValue().equals("true"));
1746:                if (nnm.getNamedItem("isReprintHeaderOnEachPage") != null)
1747:                    group.setIsReprintHeaderOnEachPage(nnm.getNamedItem(
1748:                            "isReprintHeaderOnEachPage").getNodeValue().equals(
1749:                            "true"));
1750:                if (nnm.getNamedItem("minHeightToStartNewPage") != null)
1751:                    group.setMinHeightToStartNewPage(Integer.parseInt(nnm
1752:                            .getNamedItem("minHeightToStartNewPage")
1753:                            .getNodeValue()));
1754:
1755:                // Looking for header, footer and expression...
1756:                NodeList children = groupNode.getChildNodes();
1757:                if (children != null) {
1758:                    for (int k = 0; k < children.getLength(); k++) {
1759:                        Node nodeChild = (Node) children.item(k);
1760:                        if (nodeChild.getNodeType() == Node.ELEMENT_NODE
1761:                                && nodeChild.getNodeName().equals(
1762:                                        "groupExpression")) {
1763:                            // Take the CDATA...
1764:                            NodeList list_child = nodeChild.getChildNodes();
1765:                            for (int ck = 0; ck < list_child.getLength(); ck++) {
1766:                                Node child_child = (Node) list_child.item(ck);
1767:                                if (child_child.getNodeType() == Node.CDATA_SECTION_NODE
1768:                                        || child_child.getNodeType() == Node.TEXT_NODE) {
1769:                                    group.setGroupExpression(child_child
1770:                                            .getNodeValue());
1771:                                }
1772:                            }
1773:                        } else if (fullRead
1774:                                && nodeChild.getNodeType() == Node.ELEMENT_NODE
1775:                                && nodeChild.getNodeName()
1776:                                        .equals("groupHeader")) {
1777:                            // Take the band...
1778:                            NodeList list_child = nodeChild.getChildNodes();
1779:                            for (int ck = 0; ck < list_child.getLength(); ck++) {
1780:                                Node bandNode = (Node) list_child.item(ck);
1781:                                if (bandNode.getNodeType() == Node.ELEMENT_NODE
1782:                                        && bandNode.getNodeName()
1783:                                                .equals("band")) {
1784:                                    // Read the band...
1785:                                    NamedNodeMap bandAttributes = bandNode
1786:                                            .getAttributes();
1787:                                    if (bandAttributes.getNamedItem("height") != null)
1788:                                        group.getGroupHeader().setHeight(
1789:                                                Integer.parseInt(bandAttributes
1790:                                                        .getNamedItem("height")
1791:                                                        .getNodeValue()));
1792:                                    if (bandAttributes
1793:                                            .getNamedItem("isSplitAllowed") != null)
1794:                                        group.getGroupHeader().setSplitAllowed(
1795:                                                bandAttributes.getNamedItem(
1796:                                                        "isSplitAllowed")
1797:                                                        .getNodeValue().equals(
1798:                                                                "true"));
1799:                                    readBandElements(bandNode, group
1800:                                            .getGroupHeader());
1801:                                }
1802:                            }
1803:                        } else if (fullRead
1804:                                && nodeChild.getNodeType() == Node.ELEMENT_NODE
1805:                                && nodeChild.getNodeName()
1806:                                        .equals("groupFooter")) {
1807:                            // Take the band...
1808:                            NodeList list_child = nodeChild.getChildNodes();
1809:                            for (int ck = 0; ck < list_child.getLength(); ck++) {
1810:                                Node bandNode = (Node) list_child.item(ck);
1811:                                if (bandNode.getNodeType() == Node.ELEMENT_NODE
1812:                                        && bandNode.getNodeName()
1813:                                                .equals("band")) {
1814:                                    // Read the band...
1815:                                    NamedNodeMap bandAttributes = bandNode
1816:                                            .getAttributes();
1817:                                    if (bandAttributes.getNamedItem("height") != null)
1818:                                        group.getGroupFooter().setHeight(
1819:                                                Integer.parseInt(bandAttributes
1820:                                                        .getNamedItem("height")
1821:                                                        .getNodeValue()));
1822:                                    if (bandAttributes
1823:                                            .getNamedItem("isSplitAllowed") != null)
1824:                                        group.getGroupFooter().setSplitAllowed(
1825:                                                bandAttributes.getNamedItem(
1826:                                                        "isSplitAllowed")
1827:                                                        .getNodeValue().equals(
1828:                                                                "true"));
1829:                                    readBandElements(bandNode, group
1830:                                            .getGroupFooter());
1831:                                }
1832:                            }
1833:                        }
1834:                    }
1835:                }
1836:
1837:                return group;
1838:            }
1839:
1840:            private void readBandElements(String parentElementGroup,
1841:                    Node bandNode, Band band, ReportElement parentElement,
1842:                    CrosstabReportElement crosstabReportElement,
1843:                    CrosstabCell cell) {
1844:
1845:                ReportElement rElement = null;
1846:                Style defualtStyle = getReport().getDefaultStyle();
1847:
1848:                NodeList list_child = bandNode.getChildNodes();
1849:                for (int ck = 0; ck < list_child.getLength(); ck++) {
1850:                    Node child = (Node) list_child.item(ck);
1851:                    if (child.getNodeType() == Node.ELEMENT_NODE
1852:                            && child.getNodeName()
1853:                                    .equals("printWhenExpression")) {
1854:                        // Read the band...
1855:                        //NamedNodeMap bandAttributes = bandNode.getAttributes();
1856:                        //if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
1857:                        // Take subelements and lloking for the expression...
1858:                        NodeList childsOfChild = child.getChildNodes();
1859:                        for (int c_count = 0; c_count < childsOfChild
1860:                                .getLength(); c_count++) {
1861:                            Node child_child = (Node) childsOfChild
1862:                                    .item(c_count);
1863:                            if (child_child.getNodeType() == Node.CDATA_SECTION_NODE
1864:                                    || child_child.getNodeType() == Node.TEXT_NODE) {
1865:                                band.setPrintWhenExpression(child_child
1866:                                        .getNodeValue());
1867:                            }
1868:                        }
1869:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
1870:                            && child.getNodeName().equals("staticText")) {
1871:                        StaticTextReportElement re = new StaticTextReportElement(
1872:                                0, 0, 0, 0);
1873:                        re.setIReportFont(getReport().getDefaultFont());
1874:
1875:                        if (defualtStyle != null) {
1876:                            re.setStyle(defualtStyle);
1877:                            re.setStyle(null);
1878:                        }
1879:                        re.setBand(band);
1880:                        re.setCell(cell);
1881:                        re.setElementGroup(parentElementGroup);
1882:                        re.setParentElement(parentElement);
1883:                        NodeList childsOfChild = child.getChildNodes();
1884:                        for (int c_count = 0; c_count < childsOfChild
1885:                                .getLength(); c_count++) {
1886:                            Node child_child = (Node) childsOfChild
1887:                                    .item(c_count);
1888:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
1889:                                    && child_child.getNodeName().equals(
1890:                                            "reportElement")) {
1891:                                readXMLReportElement(child_child, re);
1892:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
1893:                                    && child_child.getNodeName().equals(
1894:                                            "textElement")) {
1895:                                readXMLTextElement(child_child, re);
1896:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
1897:                                    && child_child.getNodeName().equals("text")) {
1898:                                re.setText(readPCDATA(child_child, false));
1899:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
1900:                                    && child_child.getNodeName().equals("box")) {
1901:                                readBoxElement(child_child, re);
1902:                            }
1903:                        }
1904:
1905:                        re.setPosition(re.position);
1906:                        re.trasform(new java.awt.Point(0, 0),
1907:                                TransformationType.TRANSFORMATION_RESIZE_SE);
1908:                        //elements.addElement(re);
1909:                        rElement = re;
1910:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
1911:                            && child.getNodeName().equals("image")) {
1912:                        ImageReportElement re = new ImageReportElement(0, 0, 0,
1913:                                0);
1914:                        if (defualtStyle != null) {
1915:                            re.setStyle(defualtStyle);
1916:                            re.setStyle(null);
1917:                        }
1918:                        re.setBand(band);
1919:                        re.setCell(cell);
1920:                        re.setElementGroup(parentElementGroup);
1921:                        re.setParentElement(parentElement);
1922:                        NamedNodeMap nodeAttributes = child.getAttributes();
1923:                        if (nodeAttributes.getNamedItem("isUsingCache") != null)
1924:                            re.setIsUsingCache(("" + nodeAttributes
1925:                                    .getNamedItem("isUsingCache")
1926:                                    .getNodeValue()).equals("true"));
1927:                        if (nodeAttributes.getNamedItem("isLazy") != null)
1928:                            re.setIsLazy(("" + nodeAttributes.getNamedItem(
1929:                                    "isLazy").getNodeValue()).equals("true"));
1930:                        if (nodeAttributes.getNamedItem("onErrorType") != null)
1931:                            re.setOnErrorType(""
1932:                                    + nodeAttributes
1933:                                            .getNamedItem("onErrorType")
1934:                                            .getNodeValue());
1935:                        if (nodeAttributes.getNamedItem("scaleImage") != null)
1936:                            re.setScaleImage(""
1937:                                    + nodeAttributes.getNamedItem("scaleImage")
1938:                                            .getNodeValue());
1939:                        if (nodeAttributes.getNamedItem("vAlign") != null)
1940:                            re.setVerticalAlignment(""
1941:                                    + nodeAttributes.getNamedItem("vAlign")
1942:                                            .getNodeValue());
1943:                        if (nodeAttributes.getNamedItem("hAlign") != null)
1944:                            re.setHorizontalAlignment(""
1945:                                    + nodeAttributes.getNamedItem("hAlign")
1946:                                            .getNodeValue());
1947:                        if (nodeAttributes.getNamedItem("evaluationTime") != null)
1948:                            re.setEvaluationTime(""
1949:                                    + nodeAttributes.getNamedItem(
1950:                                            "evaluationTime").getNodeValue());
1951:                        if (nodeAttributes.getNamedItem("evaluationGroup") != null)
1952:                            re.setEvaluationGroup(""
1953:                                    + nodeAttributes.getNamedItem(
1954:                                            "evaluationGroup").getNodeValue());
1955:                        //if (nodeAttributes.getNamedItem("hyperlinkType") != null)
1956:                        //    re.setHyperlinkType(""+nodeAttributes.getNamedItem("hyperlinkType").getNodeValue());
1957:                        //if (nodeAttributes.getNamedItem("hyperlinkTarget") != null)
1958:                        //    re.setHyperlinkTarget(""+nodeAttributes.getNamedItem("hyperlinkTarget").getNodeValue());
1959:                        //if (nodeAttributes.getNamedItem("bookmarkLevel") != null)
1960:                        //    re.setBookmarkLevel( Integer.parseInt( nodeAttributes.getNamedItem("bookmarkLevel").getNodeValue() ) );
1961:
1962:                        NodeList childsOfChild = child.getChildNodes();
1963:                        for (int c_count = 0; c_count < childsOfChild
1964:                                .getLength(); c_count++) {
1965:                            Node child_child = (Node) childsOfChild
1966:                                    .item(c_count);
1967:                            NamedNodeMap subNodeAttributes = child_child
1968:                                    .getAttributes();
1969:
1970:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
1971:                                    && child_child.getNodeName().equals(
1972:                                            "reportElement")) {
1973:                                readXMLReportElement(child_child, re);
1974:                            } // Element properties...
1975:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE
1976:                                    && child_child.getNodeName().equals(
1977:                                            "graphicElement")) {
1978:
1979:                                readGraphicsElement(re, child_child);
1980:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
1981:                                    && child_child.getNodeName().equals(
1982:                                            "imageExpression")) {
1983:                                if (subNodeAttributes.getNamedItem("class") != null) {
1984:                                    re.setImageClass(""
1985:                                            + subNodeAttributes.getNamedItem(
1986:                                                    "class").getNodeValue());
1987:                                }
1988:                                re.setImageExpression(readPCDATA(child_child));
1989:                                re.setReportDirectory(new java.io.File(
1990:                                        getReport().getFilename())
1991:                                        .getParentFile());
1992:                            }
1993:                            /*
1994:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("anchorNameExpression")) {
1995:                                re.setAnchorNameExpression( readPCDATA(child_child) );
1996:                            }
1997:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("hyperlinkAnchorExpression")) {
1998:                                re.setHyperlinkAnchorExpression( readPCDATA(child_child) );
1999:                            }
2000:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("hyperlinkPageExpression")) {
2001:                                re.setHyperlinkPageExpression( readPCDATA(child_child) );
2002:                            }
2003:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("hyperlinkReferenceExpression")) {
2004:                                re.setHyperlinkReferenceExpression( readPCDATA(child_child) );
2005:                            }
2006:                             */
2007:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE
2008:                                    && child_child.getNodeName().equals("box")) {
2009:                                readBoxElement(child_child, re);
2010:                            }
2011:
2012:                        }
2013:                        readHyperlink(child, re);
2014:                        re.setPosition(re.position);
2015:                        re.trasform(new java.awt.Point(0, 0),
2016:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2017:
2018:                        if (re
2019:                                .getImageExpression()
2020:                                .indexOf(
2021:                                        "it.businesslogic.ireport.chart.DefaultChartFactory.drawChart(") >= 0) {
2022:                            ChartReportElement chart = new ChartReportElement(
2023:                                    re.getPosition().x, re.getPosition().y, re
2024:                                            .getWidth(), re.getHeight());
2025:                            chart.setBand(re.getBand());
2026:                            chart.setElementGroup(re.getElementGroup());
2027:                            chart.setParentElement(re.getParentElement());
2028:                            chart.setHyperlinkReferenceExpression(re
2029:                                    .getHyperlinkReferenceExpression());
2030:                            chart.setHyperlinkPageExpression(re
2031:                                    .getHyperlinkPageExpression());
2032:                            chart.setHyperlinkAnchorExpression(re
2033:                                    .getHyperlinkAnchorExpression());
2034:                            chart.setHyperlinkType(re.getHyperlinkType());
2035:                            chart.setBgcolor(re.getBgcolor());
2036:                            chart.setEvaluationGroup(re.getEvaluationGroup());
2037:                            chart.setEvaluationTime(re.getEvaluationTime());
2038:                            chart.setFgcolor(re.getFgcolor());
2039:                            chart.setFill(re.getFill());
2040:                            //chart.setGraphicElementPen( re.getGraphicElementPen());
2041:                            chart.setHorizontalAlignment(re
2042:                                    .getHorizontalAlignment());
2043:                            chart.setImageClass(re.getImageClass());
2044:                            chart.setImageExpression(re.getImageExpression());
2045:                            chart.setName(re.getName());
2046:                            chart.setPositionType(re.getPositionType());
2047:                            chart.setPrintWhenExpression(re
2048:                                    .getPrintWhenExpression());
2049:                            chart.setPrintWhenGroupChanges(re
2050:                                    .getPrintWhenGroupChanges());
2051:                            chart.setScaleImage(re.getScaleImage());
2052:                            chart.setStretchType(re.getStretchType());
2053:                            chart.setTransparent(re.getTransparent());
2054:                            chart.setVerticalAlignment(re
2055:                                    .getVerticalAlignment());
2056:                            chart
2057:                                    .parseProperties(getReport()
2058:                                            .getJRproperties());
2059:                            re = chart;
2060:                        }
2061:
2062:                        if (re
2063:                                .getImageExpression()
2064:                                .indexOf(
2065:                                        "it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(") >= 0) {
2066:                            BarcodeReportElement bc = new BarcodeReportElement(
2067:                                    re.getPosition().x, re.getPosition().y, re
2068:                                            .getWidth(), re.getHeight());
2069:                            bc.setBand(re.getBand());
2070:                            bc.setCell(cell);
2071:                            bc.setElementGroup(re.getElementGroup());
2072:                            bc.setParentElement(re.getParentElement());
2073:                            bc.setHyperlinkReferenceExpression(re
2074:                                    .getHyperlinkReferenceExpression());
2075:                            bc.setHyperlinkPageExpression(re
2076:                                    .getHyperlinkPageExpression());
2077:                            bc.setHyperlinkAnchorExpression(re
2078:                                    .getHyperlinkAnchorExpression());
2079:                            bc.setHyperlinkType(re.getHyperlinkType());
2080:                            bc.setBgcolor(re.getBgcolor());
2081:                            bc.setEvaluationGroup(re.getEvaluationGroup());
2082:                            bc.setEvaluationTime(re.getEvaluationTime());
2083:                            bc.setFgcolor(re.getFgcolor());
2084:                            bc.setFill(re.getFill());
2085:                            //bc.setGraphicElementPen( re.getGraphicElementPen());
2086:                            bc.setHorizontalAlignment(re
2087:                                    .getHorizontalAlignment());
2088:                            bc.setImageClass(re.getImageClass());
2089:                            bc.setImageExpression(re.getImageExpression());
2090:                            bc.setName(re.getName());
2091:                            bc.setPositionType(re.getPositionType());
2092:                            bc.setPrintWhenExpression(re
2093:                                    .getPrintWhenExpression());
2094:                            bc.setPrintWhenGroupChanges(re
2095:                                    .getPrintWhenGroupChanges());
2096:                            bc.setScaleImage(re.getScaleImage());
2097:                            bc.setStretchType(re.getStretchType());
2098:                            bc.setTransparent(re.getTransparent());
2099:                            bc.setVerticalAlignment(re.getVerticalAlignment());
2100:
2101:                            re = bc;
2102:                        }
2103:
2104:                        //elements.addElement(re);
2105:                        rElement = re;
2106:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2107:                            && child.getNodeName().equals("rectangle")) {
2108:                        RectangleReportElement re = new RectangleReportElement(
2109:                                0, 0, 0, 0);
2110:                        if (defualtStyle != null) {
2111:                            re.setStyle(defualtStyle);
2112:                            re.setStyle(null);
2113:                        }
2114:                        re.setBand(band);
2115:                        re.setCell(cell);
2116:                        re.setElementGroup(parentElementGroup);
2117:                        re.setParentElement(parentElement);
2118:                        NamedNodeMap nodeAttributes = child.getAttributes();
2119:                        /* CompatibilitySupport.saveRoundedRectangle */
2120:                        if (nodeAttributes.getNamedItem("radius") != null)
2121:                            re.setRadius(Integer.parseInt(("" + nodeAttributes
2122:                                    .getNamedItem("radius").getNodeValue())));
2123:                        // Element properties...
2124:                        NodeList childsOfChild = child.getChildNodes();
2125:                        for (int c_count = 0; c_count < childsOfChild
2126:                                .getLength(); c_count++) {
2127:                            Node child_child = (Node) childsOfChild
2128:                                    .item(c_count);
2129:                            NamedNodeMap subNodeAttributes = child_child
2130:                                    .getAttributes();
2131:
2132:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
2133:                                    && child_child.getNodeName().equals(
2134:                                            "reportElement")) {
2135:                                readXMLReportElement(child_child, re);
2136:                            } // Element properties...
2137:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE
2138:                                    && child_child.getNodeName().equals(
2139:                                            "graphicElement")) {
2140:
2141:                                readGraphicsElement(re, child_child);
2142:
2143:                            }
2144:                        }
2145:
2146:                        re.setPosition(re.position);
2147:                        re.trasform(new java.awt.Point(0, 0),
2148:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2149:
2150:                        //elements.addElement(re);
2151:                        rElement = re;
2152:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2153:                            && child.getNodeName().equals("line")) {
2154:                        LineReportElement re = new LineReportElement(0, 0, 0, 0);
2155:                        if (defualtStyle != null) {
2156:                            re.setStyle(defualtStyle);
2157:                            re.setStyle(null);
2158:                        }
2159:                        re.setBand(band);
2160:                        re.setCell(cell);
2161:                        re.setElementGroup(parentElementGroup);
2162:                        re.setParentElement(parentElement);
2163:                        NamedNodeMap nodeAttributes = child.getAttributes();
2164:                        /* CompatibilitySupport.saveRoundedRectangle */
2165:                        if (nodeAttributes.getNamedItem("direction") != null)
2166:                            re.setDirection(""
2167:                                    + nodeAttributes.getNamedItem("direction")
2168:                                            .getNodeValue());
2169:
2170:                        // Element properties...
2171:                        NodeList childsOfChild = child.getChildNodes();
2172:                        for (int c_count = 0; c_count < childsOfChild
2173:                                .getLength(); c_count++) {
2174:                            Node child_child = (Node) childsOfChild
2175:                                    .item(c_count);
2176:                            NamedNodeMap subNodeAttributes = child_child
2177:                                    .getAttributes();
2178:
2179:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
2180:                                    && child_child.getNodeName().equals(
2181:                                            "reportElement")) {
2182:                                readXMLReportElement(child_child, re);
2183:                            } // Element properties...
2184:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE
2185:                                    && child_child.getNodeName().equals(
2186:                                            "graphicElement")) {
2187:                                readGraphicsElement(re, child_child);
2188:                            }
2189:                        }
2190:
2191:                        re.setPosition(re.position);
2192:                        re.trasform(new java.awt.Point(0, 0),
2193:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2194:                        //elements.addElement(re);
2195:                        rElement = re;
2196:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2197:                            && child.getNodeName().equals("break")) {
2198:                        BreakReportElement re = new BreakReportElement(0, 0, 0,
2199:                                0);
2200:                        re.setBand(band);
2201:                        re.setCell(cell);
2202:                        re.setElementGroup(parentElementGroup);
2203:                        re.setParentElement(parentElement);
2204:                        NamedNodeMap nodeAttributes = child.getAttributes();
2205:                        /* CompatibilitySupport.saveRoundedRectangle */
2206:                        if (nodeAttributes.getNamedItem("type") != null)
2207:                            re.setType(""
2208:                                    + nodeAttributes.getNamedItem("type")
2209:                                            .getNodeValue());
2210:
2211:                        // Element properties...
2212:                        NodeList childsOfChild = child.getChildNodes();
2213:                        for (int c_count = 0; c_count < childsOfChild
2214:                                .getLength(); c_count++) {
2215:                            Node child_child = (Node) childsOfChild
2216:                                    .item(c_count);
2217:                            NamedNodeMap subNodeAttributes = child_child
2218:                                    .getAttributes();
2219:
2220:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
2221:                                    && child_child.getNodeName().equals(
2222:                                            "reportElement")) {
2223:                                readXMLReportElement(child_child, re);
2224:                            } // Element properties...
2225:                        }
2226:
2227:                        // Fix height and position...
2228:                        re.setHeight(0);
2229:                        re.setWidth(report.getWidth() - report.getRightMargin()
2230:                                - report.getLeftMargin());
2231:                        re.position.x = 0;
2232:                        re.setPosition(re.position);
2233:                        re.trasform(new java.awt.Point(0, 0),
2234:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2235:                        //elements.addElement(re);
2236:                        rElement = re;
2237:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2238:                            && child.getNodeName().equals("ellipse")) {
2239:                        EllipseReportElement re = new EllipseReportElement(0,
2240:                                0, 0, 0);
2241:                        if (defualtStyle != null) {
2242:                            re.setStyle(defualtStyle);
2243:                            re.setStyle(null);
2244:                        }
2245:                        re.setBand(band);
2246:                        re.setCell(cell);
2247:                        re.setElementGroup(parentElementGroup);
2248:                        re.setParentElement(parentElement);
2249:                        NamedNodeMap nodeAttributes = child.getAttributes();
2250:                        /* CompatibilitySupport.saveRoundedRectangle */
2251:                        //if (nodeAttributes.getNamedItem("direction") != null)
2252:                        //	re.setDirection( ""+nodeAttributes.getNamedItem("direction").getNodeValue() );
2253:                        // Element properties...
2254:                        NodeList childsOfChild = child.getChildNodes();
2255:                        for (int c_count = 0; c_count < childsOfChild
2256:                                .getLength(); c_count++) {
2257:                            Node child_child = (Node) childsOfChild
2258:                                    .item(c_count);
2259:                            NamedNodeMap subNodeAttributes = child_child
2260:                                    .getAttributes();
2261:
2262:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
2263:                                    && child_child.getNodeName().equals(
2264:                                            "reportElement")) {
2265:                                readXMLReportElement(child_child, re);
2266:                            } // Element properties...
2267:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE
2268:                                    && child_child.getNodeName().equals(
2269:                                            "graphicElement")) {
2270:                                readGraphicsElement(re, child_child);
2271:                            }
2272:                        }
2273:
2274:                        re.setPosition(re.position);
2275:                        re.trasform(new java.awt.Point(0, 0),
2276:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2277:                        //elements.addElement(re);
2278:                        rElement = re;
2279:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2280:                            && child.getNodeName().equals("textField")) {
2281:                        TextFieldReportElement re = new TextFieldReportElement(
2282:                                0, 0, 0, 0);
2283:
2284:                        re.setIReportFont(getReport().getDefaultFont());
2285:                        if (defualtStyle != null) {
2286:                            re.setStyle(defualtStyle);
2287:                            re.setStyle(null);
2288:                        }
2289:                        re.setBand(band);
2290:                        re.setCell(cell);
2291:                        re.setElementGroup(parentElementGroup);
2292:                        re.setParentElement(parentElement);
2293:                        NamedNodeMap nodeAttributes = child.getAttributes();
2294:                        /* CompatibilitySupport.saveRoundedRectangle */
2295:                        if (nodeAttributes.getNamedItem("evaluationTime") != null)
2296:                            re.setEvaluationTime(""
2297:                                    + nodeAttributes.getNamedItem(
2298:                                            "evaluationTime").getNodeValue());
2299:                        if (nodeAttributes.getNamedItem("evaluationGroup") != null)
2300:                            re.setGroup(""
2301:                                    + nodeAttributes.getNamedItem(
2302:                                            "evaluationGroup").getNodeValue());
2303:                        if (nodeAttributes
2304:                                .getNamedItem("isStretchWithOverflow") != null)
2305:                            re.setStretchWithOverflow(nodeAttributes
2306:                                    .getNamedItem("isStretchWithOverflow")
2307:                                    .getNodeValue().equals("true"));
2308:                        if (nodeAttributes.getNamedItem("isBlankWhenNull") != null)
2309:                            re.setBlankWhenNull(nodeAttributes.getNamedItem(
2310:                                    "isBlankWhenNull").getNodeValue().equals(
2311:                                    "true"));
2312:                        if (nodeAttributes.getNamedItem("pattern") != null)
2313:                            re.setPattern(""
2314:                                    + nodeAttributes.getNamedItem("pattern")
2315:                                            .getNodeValue());
2316:                        //if (nodeAttributes.getNamedItem("hyperlinkType") != null)
2317:                        //    re.setHyperlinkType( ""+nodeAttributes.getNamedItem("hyperlinkType").getNodeValue() );
2318:                        //if (nodeAttributes.getNamedItem("hyperlinkTarget") != null)
2319:                        //    re.setHyperlinkTarget( ""+nodeAttributes.getNamedItem("hyperlinkTarget").getNodeValue() );
2320:                        //if (nodeAttributes.getNamedItem("bookmarkLevel") != null)
2321:                        //    re.setBookmarkLevel( Integer.parseInt( nodeAttributes.getNamedItem("bookmarkLevel").getNodeValue() ) );
2322:
2323:                        NodeList childsOfChild = child.getChildNodes();
2324:                        for (int c_count = 0; c_count < childsOfChild
2325:                                .getLength(); c_count++) {
2326:                            Node child_child = (Node) childsOfChild
2327:                                    .item(c_count);
2328:                            NamedNodeMap subNodeAttributes = child_child
2329:                                    .getAttributes();
2330:
2331:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
2332:                                    && child_child.getNodeName().equals(
2333:                                            "reportElement")) {
2334:                                readXMLReportElement(child_child, re);
2335:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2336:                                    && child_child.getNodeName().equals(
2337:                                            "textElement")) {
2338:                                readXMLTextElement(child_child, re);
2339:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2340:                                    && child_child.getNodeName().equals(
2341:                                            "textFieldExpression")) {
2342:                                if (subNodeAttributes.getNamedItem("class") != null) {
2343:                                    re.setClassExpression(""
2344:                                            + subNodeAttributes.getNamedItem(
2345:                                                    "class").getNodeValue());
2346:                                }
2347:                                re.setText(readPCDATA(child_child).trim());
2348:                            }
2349:                            /*
2350:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("anchorNameExpression")) {
2351:                                re.setAnchorNameExpression( readPCDATA(child_child) );
2352:                            }
2353:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("hyperlinkAnchorExpression")) {
2354:                                re.setHyperlinkAnchorExpression( readPCDATA(child_child) );
2355:                            }
2356:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("hyperlinkPageExpression")) {
2357:                                re.setHyperlinkPageExpression( readPCDATA(child_child) );
2358:                            }
2359:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("hyperlinkReferenceExpression")) {
2360:                                re.setHyperlinkReferenceExpression( readPCDATA(child_child) );
2361:                            }
2362:                             */
2363:                            else if (child_child.getNodeType() == Node.ELEMENT_NODE
2364:                                    && child_child.getNodeName().equals("box")) {
2365:                                readBoxElement(child_child, re);
2366:                            }
2367:                        }
2368:                        readHyperlink(child, re);
2369:                        re.setPosition(re.position);
2370:                        re.trasform(new java.awt.Point(0, 0),
2371:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2372:                        //elements.addElement(re);
2373:                        rElement = re;
2374:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2375:                            && child.getNodeName().equals("frame")) {
2376:                        FrameReportElement re = new FrameReportElement(0, 0, 0,
2377:                                0);
2378:                        if (defualtStyle != null) {
2379:                            re.setStyle(defualtStyle);
2380:                            re.setStyle(null);
2381:                        }
2382:                        re.setBand(band);
2383:                        re.setCell(cell);
2384:                        re.setElementGroup(parentElementGroup);
2385:                        re.setParentElement(parentElement);
2386:                        NamedNodeMap nodeAttributes = child.getAttributes();
2387:
2388:                        NodeList childsOfChild = child.getChildNodes();
2389:                        for (int c_count = 0; c_count < childsOfChild
2390:                                .getLength(); c_count++) {
2391:                            Node child_child = (Node) childsOfChild
2392:                                    .item(c_count);
2393:                            NamedNodeMap subNodeAttributes = child_child
2394:                                    .getAttributes();
2395:
2396:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
2397:                                    && child_child.getNodeName().equals(
2398:                                            "reportElement")) {
2399:                                readXMLReportElement(child_child, re);
2400:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2401:                                    && child_child.getNodeName().equals("box")) {
2402:                                readBoxElement(child_child, re);
2403:                            }
2404:                        }
2405:
2406:                        re.setPosition(re.position);
2407:                        re.trasform(new java.awt.Point(0, 0),
2408:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2409:                        rElement = re;
2410:
2411:                        if (crosstabReportElement != null) {
2412:                            crosstabReportElement.getElements().addElement(
2413:                                    rElement);
2414:                        } else {
2415:                            getReport().getElements().addElement(rElement);
2416:                        }
2417:
2418:                        readBandElements("", child, band, re,
2419:                                crosstabReportElement, cell);
2420:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2421:                            && child.getNodeName().equals("elementGroup")) {
2422:                        String newgroup = getReport().createChildGroup(
2423:                                parentElementGroup);
2424:                        readBandElements(newgroup, child, band, parentElement,
2425:                                crosstabReportElement, cell);
2426:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2427:                            && child.getNodeName().equals("subreport")) {
2428:                        SubReportElement re = new SubReportElement(0, 0, 0, 0);
2429:                        if (defualtStyle != null) {
2430:                            re.setStyle(defualtStyle);
2431:                            re.setStyle(null);
2432:                        }
2433:                        re.setBand(band);
2434:                        re.setElementGroup(parentElementGroup);
2435:                        re.setParentElement(parentElement);
2436:                        NamedNodeMap nodeAttributes = child.getAttributes();
2437:                        if (nodeAttributes.getNamedItem("isUsingCache") != null)
2438:                            re.setIsUsingCache(nodeAttributes.getNamedItem(
2439:                                    "isUsingCache").getNodeValue().equals(
2440:                                    "true"));
2441:
2442:                        NodeList childsOfChild = child.getChildNodes();
2443:                        for (int c_count = 0; c_count < childsOfChild
2444:                                .getLength(); c_count++) {
2445:                            Node child_child = (Node) childsOfChild
2446:                                    .item(c_count);
2447:                            NamedNodeMap subNodeAttributes = child_child
2448:                                    .getAttributes();
2449:
2450:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
2451:                                    && child_child.getNodeName().equals(
2452:                                            "reportElement")) {
2453:                                readXMLReportElement(child_child, re);
2454:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2455:                                    && child_child.getNodeName().equals(
2456:                                            "parametersMapExpression")) {
2457:                                re
2458:                                        .setParametersMapExpression(readPCDATA(child_child));
2459:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2460:                                    && child_child.getNodeName().equals(
2461:                                            "returnValue")) {
2462:                                it.businesslogic.ireport.JRSubreportReturnValue returnValue = new it.businesslogic.ireport.JRSubreportReturnValue();
2463:
2464:                                if (subNodeAttributes
2465:                                        .getNamedItem("subreportVariable") != null) {
2466:                                    returnValue.setSubreportVariable(""
2467:                                            + subNodeAttributes.getNamedItem(
2468:                                                    "subreportVariable")
2469:                                                    .getNodeValue());
2470:                                }
2471:                                if (subNodeAttributes
2472:                                        .getNamedItem("toVariable") != null) {
2473:                                    returnValue.setToVariable(""
2474:                                            + subNodeAttributes.getNamedItem(
2475:                                                    "toVariable")
2476:                                                    .getNodeValue());
2477:                                }
2478:                                if (subNodeAttributes
2479:                                        .getNamedItem("calculation") != null) {
2480:                                    returnValue.setCalculation(""
2481:                                            + subNodeAttributes.getNamedItem(
2482:                                                    "calculation")
2483:                                                    .getNodeValue());
2484:                                }
2485:                                if (subNodeAttributes
2486:                                        .getNamedItem("incrementerFactoryClass") != null) {
2487:                                    returnValue.setIncrementFactoryClass(""
2488:                                            + subNodeAttributes.getNamedItem(
2489:                                                    "incrementerFactoryClass")
2490:                                                    .getNodeValue());
2491:                                }
2492:                                re.getReturnValues().addElement(returnValue);
2493:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2494:                                    && child_child.getNodeName().equals(
2495:                                            "subreportParameter")) {
2496:                                String name = "";
2497:                                if (subNodeAttributes.getNamedItem("name") != null) {
2498:                                    name = ""
2499:                                            + subNodeAttributes.getNamedItem(
2500:                                                    "name").getNodeValue();
2501:                                }
2502:                                // Find expression in childs......
2503:                                String expression = "";
2504:                                NodeList childsOfChildOfChild = child_child
2505:                                        .getChildNodes();
2506:                                for (int c_count_2 = 0; c_count_2 < childsOfChildOfChild
2507:                                        .getLength(); c_count_2++) {
2508:                                    Node child_child_child = (Node) childsOfChildOfChild
2509:                                            .item(c_count_2);
2510:                                    if (child_child_child.getNodeType() == Node.ELEMENT_NODE
2511:                                            && child_child_child
2512:                                                    .getNodeName()
2513:                                                    .equals(
2514:                                                            "subreportParameterExpression")) {
2515:                                        expression = readPCDATA(child_child_child);
2516:                                        break;
2517:                                    }
2518:                                }
2519:                                re
2520:                                        .getSubreportParameters()
2521:                                        .addElement(
2522:                                                new it.businesslogic.ireport.JRSubreportParameter(
2523:                                                        name, expression));
2524:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2525:                                    && child_child.getNodeName().equals(
2526:                                            "connectionExpression")) {
2527:                                re
2528:                                        .setConnectionExpression(readPCDATA(child_child));
2529:                                re.setUseConnection(true);
2530:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2531:                                    && child_child.getNodeName().equals(
2532:                                            "dataSourceExpression")) {
2533:                                re
2534:                                        .setDataSourceExpression(readPCDATA(child_child));
2535:                                re.setUseConnection(false);
2536:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2537:                                    && child_child.getNodeName().equals(
2538:                                            "subreportExpression")) {
2539:                                re
2540:                                        .setSubreportExpression(readPCDATA(child_child));
2541:                                if (subNodeAttributes.getNamedItem("class") != null) {
2542:                                    re.setSubreportExpressionClass(""
2543:                                            + subNodeAttributes.getNamedItem(
2544:                                                    "class").getNodeValue());
2545:                                }
2546:                            }
2547:                        }
2548:
2549:                        re.setPosition(re.position);
2550:                        re.trasform(new java.awt.Point(0, 0),
2551:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2552:                        //elements.addElement(re);
2553:                        rElement = re;
2554:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2555:                            && child.getNodeName().equals("pieChart")
2556:                            || child.getNodeType() == Node.ELEMENT_NODE
2557:                            && child.getNodeName().equals("pie3DChart")
2558:                            || child.getNodeType() == Node.ELEMENT_NODE
2559:                            && child.getNodeName().equals("barChart")
2560:                            || child.getNodeType() == Node.ELEMENT_NODE
2561:                            && child.getNodeName().equals("bar3DChart")
2562:                            || child.getNodeType() == Node.ELEMENT_NODE
2563:                            && child.getNodeName().equals("xyBarChart")
2564:                            || child.getNodeType() == Node.ELEMENT_NODE
2565:                            && child.getNodeName().equals("stackedBarChart")
2566:                            || child.getNodeType() == Node.ELEMENT_NODE
2567:                            && child.getNodeName().equals("stackedBar3DChart")
2568:                            || child.getNodeType() == Node.ELEMENT_NODE
2569:                            && child.getNodeName().equals("lineChart")
2570:                            || child.getNodeType() == Node.ELEMENT_NODE
2571:                            && child.getNodeName().equals("xyLineChart")
2572:                            || child.getNodeType() == Node.ELEMENT_NODE
2573:                            && child.getNodeName().equals("areaChart")
2574:                            || child.getNodeType() == Node.ELEMENT_NODE
2575:                            && child.getNodeName().equals("stackedAreaChart")
2576:                            || child.getNodeType() == Node.ELEMENT_NODE
2577:                            && child.getNodeName().equals("xyAreaChart")
2578:                            || child.getNodeType() == Node.ELEMENT_NODE
2579:                            && child.getNodeName().equals("scatterChart")
2580:                            || child.getNodeType() == Node.ELEMENT_NODE
2581:                            && child.getNodeName().equals("bubbleChart")
2582:                            || child.getNodeType() == Node.ELEMENT_NODE
2583:                            && child.getNodeName().equals("timeSeriesChart")
2584:                            || child.getNodeType() == Node.ELEMENT_NODE
2585:                            && child.getNodeName().equals("highLowChart")
2586:                            || child.getNodeType() == Node.ELEMENT_NODE
2587:                            && child.getNodeName().equals("candlestickChart")
2588:                            || child.getNodeType() == Node.ELEMENT_NODE
2589:                            && child.getNodeName().equals("meterChart")
2590:                            || child.getNodeType() == Node.ELEMENT_NODE
2591:                            && child.getNodeName().equals("thermometerChart")
2592:                            || child.getNodeType() == Node.ELEMENT_NODE
2593:                            && child.getNodeName().equals("multiAxisChart")) {
2594:                        ChartReportElement2 re = new ChartReportElement2(0, 0,
2595:                                0, 0);
2596:                        if (defualtStyle != null) {
2597:                            re.setStyle(defualtStyle);
2598:                            re.setStyle(null);
2599:                        }
2600:                        re.setBand(band);
2601:                        re.setElementGroup(parentElementGroup);
2602:                        re.setParentElement(parentElement);
2603:
2604:                        readChartReportElement(child, re);
2605:
2606:                        re.setPosition(re.position);
2607:                        re.trasform(new java.awt.Point(0, 0),
2608:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2609:                        //elements.addElement(re);
2610:                        rElement = re;
2611:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2612:                            && child.getNodeName().equals("crosstab")) {
2613:                        CrosstabReportElement re = new CrosstabReportElement(0,
2614:                                0, 0, 0);
2615:                        if (defualtStyle != null) {
2616:                            re.setStyle(defualtStyle);
2617:                            re.setStyle(null);
2618:                        }
2619:                        re.setBand(band);
2620:                        re.setElementGroup(parentElementGroup);
2621:                        re.setParentElement(parentElement);
2622:                        re.setReport(getReport());
2623:                        NamedNodeMap nodeAttributes = child.getAttributes();
2624:
2625:                        if (nodeAttributes
2626:                                .getNamedItem("isRepeatColumnHeaders") != null)
2627:                            re.setRepeatColumnHeaders(nodeAttributes
2628:                                    .getNamedItem("isRepeatColumnHeaders")
2629:                                    .getNodeValue().equals("true"));
2630:
2631:                        if (nodeAttributes.getNamedItem("isRepeatRowHeaders") != null)
2632:                            re.setRepeatRowHeaders(nodeAttributes.getNamedItem(
2633:                                    "isRepeatRowHeaders").getNodeValue()
2634:                                    .equals("true"));
2635:
2636:                        if (nodeAttributes.getNamedItem("isRepeatRowHeaders") != null) {
2637:                            try {
2638:                                int columnBreakOffset = Integer
2639:                                        .parseInt(nodeAttributes.getNamedItem(
2640:                                                "columnBreakOffset")
2641:                                                .getNodeValue());
2642:                                re.setColumnBreakOffset(columnBreakOffset);
2643:                            } catch (Exception ex) {
2644:                                System.out
2645:                                        .println("Invalid columnBreakOffset, using default");
2646:                            }
2647:                        }
2648:
2649:                        if (nodeAttributes.getNamedItem("runDirection") != null)
2650:                            re.setRunDirection(nodeAttributes.getNamedItem(
2651:                                    "runDirection").getNodeValue());
2652:
2653:                        NodeList childsOfChild = child.getChildNodes();
2654:                        for (int c_count = 0; c_count < childsOfChild
2655:                                .getLength(); c_count++) {
2656:                            Node child_child = (Node) childsOfChild
2657:                                    .item(c_count);
2658:                            NamedNodeMap subNodeAttributes = child_child
2659:                                    .getAttributes();
2660:
2661:                            if (child_child.getNodeType() == Node.ELEMENT_NODE
2662:                                    && child_child.getNodeName().equals(
2663:                                            "reportElement")) {
2664:                                readXMLReportElement(child_child, re);
2665:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2666:                                    && child_child.getNodeName().equals(
2667:                                            "parametersMapExpression")) {
2668:                                re
2669:                                        .setParametersMapExpression(readPCDATA(child_child));
2670:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2671:                                    && child_child.getNodeName().equals(
2672:                                            "crosstabParameter")) {
2673:                                String name = "";
2674:                                String clazz = "";
2675:                                if (subNodeAttributes.getNamedItem("name") != null) {
2676:                                    name = ""
2677:                                            + subNodeAttributes.getNamedItem(
2678:                                                    "name").getNodeValue();
2679:                                }
2680:                                CrosstabParameter cp = new CrosstabParameter(
2681:                                        name);
2682:                                if (subNodeAttributes.getNamedItem("class") != null) {
2683:                                    clazz = ""
2684:                                            + subNodeAttributes.getNamedItem(
2685:                                                    "class").getNodeValue();
2686:                                    cp.setClassType(clazz);
2687:                                }
2688:
2689:                                // Find expression in childs......
2690:                                String expression = "";
2691:                                NodeList childsOfChildOfChild = child_child
2692:                                        .getChildNodes();
2693:                                for (int c_count_2 = 0; c_count_2 < childsOfChildOfChild
2694:                                        .getLength(); c_count_2++) {
2695:                                    Node child_child_child = (Node) childsOfChildOfChild
2696:                                            .item(c_count_2);
2697:                                    if (child_child_child.getNodeType() == Node.ELEMENT_NODE
2698:                                            && child_child_child
2699:                                                    .getNodeName()
2700:                                                    .equals(
2701:                                                            "parameterValueExpression")) {
2702:                                        expression = readPCDATA(child_child_child);
2703:                                        cp
2704:                                                .setParameterValueExpression(expression);
2705:                                        break;
2706:                                    }
2707:                                }
2708:
2709:                                re.getCrosstabParameters().addElement(cp);
2710:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2711:                                    && child_child.getNodeName().equals(
2712:                                            "crosstabDataset")) {
2713:
2714:                                re.setUseDataset(true);
2715:                                if (subNodeAttributes
2716:                                        .getNamedItem("isDataPreSorted") != null) {
2717:                                    re.setPreSorted(subNodeAttributes
2718:                                            .getNamedItem("isDataPreSorted")
2719:                                            .getNodeValue().equals("true"));
2720:
2721:                                }
2722:
2723:                                NodeList childsOfChildOfChild = child_child
2724:                                        .getChildNodes();
2725:                                for (int c_count_2 = 0; c_count_2 < childsOfChildOfChild
2726:                                        .getLength(); c_count_2++) {
2727:                                    Node child_child_child = (Node) childsOfChildOfChild
2728:                                            .item(c_count_2);
2729:                                    if (child_child_child.getNodeType() == Node.ELEMENT_NODE
2730:                                            && child_child_child.getNodeName()
2731:                                                    .equals("dataset")) {
2732:                                        readDataset(child_child_child, re
2733:                                                .getDataset());
2734:                                        break;
2735:                                    }
2736:                                }
2737:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2738:                                    && child_child.getNodeName().equals(
2739:                                            "rowGroup")) {
2740:                                readCrosstabRowGroup(child_child, re);
2741:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2742:                                    && child_child.getNodeName().equals(
2743:                                            "columnGroup")) {
2744:                                readCrosstabColumnGroup(child_child, re);
2745:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2746:                                    && child_child.getNodeName().equals(
2747:                                            "measure")) {
2748:                                Measure measure = readMeasureElement(child_child);
2749:                                re.getMeasures().add(measure);
2750:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2751:                                    && child_child.getNodeName().equals(
2752:                                            "crosstabCell")) {
2753:                                it.businesslogic.ireport.crosstab.CrosstabCell detailCell = new it.businesslogic.ireport.crosstab.CrosstabCell();
2754:                                readCellContents(child_child, detailCell, re);
2755:                                detailCell.setType(detailCell.DETAIL_CELL);
2756:                                detailCell.setParent(re);
2757:                                re.getCells().add(detailCell);
2758:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2759:                                    && child_child.getNodeName().equals(
2760:                                            "whenNoDataCell")) {
2761:                                it.businesslogic.ireport.crosstab.CrosstabCell detailCell = new it.businesslogic.ireport.crosstab.CrosstabCell();
2762:                                readCellContents(child_child, detailCell, re);
2763:                                detailCell.setType(detailCell.NODATA_CELL);
2764:                                detailCell.setParent(re);
2765:                                re.getCells().add(detailCell);
2766:                            } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2767:                                    && child_child.getNodeName().equals(
2768:                                            "crosstabHeaderCell")) {
2769:                                it.businesslogic.ireport.crosstab.CrosstabCell detailCell = new it.businesslogic.ireport.crosstab.CrosstabCell();
2770:                                readCellContents(child_child, detailCell, re);
2771:                                detailCell.setType(detailCell.CT_HEADER_CELL);
2772:                                detailCell.setParent(re);
2773:                                re.getCells().add(detailCell);
2774:                            }
2775:
2776:                        }
2777:
2778:                        re.setPosition(re.position);
2779:                        re.trasform(new java.awt.Point(0, 0),
2780:                                TransformationType.TRANSFORMATION_RESIZE_SE);
2781:                        rElement = re;
2782:                    }
2783:
2784:                    //System.out.println(""+child.getNodeName());
2785:                    if (rElement != null
2786:                            && !(rElement instanceof  FrameReportElement)) {
2787:                        if (crosstabReportElement != null) {
2788:                            crosstabReportElement.getElements().addElement(
2789:                                    rElement);
2790:                        } else {
2791:                            getReport().getElements().addElement(rElement);
2792:                        }
2793:                    }
2794:                    rElement = null;
2795:                }
2796:
2797:            }
2798:
2799:            /**
2800:             * Read all the hyperlink related attibutes and parameters
2801:             *
2802:             */
2803:            private void readHyperlink(Node elementNode,
2804:                    HyperLinkableReportElement re) {
2805:                NodeList childsOfChild = elementNode.getChildNodes();
2806:
2807:                NamedNodeMap nodeAttributes = elementNode.getAttributes();
2808:                if (nodeAttributes.getNamedItem("hyperlinkType") != null)
2809:                    re.setHyperlinkType(""
2810:                            + nodeAttributes.getNamedItem("hyperlinkType")
2811:                                    .getNodeValue());
2812:                if (nodeAttributes.getNamedItem("hyperlinkTarget") != null)
2813:                    re.setHyperlinkTarget(""
2814:                            + nodeAttributes.getNamedItem("hyperlinkTarget")
2815:                                    .getNodeValue());
2816:                if (nodeAttributes.getNamedItem("bookmarkLevel") != null)
2817:                    re.setBookmarkLevel(Integer.parseInt(nodeAttributes
2818:                            .getNamedItem("bookmarkLevel").getNodeValue()));
2819:
2820:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
2821:                    Node child_child = (Node) childsOfChild.item(c_count);
2822:                    NamedNodeMap subNodeAttributes = child_child
2823:                            .getAttributes();
2824:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
2825:                            && child_child.getNodeName().equals(
2826:                                    "hyperlinkParameter")) {
2827:                        String name = "";
2828:                        if (subNodeAttributes.getNamedItem("name") != null) {
2829:                            name = ""
2830:                                    + subNodeAttributes.getNamedItem("name")
2831:                                            .getNodeValue();
2832:                        }
2833:                        // Find expression in childs......
2834:                        String expression = "";
2835:                        NodeList childsOfChildOfChild = child_child
2836:                                .getChildNodes();
2837:                        for (int c_count_2 = 0; c_count_2 < childsOfChildOfChild
2838:                                .getLength(); c_count_2++) {
2839:                            Node child_child_child = (Node) childsOfChildOfChild
2840:                                    .item(c_count_2);
2841:                            if (child_child_child.getNodeType() == Node.ELEMENT_NODE
2842:                                    && child_child_child.getNodeName().equals(
2843:                                            "hyperlinkParameterExpression")) {
2844:                                expression = readPCDATA(child_child_child);
2845:                                break;
2846:                            }
2847:                        }
2848:                        re.getLinkParameters().add(
2849:                                new it.businesslogic.ireport.JRLinkParameter(
2850:                                        name, expression));
2851:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2852:                            && child_child.getNodeName().equals(
2853:                                    "anchorNameExpression")) {
2854:                        re.setAnchorNameExpression(readPCDATA(child_child));
2855:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2856:                            && child_child.getNodeName().equals(
2857:                                    "hyperlinkAnchorExpression")) {
2858:                        re
2859:                                .setHyperlinkAnchorExpression(readPCDATA(child_child));
2860:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2861:                            && child_child.getNodeName().equals(
2862:                                    "hyperlinkPageExpression")) {
2863:                        re.setHyperlinkPageExpression(readPCDATA(child_child));
2864:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2865:                            && child_child.getNodeName().equals(
2866:                                    "hyperlinkReferenceExpression")) {
2867:                        re
2868:                                .setHyperlinkReferenceExpression(readPCDATA(child_child));
2869:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
2870:                            && child_child.getNodeName().equals(
2871:                                    "hyperlinkTooltipExpression")) {
2872:                        re.setTooltipExpression(readPCDATA(child_child));
2873:                    }
2874:                }
2875:            }
2876:
2877:            private void readCrosstabRowGroup(Node rowGroupXmlNode,
2878:                    CrosstabReportElement re) {
2879:                CrosstabRowGroup group = new CrosstabRowGroup();
2880:
2881:                NamedNodeMap nodeAttributes = rowGroupXmlNode.getAttributes();
2882:
2883:                if (nodeAttributes.getNamedItem("name") != null)
2884:                    group.setName(nodeAttributes.getNamedItem("name")
2885:                            .getNodeValue());
2886:
2887:                if (nodeAttributes.getNamedItem("width") != null) {
2888:                    try {
2889:                        group.setWidth(Integer.parseInt(nodeAttributes
2890:                                .getNamedItem("width").getNodeValue()));
2891:                    } catch (Exception ex) {
2892:                        System.out
2893:                                .println("Invalid width for crosstab row group "
2894:                                        + group.getName());
2895:                    }
2896:                }
2897:
2898:                if (nodeAttributes.getNamedItem("totalPosition") != null)
2899:                    group.setTotalPosition(nodeAttributes.getNamedItem(
2900:                            "totalPosition").getNodeValue());
2901:                if (nodeAttributes.getNamedItem("headerPosition") != null)
2902:                    group.setHeaderPosition(nodeAttributes.getNamedItem(
2903:                            "headerPosition").getNodeValue());
2904:
2905:                re.getRowGroups().add(group);
2906:
2907:                NodeList list_child = rowGroupXmlNode.getChildNodes();
2908:                for (int ck = 0; ck < list_child.getLength(); ck++) {
2909:                    Node child = (Node) list_child.item(ck);
2910:                    NamedNodeMap subNodeAttributes = child.getAttributes();
2911:                    if (child.getNodeType() == Node.ELEMENT_NODE
2912:                            && child.getNodeName().equals("bucket")) {
2913:
2914:                        readBucket(child, group);
2915:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2916:                            && child.getNodeName().equals("crosstabRowHeader")) {
2917:
2918:                        it.businesslogic.ireport.crosstab.CrosstabCell cell = new it.businesslogic.ireport.crosstab.CrosstabCell();
2919:                        cell.setName(group.getName() + " header");
2920:                        readCellContents(child, cell, re);
2921:                        group.setHeaderCell(cell);
2922:                        cell.setType(cell.HEADER_CELL);
2923:                        cell.setParent(re);
2924:                        re.getCells().add(cell);
2925:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
2926:                            && child.getNodeName().equals(
2927:                                    "crosstabTotalRowHeader")) {
2928:                        it.businesslogic.ireport.crosstab.CrosstabCell cell = new it.businesslogic.ireport.crosstab.CrosstabCell();
2929:                        cell.setName(group.getName() + " total header");
2930:                        readCellContents(child, cell, re);
2931:                        group.setTotalCell(cell);
2932:                        cell.setType(cell.HEADER_CELL);
2933:                        cell.setParent(re);
2934:                        re.getCells().add(cell);
2935:                    }
2936:                }
2937:
2938:                if (group.getHeaderCell() == null) {
2939:                    it.businesslogic.ireport.crosstab.CrosstabCell cell = new it.businesslogic.ireport.crosstab.CrosstabCell();
2940:                    cell.setName(group.getName() + " header");
2941:                    cell.setType(cell.HEADER_CELL);
2942:                    cell.setParent(re);
2943:                    cell.setWidth(group.getWidth());
2944:                    re.getCells().add(cell);
2945:                    group.setHeaderCell(cell);
2946:                }
2947:
2948:                if (group.getTotalCell() == null) {
2949:                    it.businesslogic.ireport.crosstab.CrosstabCell cell = new it.businesslogic.ireport.crosstab.CrosstabCell();
2950:                    cell.setType(cell.HEADER_CELL);
2951:                    cell.setName(group.getName() + " total header");
2952:                    cell.setParent(re);
2953:                    cell.setWidth(group.getWidth());
2954:                    re.getCells().add(cell);
2955:                    group.setTotalCell(cell);
2956:                }
2957:
2958:            }
2959:
2960:            private void readCrosstabColumnGroup(Node columnGroupXmlNode,
2961:                    CrosstabReportElement re) {
2962:                CrosstabColumnGroup group = new CrosstabColumnGroup();
2963:
2964:                NamedNodeMap nodeAttributes = columnGroupXmlNode
2965:                        .getAttributes();
2966:
2967:                if (nodeAttributes.getNamedItem("name") != null)
2968:                    group.setName(nodeAttributes.getNamedItem("name")
2969:                            .getNodeValue());
2970:
2971:                if (nodeAttributes.getNamedItem("height") != null) {
2972:                    try {
2973:                        group.setHeight(Integer.parseInt(nodeAttributes
2974:                                .getNamedItem("height").getNodeValue()));
2975:                    } catch (Exception ex) {
2976:                        System.out
2977:                                .println("Invalid height for crosstab column group "
2978:                                        + group.getName());
2979:                    }
2980:                }
2981:
2982:                if (nodeAttributes.getNamedItem("totalPosition") != null)
2983:                    group.setTotalPosition(nodeAttributes.getNamedItem(
2984:                            "totalPosition").getNodeValue());
2985:                if (nodeAttributes.getNamedItem("headerPosition") != null)
2986:                    group.setHeaderPosition(nodeAttributes.getNamedItem(
2987:                            "headerPosition").getNodeValue());
2988:
2989:                re.getColumnGroups().add(group);
2990:
2991:                NodeList list_child = columnGroupXmlNode.getChildNodes();
2992:                for (int ck = 0; ck < list_child.getLength(); ck++) {
2993:                    Node child = (Node) list_child.item(ck);
2994:                    NamedNodeMap subNodeAttributes = child.getAttributes();
2995:                    if (child.getNodeType() == Node.ELEMENT_NODE
2996:                            && child.getNodeName().equals("bucket")) {
2997:
2998:                        readBucket(child, group);
2999:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
3000:                            && child.getNodeName().equals(
3001:                                    "crosstabColumnHeader")) {
3002:
3003:                        it.businesslogic.ireport.crosstab.CrosstabCell cell = new it.businesslogic.ireport.crosstab.CrosstabCell();
3004:                        cell.setName(group.getName() + " header");
3005:                        readCellContents(child, cell, re);
3006:                        group.setHeaderCell(cell);
3007:                        cell.setType(cell.HEADER_CELL);
3008:                        cell.setParent(re);
3009:                        re.getCells().add(cell);
3010:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
3011:                            && child.getNodeName().equals(
3012:                                    "crosstabTotalColumnHeader")) {
3013:                        it.businesslogic.ireport.crosstab.CrosstabCell cell = new it.businesslogic.ireport.crosstab.CrosstabCell();
3014:                        cell.setName(group.getName() + " total header");
3015:                        readCellContents(child, cell, re);
3016:                        group.setTotalCell(cell);
3017:                        cell.setType(cell.HEADER_CELL);
3018:                        cell.setParent(re);
3019:                        re.getCells().add(cell);
3020:                    }
3021:
3022:                }
3023:
3024:                if (group.getHeaderCell() == null) {
3025:                    it.businesslogic.ireport.crosstab.CrosstabCell cell = new it.businesslogic.ireport.crosstab.CrosstabCell();
3026:                    cell.setName(group.getName() + " header");
3027:                    cell.setType(cell.HEADER_CELL);
3028:                    cell.setParent(re);
3029:                    cell.setHeight(group.getHeight());
3030:                    re.getCells().add(cell);
3031:                    group.setHeaderCell(cell);
3032:                }
3033:
3034:                if (group.getTotalCell() == null) {
3035:                    it.businesslogic.ireport.crosstab.CrosstabCell cell = new it.businesslogic.ireport.crosstab.CrosstabCell();
3036:                    cell.setType(cell.HEADER_CELL);
3037:                    cell.setName(group.getName() + " total header");
3038:                    cell.setParent(re);
3039:                    cell.setHeight(group.getHeight());
3040:                    re.getCells().add(cell);
3041:                    group.setTotalCell(cell);
3042:                }
3043:            }
3044:
3045:            private void readCellContents(Node cellConetensNode,
3046:                    it.businesslogic.ireport.crosstab.CrosstabCell cell,
3047:                    CrosstabReportElement re) {
3048:                NamedNodeMap nodeAttributes = cellConetensNode.getAttributes();
3049:
3050:                if (nodeAttributes.getNamedItem("width") != null) {
3051:                    try {
3052:                        cell.setWidth(Integer.parseInt(nodeAttributes
3053:                                .getNamedItem("width").getNodeValue()));
3054:                    } catch (Exception ex) {
3055:                        System.out.println("Invalid width for crosstab cell");
3056:                    }
3057:                }
3058:
3059:                if (nodeAttributes.getNamedItem("height") != null) {
3060:                    try {
3061:                        cell.setHeight(Integer.parseInt(nodeAttributes
3062:                                .getNamedItem("height").getNodeValue()));
3063:                    } catch (Exception ex) {
3064:                        System.out.println("Invalid height for crosstab cell");
3065:                    }
3066:                }
3067:
3068:                if (nodeAttributes.getNamedItem("rowTotalGroup") != null)
3069:                    cell.setRowTotalGroup(nodeAttributes.getNamedItem(
3070:                            "rowTotalGroup").getNodeValue());
3071:
3072:                if (nodeAttributes.getNamedItem("columnTotalGroup") != null)
3073:                    cell.setColumnTotalGroup(nodeAttributes.getNamedItem(
3074:                            "columnTotalGroup").getNodeValue());
3075:
3076:                // Look for the CellContents node...
3077:                Node cellContentsElementNode = null;
3078:                NodeList list_child = cellConetensNode.getChildNodes();
3079:                for (int ck = 0; ck < list_child.getLength(); ck++) {
3080:                    Node child = (Node) list_child.item(ck);
3081:                    NamedNodeMap subNodeAttributes = child.getAttributes();
3082:                    if (child.getNodeType() == Node.ELEMENT_NODE
3083:                            && child.getNodeName().equals("cellContents")) {
3084:                        cellContentsElementNode = child;
3085:
3086:                        if (subNodeAttributes.getNamedItem("style") != null) {
3087:                            String sname = subNodeAttributes.getNamedItem(
3088:                                    "style").getNodeValue();
3089:                            for (int j = 0; j < getReport().getStyles().size(); ++j) {
3090:                                Style sparent = (Style) getReport().getStyles()
3091:                                        .elementAt(j);
3092:                                if (sparent.getName().equals(sname)) {
3093:                                    cell.setStyle(sparent);
3094:                                    break;
3095:                                }
3096:                            }
3097:                            if (cell.getStyle() == null) {
3098:                                UndefinedStyle us = new UndefinedStyle();
3099:                                us.setName(sname);
3100:                                getReport().getStyles().addElement(us);
3101:                                cell.setStyle(us);
3102:                            }
3103:                        }
3104:
3105:                        if (subNodeAttributes.getNamedItem("backcolor") != null)
3106:                            cell.setBackcolor(getReport().decodeColor(
3107:                                    subNodeAttributes.getNamedItem("backcolor")
3108:                                            .getNodeValue()));
3109:
3110:                        if (subNodeAttributes.getNamedItem("mode") != null)
3111:                            cell.setMode(subNodeAttributes.getNamedItem("mode")
3112:                                    .getNodeValue());
3113:                    }
3114:                }
3115:
3116:                if (cellContentsElementNode != null) {
3117:                    list_child = cellContentsElementNode.getChildNodes();
3118:                    for (int ck = 0; ck < list_child.getLength(); ck++) {
3119:                        Node child = (Node) list_child.item(ck);
3120:                        NamedNodeMap subNodeAttributes = child.getAttributes();
3121:
3122:                        if (child.getNodeType() == Node.ELEMENT_NODE
3123:                                && child.getNodeName().equals("box")) {
3124:                            readBoxElement(child, cell);
3125:                        }
3126:                    }
3127:
3128:                }
3129:                readBandElements("", cellContentsElementNode, null, null, re,
3130:                        cell);
3131:
3132:            }
3133:
3134:            private void readBucket(Node bucketXmlNode, CrosstabGroup grp) {
3135:                NamedNodeMap nodeAttributes = bucketXmlNode.getAttributes();
3136:
3137:                if (nodeAttributes.getNamedItem("order") != null)
3138:                    grp.setBucketOrder(nodeAttributes.getNamedItem("order")
3139:                            .getNodeValue());
3140:
3141:                NodeList list_child = bucketXmlNode.getChildNodes();
3142:                for (int ck = 0; ck < list_child.getLength(); ck++) {
3143:                    Node child = (Node) list_child.item(ck);
3144:                    NamedNodeMap subNodeAttributes = child.getAttributes();
3145:                    if (child.getNodeType() == Node.ELEMENT_NODE
3146:                            && child.getNodeName().equals("bucketExpression")) {
3147:
3148:                        if (subNodeAttributes.getNamedItem("class") != null)
3149:                            grp.setBucketExpressionClass(subNodeAttributes
3150:                                    .getNamedItem("class").getNodeValue());
3151:
3152:                        grp.setBucketExpression(readPCDATA(child));
3153:                    } else if (child.getNodeType() == Node.ELEMENT_NODE
3154:                            && child.getNodeName().equals(
3155:                                    "comparatorExpression")) {
3156:                        grp.setBucketComparatorExpression(readPCDATA(child));
3157:                    }
3158:                }
3159:            }
3160:
3161:            private void readChartElement(Node xmlChart, ChartReportElement2 re) {
3162:                NamedNodeMap nodeAttributes = xmlChart.getAttributes();
3163:
3164:                if (nodeAttributes.getNamedItem("isShowLegend") != null)
3165:                    re.getChart().setShowLegend(
3166:                            nodeAttributes.getNamedItem("isShowLegend")
3167:                                    .getNodeValue().equals("true"));
3168:                if (nodeAttributes.getNamedItem("evaluationTime") != null)
3169:                    re.setEvaluationTime(nodeAttributes.getNamedItem(
3170:                            "evaluationTime").getNodeValue());
3171:                if (nodeAttributes.getNamedItem("evaluationGroup") != null)
3172:                    re.setEvaluationGroup(nodeAttributes.getNamedItem(
3173:                            "evaluationGroup").getNodeValue());
3174:                //if (nodeAttributes.getNamedItem("hyperlinkType") != null)
3175:                //    re.setHyperlinkType( ""+nodeAttributes.getNamedItem("hyperlinkType").getNodeValue() );
3176:                //if (nodeAttributes.getNamedItem("hyperlinkTarget") != null)
3177:                //    re.setHyperlinkTarget( ""+nodeAttributes.getNamedItem("hyperlinkTarget").getNodeValue() );
3178:                //if (nodeAttributes.getNamedItem("bookmarkLevel") != null)
3179:                //    re.setBookmarkLevel( Integer.parseInt( nodeAttributes.getNamedItem("bookmarkLevel").getNodeValue() ) );
3180:                if (nodeAttributes.getNamedItem("customizerClass") != null)
3181:                    re.getChart().setCustomizerClass(
3182:                            nodeAttributes.getNamedItem("customizerClass")
3183:                                    .getNodeValue());
3184:
3185:                if (nodeAttributes.getNamedItem("renderType") != null)
3186:                    re.setRenderType(nodeAttributes.getNamedItem("renderType")
3187:                            .getNodeValue());
3188:
3189:                NodeList childsOfChild = xmlChart.getChildNodes();
3190:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3191:                    Node child_child = (Node) childsOfChild.item(c_count);
3192:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3193:                            && child_child.getNodeName().equals(
3194:                                    "printWhenExpression")) {
3195:                        re.setPrintWhenExpression(readPCDATA(child_child));
3196:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3197:                            && child_child.getNodeName()
3198:                                    .equals("reportElement")) {
3199:                        readXMLReportElement(child_child, re);
3200:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3201:                            && child_child.getNodeName().equals("box")) {
3202:                        readBoxElement(child_child, re);
3203:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3204:                            && child_child.getNodeName().equals("chartTitle")) {
3205:                        readChartTitleElement(child_child, re);
3206:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3207:                            && child_child.getNodeName()
3208:                                    .equals("chartSubtitle")) {
3209:                        readChartSubTitleElement(child_child, re);
3210:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3211:                            && child_child.getNodeName().equals("chartLegend")) {
3212:                        readChartLegendElement(child_child, re);
3213:                    }
3214:                    /*
3215:                    else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("anchorNameExpression")) {
3216:                        re.setAnchorNameExpression( readPCDATA(child_child) );
3217:                    }
3218:                    else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("hyperlinkAnchorExpression")) {
3219:                        re.setHyperlinkAnchorExpression( readPCDATA(child_child) );
3220:                    }
3221:                    else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("hyperlinkPageExpression")) {
3222:                        re.setHyperlinkPageExpression( readPCDATA(child_child) );
3223:                    }
3224:                    else if (child_child.getNodeType() == Node.ELEMENT_NODE && child_child.getNodeName().equals("hyperlinkReferenceExpression")) {
3225:                        re.setHyperlinkReferenceExpression( readPCDATA(child_child) );
3226:                    }
3227:                     */
3228:                }
3229:                readHyperlink(xmlChart, re);
3230:            }
3231:
3232:            private void readChartTitleElement(Node xmlElement,
3233:                    ChartReportElement2 re) {
3234:                NamedNodeMap nodeAttributes = xmlElement.getAttributes();
3235:
3236:                if (nodeAttributes.getNamedItem("position") != null)
3237:                    re.getChart().getTitle().setPosition(
3238:                            nodeAttributes.getNamedItem("position")
3239:                                    .getNodeValue());
3240:                if (nodeAttributes.getNamedItem("color") != null)
3241:                    re.getChart().getTitle().setColor(
3242:                            decodeColor(""
3243:                                    + nodeAttributes.getNamedItem("color")
3244:                                            .getNodeValue()));
3245:
3246:                NodeList childsOfChild = xmlElement.getChildNodes();
3247:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3248:                    Node child_child = (Node) childsOfChild.item(c_count);
3249:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3250:                            && child_child.getNodeName().equals(
3251:                                    "titleExpression")) {
3252:                        re.getChart().getTitle().setTitleExpression(
3253:                                readPCDATA(child_child));
3254:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3255:                            && child_child.getNodeName().equals("font")) {
3256:                        re.getChart().getTitle().setFont(
3257:                                readFontElement(child_child));
3258:                    }
3259:                }
3260:            }
3261:
3262:            private void readChartLegendElement(Node xmlElement,
3263:                    ChartReportElement2 re) {
3264:                NamedNodeMap nodeAttributes = xmlElement.getAttributes();
3265:
3266:                if (nodeAttributes.getNamedItem("textColor") != null)
3267:                    re.getChart().getLegend().setTextColor(
3268:                            decodeColor(""
3269:                                    + nodeAttributes.getNamedItem("textColor")
3270:                                            .getNodeValue()));
3271:
3272:                if (nodeAttributes.getNamedItem("backgroundColor") != null)
3273:                    re.getChart().getLegend().setBackgroundColor(
3274:                            decodeColor(""
3275:                                    + nodeAttributes.getNamedItem(
3276:                                            "backgroundColor").getNodeValue()));
3277:
3278:                NodeList childsOfChild = xmlElement.getChildNodes();
3279:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3280:                    Node child_child = (Node) childsOfChild.item(c_count);
3281:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3282:                            && child_child.getNodeName().equals("font")) {
3283:                        re.getChart().getLegend().setFont(
3284:                                readFontElement(child_child));
3285:                    }
3286:                }
3287:            }
3288:
3289:            private IReportFont readFontElement(Node xmlElement) {
3290:
3291:                NamedNodeMap nnm = xmlElement.getAttributes();
3292:                IReportFont font = null;
3293:
3294:                if (nnm.getNamedItem("reportFont") != null) {
3295:
3296:                    font = getReport().getReportFontByName(
3297:                            nnm.getNamedItem("reportFont").getNodeValue());
3298:                    if (font != null) {
3299:                        font = (IReportFont) font.clone();
3300:                        font.setReportFont(nnm.getNamedItem("reportFont")
3301:                                .getNodeValue());
3302:                    }
3303:                }
3304:
3305:                if (font == null) {
3306:                    if (getReport().getDefaultFont() != null) {
3307:                        font = (IReportFont) getReport().getDefaultFont()
3308:                                .clone();
3309:                    } else {
3310:                        font = new IReportFont();
3311:                    }
3312:                }
3313:
3314:                //System.out.println("Working on: " + xmlReportElement);
3315:                for (int kkk = 0; kkk < nnm.getLength(); ++kkk) {
3316:                    //System.out.println( + " " + );
3317:
3318:                    String propName = nnm.item(kkk).getNodeName();
3319:                    String propValue = nnm.item(kkk).getNodeValue();
3320:                    if (propName != null && propValue != null) {
3321:                        if (propName.equals("fontName"))
3322:                            font.setFontName(propValue);
3323:                        else if (propName.equals("pdfFontName"))
3324:                            font.setPDFFontName(propValue);
3325:                        else if (propName.equals("size"))
3326:                            font.setFontSize(Integer.parseInt("" + propValue));
3327:                        else if (propName.equals("isBold"))
3328:                            font.setBold((new String("" + propValue))
3329:                                    .equalsIgnoreCase("true"));
3330:                        else if (propName.equals("isItalic"))
3331:                            font.setItalic((new String("" + propValue))
3332:                                    .equalsIgnoreCase("true"));
3333:                        else if (propName.equals("isUnderline"))
3334:                            font.setUnderline((new String("" + propValue))
3335:                                    .equalsIgnoreCase("true"));
3336:                        else if (propName.equals("isStrikeThrough"))
3337:                            font.setStrikeTrought((new String("" + propValue))
3338:                                    .equalsIgnoreCase("true"));
3339:                        else if (propName.equals("isPdfEmbedded"))
3340:                            font.setPdfEmbedded((new String("" + propValue))
3341:                                    .equalsIgnoreCase("true"));
3342:                        else if (propName.equals("pdfEncoding"))
3343:                            font.setPdfEncoding("" + propValue);
3344:                    }
3345:                }
3346:
3347:                return font;
3348:            }
3349:
3350:            private void readDataset(Node xmlNode, ChartReportElement2 re) {
3351:
3352:                readDataset(xmlNode, re.getChart().getDataset());
3353:            }
3354:
3355:            private void readDataset(Node xmlNode, Dataset dataset) {
3356:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
3357:
3358:                if (nodeAttributes.getNamedItem("resetType") != null)
3359:                    dataset.setResetType(nodeAttributes.getNamedItem(
3360:                            "resetType").getNodeValue());
3361:                if (nodeAttributes.getNamedItem("resetGroup") != null)
3362:                    dataset.setResetGroup(nodeAttributes.getNamedItem(
3363:                            "resetGroup").getNodeValue());
3364:                if (nodeAttributes.getNamedItem("incrementType") != null)
3365:                    dataset.setIncrementType(nodeAttributes.getNamedItem(
3366:                            "incrementType").getNodeValue());
3367:                if (nodeAttributes.getNamedItem("incrementGroup") != null)
3368:                    dataset.setIncrementGroup(nodeAttributes.getNamedItem(
3369:                            "incrementGroup").getNodeValue());
3370:
3371:                NodeList childsOfChild = xmlNode.getChildNodes();
3372:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3373:                    Node child_child = (Node) childsOfChild.item(c_count);
3374:
3375:                    NamedNodeMap subNodeAttributes = child_child
3376:                            .getAttributes();
3377:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3378:                            && child_child.getNodeName().equals(
3379:                                    "incrementWhenExpression")) {
3380:
3381:                        dataset
3382:                                .setIncrementWhenExpression(readPCDATA(child_child));
3383:                    }
3384:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3385:                            && child_child.getNodeName().equals("datasetRun")) {
3386:
3387:                        if (subNodeAttributes.getNamedItem("subDataset") != null) {
3388:                            String name = subNodeAttributes.getNamedItem(
3389:                                    "subDataset").getNodeValue();
3390:                            Enumeration enum_datasets = getReport()
3391:                                    .getSubDatasets().elements();
3392:                            while (enum_datasets.hasMoreElements()) {
3393:                                SubDataset subDataset = (SubDataset) enum_datasets
3394:                                        .nextElement();
3395:                                if (subDataset.getName().equals(name)) {
3396:                                    dataset.setSubDataset(subDataset);
3397:                                    break;
3398:                                }
3399:                            }
3400:
3401:                            NodeList childsOfchild_child = child_child
3402:                                    .getChildNodes();
3403:                            for (int c_count2 = 0; c_count2 < childsOfchild_child
3404:                                    .getLength(); c_count2++) {
3405:                                Node child_child2 = (Node) childsOfchild_child
3406:                                        .item(c_count2);
3407:
3408:                                NamedNodeMap subNodeAttributes2 = child_child2
3409:                                        .getAttributes();
3410:
3411:                                if (child_child2.getNodeType() == Node.ELEMENT_NODE
3412:                                        && child_child2.getNodeName().equals(
3413:                                                "parametersMapExpression")) {
3414:                                    dataset
3415:                                            .setParametersMapExpression(readPCDATA(child_child2));
3416:                                } else if (child_child2.getNodeType() == Node.ELEMENT_NODE
3417:                                        && child_child2.getNodeName().equals(
3418:                                                "datasetParameter")) {
3419:                                    name = "";
3420:                                    if (subNodeAttributes2.getNamedItem("name") != null) {
3421:                                        name = ""
3422:                                                + subNodeAttributes2
3423:                                                        .getNamedItem("name")
3424:                                                        .getNodeValue();
3425:                                    }
3426:                                    // Find expression in childs......
3427:                                    String expression = "";
3428:                                    NodeList childsOfChildOfChild = child_child2
3429:                                            .getChildNodes();
3430:                                    for (int c_count_2 = 0; c_count_2 < childsOfChildOfChild
3431:                                            .getLength(); c_count_2++) {
3432:                                        Node child_child_child = (Node) childsOfChildOfChild
3433:                                                .item(c_count_2);
3434:                                        if (child_child_child.getNodeType() == Node.ELEMENT_NODE
3435:                                                && child_child_child
3436:                                                        .getNodeName()
3437:                                                        .equals(
3438:                                                                "datasetParameterExpression")) {
3439:                                            expression = readPCDATA(child_child_child);
3440:                                            break;
3441:                                        }
3442:                                    }
3443:                                    dataset
3444:                                            .getSubreportParameters()
3445:                                            .addElement(
3446:                                                    new it.businesslogic.ireport.JRSubreportParameter(
3447:                                                            name, expression));
3448:                                } else if (child_child2.getNodeType() == Node.ELEMENT_NODE
3449:                                        && child_child2.getNodeName().equals(
3450:                                                "connectionExpression")) {
3451:                                    dataset
3452:                                            .setConnectionExpression(readPCDATA(child_child2));
3453:                                    dataset.setUseConnection(true);
3454:                                } else if (child_child2.getNodeType() == Node.ELEMENT_NODE
3455:                                        && child_child2.getNodeName().equals(
3456:                                                "dataSourceExpression")) {
3457:                                    dataset
3458:                                            .setDataSourceExpression(readPCDATA(child_child2));
3459:                                    dataset.setUseConnection(false);
3460:                                }
3461:                            }
3462:                        }
3463:                    }
3464:                }
3465:            }
3466:
3467:            private void readSectionItemHyperlink(Node elementNode,
3468:                    SectionItemHyperlink sih) {
3469:
3470:                NodeList childsOfChild = elementNode.getChildNodes();
3471:
3472:                NamedNodeMap nodeAttributes = elementNode.getAttributes();
3473:                if (nodeAttributes.getNamedItem("hyperlinkType") != null)
3474:                    sih.setHyperlinkType(""
3475:                            + nodeAttributes.getNamedItem("hyperlinkType")
3476:                                    .getNodeValue());
3477:                if (nodeAttributes.getNamedItem("hyperlinkTarget") != null)
3478:                    sih.setHyperlinkTarget(""
3479:                            + nodeAttributes.getNamedItem("hyperlinkTarget")
3480:                                    .getNodeValue());
3481:
3482:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3483:                    Node child_child = (Node) childsOfChild.item(c_count);
3484:                    NamedNodeMap subNodeAttributes = child_child
3485:                            .getAttributes();
3486:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3487:                            && child_child.getNodeName().equals(
3488:                                    "hyperlinkParameter")) {
3489:                        String name = "";
3490:                        if (subNodeAttributes.getNamedItem("name") != null) {
3491:                            name = ""
3492:                                    + subNodeAttributes.getNamedItem("name")
3493:                                            .getNodeValue();
3494:                        }
3495:                        // Find expression in childs......
3496:                        String expression = "";
3497:                        NodeList childsOfChildOfChild = child_child
3498:                                .getChildNodes();
3499:                        for (int c_count_2 = 0; c_count_2 < childsOfChildOfChild
3500:                                .getLength(); c_count_2++) {
3501:                            Node child_child_child = (Node) childsOfChildOfChild
3502:                                    .item(c_count_2);
3503:                            if (child_child_child.getNodeType() == Node.ELEMENT_NODE
3504:                                    && child_child_child.getNodeName().equals(
3505:                                            "hyperlinkParameterExpression")) {
3506:                                expression = readPCDATA(child_child_child);
3507:                                break;
3508:                            }
3509:                        }
3510:                        sih.getHyperlinkParameters().add(
3511:                                new it.businesslogic.ireport.JRLinkParameter(
3512:                                        name, expression));
3513:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3514:                            && child_child.getNodeName().equals(
3515:                                    "hyperlinkAnchorExpression")) {
3516:                        sih
3517:                                .setHyperlinkAnchorExpression(readPCDATA(child_child));
3518:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3519:                            && child_child.getNodeName().equals(
3520:                                    "hyperlinkPageExpression")) {
3521:                        sih.setHyperlinkPageExpression(readPCDATA(child_child));
3522:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3523:                            && child_child.getNodeName().equals(
3524:                                    "hyperlinkReferenceExpression")) {
3525:                        sih
3526:                                .setHyperlinkReferenceExpression(readPCDATA(child_child));
3527:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3528:                            && child_child.getNodeName().equals(
3529:                                    "hyperlinkTooltipExpression")) {
3530:                        sih
3531:                                .setHyperlinkTooltipExpression(readPCDATA(child_child));
3532:                    }
3533:                }
3534:
3535:            }
3536:
3537:            private void readPieDataset(Node xmlNode, ChartReportElement2 re) {
3538:
3539:                NodeList childsOfChild = xmlNode.getChildNodes();
3540:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3541:                    Node child_child = (Node) childsOfChild.item(c_count);
3542:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3543:                            && child_child.getNodeName().equals("dataset")) {
3544:                        readDataset(child_child, re);
3545:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3546:                            && child_child.getNodeName()
3547:                                    .equals("keyExpression")) {
3548:                        ((it.businesslogic.ireport.chart.PieDataset) re
3549:                                .getChart().getDataset())
3550:                                .setKeyExpression(readPCDATA(child_child));
3551:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3552:                            && child_child.getNodeName().equals(
3553:                                    "valueExpression")) {
3554:                        ((it.businesslogic.ireport.chart.PieDataset) re
3555:                                .getChart().getDataset())
3556:                                .setValueExpression(readPCDATA(child_child));
3557:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3558:                            && child_child.getNodeName().equals(
3559:                                    "labelExpression")) {
3560:                        ((it.businesslogic.ireport.chart.PieDataset) re
3561:                                .getChart().getDataset())
3562:                                .setLabelExpression(readPCDATA(child_child));
3563:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3564:                            && child_child.getNodeName().equals(
3565:                                    "sectionHyperlink")) {
3566:                        readSectionItemHyperlink(child_child, ((PieDataset) re
3567:                                .getChart().getDataset()).getSectionHyperLink());
3568:                    }
3569:                }
3570:            }
3571:
3572:            private void readCategoryDataset(Node xmlNode,
3573:                    ChartReportElement2 re) {
3574:
3575:                NodeList childsOfChild = xmlNode.getChildNodes();
3576:
3577:                CategoryDataset cd = new CategoryDataset();
3578:                re.getChart().setDataset(cd);
3579:
3580:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3581:                    Node child_child = (Node) childsOfChild.item(c_count);
3582:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3583:                            && child_child.getNodeName().equals("dataset")) {
3584:                        readDataset(child_child, re);
3585:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3586:                            && child_child.getNodeName().equals(
3587:                                    "categorySeries")) {
3588:                        CategorySeries cs = readCategorySeries(child_child);
3589:                        cd.getCategorySeries().add(cs);
3590:                    }
3591:                }
3592:            }
3593:
3594:            private void readTimePeriodDataset(Node xmlNode,
3595:                    ChartReportElement2 re) {
3596:
3597:                NodeList childsOfChild = xmlNode.getChildNodes();
3598:
3599:                TimePeriodDataset cd = new TimePeriodDataset();
3600:                re.getChart().setDataset(cd);
3601:
3602:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3603:                    Node child_child = (Node) childsOfChild.item(c_count);
3604:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3605:                            && child_child.getNodeName().equals("dataset")) {
3606:                        readDataset(child_child, re);
3607:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3608:                            && child_child.getNodeName().equals(
3609:                                    "timePeriodSeries")) {
3610:                        TimePeriodSeries cs = readTimePeriodSeries(child_child);
3611:                        cd.getTimePeriodSeries().add(cs);
3612:                    }
3613:                }
3614:            }
3615:
3616:            private void readXYDataset(Node xmlNode, ChartReportElement2 re) {
3617:
3618:                NodeList childsOfChild = xmlNode.getChildNodes();
3619:
3620:                XYDataset cd = new XYDataset();
3621:                re.getChart().setDataset(cd);
3622:
3623:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3624:                    Node child_child = (Node) childsOfChild.item(c_count);
3625:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3626:                            && child_child.getNodeName().equals("dataset")) {
3627:                        readDataset(child_child, re);
3628:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3629:                            && child_child.getNodeName().equals("xySeries")) {
3630:                        XYSeries cs = readXYSeries(child_child);
3631:                        cd.getXYSeries().add(cs);
3632:                    }
3633:                }
3634:            }
3635:
3636:            private void readXYZDataset(Node xmlNode, ChartReportElement2 re) {
3637:
3638:                NodeList childsOfChild = xmlNode.getChildNodes();
3639:
3640:                XYZDataset cd = new XYZDataset();
3641:                re.getChart().setDataset(cd);
3642:
3643:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3644:                    Node child_child = (Node) childsOfChild.item(c_count);
3645:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3646:                            && child_child.getNodeName().equals("dataset")) {
3647:                        readDataset(child_child, re);
3648:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3649:                            && child_child.getNodeName().equals("xyzSeries")) {
3650:                        XYZSeries cs = readXYZSeries(child_child);
3651:                        cd.getXYZSeries().add(cs);
3652:                    }
3653:                }
3654:            }
3655:
3656:            private void readTimeSeriesDataset(Node xmlNode,
3657:                    ChartReportElement2 re) {
3658:
3659:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
3660:                NodeList childsOfChild = xmlNode.getChildNodes();
3661:
3662:                TimeSeriesDataset cd = new TimeSeriesDataset();
3663:                re.getChart().setDataset(cd);
3664:
3665:                if (nodeAttributes.getNamedItem("timePeriod") != null)
3666:                    cd.setTimePeriod(nodeAttributes.getNamedItem("timePeriod")
3667:                            .getNodeValue());
3668:
3669:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3670:                    Node child_child = (Node) childsOfChild.item(c_count);
3671:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3672:                            && child_child.getNodeName().equals("dataset")) {
3673:                        readDataset(child_child, re);
3674:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3675:                            && child_child.getNodeName().equals("timeSeries")) {
3676:                        TimeSeries cs = readTimeSeries(child_child);
3677:                        cd.getTimeSeries().add(cs);
3678:                    }
3679:                }
3680:            }
3681:
3682:            private void readHighLowDataset(Node xmlNode, ChartReportElement2 re) {
3683:
3684:                NodeList childsOfChild = xmlNode.getChildNodes();
3685:
3686:                HighLowDataset cd = new HighLowDataset();
3687:                re.getChart().setDataset(cd);
3688:
3689:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3690:                    Node child_child = (Node) childsOfChild.item(c_count);
3691:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3692:                            && child_child.getNodeName().equals("dataset")) {
3693:                        readDataset(child_child, re);
3694:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3695:                            && child_child.getNodeName().equals(
3696:                                    "seriesExpression")) {
3697:                        cd.setSeriesExpression(readPCDATA(child_child));
3698:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3699:                            && child_child.getNodeName().equals(
3700:                                    "dateExpression")) {
3701:                        cd.setDateExpression(readPCDATA(child_child));
3702:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3703:                            && child_child.getNodeName().equals(
3704:                                    "highExpression")) {
3705:                        cd.setHighExpression(readPCDATA(child_child));
3706:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3707:                            && child_child.getNodeName()
3708:                                    .equals("lowExpression")) {
3709:                        cd.setLowExpression(readPCDATA(child_child));
3710:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3711:                            && child_child.getNodeName().equals(
3712:                                    "openExpression")) {
3713:                        cd.setOpenExpression(readPCDATA(child_child));
3714:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3715:                            && child_child.getNodeName().equals(
3716:                                    "closeExpression")) {
3717:                        cd.setCloseExpression(readPCDATA(child_child));
3718:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3719:                            && child_child.getNodeName().equals(
3720:                                    "volumeExpression")) {
3721:                        cd.setVolumeExpression(readPCDATA(child_child));
3722:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3723:                            && child_child.getNodeName()
3724:                                    .equals("itemHyperlink")) {
3725:                        readSectionItemHyperlink(child_child, cd
3726:                                .getItemHyperLink());
3727:                    }
3728:
3729:                }
3730:            }
3731:
3732:            private void readValueDataset(Node xmlNode, ChartReportElement2 re) {
3733:
3734:                NodeList childsOfChild = xmlNode.getChildNodes();
3735:
3736:                ValueDataset cd = new ValueDataset();
3737:                re.getChart().setDataset(cd);
3738:
3739:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3740:                    Node child_child = (Node) childsOfChild.item(c_count);
3741:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3742:                            && child_child.getNodeName().equals("dataset")) {
3743:                        readDataset(child_child, re);
3744:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3745:                            && child_child.getNodeName().equals(
3746:                                    "valueExpression")) {
3747:                        cd.setValueExpression(readPCDATA(child_child));
3748:                    }
3749:
3750:                }
3751:            }
3752:
3753:            private CategorySeries readCategorySeries(Node xmlNode) {
3754:
3755:                NodeList childsOfChild = xmlNode.getChildNodes();
3756:
3757:                CategorySeries cs = new CategorySeries();
3758:
3759:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3760:                    Node child_child = (Node) childsOfChild.item(c_count);
3761:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3762:                            && child_child.getNodeName().equals(
3763:                                    "seriesExpression")) {
3764:                        cs.setSeriesExpression(readPCDATA(child_child));
3765:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3766:                            && child_child.getNodeName().equals(
3767:                                    "categoryExpression")) {
3768:                        cs.setCategoryExpression(readPCDATA(child_child));
3769:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3770:                            && child_child.getNodeName().equals(
3771:                                    "valueExpression")) {
3772:                        cs.setValueExpression(readPCDATA(child_child));
3773:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3774:                            && child_child.getNodeName().equals(
3775:                                    "labelExpression")) {
3776:                        cs.setLabelExpression(readPCDATA(child_child));
3777:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3778:                            && child_child.getNodeName()
3779:                                    .equals("itemHyperlink")) {
3780:                        readSectionItemHyperlink(child_child, cs
3781:                                .getSectionItemHyperlink());
3782:                    }
3783:                }
3784:
3785:                return cs;
3786:            }
3787:
3788:            private TimePeriodSeries readTimePeriodSeries(Node xmlNode) {
3789:
3790:                NodeList childsOfChild = xmlNode.getChildNodes();
3791:
3792:                TimePeriodSeries cs = new TimePeriodSeries();
3793:
3794:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3795:                    Node child_child = (Node) childsOfChild.item(c_count);
3796:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3797:                            && child_child.getNodeName().equals(
3798:                                    "seriesExpression")) {
3799:                        cs.setSeriesExpression(readPCDATA(child_child));
3800:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3801:                            && child_child.getNodeName().equals(
3802:                                    "startDateExpression")) {
3803:                        cs.setStartDateExpression(readPCDATA(child_child));
3804:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3805:                            && child_child.getNodeName().equals(
3806:                                    "endDateExpression")) {
3807:                        cs.setEndDateExpression(readPCDATA(child_child));
3808:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3809:                            && child_child.getNodeName().equals(
3810:                                    "valueExpression")) {
3811:                        cs.setValueExpression(readPCDATA(child_child));
3812:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3813:                            && child_child.getNodeName().equals(
3814:                                    "labelExpression")) {
3815:                        cs.setLabelExpression(readPCDATA(child_child));
3816:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3817:                            && child_child.getNodeName()
3818:                                    .equals("itemHyperlink")) {
3819:                        readSectionItemHyperlink(child_child, cs
3820:                                .getSectionItemHyperlink());
3821:                    }
3822:                }
3823:
3824:                return cs;
3825:            }
3826:
3827:            private TimeSeries readTimeSeries(Node xmlNode) {
3828:
3829:                NodeList childsOfChild = xmlNode.getChildNodes();
3830:
3831:                TimeSeries cs = new TimeSeries();
3832:
3833:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3834:                    Node child_child = (Node) childsOfChild.item(c_count);
3835:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3836:                            && child_child.getNodeName().equals(
3837:                                    "seriesExpression")) {
3838:                        cs.setSeriesExpression(readPCDATA(child_child));
3839:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3840:                            && child_child.getNodeName().equals(
3841:                                    "timePeriodExpression")) {
3842:                        cs.setTimePeriodExpression(readPCDATA(child_child));
3843:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3844:                            && child_child.getNodeName().equals(
3845:                                    "valueExpression")) {
3846:                        cs.setValueExpression(readPCDATA(child_child));
3847:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3848:                            && child_child.getNodeName().equals(
3849:                                    "labelExpression")) {
3850:                        cs.setLabelExpression(readPCDATA(child_child));
3851:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3852:                            && child_child.getNodeName()
3853:                                    .equals("itemHyperlink")) {
3854:                        readSectionItemHyperlink(child_child, cs
3855:                                .getSectionItemHyperlink());
3856:                    }
3857:                }
3858:
3859:                return cs;
3860:            }
3861:
3862:            private XYSeries readXYSeries(Node xmlNode) {
3863:
3864:                NodeList childsOfChild = xmlNode.getChildNodes();
3865:
3866:                XYSeries cs = new XYSeries();
3867:
3868:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3869:                    Node child_child = (Node) childsOfChild.item(c_count);
3870:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3871:                            && child_child.getNodeName().equals(
3872:                                    "seriesExpression")) {
3873:                        cs.setSeriesExpression(readPCDATA(child_child));
3874:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3875:                            && child_child.getNodeName().equals(
3876:                                    "xValueExpression")) {
3877:                        cs.setXValueExpression(readPCDATA(child_child));
3878:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3879:                            && child_child.getNodeName().equals(
3880:                                    "yValueExpression")) {
3881:                        cs.setYValueExpression(readPCDATA(child_child));
3882:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3883:                            && child_child.getNodeName().equals(
3884:                                    "labelExpression")) {
3885:                        cs.setLabelExpression(readPCDATA(child_child));
3886:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3887:                            && child_child.getNodeName()
3888:                                    .equals("itemHyperlink")) {
3889:                        readSectionItemHyperlink(child_child, cs
3890:                                .getSectionItemHyperlink());
3891:                    }
3892:                }
3893:
3894:                return cs;
3895:            }
3896:
3897:            private XYZSeries readXYZSeries(Node xmlNode) {
3898:
3899:                NodeList childsOfChild = xmlNode.getChildNodes();
3900:
3901:                XYZSeries cs = new XYZSeries();
3902:
3903:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3904:                    Node child_child = (Node) childsOfChild.item(c_count);
3905:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3906:                            && child_child.getNodeName().equals(
3907:                                    "seriesExpression")) {
3908:                        cs.setSeriesExpression(readPCDATA(child_child));
3909:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3910:                            && child_child.getNodeName().equals(
3911:                                    "xValueExpression")) {
3912:                        cs.setXValueExpression(readPCDATA(child_child));
3913:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3914:                            && child_child.getNodeName().equals(
3915:                                    "yValueExpression")) {
3916:                        cs.setYValueExpression(readPCDATA(child_child));
3917:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3918:                            && child_child.getNodeName().equals(
3919:                                    "zValueExpression")) {
3920:                        cs.setZValueExpression(readPCDATA(child_child));
3921:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3922:                            && child_child.getNodeName()
3923:                                    .equals("itemHyperlink")) {
3924:                        readSectionItemHyperlink(child_child, cs
3925:                                .getSectionItemHyperlink());
3926:                    }
3927:                }
3928:
3929:                return cs;
3930:            }
3931:
3932:            private void readPiePlot(Node xmlNode, PiePlot plot) {
3933:
3934:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
3935:                plot.setCircular(nodeAttributes.getNamedItem("isCircular")
3936:                        .getNodeValue().equals("true"));
3937:
3938:                readPlot(xmlNode, plot);
3939:            }
3940:
3941:            private void readPie3DPlot(Node xmlNode, Pie3DPlot plot) {
3942:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
3943:
3944:                if (nodeAttributes.getNamedItem("depthFactor") != null)
3945:                    plot.setDepthFactor(Double.parseDouble(nodeAttributes
3946:                            .getNamedItem("depthFactor").getNodeValue()));
3947:
3948:                if (nodeAttributes.getNamedItem("isCircular") != null)
3949:                    plot.setCircular(nodeAttributes.getNamedItem("isCircular")
3950:                            .getNodeValue().equals("true"));
3951:
3952:                readPlot(xmlNode, plot);
3953:            }
3954:
3955:            private void readBarPlot(Node xmlNode, BarPlot plot) {
3956:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
3957:
3958:                readPlot(xmlNode, plot);
3959:
3960:                if (nodeAttributes.getNamedItem("isShowLabels") != null)
3961:                    plot.setShowLabels(nodeAttributes.getNamedItem(
3962:                            "isShowLabels").getNodeValue().equals("true"));
3963:                if (nodeAttributes.getNamedItem("isShowTickMarks") != null)
3964:                    plot.setShowTickMarks(nodeAttributes.getNamedItem(
3965:                            "isShowTickMarks").getNodeValue().equals("true"));
3966:                if (nodeAttributes.getNamedItem("isShowTickLabels") != null)
3967:                    plot.setShowTickLabels(nodeAttributes.getNamedItem(
3968:                            "isShowTickLabels").getNodeValue().equals("true"));
3969:
3970:                NodeList childsOfChild = xmlNode.getChildNodes();
3971:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
3972:                    Node child_child = (Node) childsOfChild.item(c_count);
3973:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
3974:                            && child_child.getNodeName().equals(
3975:                                    "categoryAxisLabelExpression")) {
3976:                        plot
3977:                                .setCategoryAxisLabelExpression(readPCDATA(child_child));
3978:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3979:                            && child_child.getNodeName().equals(
3980:                                    "valueAxisLabelExpression")) {
3981:                        plot
3982:                                .setValueAxisLabelExpression(readPCDATA(child_child));
3983:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3984:                            && child_child.getNodeName().equals(
3985:                                    "categoryAxisFormat")) {
3986:                        plot.setCategoryAxisFormat(readAxisFormat(findChild(
3987:                                child_child, "axisFormat")));
3988:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
3989:                            && child_child.getNodeName().equals(
3990:                                    "valueAxisFormat")) {
3991:                        plot.setValueAxisFormat(readAxisFormat(findChild(
3992:                                child_child, "axisFormat")));
3993:                    }
3994:                }
3995:            }
3996:
3997:            private void readBar3DPlot(Node xmlNode, Bar3DPlot plot) {
3998:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
3999:
4000:                readPlot(xmlNode, plot);
4001:
4002:                if (nodeAttributes.getNamedItem("isShowLabels") != null)
4003:                    plot.setShowLabels(nodeAttributes.getNamedItem(
4004:                            "isShowLabels").getNodeValue().equals("true"));
4005:                if (nodeAttributes.getNamedItem("xOffset") != null)
4006:                    plot.setXOffset(Double.parseDouble(nodeAttributes
4007:                            .getNamedItem("xOffset").getNodeValue()));
4008:                if (nodeAttributes.getNamedItem("yOffset") != null)
4009:                    plot.setYOffset(Double.parseDouble(nodeAttributes
4010:                            .getNamedItem("yOffset").getNodeValue()));
4011:
4012:                NodeList childsOfChild = xmlNode.getChildNodes();
4013:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4014:                    Node child_child = (Node) childsOfChild.item(c_count);
4015:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4016:                            && child_child.getNodeName().equals(
4017:                                    "categoryAxisLabelExpression")) {
4018:                        plot
4019:                                .setCategoryAxisLabelExpression(readPCDATA(child_child));
4020:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4021:                            && child_child.getNodeName().equals(
4022:                                    "valueAxisLabelExpression")) {
4023:                        plot
4024:                                .setValueAxisLabelExpression(readPCDATA(child_child));
4025:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4026:                            && child_child.getNodeName().equals(
4027:                                    "categoryAxisFormat")) {
4028:                        plot.setCategoryAxisFormat(readAxisFormat(findChild(
4029:                                child_child, "axisFormat")));
4030:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4031:                            && child_child.getNodeName().equals(
4032:                                    "valueAxisFormat")) {
4033:                        plot.setValueAxisFormat(readAxisFormat(findChild(
4034:                                child_child, "axisFormat")));
4035:                    }
4036:                }
4037:            }
4038:
4039:            private void readLinePlot(Node xmlNode, LinePlot plot) {
4040:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4041:
4042:                readPlot(xmlNode, plot);
4043:
4044:                if (nodeAttributes.getNamedItem("isShowLines") != null)
4045:                    plot.setShowLines(nodeAttributes
4046:                            .getNamedItem("isShowLines").getNodeValue().equals(
4047:                                    "true"));
4048:                if (nodeAttributes.getNamedItem("isShowShapes") != null)
4049:                    plot.setShowShapes(nodeAttributes.getNamedItem(
4050:                            "isShowShapes").getNodeValue().equals("true"));
4051:
4052:                NodeList childsOfChild = xmlNode.getChildNodes();
4053:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4054:                    Node child_child = (Node) childsOfChild.item(c_count);
4055:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4056:                            && child_child.getNodeName().equals(
4057:                                    "categoryAxisLabelExpression")) {
4058:                        plot
4059:                                .setCategoryAxisLabelExpression(readPCDATA(child_child));
4060:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4061:                            && child_child.getNodeName().equals(
4062:                                    "valueAxisLabelExpression")) {
4063:                        plot
4064:                                .setValueAxisLabelExpression(readPCDATA(child_child));
4065:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4066:                            && child_child.getNodeName().equals(
4067:                                    "categoryAxisFormat")) {
4068:                        plot.setCategoryAxisFormat(readAxisFormat(findChild(
4069:                                child_child, "axisFormat")));
4070:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4071:                            && child_child.getNodeName().equals(
4072:                                    "valueAxisFormat")) {
4073:                        plot.setValueAxisFormat(readAxisFormat(findChild(
4074:                                child_child, "axisFormat")));
4075:                    }
4076:                }
4077:            }
4078:
4079:            private AxisFormat readAxisFormat(Node xmlNode) {
4080:
4081:                AxisFormat axisFormat = new AxisFormat();
4082:
4083:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4084:
4085:                if (nodeAttributes.getNamedItem("labelColor") != null)
4086:                    axisFormat.setLabelColor(decodeColor(""
4087:                            + nodeAttributes.getNamedItem("labelColor")
4088:                                    .getNodeValue()));
4089:
4090:                if (nodeAttributes.getNamedItem("tickLabelColor") != null)
4091:                    axisFormat.setTickLabelColor(decodeColor(""
4092:                            + nodeAttributes.getNamedItem("tickLabelColor")
4093:                                    .getNodeValue()));
4094:
4095:                if (nodeAttributes.getNamedItem("axisLineColor") != null)
4096:                    axisFormat.setAxisLineColor(decodeColor(""
4097:                            + nodeAttributes.getNamedItem("axisLineColor")
4098:                                    .getNodeValue()));
4099:
4100:                if (nodeAttributes.getNamedItem("tickLabelMask") != null)
4101:                    axisFormat.setTickLabelMask(""
4102:                            + nodeAttributes.getNamedItem("tickLabelMask")
4103:                                    .getNodeValue());
4104:
4105:                NodeList childsOfChild = xmlNode.getChildNodes();
4106:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4107:                    Node child_child = (Node) childsOfChild.item(c_count);
4108:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4109:                            && child_child.getNodeName().equals("labelFont")) {
4110:                        Node fontNode = findChild(child_child, "font");
4111:                        if (fontNode != null)
4112:                            axisFormat.setLabelFont(readFontElement(fontNode));
4113:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4114:                            && child_child.getNodeName()
4115:                                    .equals("tickLabelFont")) {
4116:                        Node fontNode = findChild(child_child, "font");
4117:                        if (fontNode != null)
4118:                            axisFormat
4119:                                    .setTickLabelFont(readFontElement(fontNode));
4120:                    }
4121:                }
4122:
4123:                return axisFormat;
4124:            }
4125:
4126:            private void readAreaPlot(Node xmlNode, AreaPlot plot) {
4127:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4128:
4129:                readPlot(xmlNode, plot);
4130:
4131:                NodeList childsOfChild = xmlNode.getChildNodes();
4132:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4133:                    Node child_child = (Node) childsOfChild.item(c_count);
4134:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4135:                            && child_child.getNodeName().equals(
4136:                                    "categoryAxisLabelExpression")) {
4137:                        plot
4138:                                .setCategoryAxisLabelExpression(readPCDATA(child_child));
4139:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4140:                            && child_child.getNodeName().equals(
4141:                                    "valueAxisLabelExpression")) {
4142:                        plot
4143:                                .setValueAxisLabelExpression(readPCDATA(child_child));
4144:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4145:                            && child_child.getNodeName().equals(
4146:                                    "categoryAxisFormat")) {
4147:                        plot.setCategoryAxisFormat(readAxisFormat(findChild(
4148:                                child_child, "axisFormat")));
4149:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4150:                            && child_child.getNodeName().equals(
4151:                                    "valueAxisFormat")) {
4152:                        plot.setValueAxisFormat(readAxisFormat(findChild(
4153:                                child_child, "axisFormat")));
4154:                    }
4155:                }
4156:            }
4157:
4158:            private void readScatterPlot(Node xmlNode, ScatterPlot plot) {
4159:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4160:
4161:                readPlot(xmlNode, plot);
4162:
4163:                if (nodeAttributes.getNamedItem("isShowLines") != null)
4164:                    plot.setShowLines(nodeAttributes
4165:                            .getNamedItem("isShowLines").getNodeValue().equals(
4166:                                    "true"));
4167:                if (nodeAttributes.getNamedItem("isShowShapes") != null)
4168:                    plot.setShowShapes(nodeAttributes.getNamedItem(
4169:                            "isShowShapes").getNodeValue().equals("true"));
4170:
4171:                NodeList childsOfChild = xmlNode.getChildNodes();
4172:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4173:                    Node child_child = (Node) childsOfChild.item(c_count);
4174:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4175:                            && child_child.getNodeName().equals(
4176:                                    "xAxisLabelExpression")) {
4177:                        plot.setXAxisLabelExpression(readPCDATA(child_child));
4178:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4179:                            && child_child.getNodeName().equals(
4180:                                    "yAxisLabelExpression")) {
4181:                        plot.setYAxisLabelExpression(readPCDATA(child_child));
4182:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4183:                            && child_child.getNodeName().equals("xAxisFormat")) {
4184:                        plot.setXAxisFormat(readAxisFormat(findChild(
4185:                                child_child, "axisFormat")));
4186:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4187:                            && child_child.getNodeName().equals("yAxisFormat")) {
4188:                        plot.setYAxisFormat(readAxisFormat(findChild(
4189:                                child_child, "axisFormat")));
4190:                    }
4191:                }
4192:            }
4193:
4194:            private void readBubblePlot(Node xmlNode, BubblePlot plot) {
4195:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4196:
4197:                readPlot(xmlNode, plot);
4198:
4199:                if (nodeAttributes.getNamedItem("scaleType") != null)
4200:                    plot.setScaleType(nodeAttributes.getNamedItem("scaleType")
4201:                            .getNodeValue());
4202:
4203:                NodeList childsOfChild = xmlNode.getChildNodes();
4204:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4205:                    Node child_child = (Node) childsOfChild.item(c_count);
4206:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4207:                            && child_child.getNodeName().equals(
4208:                                    "xAxisLabelExpression")) {
4209:                        plot.setXAxisLabelExpression(readPCDATA(child_child));
4210:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4211:                            && child_child.getNodeName().equals(
4212:                                    "yAxisLabelExpression")) {
4213:                        plot.setYAxisLabelExpression(readPCDATA(child_child));
4214:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4215:                            && child_child.getNodeName().equals("xAxisFormat")) {
4216:                        plot.setXAxisFormat(readAxisFormat(findChild(
4217:                                child_child, "axisFormat")));
4218:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4219:                            && child_child.getNodeName().equals("yAxisFormat")) {
4220:                        plot.setYAxisFormat(readAxisFormat(findChild(
4221:                                child_child, "axisFormat")));
4222:                    }
4223:                }
4224:            }
4225:
4226:            private void readTimeSeriesPlot(Node xmlNode, TimeSeriesPlot plot) {
4227:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4228:
4229:                readPlot(xmlNode, plot);
4230:
4231:                if (nodeAttributes.getNamedItem("isShowLines") != null)
4232:                    plot.setShowLines(nodeAttributes
4233:                            .getNamedItem("isShowLines").getNodeValue().equals(
4234:                                    "true"));
4235:                if (nodeAttributes.getNamedItem("isShowShapes") != null)
4236:                    plot.setShowShapes(nodeAttributes.getNamedItem(
4237:                            "isShowShapes").getNodeValue().equals("true"));
4238:
4239:                NodeList childsOfChild = xmlNode.getChildNodes();
4240:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4241:                    Node child_child = (Node) childsOfChild.item(c_count);
4242:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4243:                            && child_child.getNodeName().equals(
4244:                                    "timeAxisLabelExpression")) {
4245:                        plot
4246:                                .setTimeAxisLabelExpression(readPCDATA(child_child));
4247:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4248:                            && child_child.getNodeName().equals(
4249:                                    "valueAxisLabelExpression")) {
4250:                        plot
4251:                                .setValueAxisLabelExpression(readPCDATA(child_child));
4252:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4253:                            && child_child.getNodeName().equals(
4254:                                    "timeAxisFormat")) {
4255:                        plot.setTimeAxisFormat(readAxisFormat(findChild(
4256:                                child_child, "axisFormat")));
4257:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4258:                            && child_child.getNodeName().equals(
4259:                                    "valueAxisFormat")) {
4260:                        plot.setValueAxisFormat(readAxisFormat(findChild(
4261:                                child_child, "axisFormat")));
4262:                    }
4263:                }
4264:            }
4265:
4266:            private void readHighLowPlot(Node xmlNode, HighLowPlot plot) {
4267:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4268:
4269:                readPlot(xmlNode, plot);
4270:
4271:                if (nodeAttributes.getNamedItem("isShowCloseTicks") != null)
4272:                    plot.setShowCloseTicks(nodeAttributes.getNamedItem(
4273:                            "isShowCloseTicks").getNodeValue().equals("true"));
4274:                if (nodeAttributes.getNamedItem("isShowOpenTicks") != null)
4275:                    plot.setShowOpenTicks(nodeAttributes.getNamedItem(
4276:                            "isShowOpenTicks").getNodeValue().equals("true"));
4277:
4278:                NodeList childsOfChild = xmlNode.getChildNodes();
4279:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4280:                    Node child_child = (Node) childsOfChild.item(c_count);
4281:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4282:                            && child_child.getNodeName().equals(
4283:                                    "timeAxisLabelExpression")) {
4284:                        plot
4285:                                .setTimeAxisLabelExpression(readPCDATA(child_child));
4286:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4287:                            && child_child.getNodeName().equals(
4288:                                    "valueAxisLabelExpression")) {
4289:                        plot
4290:                                .setValueAxisLabelExpression(readPCDATA(child_child));
4291:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4292:                            && child_child.getNodeName().equals(
4293:                                    "timeAxisFormat")) {
4294:                        plot.setTimeAxisFormat(readAxisFormat(findChild(
4295:                                child_child, "axisFormat")));
4296:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4297:                            && child_child.getNodeName().equals(
4298:                                    "valueAxisFormat")) {
4299:                        plot.setValueAxisFormat(readAxisFormat(findChild(
4300:                                child_child, "axisFormat")));
4301:                    }
4302:                }
4303:            }
4304:
4305:            private void readCandlestickPlot(Node xmlNode, CandlestickPlot plot) {
4306:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4307:
4308:                readPlot(xmlNode, plot);
4309:
4310:                if (nodeAttributes.getNamedItem("isShowVolume") != null)
4311:                    plot.setShowVolume(nodeAttributes.getNamedItem(
4312:                            "isShowVolume").getNodeValue().equals("true"));
4313:
4314:                NodeList childsOfChild = xmlNode.getChildNodes();
4315:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4316:                    Node child_child = (Node) childsOfChild.item(c_count);
4317:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4318:                            && child_child.getNodeName().equals(
4319:                                    "timeAxisLabelExpression")) {
4320:                        plot
4321:                                .setTimeAxisLabelExpression(readPCDATA(child_child));
4322:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4323:                            && child_child.getNodeName().equals(
4324:                                    "valueAxisLabelExpression")) {
4325:                        plot
4326:                                .setValueAxisLabelExpression(readPCDATA(child_child));
4327:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4328:                            && child_child.getNodeName().equals(
4329:                                    "timeAxisFormat")) {
4330:                        plot.setTimeAxisFormat(readAxisFormat(findChild(
4331:                                child_child, "axisFormat")));
4332:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4333:                            && child_child.getNodeName().equals(
4334:                                    "valueAxisFormat")) {
4335:                        plot.setValueAxisFormat(readAxisFormat(findChild(
4336:                                child_child, "axisFormat")));
4337:                    }
4338:                }
4339:            }
4340:
4341:            private void readMeterPlot(Node xmlNode, MeterPlot plot) {
4342:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4343:
4344:                readPlot(xmlNode, plot);
4345:
4346:                if (nodeAttributes.getNamedItem("shape") != null)
4347:                    plot.setShape(nodeAttributes.getNamedItem("shape")
4348:                            .getNodeValue());
4349:
4350:                if (nodeAttributes.getNamedItem("angle") != null) {
4351:                    try {
4352:                        plot.setAngle(Integer.parseInt(nodeAttributes
4353:                                .getNamedItem("angle").getNodeValue()
4354:                                + ""));
4355:                    } catch (Exception ex) {
4356:                        it.businesslogic.ireport.gui.MainFrame
4357:                                .getMainInstance()
4358:                                .logOnConsole(
4359:                                        I18n
4360:                                                .getString(
4361:                                                        "reportReader.notValidAngle",
4362:                                                        "Not valid angle value for the MeterPlot tag."));
4363:                    }
4364:                }
4365:                if (nodeAttributes.getNamedItem("units") != null)
4366:                    plot.setUnits(nodeAttributes.getNamedItem("units")
4367:                            .getNodeValue());
4368:
4369:                if (nodeAttributes.getNamedItem("tickInterval") != null) {
4370:                    try {
4371:                        plot.setTickInterval(Double.parseDouble(nodeAttributes
4372:                                .getNamedItem("tickInterval").getNodeValue()
4373:                                + ""));
4374:                    } catch (Exception ex) {
4375:                        it.businesslogic.ireport.gui.MainFrame
4376:                                .getMainInstance()
4377:                                .logOnConsole(
4378:                                        I18n
4379:                                                .getString(
4380:                                                        "reportReader.notValidTickInterval",
4381:                                                        "Not valid tickInterval value for the MeterPlot tag."));
4382:                    }
4383:                }
4384:
4385:                if (nodeAttributes.getNamedItem("meterColor") != null)
4386:                    plot.setMeterColor(decodeColor(""
4387:                            + nodeAttributes.getNamedItem("meterColor")
4388:                                    .getNodeValue()));
4389:
4390:                if (nodeAttributes.getNamedItem("needleColor") != null)
4391:                    plot.setNeedleColor(decodeColor(""
4392:                            + nodeAttributes.getNamedItem("needleColor")
4393:                                    .getNodeValue()));
4394:
4395:                if (nodeAttributes.getNamedItem("tickColor") != null)
4396:                    plot.setTickColor(decodeColor(""
4397:                            + nodeAttributes.getNamedItem("tickColor")
4398:                                    .getNodeValue()));
4399:
4400:                NodeList childsOfChild = xmlNode.getChildNodes();
4401:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4402:                    Node child_child = (Node) childsOfChild.item(c_count);
4403:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4404:                            && child_child.getNodeName().equals("valueDisplay")) {
4405:                        plot.setValueDisplay(readValueDisplay(child_child));
4406:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4407:                            && child_child.getNodeName().equals("dataRange")) {
4408:                        plot.setDataRange(readDataRange(child_child));
4409:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4410:                            && child_child.getNodeName()
4411:                                    .equals("meterInterval")) {
4412:                        plot.getMeterIntervals().add(
4413:                                readMeterInterval(child_child));
4414:                    }
4415:
4416:                }
4417:            }
4418:
4419:            private void readThermometerPlot(Node xmlNode, ThermometerPlot plot) {
4420:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4421:
4422:                readPlot(xmlNode, plot);
4423:
4424:                if (nodeAttributes.getNamedItem("valueLocation") != null)
4425:                    plot.setValueLocation(nodeAttributes.getNamedItem(
4426:                            "valueLocation").getNodeValue());
4427:
4428:                if (nodeAttributes.getNamedItem("isShowValueLines") != null)
4429:                    plot.setShowValueLines(nodeAttributes.getNamedItem(
4430:                            "isShowValueLines").getNodeValue().equals("true"));
4431:
4432:                if (nodeAttributes.getNamedItem("mercuryColor") != null)
4433:                    plot.setMercuryColor(decodeColor(""
4434:                            + nodeAttributes.getNamedItem("mercuryColor")
4435:                                    .getNodeValue()));
4436:
4437:                NodeList childsOfChild = xmlNode.getChildNodes();
4438:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4439:                    Node child_child = (Node) childsOfChild.item(c_count);
4440:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4441:                            && child_child.getNodeName().equals("valueDisplay")) {
4442:                        plot.setValueDisplay(readValueDisplay(child_child));
4443:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4444:                            && child_child.getNodeName().equals("dataRange")) {
4445:                        plot.setDataRange(readDataRange(child_child));
4446:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4447:                            && child_child.getNodeName().equals("lowRange")) {
4448:                        plot.setLowRange(readDataRange(findChild(child_child,
4449:                                "dataRange")));
4450:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4451:                            && child_child.getNodeName().equals("mediumRange")) {
4452:                        plot.setMediumRange(readDataRange(findChild(
4453:                                child_child, "dataRange")));
4454:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4455:                            && child_child.getNodeName().equals("highRange")) {
4456:                        plot.setHighRange(readDataRange(findChild(child_child,
4457:                                "dataRange")));
4458:                    }
4459:
4460:                }
4461:            }
4462:
4463:            private ValueDisplay readValueDisplay(Node xmlNode) {
4464:
4465:                ValueDisplay valueDisplay = new ValueDisplay();
4466:
4467:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4468:
4469:                if (nodeAttributes.getNamedItem("color") != null)
4470:                    valueDisplay.setColor(decodeColor(""
4471:                            + nodeAttributes.getNamedItem("color")
4472:                                    .getNodeValue()));
4473:
4474:                if (nodeAttributes.getNamedItem("mask") != null)
4475:                    valueDisplay.setMask(""
4476:                            + nodeAttributes.getNamedItem("mask")
4477:                                    .getNodeValue());
4478:
4479:                NodeList childsOfChild = xmlNode.getChildNodes();
4480:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4481:                    Node child_child = (Node) childsOfChild.item(c_count);
4482:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4483:                            && child_child.getNodeName().equals("font")) {
4484:                        valueDisplay.setFont(readFontElement(child_child));
4485:                    }
4486:                }
4487:
4488:                return valueDisplay;
4489:            }
4490:
4491:            private DataRange readDataRange(Node xmlNode) {
4492:
4493:                DataRange dataRange = new DataRange();
4494:
4495:                NodeList childsOfChild = xmlNode.getChildNodes();
4496:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4497:                    Node child_child = (Node) childsOfChild.item(c_count);
4498:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4499:                            && child_child.getNodeName()
4500:                                    .equals("lowExpression")) {
4501:                        dataRange.setLowExpression(readPCDATA(child_child));
4502:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4503:                            && child_child.getNodeName().equals(
4504:                                    "highExpression")) {
4505:                        dataRange.setHighExpression(readPCDATA(child_child));
4506:                    }
4507:                }
4508:
4509:                return dataRange;
4510:            }
4511:
4512:            private MeterInterval readMeterInterval(Node xmlNode) {
4513:
4514:                MeterInterval meterInterval = new MeterInterval();
4515:
4516:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4517:
4518:                if (nodeAttributes.getNamedItem("label") != null)
4519:                    meterInterval.setLabel(""
4520:                            + nodeAttributes.getNamedItem("label")
4521:                                    .getNodeValue());
4522:
4523:                if (nodeAttributes.getNamedItem("color") != null)
4524:                    meterInterval.setColor(decodeColor(""
4525:                            + nodeAttributes.getNamedItem("color")
4526:                                    .getNodeValue()));
4527:
4528:                if (nodeAttributes.getNamedItem("alpha") != null) {
4529:                    try {
4530:                        meterInterval.setAlpha(Double
4531:                                .parseDouble(nodeAttributes.getNamedItem(
4532:                                        "alpha").getNodeValue()
4533:                                        + ""));
4534:                    } catch (Exception ex) {
4535:                        it.businesslogic.ireport.gui.MainFrame
4536:                                .getMainInstance()
4537:                                .logOnConsole(
4538:                                        I18n
4539:                                                .getString(
4540:                                                        "reportReader.notValidApha",
4541:                                                        "Not valid alpha value for the MeterPlot -> MeterInterval tag."));
4542:                    }
4543:                }
4544:
4545:                NodeList childsOfChild = xmlNode.getChildNodes();
4546:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4547:                    Node child_child = (Node) childsOfChild.item(c_count);
4548:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4549:                            && child_child.getNodeName().equals("dataRange")) {
4550:                        meterInterval.setDataRange(readDataRange(child_child));
4551:                    }
4552:                }
4553:
4554:                return meterInterval;
4555:            }
4556:
4557:            private void readPlot(Node xmlNodeParent, Plot plot) {
4558:                NodeList childsOfChild = xmlNodeParent.getChildNodes();
4559:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4560:                    Node xmlNode = (Node) childsOfChild.item(c_count);
4561:                    if (xmlNode.getNodeType() == Node.ELEMENT_NODE
4562:                            && xmlNode.getNodeName().equals("plot")) {
4563:
4564:                        NamedNodeMap nodeAttributes = xmlNode.getAttributes();
4565:
4566:                        if (nodeAttributes.getNamedItem("backcolor") != null)
4567:                            plot.setBackcolor(decodeColor(""
4568:                                    + nodeAttributes.getNamedItem("backcolor")
4569:                                            .getNodeValue()));
4570:
4571:                        if (nodeAttributes.getNamedItem("orientation") != null)
4572:                            plot.setOrientation(""
4573:                                    + nodeAttributes
4574:                                            .getNamedItem("orientation")
4575:                                            .getNodeValue());
4576:
4577:                        if (nodeAttributes.getNamedItem("backgroundAlpha") != null)
4578:                            plot.setBackgroundAlpha(Double
4579:                                    .parseDouble(nodeAttributes.getNamedItem(
4580:                                            "backgroundAlpha").getNodeValue()));
4581:
4582:                        if (nodeAttributes.getNamedItem("foregroundAlpha") != null)
4583:                            plot.setForegroundAlpha(Double
4584:                                    .parseDouble(nodeAttributes.getNamedItem(
4585:                                            "foregroundAlpha").getNodeValue()));
4586:
4587:                        if (nodeAttributes.getNamedItem("labelRotation") != null)
4588:                            plot.setLabelRotation(Double
4589:                                    .parseDouble(nodeAttributes.getNamedItem(
4590:                                            "labelRotation").getNodeValue()));
4591:
4592:                        NodeList childsOfChildPlot = xmlNode.getChildNodes();
4593:                        for (int c_plot_count = 0; c_plot_count < childsOfChildPlot
4594:                                .getLength(); c_plot_count++) {
4595:                            Node child_child_plot = (Node) childsOfChildPlot
4596:                                    .item(c_plot_count);
4597:                            if (child_child_plot.getNodeType() == Node.ELEMENT_NODE
4598:                                    && child_child_plot.getNodeName().equals(
4599:                                            "seriesColor")) {
4600:
4601:                                NamedNodeMap nodeAttributes2 = child_child_plot
4602:                                        .getAttributes();
4603:
4604:                                java.awt.Color c = java.awt.Color.red;
4605:                                int seriesOrder = 0;
4606:
4607:                                if (nodeAttributes2.getNamedItem("color") != null)
4608:                                    c = decodeColor(""
4609:                                            + nodeAttributes2.getNamedItem(
4610:                                                    "color").getNodeValue());
4611:
4612:                                if (nodeAttributes2.getNamedItem("seriesOrder") != null) {
4613:                                    try {
4614:                                        seriesOrder = Integer.parseInt(""
4615:                                                + nodeAttributes2.getNamedItem(
4616:                                                        "seriesOrder")
4617:                                                        .getNodeValue());
4618:                                    } catch (Exception ex) {
4619:                                    }
4620:                                }
4621:
4622:                                SeriesColor sc = new SeriesColor();
4623:                                sc.setSeriesOrder(seriesOrder);
4624:                                sc.setColor(c);
4625:
4626:                                plot.getSeriesColors().add(sc);
4627:                            }
4628:                        }
4629:                        // Sort seriescolor....
4630:                        Object[] objs = plot.getSeriesColors().toArray();
4631:                        java.util.Arrays.sort(objs);
4632:                        plot.getSeriesColors().clear();
4633:                        for (int i = 0; i < objs.length; ++i) {
4634:                            plot.getSeriesColors().add(objs[i]);
4635:                        }
4636:                    }
4637:                }
4638:            }
4639:
4640:            private void readChartSubTitleElement(Node xmlElement,
4641:                    ChartReportElement2 re) {
4642:                NamedNodeMap nodeAttributes = xmlElement.getAttributes();
4643:
4644:                if (nodeAttributes.getNamedItem("color") != null)
4645:                    re.getChart().getSubTitle().setColor(
4646:                            decodeColor(""
4647:                                    + nodeAttributes.getNamedItem("color")
4648:                                            .getNodeValue()));
4649:
4650:                NodeList childsOfChild = xmlElement.getChildNodes();
4651:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4652:                    Node child_child = (Node) childsOfChild.item(c_count);
4653:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4654:                            && child_child.getNodeName().equals(
4655:                                    "subtitleExpression")) {
4656:                        re.getChart().getSubTitle().setTitleExpression(
4657:                                readPCDATA(child_child));
4658:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4659:                            && child_child.getNodeName().equals("font")) {
4660:                        re.getChart().getSubTitle().setFont(
4661:                                readFontElement(child_child));
4662:                    }
4663:                }
4664:            }
4665:
4666:            private void readXMLReportElement(Node xmlReportElement,
4667:                    ReportElement re) {
4668:                NamedNodeMap nodeAttributes = xmlReportElement.getAttributes();
4669:
4670:                if (nodeAttributes.getNamedItem("style") != null) {
4671:                    String sname = nodeAttributes.getNamedItem("style")
4672:                            .getNodeValue();
4673:                    for (int j = 0; j < getReport().getStyles().size(); ++j) {
4674:                        Style sparent = (Style) getReport().getStyles()
4675:                                .elementAt(j);
4676:                        if (sparent.getName().equals(sname)) {
4677:                            re.setStyle(sparent);
4678:                            break;
4679:                        }
4680:                    }
4681:                    if (re.getStyle() == null) {
4682:                        UndefinedStyle us = new UndefinedStyle();
4683:                        us.setName(sname);
4684:                        getReport().getStyles().addElement(us);
4685:                        re.setStyle(us);
4686:                    }
4687:                }
4688:                //if ( bandAttributes.getNamedItem("height") != null) b.setHeight( Integer.parseInt(bandAttributes.getNamedItem("height").getNodeValue()) );
4689:                if (nodeAttributes.getNamedItem("x") != null) {
4690:                    re.getPosition().x = Integer.parseInt(""
4691:                            + nodeAttributes.getNamedItem("x").getNodeValue());
4692:                    re.getRelativePosition().x = re.getPosition().x;
4693:                }
4694:                if (nodeAttributes.getNamedItem("y") != null) {
4695:                    re.getPosition().y = Integer.parseInt(""
4696:                            + nodeAttributes.getNamedItem("y").getNodeValue());
4697:                    re.getRelativePosition().y = re.getPosition().y;
4698:                }
4699:                if (nodeAttributes.getNamedItem("width") != null)
4700:                    re.setWidth(Integer.parseInt(""
4701:                            + nodeAttributes.getNamedItem("width")
4702:                                    .getNodeValue()));
4703:                if (nodeAttributes.getNamedItem("height") != null)
4704:                    re.setHeight(Integer.parseInt(""
4705:                            + nodeAttributes.getNamedItem("height")
4706:                                    .getNodeValue()));
4707:                if (nodeAttributes.getNamedItem("key") != null)
4708:                    re
4709:                            .setKey(""
4710:                                    + nodeAttributes.getNamedItem("key")
4711:                                            .getNodeValue());
4712:
4713:                if (nodeAttributes.getNamedItem("stretchType") != null)
4714:                    re.setStretchType(""
4715:                            + nodeAttributes.getNamedItem("stretchType")
4716:                                    .getNodeValue());
4717:
4718:                if (nodeAttributes.getNamedItem("isPrintRepeatedValues") != null)
4719:                    re.setIsPrintRepeatedValues(("" + nodeAttributes
4720:                            .getNamedItem("isPrintRepeatedValues")
4721:                            .getNodeValue()).equalsIgnoreCase("true"));
4722:
4723:                if (nodeAttributes.getNamedItem("positionType") != null)
4724:                    re.setPositionType(""
4725:                            + nodeAttributes.getNamedItem("positionType")
4726:                                    .getNodeValue());
4727:                else
4728:                    re.setPositionType("FixRelativeToTop");
4729:
4730:                if (nodeAttributes.getNamedItem("isPrintRepeatedValues") != null)
4731:                    re.setIsPrintRepeatedValues(("" + nodeAttributes
4732:                            .getNamedItem("isPrintRepeatedValues")
4733:                            .getNodeValue()).equalsIgnoreCase("true"));
4734:
4735:                if (nodeAttributes.getNamedItem("isRemoveLineWhenBlank") != null) {
4736:                    re.setIsRemoveLineWhenBlank(("" + nodeAttributes
4737:                            .getNamedItem("isRemoveLineWhenBlank")
4738:                            .getNodeValue()).equalsIgnoreCase("true"));
4739:                }
4740:
4741:                if (nodeAttributes.getNamedItem("isPrintInFirstWholeBand") != null)
4742:                    re.setIsPrintInFirstWholeBand(("" + nodeAttributes
4743:                            .getNamedItem("isPrintInFirstWholeBand")
4744:                            .getNodeValue()).equalsIgnoreCase("true"));
4745:
4746:                if (nodeAttributes.getNamedItem("isPrintWhenDetailOverflows") != null)
4747:                    re.setIsPrintWhenDetailOverflows(("" + nodeAttributes
4748:                            .getNamedItem("isPrintWhenDetailOverflows")
4749:                            .getNodeValue()).equalsIgnoreCase("true"));
4750:
4751:                if (nodeAttributes.getNamedItem("printWhenGroupChanges") != null)
4752:                    re.setPrintWhenGroupChanges(""
4753:                            + nodeAttributes.getNamedItem(
4754:                                    "printWhenGroupChanges").getNodeValue());
4755:
4756:                if (nodeAttributes.getNamedItem("forecolor") != null) {
4757:                    String color = ""
4758:                            + nodeAttributes.getNamedItem("forecolor")
4759:                                    .getNodeValue();
4760:                    re.setFgcolor(decodeColor(color));
4761:                }
4762:                if (nodeAttributes.getNamedItem("backcolor") != null) {
4763:                    String color = ""
4764:                            + nodeAttributes.getNamedItem("backcolor")
4765:                                    .getNodeValue();
4766:                    re.setBgcolor(decodeColor(color));
4767:
4768:                }
4769:                if (nodeAttributes.getNamedItem("mode") != null) {
4770:                    re.setTransparent(""
4771:                            + nodeAttributes.getNamedItem("mode")
4772:                                    .getNodeValue());
4773:                }
4774:
4775:                NodeList childsOfChild = xmlReportElement.getChildNodes();
4776:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
4777:                    Node child_child = (Node) childsOfChild.item(c_count);
4778:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
4779:                            && child_child.getNodeName().equals(
4780:                                    "printWhenExpression")) {
4781:                        re.setPrintWhenExpression(readPCDATA(child_child));
4782:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
4783:                            && child_child.getNodeName().equals("property")) {
4784:                        // Add element property...
4785:                        it.businesslogic.ireport.JRProperty property = readPropertyElement(child_child);
4786:                        if (property.getName() != null
4787:                                && property.getName().length() != 0) {
4788:                            re.getElementProperties().add(property);
4789:                        }
4790:                    }
4791:                }
4792:            }
4793:
4794:            private float getLineWidthByBorder(String s) {
4795:                if (s == null)
4796:                    return 0f;
4797:                if (s.equals("None"))
4798:                    return 0f;
4799:                if (s.equals("Thin"))
4800:                    return 0.25f;
4801:                if (s.equals("1Point"))
4802:                    return 1f;
4803:                if (s.equals("2Point"))
4804:                    return 2f;
4805:                if (s.equals("4Point"))
4806:                    return 4f;
4807:                if (s.equals("Dotted"))
4808:                    return 1f;
4809:                return 0f;
4810:            }
4811:
4812:            private String getLineStyleByBorder(String s) {
4813:                if (s != null && s.equals("Dotted"))
4814:                    return "Dotted";
4815:                return "Solid";
4816:            }
4817:
4818:            private void readBoxElement(Node xmlReportElement, BoxElement re) {
4819:                NamedNodeMap nodeAttributes = xmlReportElement.getAttributes();
4820:
4821:                Box box = new Box();
4822:                // ------- defaults --------
4823:                if (nodeAttributes.getNamedItem("border") != null) {
4824:                    box.setBorder(""
4825:                            + nodeAttributes.getNamedItem("border")
4826:                                    .getNodeValue());
4827:                    //box.setLeftBorder(""+nodeAttributes.getNamedItem("border").getNodeValue() );
4828:                    //box.setRightBorder(""+nodeAttributes.getNamedItem("border").getNodeValue() );
4829:                    //box.setTopBorder(""+nodeAttributes.getNamedItem("border").getNodeValue() );
4830:                    //box.setBottomBorder(""+nodeAttributes.getNamedItem("border").getNodeValue() );
4831:                    if (box.getPen() == null)
4832:                        box.setPen(new Pen());
4833:                    box.getPen().setLineWidth(
4834:                            getLineWidthByBorder(box.getBorder()));
4835:                    box.getPen().setLineStyle(
4836:                            getLineStyleByBorder(box.getBorder()));
4837:                    deprecationWarning = true;
4838:                }
4839:
4840:                if (nodeAttributes.getNamedItem("padding") != null) {
4841:                    box.setPadding(Integer.parseInt(""
4842:                            + nodeAttributes.getNamedItem("padding")
4843:                                    .getNodeValue()));
4844:                    box.setLeftPadding(Integer.parseInt(""
4845:                            + nodeAttributes.getNamedItem("padding")
4846:                                    .getNodeValue()));
4847:                    box.setRightPadding(Integer.parseInt(""
4848:                            + nodeAttributes.getNamedItem("padding")
4849:                                    .getNodeValue()));
4850:                    box.setTopPadding(Integer.parseInt(""
4851:                            + nodeAttributes.getNamedItem("padding")
4852:                                    .getNodeValue()));
4853:                    box.setBottomPadding(Integer.parseInt(""
4854:                            + nodeAttributes.getNamedItem("padding")
4855:                                    .getNodeValue()));
4856:                }
4857:
4858:                if (nodeAttributes.getNamedItem("borderColor") != null) {
4859:                    String color = ""
4860:                            + nodeAttributes.getNamedItem("borderColor")
4861:                                    .getNodeValue();
4862:                    java.awt.Color colorObj = decodeColor(color);
4863:
4864:                    box.setBorderColor(new java.awt.Color(colorObj.getRGB()));
4865:                    //box.setLeftBorderColor(new java.awt.Color(colorObj.getRGB()));
4866:                    //box.setRightBorderColor(new java.awt.Color(colorObj.getRGB()));
4867:                    //box.setTopBorderColor(new java.awt.Color(colorObj.getRGB()));
4868:                    //box.setBottomBorderColor(new java.awt.Color(colorObj.getRGB()));
4869:                    deprecationWarning = true;
4870:                    if (box.getPen() == null)
4871:                        box.setPen(new Pen());
4872:                    box.getPen().setLineColor(box.getBorderColor());
4873:                }
4874:                // ------- top --------
4875:                if (nodeAttributes.getNamedItem("topBorder") != null) {
4876:                    box.setTopBorder(""
4877:                            + nodeAttributes.getNamedItem("topBorder")
4878:                                    .getNodeValue());
4879:                    deprecationWarning = true;
4880:                    if (box.getTopPen() == null)
4881:                        box.setTopPen(new Pen());
4882:                    box.getTopPen().setLineWidth(
4883:                            getLineWidthByBorder(box.getTopBorder()));
4884:                    box.getTopPen().setLineStyle(
4885:                            getLineStyleByBorder(box.getTopBorder()));
4886:                }
4887:
4888:                if (nodeAttributes.getNamedItem("topPadding") != null) {
4889:                    box.setTopPadding(Integer.parseInt(""
4890:                            + nodeAttributes.getNamedItem("topPadding")
4891:                                    .getNodeValue()));
4892:                }
4893:
4894:                if (nodeAttributes.getNamedItem("topBorderColor") != null) {
4895:                    String color = ""
4896:                            + nodeAttributes.getNamedItem("topBorderColor")
4897:                                    .getNodeValue();
4898:                    deprecationWarning = true;
4899:                    box.setTopBorderColor(decodeColor(color));
4900:                    if (box.getTopPen() == null)
4901:                        box.setTopPen(new Pen());
4902:                    box.getTopPen().setLineColor(box.getTopBorderColor());
4903:                }
4904:
4905:                // ------- left --------
4906:                if (nodeAttributes.getNamedItem("leftBorder") != null) {
4907:                    box.setLeftBorder(""
4908:                            + nodeAttributes.getNamedItem("leftBorder")
4909:                                    .getNodeValue());
4910:                    deprecationWarning = true;
4911:                    if (box.getLeftPen() == null)
4912:                        box.setLeftPen(new Pen());
4913:                    box.getLeftPen().setLineWidth(
4914:                            getLineWidthByBorder(box.getLeftBorder()));
4915:                    box.getLeftPen().setLineStyle(
4916:                            getLineStyleByBorder(box.getLeftBorder()));
4917:                }
4918:
4919:                if (nodeAttributes.getNamedItem("leftPadding") != null) {
4920:                    box.setLeftPadding(Integer.parseInt(""
4921:                            + nodeAttributes.getNamedItem("leftPadding")
4922:                                    .getNodeValue()));
4923:                }
4924:
4925:                if (nodeAttributes.getNamedItem("leftBorderColor") != null) {
4926:                    String color = ""
4927:                            + nodeAttributes.getNamedItem("leftBorderColor")
4928:                                    .getNodeValue();
4929:                    deprecationWarning = true;
4930:                    box.setLeftBorderColor(decodeColor(color));
4931:                    if (box.getLeftPen() == null)
4932:                        box.setLeftPen(new Pen());
4933:                    box.getLeftPen().setLineColor(box.getLeftBorderColor());
4934:                }
4935:
4936:                // ------- right --------
4937:                if (nodeAttributes.getNamedItem("rightBorder") != null) {
4938:                    box.setRightBorder(""
4939:                            + nodeAttributes.getNamedItem("rightBorder")
4940:                                    .getNodeValue());
4941:                    deprecationWarning = true;
4942:                    if (box.getRightPen() == null)
4943:                        box.setRightPen(new Pen());
4944:                    box.getRightPen().setLineWidth(
4945:                            getLineWidthByBorder(box.getRightBorder()));
4946:                    box.getRightPen().setLineStyle(
4947:                            getLineStyleByBorder(box.getRightBorder()));
4948:                }
4949:
4950:                if (nodeAttributes.getNamedItem("rightPadding") != null) {
4951:                    box.setRightPadding(Integer.parseInt(""
4952:                            + nodeAttributes.getNamedItem("rightPadding")
4953:                                    .getNodeValue()));
4954:                }
4955:
4956:                if (nodeAttributes.getNamedItem("rightBorderColor") != null) {
4957:                    String color = ""
4958:                            + nodeAttributes.getNamedItem("rightBorderColor")
4959:                                    .getNodeValue();
4960:                    deprecationWarning = true;
4961:                    box.setRightBorderColor(decodeColor(color));
4962:                    if (box.getRightPen() == null)
4963:                        box.setRightPen(new Pen());
4964:                    box.getRightPen().setLineColor(box.getRightBorderColor());
4965:                }
4966:
4967:                // ------- bottom --------
4968:                if (nodeAttributes.getNamedItem("bottomBorder") != null) {
4969:                    box.setBottomBorder(""
4970:                            + nodeAttributes.getNamedItem("bottomBorder")
4971:                                    .getNodeValue());
4972:                    deprecationWarning = true;
4973:                    if (box.getRightPen() == null)
4974:                        box.setRightPen(new Pen());
4975:                    box.getRightPen().setLineWidth(
4976:                            getLineWidthByBorder(box.getRightBorder()));
4977:                    box.getRightPen().setLineStyle(
4978:                            getLineStyleByBorder(box.getRightBorder()));
4979:                }
4980:
4981:                if (nodeAttributes.getNamedItem("bottomPadding") != null) {
4982:                    box.setBottomPadding(Integer.parseInt(""
4983:                            + nodeAttributes.getNamedItem("bottomPadding")
4984:                                    .getNodeValue()));
4985:                }
4986:
4987:                if (nodeAttributes.getNamedItem("bottomBorderColor") != null) {
4988:                    String color = ""
4989:                            + nodeAttributes.getNamedItem("bottomBorderColor")
4990:                                    .getNodeValue();
4991:                    deprecationWarning = true;
4992:                    box.setBottomBorderColor(decodeColor(color));
4993:                    if (box.getBottomPen() == null)
4994:                        box.setBottomPen(new Pen());
4995:                    box.getBottomPen().setLineColor(box.getBottomBorderColor());
4996:                }
4997:
4998:                // reading the new pen tags...
4999:                NodeList children = xmlReportElement.getChildNodes();
5000:                for (int c_count = 0; c_count < children.getLength(); c_count++) {
5001:                    Node child_child = (Node) children.item(c_count);
5002:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
5003:                            && child_child.getNodeName().equals("pen")) {
5004:                        box.setPen(readPen(child_child, 0f));
5005:                        box.setTopPen(box.getPen().cloneMe());
5006:                        box.setBottomPen(box.getPen().cloneMe());
5007:                        box.setLeftPen(box.getPen().cloneMe());
5008:                        box.setRightPen(box.getPen().cloneMe());
5009:                    }
5010:                }
5011:
5012:                for (int c_count = 0; c_count < children.getLength(); c_count++) {
5013:                    Node child_child = (Node) children.item(c_count);
5014:
5015:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
5016:                            && child_child.getNodeName().equals("topPen")) {
5017:                        box
5018:                                .setTopPen(readPen(child_child, 0f, box
5019:                                        .getTopPen()));
5020:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5021:                            && child_child.getNodeName().equals("bottomPen")) {
5022:                        box.setBottomPen(readPen(child_child, 0f, box
5023:                                .getBottomPen()));
5024:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5025:                            && child_child.getNodeName().equals("leftPen")) {
5026:                        box.setLeftPen(readPen(child_child, 0f, box
5027:                                .getLeftPen()));
5028:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5029:                            && child_child.getNodeName().equals("rightPen")) {
5030:                        box.setRightPen(readPen(child_child, 0f, box
5031:                                .getRightPen()));
5032:                    }
5033:                }
5034:
5035:                // changing box structure...
5036:
5037:                if (re instanceof  BoxElement)
5038:                    ((BoxElement) re).setBox(box);
5039:
5040:            }
5041:
5042:            static java.awt.Color decodeColor(String colorString) {
5043:                java.awt.Color color = null;
5044:                char firstChar = colorString.charAt(0);
5045:                if (firstChar == '#') {
5046:                    color = new java.awt.Color(Integer.parseInt(colorString
5047:                            .substring(1), 16));
5048:                } else if ('0' <= firstChar && firstChar <= '9') {
5049:                    color = new java.awt.Color(Integer.parseInt(colorString));
5050:                } else {
5051:                    if (net.sf.jasperreports.engine.xml.JRXmlConstants
5052:                            .getColorMap().containsKey(colorString)) {
5053:                        color = (java.awt.Color) net.sf.jasperreports.engine.xml.JRXmlConstants
5054:                                .getColorMap().get(colorString);
5055:                    } else {
5056:                        color = java.awt.Color.black;
5057:                    }
5058:                }
5059:                return color;
5060:
5061:            }
5062:
5063:            static public String readPCDATA(Node textNode) {
5064:                return readPCDATA(textNode, true);
5065:            }
5066:
5067:            static public String readPCDATA(Node textNode, boolean trim) {
5068:                NodeList list_child = textNode.getChildNodes();
5069:                for (int ck = 0; ck < list_child.getLength(); ck++) {
5070:                    Node child_child = (Node) list_child.item(ck);
5071:
5072:                    // --- start solution: if there is another node this should be the PCDATA-node
5073:                    Node ns = child_child.getNextSibling();
5074:                    if (ns != null)
5075:                        child_child = ns;
5076:                    // --- end solution
5077:
5078:                    final short nt = child_child.getNodeType();
5079:                    if ((nt == Node.CDATA_SECTION_NODE)
5080:                            || (nt == Node.TEXT_NODE)) {
5081:                        if (trim)
5082:                            return ((String) child_child.getNodeValue()).trim();
5083:                        return (String) child_child.getNodeValue();
5084:                    }
5085:                }
5086:                return "";
5087:            }
5088:
5089:            private void readXMLTextElement(Node xmlReportElement,
5090:                    TextReportElement re) {
5091:                NamedNodeMap nodeAttributes = xmlReportElement.getAttributes();
5092:                if (nodeAttributes.getNamedItem("textAlignment") != null)
5093:                    re.setAlign(""
5094:                            + nodeAttributes.getNamedItem("textAlignment")
5095:                                    .getNodeValue());
5096:
5097:                if (nodeAttributes.getNamedItem("verticalAlignment") != null)
5098:                    re.setVerticalAlign(""
5099:                            + nodeAttributes.getNamedItem("verticalAlignment")
5100:                                    .getNodeValue());
5101:
5102:                if (nodeAttributes.getNamedItem("lineSpacing") != null)
5103:                    re.setLineSpacing(""
5104:                            + nodeAttributes.getNamedItem("lineSpacing")
5105:                                    .getNodeValue());
5106:
5107:                if (nodeAttributes.getNamedItem("rotation") != null)
5108:                    re.setRotate(""
5109:                            + nodeAttributes.getNamedItem("rotation")
5110:                                    .getNodeValue());
5111:
5112:                if (nodeAttributes.getNamedItem("isStyledText") != null)
5113:                    re.setIsStyledText(("" + nodeAttributes.getNamedItem(
5114:                            "isStyledText").getNodeValue()).equals("true"));
5115:
5116:                if (nodeAttributes.getNamedItem("markup") != null)
5117:                    re.setMarkup(""
5118:                            + nodeAttributes.getNamedItem("markup")
5119:                                    .getNodeValue());
5120:
5121:                // Check for Font sub_element...
5122:                NodeList childsOfChild = xmlReportElement.getChildNodes();
5123:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
5124:                    Node child_child = (Node) childsOfChild.item(c_count);
5125:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
5126:                            && child_child.getNodeName().equals("font")) {
5127:                        NamedNodeMap subNodeAttributes = child_child
5128:                                .getAttributes();
5129:                        if (subNodeAttributes.getNamedItem("reportFont") != null) {
5130:
5131:                            IReportFont baseFont = null;
5132:                            re.setReportFont(subNodeAttributes.getNamedItem(
5133:                                    "reportFont").getNodeValue());
5134:                            for (int fn = 0; fn < getReport().getFonts().size(); ++fn) {
5135:                                baseFont = (IReportFont) getReport().getFonts()
5136:                                        .elementAt(fn);
5137:                                if (baseFont != null
5138:                                        && baseFont.getReportFont().equals(
5139:                                                re.getReportFont())) {
5140:                                    break;
5141:                                } else
5142:                                    baseFont = null;
5143:                            }
5144:                            if (baseFont != null) {
5145:                                //re.setFontSize(baseFont.getFontSize());
5146:                                //re.setFontName(baseFont.getFontName());
5147:                                //re.setPDFFontName( baseFont.getPDFFontName());
5148:                                //re.setPdfEncoding( baseFont.getPdfEncoding());
5149:                                //re.setPdfEmbedded( baseFont.isPdfEmbedded());
5150:                                //re.setBold(baseFont.isBold()) ;
5151:                                //re.setItalic( baseFont.isItalic());
5152:                                //re.setStrikeTrought(baseFont.isStrikeTrought());
5153:                                //re.setUnderline(baseFont.isUnderline());
5154:                            } else {
5155:
5156:                                //using default font
5157:                                //re.setFontSize(defaultFont.getFontSize());
5158:                                //re.setFontName(defaultFont.getFontName());
5159:                                //re.setPDFFontName( defaultFont.getPDFFontName());
5160:                                //re.setPdfEncoding( defaultFont.getPdfEncoding());
5161:                                //re.setPdfEmbedded( defaultFont.isPdfEmbedded());
5162:                                //re.setBold(defaultFont.isBold()) ;
5163:                                //re.setItalic(defaultFont.isItalic());
5164:                                //re.setStrikeTrought(defaultFont.isStrikeTrought());
5165:                                //re.setUnderline(defaultFont.isUnderline());
5166:                            }
5167:
5168:                        }
5169:
5170:                        //System.out.println("Working on: " + xmlReportElement);
5171:                        for (int kkk = 0; kkk < subNodeAttributes.getLength(); ++kkk) {
5172:                            //System.out.println( + " " + );
5173:
5174:                            String propName = subNodeAttributes.item(kkk)
5175:                                    .getNodeName();
5176:                            String propValue = subNodeAttributes.item(kkk)
5177:                                    .getNodeValue();
5178:                            if (propName != null && propValue != null) {
5179:                                if (propName.equals("fontName"))
5180:                                    re.setFontName(propValue);
5181:                                else if (propName.equals("pdfFontName"))
5182:                                    re.setPDFFontName(propValue);
5183:                                else if (propName.equals("size"))
5184:                                    re.setFontSize(Integer.parseInt(""
5185:                                            + propValue));
5186:                                else if (propName.equals("isBold"))
5187:                                    re.setBold((new String("" + propValue))
5188:                                            .equalsIgnoreCase("true"));
5189:                                else if (propName.equals("isItalic"))
5190:                                    re.setItalic((new String("" + propValue))
5191:                                            .equalsIgnoreCase("true"));
5192:                                else if (propName.equals("isUnderline"))
5193:                                    re
5194:                                            .setUnderline((new String(""
5195:                                                    + propValue))
5196:                                                    .equalsIgnoreCase("true"));
5197:                                else if (propName.equals("isStrikeThrough"))
5198:                                    re.setStrikeTrought((new String(""
5199:                                            + propValue))
5200:                                            .equalsIgnoreCase("true"));
5201:                                else if (propName.equals("isPdfEmbedded"))
5202:                                    re.setPdfEmbedded((new String(""
5203:                                            + propValue))
5204:                                            .equalsIgnoreCase("true"));
5205:                                else if (propName.equals("pdfEncoding"))
5206:                                    re.setPdfEncoding("" + propValue);
5207:                            }
5208:                        }
5209:                        re.setFont(null);
5210:                    }
5211:                }
5212:            }
5213:
5214:            private Node findNextNode(Node node) {
5215:                int type = node.getNodeType();
5216:                if (type == Node.ELEMENT_NODE) {
5217:                    return node;
5218:                }
5219:                NodeList children = node.getChildNodes();
5220:                if (children != null) {
5221:                    for (int i = 0; i < children.getLength(); i++) {
5222:                        return findNextNode(children.item(i));
5223:                    }
5224:                }
5225:                return null;
5226:            }
5227:
5228:            /**
5229:             * Find a node named childName inside parent
5230:             *
5231:             */
5232:            private Node findChild(Node parent, String childName) {
5233:
5234:                if (parent == null)
5235:                    return null;
5236:
5237:                NodeList children = parent.getChildNodes();
5238:
5239:                if (children != null) {
5240:                    for (int i = 0; i < children.getLength(); i++) {
5241:
5242:                        Node node = (Node) children.item(i);
5243:                        if (node.getNodeType() == Node.ELEMENT_NODE
5244:                                && node.getNodeName().equals(childName)) {
5245:                            return node;
5246:                        }
5247:                    }
5248:                    Node foundNode = null;
5249:                    for (int i = 0; foundNode == null
5250:                            && i < children.getLength(); i++) {
5251:
5252:                        Node node = (Node) children.item(i);
5253:                        if (node.getNodeType() == Node.ELEMENT_NODE) {
5254:                            foundNode = findChild(node, childName);
5255:                        }
5256:                    }
5257:                    return foundNode;
5258:                }
5259:                return null;
5260:            }
5261:
5262:            private void readChartReportElement(Node child,
5263:                    ChartReportElement2 re) {
5264:
5265:                if (child.getNodeName().equals("pieChart")) {
5266:                    re.setChart(new it.businesslogic.ireport.chart.PieChart());
5267:                } else if (child.getNodeName().equals("pie3DChart")) {
5268:                    re
5269:                            .setChart(new it.businesslogic.ireport.chart.Pie3DChart());
5270:                } else if (child.getNodeName().equals("barChart")) {
5271:                    re.setChart(new it.businesslogic.ireport.chart.BarChart());
5272:                } else if (child.getNodeName().equals("bar3DChart")) {
5273:                    re
5274:                            .setChart(new it.businesslogic.ireport.chart.Bar3DChart());
5275:                } else if (child.getNodeName().equals("xyBarChart")) {
5276:                    re
5277:                            .setChart(new it.businesslogic.ireport.chart.XYBarChart());
5278:                } else if (child.getNodeName().equals("stackedBarChart")) {
5279:                    re
5280:                            .setChart(new it.businesslogic.ireport.chart.StackedBarChart());
5281:                } else if (child.getNodeName().equals("stackedBar3DChart")) {
5282:                    re
5283:                            .setChart(new it.businesslogic.ireport.chart.StackedBar3DChart());
5284:                } else if (child.getNodeName().equals("lineChart")) {
5285:                    re.setChart(new it.businesslogic.ireport.chart.LineChart());
5286:                } else if (child.getNodeName().equals("xyLineChart")) {
5287:                    re
5288:                            .setChart(new it.businesslogic.ireport.chart.XYLineChart());
5289:                } else if (child.getNodeName().equals("areaChart")) {
5290:                    re.setChart(new it.businesslogic.ireport.chart.AreaChart());
5291:                } else if (child.getNodeName().equals("stackedAreaChart")) {
5292:                    re
5293:                            .setChart(new it.businesslogic.ireport.chart.StackedAreaChart());
5294:                } else if (child.getNodeName().equals("xyAreaChart")) {
5295:                    re
5296:                            .setChart(new it.businesslogic.ireport.chart.XYAreaChart());
5297:                } else if (child.getNodeName().equals("scatterChart")) {
5298:                    re
5299:                            .setChart(new it.businesslogic.ireport.chart.ScatterChart());
5300:                } else if (child.getNodeName().equals("bubbleChart")) {
5301:                    re
5302:                            .setChart(new it.businesslogic.ireport.chart.BubbleChart());
5303:                } else if (child.getNodeName().equals("timeSeriesChart")) {
5304:                    re
5305:                            .setChart(new it.businesslogic.ireport.chart.TimeSeriesChart());
5306:                } else if (child.getNodeName().equals("highLowChart")) {
5307:                    re
5308:                            .setChart(new it.businesslogic.ireport.chart.HighLowChart());
5309:                } else if (child.getNodeName().equals("candlestickChart")) {
5310:                    re
5311:                            .setChart(new it.businesslogic.ireport.chart.CandlestickChart());
5312:                } else if (child.getNodeName().equals("meterChart")) {
5313:                    re
5314:                            .setChart(new it.businesslogic.ireport.chart.MeterChart());
5315:                } else if (child.getNodeName().equals("thermometerChart")) {
5316:                    re
5317:                            .setChart(new it.businesslogic.ireport.chart.ThermometerChart());
5318:                } else if (child.getNodeName().equals("multiAxisChart")) {
5319:                    re
5320:                            .setChart(new it.businesslogic.ireport.chart.MultiAxisChart());
5321:                }
5322:
5323:                // Element properties...
5324:                NodeList childsOfChild = child.getChildNodes();
5325:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
5326:                    Node child_child = (Node) childsOfChild.item(c_count);
5327:                    NamedNodeMap subNodeAttributes = child_child
5328:                            .getAttributes();
5329:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
5330:                            && child_child.getNodeName().equals("chart")) {
5331:                        readChartElement(child_child, re);
5332:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5333:                            && child_child.getNodeName().equals("pieDataset")) {
5334:                        readPieDataset(child_child, re);
5335:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5336:                            && child_child.getNodeName().equals(
5337:                                    "categoryDataset")) {
5338:                        readCategoryDataset(child_child, re);
5339:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5340:                            && child_child.getNodeName().equals(
5341:                                    "timePeriodDataset")) {
5342:                        readTimePeriodDataset(child_child, re);
5343:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5344:                            && child_child.getNodeName().equals(
5345:                                    "timeSeriesDataset")) {
5346:                        readTimeSeriesDataset(child_child, re);
5347:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5348:                            && child_child.getNodeName().equals("xyDataset")) {
5349:                        readXYDataset(child_child, re);
5350:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5351:                            && child_child.getNodeName().equals("xyzDataset")) {
5352:                        readXYZDataset(child_child, re);
5353:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5354:                            && child_child.getNodeName().equals(
5355:                                    "highLowDataset")) {
5356:                        readHighLowDataset(child_child, re);
5357:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5358:                            && child_child.getNodeName().equals("valueDataset")) {
5359:                        readValueDataset(child_child, re);
5360:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5361:                            && child_child.getNodeName().equals("piePlot")) {
5362:                        readPiePlot(child_child, (PiePlot) re.getChart()
5363:                                .getPlot());
5364:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5365:                            && child_child.getNodeName().equals("pie3DPlot")) {
5366:                        readPie3DPlot(child_child, (Pie3DPlot) re.getChart()
5367:                                .getPlot());
5368:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5369:                            && child_child.getNodeName().equals("barPlot")) {
5370:                        readBarPlot(child_child, (BarPlot) re.getChart()
5371:                                .getPlot());
5372:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5373:                            && child_child.getNodeName().equals("bar3DPlot")) {
5374:                        readBar3DPlot(child_child, (Bar3DPlot) re.getChart()
5375:                                .getPlot());
5376:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5377:                            && child_child.getNodeName().equals("linePlot")) {
5378:                        readLinePlot(child_child, (LinePlot) re.getChart()
5379:                                .getPlot());
5380:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5381:                            && child_child.getNodeName().equals("areaPlot")) {
5382:                        readAreaPlot(child_child, (AreaPlot) re.getChart()
5383:                                .getPlot());
5384:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5385:                            && child_child.getNodeName().equals("scatterPlot")) {
5386:                        readScatterPlot(child_child, (ScatterPlot) re
5387:                                .getChart().getPlot());
5388:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5389:                            && child_child.getNodeName().equals("bubblePlot")) {
5390:                        readBubblePlot(child_child, (BubblePlot) re.getChart()
5391:                                .getPlot());
5392:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5393:                            && child_child.getNodeName().equals(
5394:                                    "timeSeriesPlot")) {
5395:                        readTimeSeriesPlot(child_child, (TimeSeriesPlot) re
5396:                                .getChart().getPlot());
5397:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5398:                            && child_child.getNodeName().equals("highLowPlot")) {
5399:                        readHighLowPlot(child_child, (HighLowPlot) re
5400:                                .getChart().getPlot());
5401:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5402:                            && child_child.getNodeName().equals(
5403:                                    "candlestickPlot")) {
5404:                        readCandlestickPlot(child_child, (CandlestickPlot) re
5405:                                .getChart().getPlot());
5406:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5407:                            && child_child.getNodeName().equals("meterPlot")) {
5408:                        readMeterPlot(child_child, (MeterPlot) re.getChart()
5409:                                .getPlot());
5410:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5411:                            && child_child.getNodeName().equals(
5412:                                    "thermometerPlot")) {
5413:                        readThermometerPlot(child_child, (ThermometerPlot) re
5414:                                .getChart().getPlot());
5415:                    } else if (child_child.getNodeType() == Node.ELEMENT_NODE
5416:                            && child_child.getNodeName()
5417:                                    .equals("multiAxisPlot")) {
5418:                        readMultiAxisPlot(child_child, (MultiAxisPlot) re
5419:                                .getChart().getPlot());
5420:                    }
5421:                }
5422:            }
5423:
5424:            private void readMultiAxisPlot(Node xmlNode, MultiAxisPlot plot) {
5425:
5426:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
5427:
5428:                readPlot(xmlNode, plot);
5429:
5430:                NodeList childsOfChild = xmlNode.getChildNodes();
5431:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
5432:                    Node child_child = (Node) childsOfChild.item(c_count);
5433:                    if (child_child.getNodeType() == Node.ELEMENT_NODE
5434:                            && child_child.getNodeName().equals("axis")) {
5435:                        plot.getAxis().add(readAxis(child_child));
5436:                    }
5437:                }
5438:            }
5439:
5440:            private Axis readAxis(Node xmlNode) {
5441:
5442:                Axis axis = new Axis();
5443:
5444:                NamedNodeMap nodeAttributes = xmlNode.getAttributes();
5445:
5446:                if (nodeAttributes.getNamedItem("position") != null)
5447:                    axis.setPosition(""
5448:                            + nodeAttributes.getNamedItem("position")
5449:                                    .getNodeValue());
5450:
5451:                NodeList childsOfChild = xmlNode.getChildNodes();
5452:                for (int c_count = 0; c_count < childsOfChild.getLength(); c_count++) {
5453:                    Node child = (Node) childsOfChild.item(c_count);
5454:                    if (child.getNodeType() == Node.ELEMENT_NODE
5455:                            && child.getNodeName().equals("pieChart")
5456:                            || child.getNodeType() == Node.ELEMENT_NODE
5457:                            && child.getNodeName().equals("pie3DChart")
5458:                            || child.getNodeType() == Node.ELEMENT_NODE
5459:                            && child.getNodeName().equals("barChart")
5460:                            || child.getNodeType() == Node.ELEMENT_NODE
5461:                            && child.getNodeName().equals("bar3DChart")
5462:                            || child.getNodeType() == Node.ELEMENT_NODE
5463:                            && child.getNodeName().equals("xyBarChart")
5464:                            || child.getNodeType() == Node.ELEMENT_NODE
5465:                            && child.getNodeName().equals("stackedBarChart")
5466:                            || child.getNodeType() == Node.ELEMENT_NODE
5467:                            && child.getNodeName().equals("stackedBar3DChart")
5468:                            || child.getNodeType() == Node.ELEMENT_NODE
5469:                            && child.getNodeName().equals("lineChart")
5470:                            || child.getNodeType() == Node.ELEMENT_NODE
5471:                            && child.getNodeName().equals("xyLineChart")
5472:                            || child.getNodeType() == Node.ELEMENT_NODE
5473:                            && child.getNodeName().equals("areaChart")
5474:                            || child.getNodeType() == Node.ELEMENT_NODE
5475:                            && child.getNodeName().equals("stackedAreaChart")
5476:                            || child.getNodeType() == Node.ELEMENT_NODE
5477:                            && child.getNodeName().equals("xyAreaChart")
5478:                            || child.getNodeType() == Node.ELEMENT_NODE
5479:                            && child.getNodeName().equals("scatterChart")
5480:                            || child.getNodeType() == Node.ELEMENT_NODE
5481:                            && child.getNodeName().equals("bubbleChart")
5482:                            || child.getNodeType() == Node.ELEMENT_NODE
5483:                            && child.getNodeName().equals("timeSeriesChart")
5484:                            || child.getNodeType() == Node.ELEMENT_NODE
5485:                            && child.getNodeName().equals("highLowChart")
5486:                            || child.getNodeType() == Node.ELEMENT_NODE
5487:                            && child.getNodeName().equals("candlestickChart")
5488:                            || child.getNodeType() == Node.ELEMENT_NODE
5489:                            && child.getNodeName().equals("meterChart")
5490:                            || child.getNodeType() == Node.ELEMENT_NODE
5491:                            && child.getNodeName().equals("thermometerChart")
5492:                            || child.getNodeType() == Node.ELEMENT_NODE
5493:                            && child.getNodeName().equals("multiAxisChart")) {
5494:                        ChartReportElement2 re = new ChartReportElement2(0, 0,
5495:                                0, 0);
5496:                        readChartReportElement(child, re);
5497:                        axis.setChartReportElement(re);
5498:                    }
5499:                }
5500:
5501:                return axis;
5502:            }
5503:
5504:            private Pen readPen(Node penNode) {
5505:
5506:                return readPen(penNode, 1f);
5507:            }
5508:
5509:            private Pen readPen(Node penNode, float defWidth) {
5510:                return readPen(penNode, defWidth, null);
5511:            }
5512:
5513:            private Pen readPen(Node penNode, float defWidth, Pen pen) {
5514:
5515:                if (pen == null) {
5516:                    pen = new Pen();
5517:                    pen.setLineWidth(defWidth);
5518:                }
5519:
5520:                NamedNodeMap nodeAttributes = penNode.getAttributes();
5521:
5522:                if (nodeAttributes.getNamedItem("lineWidth") != null) {
5523:                    try {
5524:                        pen.setLineWidth(Double.valueOf(
5525:                                ""
5526:                                        + nodeAttributes.getNamedItem(
5527:                                                "lineWidth").getNodeValue())
5528:                                .floatValue());
5529:                    } catch (Exception ex) {
5530:                        ex.printStackTrace();
5531:                        ;
5532:                    }
5533:                }
5534:
5535:                if (nodeAttributes.getNamedItem("lineStyle") != null)
5536:                    pen.setLineStyle(""
5537:                            + nodeAttributes.getNamedItem("lineStyle")
5538:                                    .getNodeValue());
5539:
5540:                if (nodeAttributes.getNamedItem("lineColor") != null)
5541:                    pen.setLineColor(decodeColor(""
5542:                            + nodeAttributes.getNamedItem("lineColor")
5543:                                    .getNodeValue()));
5544:
5545:                return pen;
5546:            }
5547:
5548:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.