[Schmitzm-commits] r191 - trunk/src/schmitzm/jfree/chart/style

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jul 3 18:18:56 CEST 2009


Author: alfonx
Date: 2009-07-03 18:18:56 +0200 (Fri, 03 Jul 2009)
New Revision: 191

Modified:
   trunk/src/schmitzm/jfree/chart/style/ChartStyleUtil.java
Log:


Modified: trunk/src/schmitzm/jfree/chart/style/ChartStyleUtil.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/style/ChartStyleUtil.java	2009-07-03 16:12:02 UTC (rev 190)
+++ trunk/src/schmitzm/jfree/chart/style/ChartStyleUtil.java	2009-07-03 16:18:56 UTC (rev 191)
@@ -9,8 +9,9 @@
     Sie sollten eine Kopie der GNU Lesser General Public License zusammen mit dieser Bibliothek erhalten haben; falls nicht, schreiben Sie an die Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
  **/
 
-package schmitzm.jfree.chart.style;
+package schmitzm.jfree.chart.style;
 
+import java.io.File;
 import java.io.IOException;
 import java.net.URL;
 
@@ -21,54 +22,68 @@
 import schmitzm.io.IOUtil;
 import schmitzm.jfree.chart.style.ChartStyle.ChartType;
 
-/**
- * This class contains static utility methods related to chart styling.
- * @author <a href="mailto:Martin.Schmitz at koeln.de">Martin Schmitz</a>
- * @version 1.0
- */
+/**
+ * This class contains static utility methods related to chart styling.
+ * 
+ * @author <a href="mailto:Martin.Schmitz at koeln.de">Martin Schmitz</a>
+ * @version 1.0
+ */
 public class ChartStyleUtil {
-  private static final SAXBuilder SAX_BUILDER = new SAXBuilder();
+	private static final SAXBuilder SAX_BUILDER = new SAXBuilder();
 
-  /** Instance of {@link ChartStyleXMLFactory}. */
-  public static final ChartStyleXMLFactory CHART_STYLE_FACTORY = new ChartStyleXMLFactory();
-  
-  /**
-   * Returns the chart style for a given string.
-   */
-  public static ChartType getChartType(String typeStr) {
-    try {
-      return ChartType.valueOf( typeStr.toUpperCase() );
-    } catch (IllegalArgumentException err){
-      throw new UnsupportedOperationException("Unknown chart style type: "+typeStr);
-    }
-  }
+	/** Instance of {@link ChartStyleXMLFactory}. */
+	public static final ChartStyleXMLFactory CHART_STYLE_FACTORY = new ChartStyleXMLFactory();
 
-  /**
-   * Reads a chart definition from {@link URL}. The URL must refers to
-   * a resource which contains exactly one chart definition as root element.<br>
-   * <b>The filename is taken as chart ID</b>
-   * @param url refers to XML resource
-   */
-  public static ChartStyle readStyleFromXML(URL url, ChartStyleXMLFactory factory) throws IOException {
-    String id = IOUtil.urlToFile(url).getName();
-    return readStyleFromXML(url, id, factory);
-  }
+	/**
+	 * Returns the chart style for a given string.
+	 */
+	public static ChartType getChartType(String typeStr) {
+		try {
+			return ChartType.valueOf(typeStr.toUpperCase());
+		} catch (IllegalArgumentException err) {
+			throw new UnsupportedOperationException(
+					"Unknown chart style type: " + typeStr);
+		}
+	}
 
-  /**
-   * Reads a chart definition from {@link URL}. The URL must refers to
-   * a resource which contains exactly one chart definition as root element.
-   * @param url refers to XML resource
-   * @param id  the ID for the style (if {@code null} the
-   *            ID is taken from "id" attribute)
-   * @param factory factory to create the style with
-   */
-  public static ChartStyle readStyleFromXML(URL url, String id, ChartStyleXMLFactory factory) throws IOException {
-    try {
-      Document document = SAX_BUILDER.build(url);
-      return( factory.createStyleFromXML(document.getRootElement(),null) );
-    } catch (JDOMException err) {
-      throw new IOException(err);
-    }
-  }
+	/**
+	 * Reads a chart definition from {@link URL}. The URL must refers to a
+	 * resource which contains exactly one chart definition as root element.<br>
+	 * <b>The filename is taken as chart ID</b>
+	 * 
+	 * @param url
+	 *            refers to XML resource
+	 */
+	public static ChartStyle readStyleFromXML(URL url,
+			ChartStyleXMLFactory factory) throws IOException {
+		String id = IOUtil.urlToFile(url).getName();
+		return readStyleFromXML(url, id, factory);
+	}
 
-}
+	/**
+	 * Reads a chart definition from {@link URL}. The URL must refers to a
+	 * resource which contains exactly one chart definition as root element.
+	 * 
+	 * @param url
+	 *            refers to XML resource
+	 * @param id
+	 *            the ID for the style (if {@code null} the ID is taken from
+	 *            "id" attribute)
+	 * @param factory
+	 *            factory to create the style with
+	 */
+	public static ChartStyle readStyleFromXML(URL url, String id,
+			ChartStyleXMLFactory factory) throws IOException {
+		try {
+			Document document = SAX_BUILDER.build(url);
+			return (factory.createStyleFromXML(document.getRootElement(), null));
+		} catch (JDOMException err) {
+			throw new IOException(err);
+		}
+	}
+
+	public static void writeStyleToXML(ChartStyle chartStyle, File chartFile) {
+		// TODO Auto-generated method stub
+	}
+
+}



More information about the Schmitzm-commits mailing list