Author: dandre
Date: Wed Dec  4 00:21:12 2013
New Revision: 4695

Log:
Add comparable interface to PropertyWrapper and gedart report. now dates may be 
compared in gedart reports.

Added:
   trunk/AncestrisCore/modules.renderer.velocity/test/
   trunk/AncestrisCore/modules.renderer.velocity/test/unit/
   trunk/AncestrisCore/modules.renderer.velocity/test/unit/src/
   trunk/AncestrisCore/modules.renderer.velocity/test/unit/src/ancestris/
   
trunk/AncestrisCore/modules.renderer.velocity/test/unit/src/ancestris/renderer/
   
trunk/AncestrisCore/modules.renderer.velocity/test/unit/src/ancestris/renderer/velocity/
   
trunk/AncestrisCore/modules.renderer.velocity/test/unit/src/ancestris/renderer/velocity/PropertyWrapperTest.java
Modified:
   trunk/AncestrisCore/modules.renderer.velocity/nbproject/build-impl.xml
   trunk/AncestrisCore/modules.renderer.velocity/nbproject/genfiles.properties
   
trunk/AncestrisCore/modules.renderer.velocity/src/ancestris/renderer/velocity/PropertyWrapper.java
   trunk/AncestrisCore/reports/nbproject/build-impl.xml
   trunk/AncestrisCore/reports/nbproject/genfiles.properties
   trunk/AncestrisCore/reports/src/ancestris/reports/gedart/DocReport.java

Modified: trunk/AncestrisCore/modules.renderer.velocity/nbproject/build-impl.xml
==============================================================================
--- trunk/AncestrisCore/modules.renderer.velocity/nbproject/build-impl.xml      
(original)
+++ trunk/AncestrisCore/modules.renderer.velocity/nbproject/build-impl.xml      
Wed Dec  4 00:21:12 2013
@@ -1,7 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?><!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
 *** GENERATED FROM project.xml - DO NOT EDIT  ***
 ***         EDIT ../build.xml INSTEAD         ***
---><project name="ancestris.renderer.velocity-impl" basedir="..">
+-->
+<project name="ancestris.renderer.velocity-impl" basedir="..">
     <fail message="Please build using Ant 1.7.1 or higher.">
         <condition>
             <not>

Modified: 
trunk/AncestrisCore/modules.renderer.velocity/nbproject/genfiles.properties
==============================================================================
--- trunk/AncestrisCore/modules.renderer.velocity/nbproject/genfiles.properties 
(original)
+++ trunk/AncestrisCore/modules.renderer.velocity/nbproject/genfiles.properties 
Wed Dec  4 00:21:12 2013
@@ -4,5 +4,5 @@
 # This file is used by a NetBeans-based IDE to track changes in generated 
files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never 
regenerate such files for you.
 nbproject/build-impl.xml.data.CRC32=8e4be806
-nbproject/build-impl.xml.script.CRC32=3df0a353
-nbproject/[email protected]
+nbproject/build-impl.xml.script.CRC32=9cd8f0bf
+nbproject/[email protected]

Modified: 
trunk/AncestrisCore/modules.renderer.velocity/src/ancestris/renderer/velocity/PropertyWrapper.java
==============================================================================
--- 
trunk/AncestrisCore/modules.renderer.velocity/src/ancestris/renderer/velocity/PropertyWrapper.java
  (original)
+++ 
trunk/AncestrisCore/modules.renderer.velocity/src/ancestris/renderer/velocity/PropertyWrapper.java
  Wed Dec  4 00:21:12 2013
@@ -26,7 +26,7 @@
  *
  * @author daniel
  */
