1 package jodd.taglet; 2 3 import java.util.Map; 4 5 import com.sun.javadoc.Tag; 6 import com.sun.tools.doclets.Taglet; 7 8 13 public class ToDoTaglet implements Taglet { 14 15 private static final String NAME = "2do"; 16 private static final String HEADER = "To Do:"; 17 private static final String CSS_CLASS = "todo"; 18 19 22 public String getName() { 23 return NAME; 24 } 25 26 33 public boolean inField() { 34 return true; 35 } 36 37 44 public boolean inConstructor() { 45 return true; 46 } 47 48 55 public boolean inMethod() { 56 return true; 57 } 58 59 66 public boolean inOverview() { 67 return true; 68 } 69 70 77 public boolean inPackage() { 78 return true; 79 } 80 81 88 public boolean inType() { 89 return true; 90 } 91 92 97 98 public boolean isInlineTag() { 99 return false; 100 } 101 102 107 public static void register(Map tagletMap) { 108 ToDoTaglet tag = new ToDoTaglet(); 109 Taglet t = (Taglet) tagletMap.get(tag.getName()); 110 if (t != null) { 111 tagletMap.remove(tag.getName()); 112 } 113 tagletMap.put(tag.getName(), tag); 114 } 115 116 117 123 public String toString(Tag tag) { 124 return getString(tag.text()); 125 } 126 127 133 public String toString(Tag[] tags) { 134 if (tags.length == 0) { 135 return null; 136 } 137 String result = new String(); 138 for (int i = 0; i < tags.length; i++) { 139 if (i > 0) { 140 result += "</dd>\n<dd class=\"" + CSS_CLASS + "\">"; 141 } 142 result += tags[i].text(); 143 } 144 return getString(result); 145 } 146 147 148 153 private String getString(String tagtext) { 154 String result = "\n<dt class=\"" + CSS_CLASS + "\">" + HEADER; 155 result += "<dd class=\"" + CSS_CLASS + "\">"; 156 result += "<span class=\"" + CSS_CLASS + "\">"; 157 result += tagtext; 158 result += "</span></dd></dt>\n"; 159 return result; 160 } 161 162 } 163 | Popular Tags |