diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-05-05 14:31:04 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-05-05 14:31:04 +0000 |
commit | 26021079df6ba1572800907ba4abfe6d63425b9c (patch) | |
tree | 1e4f0460246cbaed002d62ac5678a6c6957b9ee7 /reportdesign | |
parent | 351f8dc9a6caf48cd6b569b7aad11a60ed327d23 (diff) |
INTEGRATION: CWS dba30beta (1.3.6); FILE MERGED
2008/04/22 10:30:34 oj 1.3.6.1: #i88503# merge changes from rptchart02
Diffstat (limited to 'reportdesign')
7 files changed, 153 insertions, 175 deletions
diff --git a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapper.java b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapper.java index cc10025ae9bb..32b2ed302ff6 100644 --- a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapper.java +++ b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapper.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: StyleMapper.java,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -33,6 +33,7 @@ package com.sun.star.report.pentaho.styles; import java.util.HashMap; +import java.util.Map; import org.jfree.resourceloader.Resource; import org.jfree.resourceloader.ResourceException; import org.jfree.resourceloader.ResourceManager; @@ -53,7 +54,7 @@ import org.jfree.resourceloader.ResourceManager; */ public class StyleMapper { - private HashMap backend; + private final Map backend; public StyleMapper() { diff --git a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java index 44332db8ded8..64b50cba1197 100644 --- a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java +++ b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapperKey.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: StyleMapperKey.java,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.styles; /** @@ -39,100 +37,87 @@ package com.sun.star.report.pentaho.styles; */ public final class StyleMapperKey { - private String elementNamespace; - private String elementName; - private String attributeNamespace; - private String attributeName; - private int hashCode; - public StyleMapperKey(final String elementNamespace, - final String elementName, - final String attributeNamespace, - final String attributeName) - { - if (elementNamespace == null) + private final String elementNamespace; + private final String elementName; + private final String attributeNamespace; + private final String attributeName; + private final int hashCode; + + public StyleMapperKey(final String elementNamespace, + final String elementName, + final String attributeNamespace, + final String attributeName) { - throw new NullPointerException(); + if (elementNamespace == null) + { + throw new NullPointerException(); + } + if (elementName == null) + { + throw new NullPointerException(); + } + + this.elementNamespace = elementNamespace; + this.elementName = elementName; + this.attributeNamespace = attributeNamespace; + this.attributeName = attributeName; + this.hashCode = computeHashCode(); } - if (elementName == null) + + public String getElementNamespace() { - throw new NullPointerException(); + return elementNamespace; } - this.elementNamespace = elementNamespace; - this.elementName = elementName; - this.attributeNamespace = attributeNamespace; - this.attributeName = attributeName; - this.hashCode = computeHashCode(); - } - - public String getElementNamespace() - { - return elementNamespace; - } - - public String getElementName() - { - return elementName; - } - - public String getAttributeNamespace() - { - return attributeNamespace; - } - - public String getAttributeName() - { - return attributeName; - } - - public boolean equals(final Object o) - { - if (this == o) + public String getElementName() { - return true; + return elementName; } - if (o == null || getClass() != o.getClass()) + + public String getAttributeNamespace() { - return false; + return attributeNamespace; } - final StyleMapperKey that = (StyleMapperKey) o; - - if (attributeName != null ? !attributeName.equals( - that.attributeName) : that.attributeName != null) + public String getAttributeName() { - return false; + return attributeName; } - if (attributeNamespace != null ? !attributeNamespace.equals( - that.attributeNamespace) : that.attributeNamespace != null) + + public boolean equals(final Object o) { - return false; + if (this != o) + { + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final StyleMapperKey that = (StyleMapperKey) o; + + if ((attributeName != null ? !attributeName.equals(that.attributeName) : that.attributeName != null) || + (attributeNamespace != null ? !attributeNamespace.equals(that.attributeNamespace) : that.attributeNamespace != null) || + !elementName.equals(that.elementName) || !elementNamespace.equals(that.elementNamespace)) + { + return false; + } + } + + return true; } - if (!elementName.equals(that.elementName)) + + private int computeHashCode() { - return false; + int result = elementNamespace.hashCode(); + result = 31 * result + elementName.hashCode(); + result = 31 * result + (attributeNamespace != null ? attributeNamespace.hashCode() : 0); + result = 31 * result + (attributeName != null ? attributeName.hashCode() : 0); + return result; } - if (!elementNamespace.equals(that.elementNamespace)) + + public int hashCode() { - return false; + return hashCode; } - - return true; - } - - private int computeHashCode() - { - int result; - result = elementNamespace.hashCode(); - result = 31 * result + elementName.hashCode(); - result = 31 * result + (attributeNamespace != null ? attributeNamespace.hashCode() : 0); - result = 31 * result + (attributeName != null ? attributeName.hashCode() : 0); - return result; - } - - public int hashCode() - { - return hashCode; - } } diff --git a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java index 97128a74908c..f958e2749f41 100644 --- a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java +++ b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMapperXmlFactoryModule.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: StyleMapperXmlFactoryModule.java,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.styles; import org.jfree.xmlns.parser.XmlDocumentInfo; @@ -43,36 +41,34 @@ import org.jfree.xmlns.parser.XmlReadHandler; */ public class StyleMapperXmlFactoryModule implements XmlFactoryModule { - public static final String NAMESPACE = - "http://jfreereport.sourceforge.net/namespaces/engine/openoffice/stylemapper"; - public StyleMapperXmlFactoryModule() - { - } + public static final String NAMESPACE = + "http://jfreereport.sourceforge.net/namespaces/engine/openoffice/stylemapper"; - public XmlReadHandler createReadHandler(final XmlDocumentInfo documentInfo) - { - return new StyleMappingDocumentReadHandler(); - } + public StyleMapperXmlFactoryModule() + { + } - public int getDocumentSupport(final XmlDocumentInfo documentInfo) - { - final String rootNamespace = documentInfo.getRootElementNameSpace(); - if (StyleMapperXmlFactoryModule.NAMESPACE.equals(rootNamespace) == false) + public XmlReadHandler createReadHandler(final XmlDocumentInfo documentInfo) { - return XmlFactoryModule.NOT_RECOGNIZED; + return new StyleMappingDocumentReadHandler(); } - if ("style-mapper-definition".equals(documentInfo.getRootElement())) + public int getDocumentSupport(final XmlDocumentInfo documentInfo) { - return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE; + final String rootNamespace = documentInfo.getRootElementNameSpace(); + if (StyleMapperXmlFactoryModule.NAMESPACE.equals(rootNamespace) && + "style-mapper-definition".equals(documentInfo.getRootElement())) + { + + return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE; + } + return XmlFactoryModule.NOT_RECOGNIZED; } - return XmlFactoryModule.NOT_RECOGNIZED; - } - public String getDefaultNamespace(final XmlDocumentInfo documentInfo) - { - return null; - } + public String getDefaultNamespace(final XmlDocumentInfo documentInfo) + { + return null; + } } diff --git a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java index bc1366ef65ad..7cf89c399e37 100644 --- a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java +++ b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMappingDocumentReadHandler.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: StyleMappingDocumentReadHandler.java,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -27,12 +27,11 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.styles; import java.util.ArrayList; +import java.util.List; import org.jfree.xmlns.parser.AbstractXmlReadHandler; import org.jfree.xmlns.parser.XmlReadHandler; import org.xml.sax.SAXException; @@ -46,69 +45,64 @@ import org.xml.sax.Attributes; */ public class StyleMappingDocumentReadHandler extends AbstractXmlReadHandler { - private StyleMapper styleMapper; - private ArrayList mappings; - public StyleMappingDocumentReadHandler() - { - this.mappings = new ArrayList(); - this.styleMapper = new StyleMapper(); - } + private final StyleMapper styleMapper; + private final List mappings; - - /** - * Returns the handler for a child element. - * - * @param tagName the tag name. - * @param atts the attributes. - * @return the handler or null, if the tagname is invalid. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected XmlReadHandler getHandlerForChild(final String uri, - final String tagName, - final Attributes atts) - throws SAXException - { - if (isSameNamespace(uri) == false) + public StyleMappingDocumentReadHandler() { - return null; + this.mappings = new ArrayList(); + this.styleMapper = new StyleMapper(); } - if ("mapping".equals(tagName)) + + /** + * Returns the handler for a child element. + * + * @param tagName the tag name. + * @param atts the attributes. + * @return the handler or null, if the tagname is invalid. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected XmlReadHandler getHandlerForChild(final String uri, + final String tagName, + final Attributes atts) + throws SAXException { - final StyleMappingReadHandler smr = new StyleMappingReadHandler(); - mappings.add(smr); - return smr; + if (isSameNamespace(uri) && "mapping".equals(tagName)) + { + final StyleMappingReadHandler smr = new StyleMappingReadHandler(); + mappings.add(smr); + return smr; + } + return null; } - return null; - } - - /** - * Done parsing. - * - * @throws org.xml.sax.SAXException if there is a parsing error. - */ - protected void doneParsing() - throws SAXException - { - for (int i = 0; i < mappings.size(); i++) + /** + * Done parsing. + * + * @throws org.xml.sax.SAXException if there is a parsing error. + */ + protected void doneParsing() + throws SAXException { - final StyleMappingReadHandler handler = - (StyleMappingReadHandler) mappings.get(i); - styleMapper.addMapping(handler.getRule()); + for (int i = 0; i < mappings.size(); i++) + { + final StyleMappingReadHandler handler = + (StyleMappingReadHandler) mappings.get(i); + styleMapper.addMapping(handler.getRule()); + } } - } - /** - * Returns the object for this element or null, if this element does not - * create an object. - * - * @return the object. - */ - public Object getObject() - throws SAXException - { - return styleMapper; - } + /** + * Returns the object for this element or null, if this element does not + * create an object. + * + * @return the object. + */ + public Object getObject() + throws SAXException + { + return styleMapper; + } } diff --git a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java index cd0c25ebb92f..742daf8ba6e5 100644 --- a/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java +++ b/reportdesign/java/com/sun/star/report/pentaho/styles/StyleMappingRule.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: StyleMappingRule.java,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -39,9 +39,9 @@ package com.sun.star.report.pentaho.styles; */ public class StyleMappingRule { - private StyleMapperKey key; - private String family; - private boolean listOfValues; + private final StyleMapperKey key; + private final String family; + private final boolean listOfValues; public StyleMappingRule(final StyleMapperKey key, final String family, diff --git a/reportdesign/java/com/sun/star/report/util/DefaultJobProperties.java b/reportdesign/java/com/sun/star/report/util/DefaultJobProperties.java index 05489d9d49ab..9cd70b1c69f0 100644 --- a/reportdesign/java/com/sun/star/report/util/DefaultJobProperties.java +++ b/reportdesign/java/com/sun/star/report/util/DefaultJobProperties.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DefaultJobProperties.java,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -36,11 +36,12 @@ import java.util.HashMap; import com.sun.star.report.JobProperties; import com.sun.star.report.ReportEngineMetaData; import com.sun.star.report.JobDefinitionException; +import java.util.Map; public class DefaultJobProperties implements JobProperties { - private ReportEngineMetaData metaData; - private HashMap properties; + private final ReportEngineMetaData metaData; + private final Map properties; public DefaultJobProperties (final ReportEngineMetaData metaData) { @@ -65,7 +66,7 @@ public class DefaultJobProperties implements JobProperties { throw new JobDefinitionException("The parameter name is not known: " + key); } - if (type.isInstance(value) == false) + if (!type.isInstance(value)) { throw new JobDefinitionException("The parameter value is not understood"); } diff --git a/reportdesign/java/com/sun/star/report/util/DefaultParameterMap.java b/reportdesign/java/com/sun/star/report/util/DefaultParameterMap.java index 7c3fb3458bc4..29ee586d5075 100644 --- a/reportdesign/java/com/sun/star/report/util/DefaultParameterMap.java +++ b/reportdesign/java/com/sun/star/report/util/DefaultParameterMap.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DefaultParameterMap.java,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -34,10 +34,11 @@ package com.sun.star.report.util; import java.util.HashMap; import com.sun.star.report.ParameterMap; +import java.util.Map; public class DefaultParameterMap implements ParameterMap { - private HashMap backend; + private final Map backend; public DefaultParameterMap () { |