Slick Forums

Discuss the Slick 2D Library
It is currently Sat May 18, 2013 11:22 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Dec 06, 2008 4:33 pm 
Offline

Joined: Fri Mar 07, 2008 8:41 pm
Posts: 21
The subject says it all already ... as time went on, we not only need to read any attribute as specified in the XML (again, many thanks for making that possible at all!), but also do some magic tricks with the Element. It's already stored there, so I figured the easiest would be to extend InkscapeNonGeometricData. Proposed patch appended (against latest svn, InkscapeNonGeometricData.java). Incidentally, this also includes an NPE fix.

Code:
Index: InkscapeNonGeometricData.java
===================================================================
--- InkscapeNonGeometricData.java   (revision 1106)
+++ InkscapeNonGeometricData.java   (working copy)
@@ -4,23 +4,25 @@
import org.w3c.dom.Element;

/**
- * A custom non-geometric data type that can pass back any attribute
- * on the field.
+ * A custom non-geometric data type that can pass back any attribute on the field.
  *
  * @author kevin
  */
public class InkscapeNonGeometricData extends NonGeometricData {
   /** The element read from the SVG */
   private Element element;
-   
+
   /**
    * Create a new non-geometric data holder
    *
-    * @param metaData The metadata provided
-    * @param element The XML element from the SVG document
+    * @param metaData
+    *           The metadata provided
+    * @param element
+    *           The XML element from the SVG document
    */
   public InkscapeNonGeometricData(String metaData, Element element) {
      super(metaData);
+      this.element = element;
   }

   /**
@@ -31,8 +33,16 @@
      if (result == null) {
         result = element.getAttribute(attribute);
      }
-      
+
      return result;
   }

+   /**
+    * Returns the XML element that is wrapped by this instance.
+    *
+    * @return The XML element for this instance
+    */
+   public Element getElement() {
+      return element;
+   }
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 10, 2008 7:22 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
In SVN.

Kev


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group