1 /* gnu.classpath.tools.taglets.SinceTaglet
2 Copyright (C) 2001 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 package gnu
.classpath
.tools
.taglets
;
25 import com
.sun
.tools
.doclets
.Taglet
;
27 import com
.sun
.javadoc
.Tag
;
29 import gnu
.classpath
.tools
.doclets
.InlineTagRenderer
;
32 * The default Taglet which handles since information.
34 * @author Julian Scheid (julian@sektor37.de)
36 public class SinceTaglet
implements GnuExtendedTaglet
{
38 private static final String NAME
= "since";
39 private static final String HEADER
= "Since:";
41 private static boolean enabled
= true;
43 private InlineTagRenderer inlineTagRenderer
;
45 public SinceTaglet(InlineTagRenderer inlineTagRenderer
)
47 this.inlineTagRenderer
= inlineTagRenderer
;
50 public String
getName() {
54 public boolean inField() {
58 public boolean inConstructor() {
62 public boolean inMethod() {
66 public boolean inOverview() {
70 public boolean inPackage() {
74 public boolean inType() {
78 public boolean isInlineTag() {
82 public String
toString(Tag tag
) {
83 // should raise assertion
85 return toString(new Tag
[] { tag
});
92 public String
toString(Tag
[] tags
) {
93 // should raise assertion
94 return toString(tags
, null);
97 public String
toString(Tag tag
, TagletContext context
)
102 public String
toString(Tag
[] tags
, TagletContext context
)
104 if (!enabled
|| tags
.length
== 0) {
108 boolean haveValidTag
= false;
109 for (int i
= 0; i
< tags
.length
&& !haveValidTag
; ++i
) {
110 if (tags
[i
].text().length() > 0) {
116 StringBuffer result
= new StringBuffer();
117 result
.append("<dl class=\"tag list\">");
118 result
.append("<dt class=\"tag section header\"><b>");
119 result
.append(HEADER
);
120 result
.append("</b></dt>");
121 for (int i
= 0; i
< tags
.length
; ++i
) {
122 if (tags
[i
].text().length() > 0) {
123 result
.append("<dd>");
124 result
.append(inlineTagRenderer
.renderInlineTags(tags
[i
].inlineTags(), context
));
125 result
.append("</dd>");
128 result
.append("</dl>");
129 return result
.toString();
138 * Enables/disables this taglet.
140 public static void setTagletEnabled(boolean enabled
)
142 SinceTaglet
.enabled
= enabled
;