libjava/ChangeLog:
[official-gcc.git] / libjava / classpath / tools / gnu / classpath / tools / taglets / SinceTaglet.java
blobdac68a8c46a37f6cc9100b9d0d85b48b2cbe7e62
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)
9 any later version.
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
19 02111-1307 USA. */
21 package gnu.classpath.tools.taglets;
23 import java.util.Map;
25 import com.sun.tools.doclets.Taglet;
27 import com.sun.javadoc.Tag;
29 import gnu.classpath.tools.doclets.InlineTagRenderer;
31 /**
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() {
51 return NAME;
54 public boolean inField() {
55 return true;
58 public boolean inConstructor() {
59 return true;
62 public boolean inMethod() {
63 return true;
66 public boolean inOverview() {
67 return true;
70 public boolean inPackage() {
71 return true;
74 public boolean inType() {
75 return true;
78 public boolean isInlineTag() {
79 return false;
82 public String toString(Tag tag) {
83 // should raise assertion
84 if (enabled) {
85 return toString(new Tag[] { tag });
87 else {
88 return null;
92 public String toString(Tag[] tags) {
93 // should raise assertion
94 return toString(tags, null);
97 public String toString(Tag tag, TagletContext context)
99 return null;
102 public String toString(Tag[] tags, TagletContext context)
104 if (!enabled || tags.length == 0) {
105 return null;
107 else {
108 boolean haveValidTag = false;
109 for (int i = 0; i < tags.length && !haveValidTag; ++i) {
110 if (tags[i].text().length() > 0) {
111 haveValidTag = true;
115 if (haveValidTag) {
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();
131 else {
132 return null;
138 * Enables/disables this taglet.
140 public static void setTagletEnabled(boolean enabled)
142 SinceTaglet.enabled = enabled;