[Schmitzm-commits] r251 - in trunk/src/schmitzm: jfree/chart/style jfree/feature/style xml

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jul 31 13:59:50 CEST 2009


Author: mojays
Date: 2009-07-31 13:59:50 +0200 (Fri, 31 Jul 2009)
New Revision: 251

Modified:
   trunk/src/schmitzm/jfree/chart/style/ChartStyleXMLFactory.java
   trunk/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java
   trunk/src/schmitzm/xml/XMLUtil.java
Log:
"pretty" output type for XML_OUTPUTTER
FeatureChartStyleXMLFactory: support of scatter chart type


Modified: trunk/src/schmitzm/jfree/chart/style/ChartStyleXMLFactory.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/style/ChartStyleXMLFactory.java	2009-07-31 11:55:38 UTC (rev 250)
+++ trunk/src/schmitzm/jfree/chart/style/ChartStyleXMLFactory.java	2009-07-31 11:59:50 UTC (rev 251)
@@ -43,7 +43,6 @@
 import java.util.List;
 import java.util.Random;
 
-import org.apache.commons.io.output.FileWriterWithEncoding;
 import org.jdom.Element;
 import org.jfree.chart.plot.PlotOrientation;
 import org.jfree.ui.RectangleInsets;
@@ -365,32 +364,12 @@
    * @param filePath        file to store the style to
    */
   public void writeStyleToFile(E style, String rootElementName, File filePath) throws IOException {
-//    final FileWriter out = new FileWriter( filePath );
-//    // Create XML-Document
-//    XMLUtil.XML_OUTPUTTER.output(
-//      createElementFromStyle(style, rootElementName),
-//      out
-//    );
-//    out.flush();
-//    out.close();
-//    
-//	// Create a DOM builder and parse the fragment
-//	DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-//	Document document = null;
-//	try {
-//		document = factory.newDocumentBuilder().newDocument();
-//	} catch (ParserConfigurationException e) {
-//
-//		throw new IOException("factory.newDocumentBuilder().newDocument() failed:", e);
-//	}
-//    
-//	document.appendChild(createElementFromStyle(style, rootElementName));
     OutputStreamWriter out = new OutputStreamWriter(
 				new FileOutputStream(filePath), "utf-8");
     // Create XML-Document
-    XMLUtil.XML_OUTPUTTER.output( new org.jdom.Document(
-    		createElementFromStyle(style, rootElementName)),
-    		out
+    XMLUtil.XML_OUTPUTTER.output( 
+        new org.jdom.Document(createElementFromStyle(style, rootElementName)),
+        out
     );
     out.flush();
     out.close();

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java	2009-07-31 11:55:38 UTC (rev 250)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java	2009-07-31 11:59:50 UTC (rev 251)
@@ -105,6 +105,7 @@
       case AREA:  
       case LINE:  
       case POINT: return new FeatureBasicChartStyle(id, type);
+      case SCATTER: return new FeatureScatterChartStyle(id);
     }
     throw new UnsupportedOperationException("Style for this chart type not yet supported for features: "+type);
   }

Modified: trunk/src/schmitzm/xml/XMLUtil.java
===================================================================
--- trunk/src/schmitzm/xml/XMLUtil.java	2009-07-31 11:55:38 UTC (rev 250)
+++ trunk/src/schmitzm/xml/XMLUtil.java	2009-07-31 11:59:50 UTC (rev 251)
@@ -34,6 +34,7 @@
 import org.apache.log4j.Logger;
 import org.jdom.Element;
 import org.jdom.adapters.JAXPDOMAdapter;
+import org.jdom.output.Format;
 import org.jdom.output.XMLOutputter;
 
 import schmitzm.swing.SwingUtil;
@@ -51,7 +52,7 @@
   /** Wrapper from JDOM to W3C. */
   public static final JAXPDOMAdapter JDOM_TO_JAX = new JAXPDOMAdapter();
   /** Writes XML element to file. */
-  public static final XMLOutputter XML_OUTPUTTER = new XMLOutputter();
+  public static final XMLOutputter XML_OUTPUTTER = new XMLOutputter( Format.getPrettyFormat() );
 
   /**
    * Gets the attribute value from element.



More information about the Schmitzm-commits mailing list