Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/arranger/jarl/util/doclet/JarlTaglet.java


1   package com.arranger.jarl.util.doclet;
2   
3   import com.sun.tools.doclets.Taglet;
4   import com.sun.javadoc.Tag;
5   
6   import java.util.Map;
7   
8   /**
9    * JarlTaglet created on Mar 14, 2003
10   */
11  public abstract class JarlTaglet implements Taglet {
12  
13      protected static class StrokeTaglet extends JarlTaglet {
14  
15          public String getName() {
16              return "strokeAttribute";
17          }
18      }
19  
20      protected static class TraitTaglet extends JarlTaglet {
21  
22          public String getName() {
23              return "traitAttribute";
24          }
25      }
26  
27      protected static class WidgetTaglet extends JarlTaglet {
28  
29          public String getName() {
30              return "widgetAttribute";
31          }
32      }
33  
34      protected static class FilterTaglet extends JarlTaglet {
35  
36          public String getName() {
37              return "filterAttribute";
38          }
39      }
40  
41      public boolean inField() {
42          return true;
43      }
44  
45      public boolean inConstructor() {
46          return true;
47      }
48  
49      public boolean inMethod() {
50          return true;
51      }
52  
53      public boolean inOverview() {
54          return true;
55      }
56  
57      public boolean inPackage() {
58          return true;
59      }
60  
61      public boolean inType() {
62          return true;
63      }
64  
65      public boolean isInlineTag() {
66          return false;
67      }
68  
69      /**
70       * Register this Taglet.
71       * @param tagletMap  the map to register this tag to.
72       */
73      public static void register(Map tagletMap) {
74          Taglet taglet = new StrokeTaglet();
75          tagletMap.put(taglet.getName(), taglet);
76          taglet = new TraitTaglet();
77          tagletMap.put(taglet.getName(), taglet);
78          taglet = new WidgetTaglet();
79          tagletMap.put(taglet.getName(), taglet);
80          taglet = new FilterTaglet();
81          tagletMap.put(taglet.getName(), taglet);
82      }
83  
84      /**
85       * Given the <code>Tag</code> representation of this custom
86       * tag, return its string representation.
87       * @param tag   the <code>Tag</code> representation of this custom tag.
88       */
89      public String toString(Tag tag) {
90          JarlAttributeDef jarlAttributeDef = JarlAttributeDef.getAttributeDef(tag);
91  
92          return "<DT><B>" + jarlAttributeDef.getName() + "</B><DD>"
93              + "<ul>"
94              + "<li>" + jarlAttributeDef.getDescription() + "</li>"
95              + "<li>" + jarlAttributeDef.getType() + "</li>"
96              + "</ul></DD>\n";
97      }
98  
99      /**
100      * Given an array of <code>Tag</code>s representing this custom
101      * tag, return its string representation.
102      * @param tags  the array of <code>Tag</code>s representing of this custom tag.
103      */
104     public String toString(Tag[] tags) {
105         StringBuffer stringBuffer = new StringBuffer();
106         for (int index = 0; index < tags.length; index++) {
107             stringBuffer.append(toString(tags[index]));
108         }
109         return stringBuffer.toString();
110     }
111 }