-public class PropertyWrapper extends Object {
+public class PropertyWrapper extends Object implements 
Comparable<PropertyWrapper> {
     Property property;
     static final TextOptions OPTIONS = TextOptions.getInstance();
 
@@ -36,7 +36,7 @@
     }
 
     // Factory for PropertyWrapper
-    PropertyWrapper create(Property p) {
+    static PropertyWrapper create(Property p) {
         if (p == null) {
             return null;
         }
@@ -64,6 +64,11 @@
         return new PropertyWrapper(p);
     }
 
+    @Override
+    public int compareTo(PropertyWrapper o) {
+        return property.compareTo(o.property);
+    }
+    
     public PropertyWrapper getProperty(String tagPath) {
         if (property == null) {
             return null;
@@ -131,5 +136,5 @@
     public String format(String fmtstr) {
         return (property == null) ? "" : property.format(fmtstr);
     }
-    
+
 }

Added: 
trunk/AncestrisCore/modules.renderer.velocity/test/unit/src/ancestris/renderer/velocity/PropertyWrapperTest.java
==============================================================================
--- (empty file)
+++ 
trunk/AncestrisCore/modules.renderer.velocity/test/unit/src/ancestris/renderer/velocity/PropertyWrapperTest.java
    Wed Dec  4 00:21:12 2013
@@ -0,0 +1,195 @@
+/*
+ * Ancestris - http://www.ancestris.org
+ * 
+ * Copyright 2013 Ancestris
+ * 
+ * Author: Daniel Andre ([email protected]).
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ */
+package ancestris.renderer.velocity;
+
+import genj.gedcom.Property;
+import genj.gedcom.PropertyDate;
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author daniel
+ */
+public class PropertyWrapperTest extends TestCase {
+    
+    public PropertyWrapperTest(String testName) {
+        super(testName);
+    }
+    
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+//    /**
+//     * Test of create method, of class PropertyWrapper.
+//     */
+//    public void testCreate() {
+//        System.out.println("create");
+//        Property p = null;
+//        PropertyWrapper instance = null;
+//        PropertyWrapper expResult = null;
+//        PropertyWrapper result = instance.create(p);
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+    /**
+     * Test of compareTo method, of class PropertyWrapper.
+     */
+    public void testCompareTo() {
+        PropertyWrapper o = PropertyWrapper.create(new PropertyDate(1900));
+        PropertyWrapper instance = PropertyWrapper.create(new 
PropertyDate(1901));
+        int result = instance.compareTo(o);
+        assertTrue("year 1901 is after year 1900",result>0);
+    }
+
+//    /**
+//     * Test of getProperty method, of class PropertyWrapper.
+//     */
+//    public void testGetProperty() {
+//        System.out.println("getProperty");
+//        String tagPath = "";
+//        PropertyWrapper instance = null;
+//        PropertyWrapper expResult = null;
+//        PropertyWrapper result = instance.getProperty(tagPath);
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+//    /**
+//     * Test of get method, of class PropertyWrapper.
+//     */
+//    public void testGet() {
+//        System.out.println("get");
+//        String tag = "";
+//        PropertyWrapper instance = null;
+//        Object expResult = null;
+//        Object result = instance.get(tag);
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+//    /**
+//     * Test of getProperties method, of class PropertyWrapper.
+//     */
+//    public void testGetProperties() {
+//        System.out.println("getProperties");
+//        String tagPath = "";
+//        PropertyWrapper instance = null;
+//        PropertyWrapper[] expResult = null;
+//        PropertyWrapper[] result = instance.getProperties(tagPath);
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+//    /**
+//     * Test of getPath method, of class PropertyWrapper.
+//     */
+//    public void testGetPath() {
+//        System.out.println("getPath");
+//        PropertyWrapper instance = null;
+//        String expResult = "";
+//        String result = instance.getPath();
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+//    /**
+//     * Test of getDate method, of class PropertyWrapper.
+//     */
+//    public void testGetDate() {
+//        System.out.println("getDate");
+//        PropertyWrapper instance = null;
+//        String expResult = "";
+//        String result = instance.getDate();
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+//    /**
+//     * Test of getValue method, of class PropertyWrapper.
+//     */
+//    public void testGetValue() {
+//        System.out.println("getValue");
+//        PropertyWrapper instance = null;
+//        String expResult = "";
+//        String result = instance.getValue();
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+//    /**
+//     * Test of getName method, of class PropertyWrapper.
+//     */
+//    public void testGetName() {
+//        System.out.println("getName");
+//        PropertyWrapper instance = null;
+//        String expResult = "";
+//        String result = instance.getName();
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+//    /**
+//     * Test of getPlace method, of class PropertyWrapper.
+//     */
+//    public void testGetPlace() {
+//        System.out.println("getPlace");
+//        PropertyWrapper instance = null;
+//        String expResult = "";
+//        String result = instance.getPlace();
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+//    /**
+//     * Test of toString method, of class PropertyWrapper.
+//     */
+//    public void testToString() {
+//        System.out.println("toString");
+//        PropertyWrapper instance = null;
+//        String expResult = "";
+//        String result = instance.toString();
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+//
+//    /**
+//     * Test of format method, of class PropertyWrapper.
+//     */
+//    public void testFormat() {
+//        System.out.println("format");
+//        String fmtstr = "";
+//        PropertyWrapper instance = null;
+//        String expResult = "";
+//        String result = instance.format(fmtstr);
+//        assertEquals(expResult, result);
+//        // TODO review the generated test code and remove the default call 
to fail.
+//        fail("The test case is a prototype.");
+//    }
+}

Modified: trunk/AncestrisCore/reports/nbproject/build-impl.xml
==============================================================================
--- trunk/AncestrisCore/reports/nbproject/build-impl.xml        (original)
+++ trunk/AncestrisCore/reports/nbproject/build-impl.xml        Wed Dec  4 
00:21:12 2013
@@ -1,7 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?><!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
 *** GENERATED FROM project.xml - DO NOT EDIT  ***
 ***         EDIT ../build.xml INSTEAD         ***
---><project name="ancestris.reports-impl" basedir="..">
+-->
+<project name="ancestris.reports-impl" basedir="..">
     <fail message="Please build using Ant 1.7.1 or higher.">
         <condition>
             <not>

Modified: trunk/AncestrisCore/reports/nbproject/genfiles.properties
==============================================================================
--- trunk/AncestrisCore/reports/nbproject/genfiles.properties   (original)
+++ trunk/AncestrisCore/reports/nbproject/genfiles.properties   Wed Dec  4 
00:21:12 2013
@@ -4,5 +4,5 @@
 # This file is used by a NetBeans-based IDE to track changes in generated 
files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never 
regenerate such files for you.
 nbproject/build-impl.xml.data.CRC32=1741dfae
-nbproject/build-impl.xml.script.CRC32=cb6f2dc2
-nbproject/[email protected]
+nbproject/build-impl.xml.script.CRC32=3561af56
+nbproject/[email protected]

Modified: 
trunk/AncestrisCore/reports/src/ancestris/reports/gedart/DocReport.java
==============================================================================
--- trunk/AncestrisCore/reports/src/ancestris/reports/gedart/DocReport.java     
(original)
+++ trunk/AncestrisCore/reports/src/ancestris/reports/gedart/DocReport.java     
Wed Dec  4 00:21:12 2013
@@ -1,5 +1,6 @@
 package ancestris.reports.gedart;
 
+import ancestris.core.TextOptions;
 import genj.gedcom.Entity;
 import genj.gedcom.Fam;
 import genj.gedcom.Gedcom;
@@ -12,8 +13,6 @@
 import genj.gedcom.PropertySex;
 import genj.gedcom.PropertyXRef;
 import genj.gedcom.TagPath;
-import ancestris.core.TextOptions;
-
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -26,7 +25,6 @@
 import java.util.TreeMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.tools.generic.DateTool;
@@ -451,7 +449,7 @@
                }
        }
        
-       public class reportProperty extends Object{
+       public class reportProperty extends Object implements 
Comparable<reportProperty> {
                Property property;
                reportProperty(Property prop){
                        property = prop;
@@ -473,7 +471,12 @@
                        return new reportProperty(p);
                }
                
-               public reportProperty getProperty(String tagPath) {
+                @Override
+                public int compareTo(reportProperty that) {
+                    return property.compareTo(that.property);
+                }
+
+                public reportProperty getProperty(String tagPath) {
                        if (property == null) return null;
                        Property subProp = 
property.getPropertyByPath(property.getTag()+":"+tagPath);
                        return create(subProp);

---------------------------------------------------------------------
Site Web Ancestris : http://www.ancestris.org

<*> Pour vous desinscrire de cette liste, envoyez un mail a :
              [email protected]
<*> Pour obtenir de l'aide sur les commandes de la liste :
              [email protected]

Pour obtenir tous les messages lies a ce fil de discussion, cliquez sur le 
lien ci-dessous, cela ouvrira votre logiciel de messagerie. Il vous suffira 
d'envoyer le message :
              [email protected]

Reply via email to