incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From devin...@apache.org
Subject svn commit: r1293094 - in /incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet: OdfAttributeTaglet.java OdfDatatypeTaglet.java OdfElementTaglet.java
Date Fri, 24 Feb 2012 05:56:40 GMT
Author: devinhan
Date: Fri Feb 24 05:56:39 2012
New Revision: 1293094

URL: http://svn.apache.org/viewvc?rev=1293094&view=rev
Log:
#ODFTOOLKIT-306# Update Taglets to support ODF 1.2 final version.[Developer:Devin]

Modified:
    incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java
    incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java
    incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java

Modified: incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java?rev=1293094&r1=1293093&r2=1293094&view=diff
==============================================================================
--- incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java
(original)
+++ incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfAttributeTaglet.java
Fri Feb 24 05:56:39 2012
@@ -21,148 +21,186 @@
  */
 package org.odftoolkit.odfdom.taglet;
 
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.logging.Logger;
 
 import com.sun.javadoc.Tag;
 import com.sun.tools.doclets.Taglet;
 
 /**
- *	This class implements a custom taglet to the map the ODF attribute to the
- *  declaration of the ODF attribute in the OpenDocument specification.
- *
- *  The position of the OpenDocument specification in HTML can be provided using
- *  an environment variable or java system property, while the system property overrides
- *  the environment variable.
- *  In case nothing is been a default path within the JavaDoc doc-files directory is being
used.
- *
- *  For example the taglet <code>{&#64;odf.attribute xml:id}</code> would
be resolved without variable settings to
- *  <code>JAVA_DOC_BASE/doc-files/OpenDocument-v1.2-cd05-part1.html#attribute-xml_id</code>.
+ * This class implements a custom taglet to the map the ODF attribute to the
+ * declaration of the ODF attribute in the OpenDocument specification.
+ * 
+ * The position of the OpenDocument specification in HTML can be provided using
+ * an environment variable or java system property, while the system property
+ * overrides the environment variable. In case nothing is been a default path
+ * within the JavaDoc doc-files directory is being used.
+ * 
+ * For example the taglet <code>{&#64;odf.attribute xml:id}</code> would
be
+ * resolved without variable settings to
+ * <code>JAVA_DOC_BASE/doc-files/OpenDocument-v1.2-part1.html#attribute-xml_id</code>
+ * .
  */
 public class OdfAttributeTaglet implements Taglet {
-	
+
 	private static final Logger LOG = Logger.getLogger(OdfAttributeTaglet.class.getName());
 	private static final String NAME = "odf.attribute";
-	private static final String ODF_SPEC_PATH = "../../../../../../doc-files/OpenDocument-v1.2-cd05-part1.html";
-	private static String mOdfSpecPath = null;
-
-	    /* FINDING THE ABSOLUTE PATH TO THE ODF SPEC IN HTML:
-	     * 1) Try to get the odfSpecPath from the Java System variable (ODF_SPEC_PATH)
-	     * 2) Try to get the odfSpecPath from the environemnt variable (ODF_SPEC_PATH)
-	     * 3) If both not worked, use the default path
-	     **/
-	    static {
-	        mOdfSpecPath = System.getProperty("ODF_SPEC_PATH");
-	        if (mOdfSpecPath == null) {
-	            mOdfSpecPath = System.getenv("ODF_SPEC_PATH");
-	            if (mOdfSpecPath == null) {
-	                mOdfSpecPath = ODF_SPEC_PATH;
-	                LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by class declaration.");
-	            } else {
-	                LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by environment property
'ODF_SPEC_PATH'.");
-	            }
-	        } else {
-	            LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by Java System property
'ODF_SPEC_PATH'.");
-	        }
-	    }
-
-	    /**
-	      * @return the name of this custom tag.
-	      */
-	    public String getName() {
-	           return NAME;
-	    }
-	    
-	    /**
-	     * @return true since this tag can be used in a field
-	     *         doc comment
-	     */
-	    public boolean inField() {
-	        return true;
-	    }
-
-	    /**
-	     * @return true since this tag can be used in a constructor
-	     *         doc comment
-	     */
-	    public boolean inConstructor() {
-	        return true;
-	    }
-	    
-	    /**
-	     * @return true since this tag can be used in a method
-	     *         doc comment
-	     */
-	    public boolean inMethod() {
-	        return true;
-	    }
-	    
-	    /**
-	     * @return true since this tag can be used in an overview
-	     *         doc comment
-	     */
-	    public boolean inOverview() {
-	        return true;
-	    }
-
-	    /**
-	     * @return true since this tag can be used in a package
-	     *         doc comment
-	     */
-	    public boolean inPackage() {
-	        return true;
-	    }
-
-	    /**
-	     * @return true since this 
-	     */
-	    public boolean inType() {
-	        return true;
-	    }
-	    
-	    /**
-	     * Will return true since this is an inline tag.
-	     * @return true since this is an inline tag.
-	     */
-	    
-	    public boolean isInlineTag() {
-	        return true;
-	    }
-	    
-	    /**
-	     * Register this Taglet.
-	     * @param tagletMap  the map to register this tag to.
-	     */
-	    public static void register(Map<String, Taglet> tagletMap) {
-	           OdfAttributeTaglet tag = new OdfAttributeTaglet();
-	           Taglet t = tagletMap.get(tag.getName());
-	           if (t != null) {
-	                tagletMap.remove(tag.getName());
-	            }
-	            tagletMap.put(tag.getName(), tag);
-	        }
-
-	    /**
-	     * Given the <code>Tag</code> representation of this custom
-	     * tag, return its string representation.
-	     * @param tag he <code>Tag</code> representation of this custom tag.
-	     * @return the string representation of the custom tag
-	     */
-	    public String toString(Tag tag) {
-	           int pos = tag.text().lastIndexOf(":");
-	           String fragmentIdentifier = "attribute-" + tag.text().substring(0, pos) + "_"
+ tag.text().substring(pos + 1);
-	           return "<a href=\"" + mOdfSpecPath + "#" + fragmentIdentifier + "\">" +
tag.text() + "</a>";
-	    }
-	    
-	    /**
-	     * This method should not be called since arrays of inline tags do not
-	     * exist.  Method should be used to convert this
-	     * inline tag to a string.
-	     * @param tags the array of <code>Tag</code>s representing of this custom
tag.
-	     * @return Nothing is returned, instead an <code>UnsupportedOperationException</code>
is being thrown.
-	     */
-	    public String toString(Tag[] tags) {
-	          throw new java.lang.UnsupportedOperationException("Arrays of inline tags do not
exist!");
-	    }
+	private static final String ODF_SPEC_PART1_PATH = "../../../../../../doc-files/OpenDocument-v1.2-part1.html";
+	private static final String ODF_SPEC_PART3_PATH = "../../../../../doc-files/OpenDocument-v1.2-part3.html";
+	private static String mOdfSpecPart1Path = null;
+	private static String mOdfSpecPart3Path = null;
+	private static Set<String> mNS_IN_PART3 = new HashSet<String>();
+
+	// initial attribute set which should be search in part3.
+	static {
+		mNS_IN_PART3.add("manifest");
+		mNS_IN_PART3.add("dsig");
+		mNS_IN_PART3.add("ds");
+	}
+
+	/*
+	 * FINDING THE ABSOLUTE PATH TO THE ODF SPEC PART1 and PART3 IN HTML: 
+	 * 1) Try to get the odfSpecPath from the Java System variable (ODF_SPEC_PATH) 
+	 * 2) Try to get the odfSpecPath from the environment variable (ODF_SPEC_PATH) 
+	 * 3) If both not worked, use the default path
+	 */
+	static {
+		mOdfSpecPart1Path = System.getProperty("ODF_SPEC_PART1_PATH");
+		if (mOdfSpecPart1Path == null) {
+			mOdfSpecPart1Path = System.getenv("ODF_SPEC_PATH");
+			if (mOdfSpecPart1Path == null) {
+				mOdfSpecPart1Path = ODF_SPEC_PART1_PATH;
+				LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by class declaration.");
+			} else {
+				LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by environment property
'ODF_SPEC_PATH'.");
+			}
+		} else {
+			LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by Java System property
'ODF_SPEC_PATH'.");
+		}
+		
+		mOdfSpecPart3Path = System.getProperty("ODF_SPEC_PART3_PATH");
+		if (mOdfSpecPart3Path == null) {
+			mOdfSpecPart3Path = System.getenv("ODF_SPEC_PATH");
+			if (mOdfSpecPart3Path == null) {
+				mOdfSpecPart3Path = ODF_SPEC_PART3_PATH;
+				LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by class declaration.");
+			} else {
+				LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by environment property
'ODF_SPEC_PATH'.");
+			}
+		} else {
+			LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by Java System property
'ODF_SPEC_PATH'.");
+		}
+
+	}
+
+	/**
+	 * @return the name of this custom tag.
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @return true since this tag can be used in a field doc comment
+	 */
+	public boolean inField() {
+		return true;
+	}
+
+	/**
+	 * @return true since this tag can be used in a constructor doc comment
+	 */
+	public boolean inConstructor() {
+		return true;
+	}
+
+	/**
+	 * @return true since this tag can be used in a method doc comment
+	 */
+	public boolean inMethod() {
+		return true;
+	}
+
+	/**
+	 * @return true since this tag can be used in an overview doc comment
+	 */
+	public boolean inOverview() {
+		return true;
+	}
+
+	/**
+	 * @return true since this tag can be used in a package doc comment
+	 */
+	public boolean inPackage() {
+		return true;
+	}
+
+	/**
+	 * @return true since this
+	 */
+	public boolean inType() {
+		return true;
+	}
+
+	/**
+	 * Will return true since this is an inline tag.
+	 * 
+	 * @return true since this is an inline tag.
+	 */
+
+	public boolean isInlineTag() {
+		return true;
+	}
+
+	/**
+	 * Register this Taglet.
+	 * 
+	 * @param tagletMap
+	 *            the map to register this tag to.
+	 */
+	public static void register(Map<String, Taglet> tagletMap) {
+		OdfAttributeTaglet tag = new OdfAttributeTaglet();
+		Taglet t = tagletMap.get(tag.getName());
+		if (t != null) {
+			tagletMap.remove(tag.getName());
+		}
+		tagletMap.put(tag.getName(), tag);
+	}
+
+	/**
+	 * Given the <code>Tag</code> representation of this custom tag, return its
+	 * string representation.
+	 * 
+	 * @param tag
+	 *            he <code>Tag</code> representation of this custom tag.
+	 * @return the string representation of the custom tag
+	 */
+	public String toString(Tag tag) {
+		int pos = tag.text().lastIndexOf(":");
+		String namespace = tag.text().substring(0, pos);
+		String name = tag.text().substring(pos + 1);
+		String mOdfSpecPath = mOdfSpecPart1Path;
+		if (mNS_IN_PART3.contains(namespace)) {
+			mOdfSpecPath = mOdfSpecPart3Path;
+		}
+		String fragmentIdentifier = "attribute-" + namespace + "_" + name;
+		return "<a href=\"" + mOdfSpecPath + "#" + fragmentIdentifier + "\">" + tag.text()
+ "</a>";
+	}
+
+	/**
+	 * This method should not be called since arrays of inline tags do not
+	 * exist. Method should be used to convert this inline tag to a string.
+	 * 
+	 * @param tags
+	 *            the array of <code>Tag</code>s representing of this custom
+	 *            tag.
+	 * @return Nothing is returned, instead an
+	 *         <code>UnsupportedOperationException</code> is being thrown.
+	 */
+	public String toString(Tag[] tags) {
+		throw new java.lang.UnsupportedOperationException("Arrays of inline tags do not exist!");
+	}
 
 }

Modified: incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java?rev=1293094&r1=1293093&r2=1293094&view=diff
==============================================================================
--- incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java
(original)
+++ incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfDatatypeTaglet.java
Fri Feb 24 05:56:39 2012
@@ -43,7 +43,7 @@ public class OdfDatatypeTaglet implement
 
 	private static final Logger LOG = Logger.getLogger(OdfDatatypeTaglet.class.getName());
 	private static final String NAME = "odf.datatype";
-	private static final String ODF_SPEC_PATH = "../../../../doc-files/OpenDocument-v1.2-cd05-part1.html";
+	private static final String ODF_SPEC_PATH = "../../../../doc-files/OpenDocument-v1.2-part1.html";
 	private static String mOdfSpecPath = null;
 
 	/* FINDING THE ABSOLUTE PATH TO THE ODF SPEC IN HTML:

Modified: incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java
URL: http://svn.apache.org/viewvc/incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java?rev=1293094&r1=1293093&r2=1293094&view=diff
==============================================================================
--- incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java
(original)
+++ incubator/odf/trunk/taglets/src/main/java/org/odftoolkit/odfdom/taglet/OdfElementTaglet.java
Fri Feb 24 05:56:39 2012
@@ -21,147 +21,186 @@
  */
 package org.odftoolkit.odfdom.taglet;
 
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.logging.Logger;
 
 import com.sun.javadoc.Tag;
 import com.sun.tools.doclets.Taglet;
 
-
 /**
- *	This class implements a custom taglet to the map the ODF element to the
- *  declaration of the ODF element in the OpenDocument specification.
- *
- *  The position of the OpenDocument specification in HTML can be provided using
- *  an environment variable or java system property, while the system property overrides
- *  the environment variable.
- *  In case nothing is been a default path within the JavaDoc doc-files directory is being
used.
- *
- *  For example the taglet <code>{&#64;odf.element text:span}</code> would
be resolved without variable settings to
- *  <code>JAVA_DOC_BASE/doc-files/OpenDocument-v1.2-cd05-part1.html#element-text_span</code>.
+ * This class implements a custom taglet to the map the ODF element to the
+ * declaration of the ODF element in the OpenDocument specification.
+ * 
+ * The position of the OpenDocument specification in HTML can be provided using
+ * an environment variable or java system property, while the system property
+ * overrides the environment variable. In case nothing is been a default path
+ * within the JavaDoc doc-files directory is being used.
+ * 
+ * For example the taglet <code>{&#64;odf.element text:span}</code> would
be
+ * resolved without variable settings to
+ * <code>JAVA_DOC_BASE/doc-files/OpenDocument-v1.2-part1.html#element-text_span</code>
+ * .
  */
- public class OdfElementTaglet implements Taglet {
- 
-	 private static final Logger LOG = Logger.getLogger(OdfElementTaglet.class.getName());
-	 private static final String NAME = "odf.element";
-	 private static final String ODF_SPEC_PATH = "../../../../../../doc-files/OpenDocument-v1.2-cd05-part1.html";
-	 private static String mOdfSpecPath = null;
-	  
-     /* FINDING THE ABSOLUTE PATH TO THE ODF SPEC IN HTML:
-      * 1) Try to get the odfSpecPath from the Java System variable (ODF_SPEC_PATH)
-      * 2) Try to get the odfSpecPath from the environemnt variable (ODF_SPEC_PATH)
-      * 3) If both not worked, use the default path
-      **/
-     static {
-         mOdfSpecPath = System.getProperty("ODF_SPEC_PATH");
-         if (mOdfSpecPath == null) {
-             mOdfSpecPath = System.getenv("ODF_SPEC_PATH");
-             if (mOdfSpecPath == null) {
-                 mOdfSpecPath = ODF_SPEC_PATH;
-                 LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by class declaration.");
-             } else {
-                 LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by environment property
'ODF_SPEC_PATH'.");
-             }
-         } else {
-             LOG.info("OdfSpecPath was set to " + mOdfSpecPath + " by Java System property
'ODF_SPEC_PATH'.");
-         }
-     }
-	     
-		/**
-		  * Return the name of this custom tag.
-		  */
-		public String getName() {
-		    return NAME;
+public class OdfElementTaglet implements Taglet {
+
+	private static final Logger LOG = Logger.getLogger(OdfElementTaglet.class.getName());
+	private static final String NAME = "odf.element";
+	private static final String ODF_SPEC_PART1_PATH = "../../../../../../doc-files/OpenDocument-v1.2-part1.html";
+	private static final String ODF_SPEC_PART3_PATH = "../../../../../doc-files/OpenDocument-v1.2-part3.html";
+	private static String mOdfSpecPart1Path = null;
+	private static String mOdfSpecPart3Path = null;
+	private static Set<String> mNS_IN_PART3 = new HashSet<String>();
+
+	// initial attribute set which should be search in part3.
+	static {
+		mNS_IN_PART3.add("manifest");
+		mNS_IN_PART3.add("dsig");
+		mNS_IN_PART3.add("ds");
+	}
+
+	/*
+	 * FINDING THE ABSOLUTE PATH TO THE ODF SPEC PART1 and PART3 IN HTML: 
+	 * 1) Try to get the odfSpecPath from the Java System variable (ODF_SPEC_PATH) 
+	 * 2) Try to get the odfSpecPath from the environment variable (ODF_SPEC_PATH)
+	 * 3) If both not worked, use the default path
+	 */
+	static {
+		mOdfSpecPart1Path = System.getProperty("ODF_SPEC_PART1_PATH");
+		if (mOdfSpecPart1Path == null) {
+			mOdfSpecPart1Path = System.getenv("ODF_SPEC_PATH");
+			if (mOdfSpecPart1Path == null) {
+				mOdfSpecPart1Path = ODF_SPEC_PART1_PATH;
+				LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by class declaration.");
+			} else {
+				LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by environment property
'ODF_SPEC_PATH'.");
+			}
+		} else {
+			LOG.info("OdfSpecPart1Path was set to " + mOdfSpecPart1Path + " by Java System property
'ODF_SPEC_PATH'.");
+		}
+
+		mOdfSpecPart3Path = System.getProperty("ODF_SPEC_PART3_PATH");
+		if (mOdfSpecPart3Path == null) {
+			mOdfSpecPart3Path = System.getenv("ODF_SPEC_PATH");
+			if (mOdfSpecPart3Path == null) {
+				mOdfSpecPart3Path = ODF_SPEC_PART3_PATH;
+				LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by class declaration.");
+			} else {
+				LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by environment property
'ODF_SPEC_PATH'.");
+			}
+		} else {
+			LOG.info("OdfSpecPart3Path was set to " + mOdfSpecPart3Path + " by Java System property
'ODF_SPEC_PATH'.");
 		}
-	    
-	    /**
-	     * @return true since this tag can be used in a field
-	     *         doc comment
-	     */
-	    public boolean inField() {
-	        return true;
-	    }
-
-	    /**
-	     * @return true since this tag can be used in a constructor
-	     *         doc comment
-	     */
-	    public boolean inConstructor() {
-	        return true;
-	    }
-	    
-	    /**
-	     * @return true since this tag can be used in a method
-	     *         doc comment
-	     */
-	    public boolean inMethod() {
-	        return true;
-	    }
-	    
-	    /**
-	     * @return true since this tag can be used in an overview
-	     *         doc comment
-	     */
-	    public boolean inOverview() {
-	        return true;
-	    }
-
-	    /**
-	     * @return true since this tag can be used in a package
-	     *         doc comment
-	     */
-	    public boolean inPackage() {
-	        return true;
-	    }
-
-	    /**
-	     * @return true since this 
-	     */
-	    public boolean inType() {
-	        return true;
-	    }
-	    
-	    /**
-	     * Will return true since this is an inline tag.
-	     * @return true since this is an inline tag.
-	     */
-	    
-	    public boolean isInlineTag() {
-	        return true;
-	    }
-	    
-	    /**
-	     * Register this Taglet.
-	     * @param tagletMap  the map to register this tag to.
-	     */
-	    public static void register(Map<String, Taglet> tagletMap) {
-	    	OdfElementTaglet tag = new OdfElementTaglet();
-	           Taglet t = tagletMap.get(tag.getName());
-	           if (t != null) {
-	                tagletMap.remove(tag.getName());
-	            }
-	            tagletMap.put(tag.getName(), tag);
-	    }
-
-	    /**
-	     * Given the <code>Tag</code> representation of this custom
-	     * tag, return its string representation.
-	     * @param tag he <code>Tag</code> representation of this custom tag.
-	     */
-	    public String toString(Tag tag) {
-		    int pos = tag.text().lastIndexOf(":");
-		    String fragmentIdentifier = "element-" + tag.text().substring(0, pos) + "_" + tag.text().substring(pos
+ 1);
-		    return "<a href=\"" + mOdfSpecPath + "#" + fragmentIdentifier + "\">" + tag.text()
+ "</a>";
-	    }
-	    
-	    /**
-	     * This method should not be called since arrays of inline tags do not
-	     * exist.  Method  should be used to convert this
-	     * inline tag to a string.
-	     * @param tags the array of <code>Tag</code>s representing of this custom
tag.
-	     */
-	    public String toString(Tag[] tags) {
-	        return null;
-	    }
+
+	}
+
+	/**
+	 * Return the name of this custom tag.
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @return true since this tag can be used in a field doc comment
+	 */
+	public boolean inField() {
+		return true;
+	}
+
+	/**
+	 * @return true since this tag can be used in a constructor doc comment
+	 */
+	public boolean inConstructor() {
+		return true;
+	}
+
+	/**
+	 * @return true since this tag can be used in a method doc comment
+	 */
+	public boolean inMethod() {
+		return true;
+	}
+
+	/**
+	 * @return true since this tag can be used in an overview doc comment
+	 */
+	public boolean inOverview() {
+		return true;
+	}
+
+	/**
+	 * @return true since this tag can be used in a package doc comment
+	 */
+	public boolean inPackage() {
+		return true;
+	}
+
+	/**
+	 * @return true since this
+	 */
+	public boolean inType() {
+		return true;
+	}
+
+	/**
+	 * Will return true since this is an inline tag.
+	 * 
+	 * @return true since this is an inline tag.
+	 */
+
+	public boolean isInlineTag() {
+		return true;
+	}
+
+	/**
+	 * Register this Taglet.
+	 * 
+	 * @param tagletMap
+	 *            the map to register this tag to.
+	 */
+	public static void register(Map<String, Taglet> tagletMap) {
+		OdfElementTaglet tag = new OdfElementTaglet();
+		Taglet t = tagletMap.get(tag.getName());
+		if (t != null) {
+			tagletMap.remove(tag.getName());
+		}
+		tagletMap.put(tag.getName(), tag);
+	}
+
+	/**
+	 * Given the <code>Tag</code> representation of this custom tag, return its
+	 * string representation.
+	 * 
+	 * @param tag
+	 *            he <code>Tag</code> representation of this custom tag.
+	 */
+	public String toString(Tag tag) {
+		int pos = tag.text().lastIndexOf(":");
+		String namespace = tag.text().substring(0, pos);
+		String name = tag.text().substring(pos + 1);
+		String mOdfSpecPath = mOdfSpecPart1Path;
+		if (mNS_IN_PART3.contains(namespace)) {
+			mOdfSpecPath = mOdfSpecPart3Path;
+		}
+		String fragmentIdentifier = "element-" + namespace + "_" + name;
+		if("ds:Signature".equals(tag.text())){
+			fragmentIdentifier = "element2-xmldsig_Signature";
+		}
+		return "<a href=\"" + mOdfSpecPath + "#" + fragmentIdentifier + "\">" + tag.text()
+ "</a>";
+	}
+
+	/**
+	 * This method should not be called since arrays of inline tags do not
+	 * exist. Method should be used to convert this inline tag to a string.
+	 * 
+	 * @param tags
+	 *            the array of <code>Tag</code>s representing of this custom
+	 *            tag.
+	 */
+	public String toString(Tag[] tags) {
+		return null;
+	}
 
 }



Mime
View raw message