User: kz Date: 2008-03-05 17:39:55+0000 Modified: dba/reportdesign/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java
Log: INTEGRATION: CWS rptchart01_DEV300 (1.2.70); FILE MERGED 2008/02/20 10:52:56 oj 1.2.70.1: format changes File Changes: Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/parser/ ===================================================================== File [changed]: OfficeParserUtil.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/parser/OfficeParserUtil.java?r1=1.2&r2=1.3 Delta lines: +143 -146 ----------------------- --- OfficeParserUtil.java 2007-07-09 11:56:08+0000 1.2 +++ OfficeParserUtil.java 2008-03-05 17:39:52+0000 1.3 @@ -33,8 +33,6 @@ * MA 02111-1307 USA * ************************************************************************/ - - package com.sun.star.report.pentaho.parser; import java.util.Iterator; @@ -53,10 +51,11 @@ public class OfficeParserUtil { + private static OfficeParserUtil instance; private static final String NAMESPACES_PREFIX = "namespaces."; - public static synchronized OfficeParserUtil getInstance () + public static synchronized OfficeParserUtil getInstance() { if (instance == null) { @@ -64,11 +63,10 @@ } return instance; } - private DefaultConfiguration props; private NamespaceDefinition[] namespaces; - private OfficeParserUtil () + private OfficeParserUtil() { props = new DefaultConfiguration(); @@ -76,8 +74,7 @@ resourceManager.registerDefaults(); try { - final Resource res = resourceManager.createDirectly - ("res://com/sun/star/report/pentaho/parser/selectors.properties", Properties.class); + final Resource res = resourceManager.createDirectly("res://com/sun/star/report/pentaho/parser/selectors.properties", Properties.class); final Properties resProps = (Properties) res.getResource(); props.putAll(resProps); } @@ -86,14 +83,16 @@ Log.warn("Unable to load mapping rules. Parsing services may not be available.", e); } - namespaces = Namespaces.createFromConfig - (JFreeReportBoot.getInstance().getGlobalConfig(), + namespaces = Namespaces.createFromConfig(JFreeReportBoot.getInstance().getGlobalConfig(), "org.jfree.report.namespaces.", resourceManager); } - public NamespaceDefinition getNamespaceDeclaration (String uri) + public NamespaceDefinition getNamespaceDeclaration(String uri) + { + if (uri == null) { - if (uri == null) throw new NullPointerException("URI must not be null"); + throw new NullPointerException("URI must not be null"); + } for (int i = 0; i < namespaces.length; i++) { @@ -106,23 +105,22 @@ return null; } - public String getGenericFont (String officeFont) + public String getGenericFont(String officeFont) { - return props.getProperty - ("font-family." + officeFont.toLowerCase(), officeFont); + return props.getProperty("font-family." + officeFont.toLowerCase(), officeFont); } - public String getNamespaceURI (String namespacePrefix) + public String getNamespaceURI(String namespacePrefix) { return props.getProperty(NAMESPACES_PREFIX + namespacePrefix); } - public String getNamespaceForStyleFamily (String styleFamily) + public String getNamespaceForStyleFamily(String styleFamily) { return props.getProperty("style-family." + styleFamily); } - public Map getNamespaces () + public Map getNamespaces() { Map map = new HashMap(); Iterator keys = props.findPropertyKeys(NAMESPACES_PREFIX); @@ -130,12 +128,12 @@ { String key = (String) keys.next(); String value = props.getConfigProperty(key); - map.put (key.substring(NAMESPACES_PREFIX.length()), value); + map.put(key.substring(NAMESPACES_PREFIX.length()), value); } return map; } - public String getNamespacePrefix (String namespaceURI) + public String getNamespacePrefix(String namespaceURI) { Iterator keys = props.findPropertyKeys(NAMESPACES_PREFIX); while (keys.hasNext()) @@ -150,8 +148,7 @@ return null; } - public AttributeSpecification parseStyleAttrDefinition - (final String key, final String prefix, final String tagname) + public AttributeSpecification parseStyleAttrDefinition(final String key, final String prefix, final String tagname) { final String configPrefix = "attr." + prefix + "." + tagname + "."; final String configSuffix = key.substring(configPrefix.length()); @@ -166,14 +163,14 @@ return new AttributeSpecification(namespaceUri, attrName, value); } - public Iterator findStylesForElement (final String prefix, + public Iterator findStylesForElement(final String prefix, final String tagname) { final String configPrefix = "attr." + prefix + "." + tagname + "."; return props.findPropertyKeys(configPrefix); } - public boolean isValidStyleElement (String uri, String tagName) + public boolean isValidStyleElement(String uri, String tagName) { final String prefix = getNamespacePrefix(uri); if (prefix == null) @@ -185,12 +182,12 @@ return stylesForElement.hasNext(); } - public String getSelectorPattern () + public String getSelectorPattern() { return props.getConfigProperty("style-selector.pattern"); } - public static void main (String[] args) + public static void main(String[] args) { JFreeReportBoot.getInstance().start(); System.out.print(OfficeParserUtil.getInstance().getNamespaces()); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
