From: <jen...@us...> - 2007-08-24 14:17:39
|
Revision: 53 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=53&view=rev Author: jenslehmann Date: 2007-08-24 07:17:37 -0700 (Fri, 24 Aug 2007) Log Message: ----------- added ToDo taglet Modified Paths: -------------- trunk/javadoc.xml Added Paths: ----------- trunk/src/dl-learner/org/dllearner/utilities/ToDoTaglet.java Modified: trunk/javadoc.xml =================================================================== --- trunk/javadoc.xml 2007-08-24 13:00:57 UTC (rev 52) +++ trunk/javadoc.xml 2007-08-24 14:17:37 UTC (rev 53) @@ -22,7 +22,8 @@ linksource="true" bottom="DL-Learner is licenced under the terms of the GNU General Public License.<br />Copyright &#169; 2007 Jens Lehmann" Encoding="ISO-8859-1" - windowtitle="DL-Learner Javadoc" - /> + windowtitle="DL-Learner Javadoc"> + <taglet name="org.dllearner.utilities.ToDoTaglet" path="classes" /> + </javadoc> </target> </project> Added: trunk/src/dl-learner/org/dllearner/utilities/ToDoTaglet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/ToDoTaglet.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/utilities/ToDoTaglet.java 2007-08-24 14:17:37 UTC (rev 53) @@ -0,0 +1,151 @@ +package org.dllearner.utilities; + +import java.util.Map; + +import com.sun.javadoc.Tag; +import com.sun.tools.doclets.Taglet; + +/** + * Small taglet for showing todo-markers in Javadoc-runs. + * + * Parts of the code are taken from the JDK Javadoc. + * + * @author Jens Lehmann + * + */ +public class ToDoTaglet implements Taglet { + + private static final String NAME = "todo"; + private static final String HEADER = "To Do:"; + + /** + * Return the name of this custom tag. + */ + public String getName() { + return NAME; + } + + /** + * Will return true since <code>@todo</code> + * can be used in field documentation. + * @return true since <code>@todo</code> + * can be used in field documentation and false + * otherwise. + */ + public boolean inField() { + return true; + } + + /** + * Will return true since <code>@todo</code> + * can be used in constructor documentation. + * @return true since <code>@todo</code> + * can be used in constructor documentation and false + * otherwise. + */ + public boolean inConstructor() { + return true; + } + + /** + * Will return true since <code>@todo</code> + * can be used in method documentation. + * @return true since <code>@todo</code> + * can be used in method documentation and false + * otherwise. + */ + public boolean inMethod() { + return true; + } + + /** + * Will return true since <code>@todo</code> + * can be used in method documentation. + * @return true since <code>@todo</code> + * can be used in overview documentation and false + * otherwise. + */ + public boolean inOverview() { + return true; + } + + /** + * Will return true since <code>@todo</code> + * can be used in package documentation. + * @return true since <code>@todo</code> + * can be used in package documentation and false + * otherwise. + */ + public boolean inPackage() { + return true; + } + + /** + * Will return true since <code>@todo</code> + * can be used in type documentation (classes or interfaces). + * @return true since <code>@todo</code> + * can be used in type documentation and false + * otherwise. + */ + public boolean inType() { + return true; + } + + /** + * Will return false since <code>@todo</code> + * is not an inline tag. + * @return false since <code>@todo</code> + * is not an inline tag. + */ + + public boolean isInlineTag() { + return false; + } + + /** + * Register this Taglet. + * @param tagletMap the map to register this tag to. + */ + @SuppressWarnings({"unchecked"}) + public static void register(Map tagletMap) { + ToDoTaglet tag = new ToDoTaglet(); + Taglet t = (Taglet) 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 the <code>Tag</code> representation of this custom tag. + */ + public String toString(Tag tag) { + return "<DT><B>" + HEADER + "</B><DD>" + + "<table cellpadding=2 cellspacing=0><tr><td bgcolor=\"#DC8080\">" + + tag.text() + + "</td></tr></table></DD>\n"; + } + + /** + * Given an array of <code>Tag</code>s representing this custom + * tag, return its string representation. + * @param tags the array of <code>Tag</code>s representing of this custom tag. + */ + public String toString(Tag[] tags) { + if (tags.length == 0) { + return null; + } + String result = "\n<DT><B>" + HEADER + "</B><DD>"; + result += "<table cellpadding=2 cellspacing=0><tr><td bgcolor=\"#DC8080\">"; + for (int i = 0; i < tags.length; i++) { + if (i > 0) { + result += ", "; + } + result += tags[i].text(); + } + return result + "</td></tr></table></DD>\n"; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |