[Schmitzm-commits] r986 - in trunk: doc src/schmitzm/jfree/table/style src_junit/schmitzm/jfree/feature/style

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Aug 25 18:21:56 CEST 2010


Author: mojays
Date: 2010-08-25 18:21:53 +0200 (Wed, 25 Aug 2010)
New Revision: 986

Modified:
   trunk/doc/Chart style XML structure.pdf
   trunk/src/schmitzm/jfree/table/style/TableChartStyleXMLFactory.java
   trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java
Log:
Property TableChartStyle is/setIgnoreNoDataRangeValues(.) included in XML definition (TableChartStyleXMLFactory).

Modified: trunk/doc/Chart style XML structure.pdf
===================================================================
(Binary files differ)

Modified: trunk/src/schmitzm/jfree/table/style/TableChartStyleXMLFactory.java
===================================================================
--- trunk/src/schmitzm/jfree/table/style/TableChartStyleXMLFactory.java	2010-08-25 11:41:37 UTC (rev 985)
+++ trunk/src/schmitzm/jfree/table/style/TableChartStyleXMLFactory.java	2010-08-25 16:21:53 UTC (rev 986)
@@ -34,6 +34,8 @@
 
 import org.jdom.Element;
 
+import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+
 import schmitzm.jfree.chart.style.ChartAxisStyle;
 import schmitzm.jfree.chart.style.ChartStyle;
 import schmitzm.jfree.chart.style.ChartStyleXMLFactory;
@@ -70,6 +72,9 @@
       }
     }
     
+    // Attributes of <tableAttributes>
+    XMLUtil.getBooleanAttribute(element, "ignoreNullRangeValues", true);
+    
     // Attribute definitions in <tableAttributes> element
     Element attributesElement = element.getChild("tableAttributes");
     if ( attributesElement == null )
@@ -161,6 +166,9 @@
     // Create and add element <tableAttributes>
     Element attrElem = addChildToElement(root, "tableAttributes");
     
+    // Ignore NoData range values or treat as numeric 0.
+    XMLUtil.setAttribute(attrElem, "ignoreNullRangeValues", style.isIgnoreNoDataRangeValues(),false);
+    
     // Domain attribute definition
     if ( style.getAttributeCount() > 0 )
       addChildToElement(attrElem, "domainAttr", false,

Modified: trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java
===================================================================
--- trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java	2010-08-25 11:41:37 UTC (rev 985)
+++ trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java	2010-08-25 16:21:53 UTC (rev 986)
@@ -139,31 +139,12 @@
 				Thread.sleep(100);
 			}
 		}
+		
+		assertXMLOutputAndInput(xmlFactoryFeature,lineChartStyle,"testDoubleLineChart");
 
-		File testFile = File.createTempFile("testDoubleLineChart", ".xml");
-		xmlFactoryFeature.writeStyleToFile(lineChartStyle,
-				"testDoubleLineChart", testFile);
-
-		assertTrue(testFile.getAbsolutePath() + " wurde nicht geschrieben!",
-				testFile.exists());
-
-		String writtenXML = IOUtil.readFileAsString(testFile);
-
-		// XML wieder einlesen
-		FeatureChartStyle lineChartAUsXMLgelesen = xmlFactoryFeature
-				.readStyleFromFile(testFile);
-
-		// Nochmal in XML schreiben
-		File testFile2 = File.createTempFile("testDoubleLineChart", ".xml");
-		xmlFactoryFeature.writeStyleToFile(lineChartAUsXMLgelesen,
-				"testDoubleLineChart", testFile2);
-		String readXML = IOUtil.readFileAsString(testFile2);
-		System.out.println(writtenXML);
-		System.out.println(readXML);
-		assertEquals(
-				"Nachdem das Style geschrieben, gelesen und wieder geschrieben wurde ist das XML nicht gleich!",
-				writtenXML, readXML);
 	}
+	
+	
 
 	/**
 	 * If tests are run on a system with head, we may theoretically open dialgs,
@@ -387,6 +368,7 @@
 				Thread.sleep(100);
 			}
 		}
+        assertXMLOutputAndInput(xmlFactoryFeature,chartStyle,"testKECKBarChart");
 	}
 
 	@Test
@@ -939,4 +921,34 @@
 				writtenXML, IOUtil.readFileAsString(testFile2));
 	}
 
+
+    private <S extends ChartStyle> void assertXMLOutputAndInput(ChartStyleXMLFactory<S> xmlFactory, S style, String fileName) throws IOException {
+      File testFile = File.createTempFile(fileName, ".xml");
+         xmlFactory.writeStyleToFile(style,
+                 fileName, testFile);
+
+         assertTrue(testFile.getAbsolutePath() + " wurde nicht geschrieben!",
+                 testFile.exists());
+
+         String writtenXML = IOUtil.readFileAsString(testFile);
+
+         // XML wieder einlesen
+         S chartAusXMLgelesen = xmlFactory.readStyleFromFile(testFile);
+
+         // Nochmal in XML schreiben
+         File testFile2 = File.createTempFile(fileName, ".xml");
+         xmlFactory.writeStyleToFile(chartAusXMLgelesen,
+                 fileName, testFile2);
+         String readXML = IOUtil.readFileAsString(testFile2);
+         System.out.println("##### WRITTEN XML #####");
+         System.out.println(writtenXML);
+         System.out.println("##### READ XML #####");
+         System.out.println(readXML);
+         System.out.println("#######################");
+
+         assertEquals(
+                 "Nachdem das Style geschrieben, gelesen und wieder geschrieben wurde ist das XML nicht gleich!",
+                 writtenXML, readXML);
+
+ }
 }



More information about the Schmitzm-commits mailing list