KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyBuild > javadoc > FormatIdTaglet


1 /*
2
3    Derby - Class org.apache.derbyBuild.javadoc.FormatIdTaglet
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21 package org.apache.derbyBuild.javadoc;
22
23 import com.sun.tools.doclets.Taglet;
24 import com.sun.javadoc.*;
25 import java.util.Map JavaDoc;
26
27 public class FormatIdTaglet implements Taglet {
28
29     private String JavaDoc NAME = "format_id";
30     private String JavaDoc ROWNAME = "Format ID";
31
32     /**
33      * Returns the name of this taglet
34      * @return NAME
35      */

36     public String JavaDoc getName() {
37         return NAME;
38     }
39
40     /**
41      * format_id not expected to be used in field documentation.
42      * @return false
43      */

44     public boolean inField() {
45         return false;
46     }
47
48
49     /**
50      * format_id not expected to be used in constructor documentation.
51      * @return false
52      */

53     public boolean inConstructor() {
54         return false;
55     }
56
57     /**
58      * format_id not expected to be used in method documentation.
59      * @return false
60      */

61     public boolean inMethod() {
62         return false;
63     }
64
65     /**
66      * format_id can be used in overview documentation.
67      * @return true
68      */

69     public boolean inOverview() {
70         return true;
71     }
72
73     /**
74      * format_id can be used in package documentation.
75      * @return true
76      */

77     public boolean inPackage() {
78         return true;
79     }
80
81     /**
82      * format_id can be used in type documentation.
83      * @return true
84      */

85     public boolean inType() {
86         return true;
87     }
88
89     /**
90      * format_id is not an inline tag.
91      * @return false
92      */

93     public boolean isInlineTag() {
94         return false;
95     }
96
97     /**
98      * Register this Taglet.
99      * @param tagletMap
100      */

101     public static void register(Map JavaDoc tagletMap) {
102        FormatIdTaglet tag = new FormatIdTaglet();
103        Taglet t = (Taglet) tagletMap.get(tag.getName());
104        if (t != null) {
105            tagletMap.remove(tag.getName());
106        }
107        tagletMap.put(tag.getName(), tag);
108     }
109
110     /**
111      * Embed the contents of the format_id tag as a row
112      * in the disk format table.
113      * @param tag The tag to embed to the disk format the table.
114      */

115     public String JavaDoc toString(Tag tag) {
116         return "\n<dt><table cellpadding=2 cellspacing=2><tr><td>" + ROWNAME + "</td>"
117                + "<td>" + tag.text() + "</td></tr>\n";
118     }
119
120     /**
121      * Embed multiple format_id tags as cells in the disk format table.
122      * @param tags An array of tags to add to the disk format table.
123      */

124     public String JavaDoc toString(Tag[] tags) {
125         if (tags.length == 0) {
126             return null;
127         }
128         String JavaDoc result = "<table cellpadding=2 cellspacing=2><tr><td>" + ROWNAME + "</td><td>" ;
129         for (int i = 0; i < tags.length; i++) {
130             if (i > 0) {
131                 result += "";
132             }
133             result += tags[i].text() + "</td></tr>";
134         }
135         return result + "\n";
136     }
137 }
138
139
Popular Tags