ICU-11918 Reverted accidentally modified ICUTagletAdapter.java in the previous commit.

X-SVN-Rev: 37978
This commit is contained in:
Yoshito Umaoka 2015-09-22 00:51:19 +00:00
parent e5105c7f84
commit 121c209819

View File

@ -8,40 +8,51 @@ package com.ibm.icu.dev.tool.docs;
import com.sun.javadoc.Doc;
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.formats.html.markup.RawHtml;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletOutput;
import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter;
/**
* The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API.
* The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs.
*
* This adapter supports the v7 and earlier JavaDoc API
* This adapter supports the v8 JavaDoc API
*/
public abstract class ICUTagletAdapter implements Taglet {
public abstract String toString(Tag tag);
public abstract String toString(Tag[] tags);
public TagletOutput getTagletOutput(Tag tag, TagletWriter writer)
throws IllegalArgumentException {
public Content getTagletOutput(Tag tag, TagletWriter writer)
throws IllegalArgumentException {
TagletOutput out = writer.getTagletOutputInstance();
out.setOutput(toString(tag));
return out;
// addContext doesn't except nulls so filter them out
String encodedText = toString(tag);
if(encodedText == null) return null;
Content out = writer.getOutputInstance();
out.addContent(new RawHtml(encodedText));
return out;
}
public Content getTagletOutput(Doc holder, TagletWriter writer)
throws IllegalArgumentException {
Content out = writer.getOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
}
public TagletOutput getTagletOutput(Doc holder, TagletWriter writer)
throws IllegalArgumentException {
// addContext doesn't except nulls so filter them out
String encodedText = toString(tags[0]);
if(encodedText == null) return null;
TagletOutput out = writer.getTagletOutputInstance();
Tag[] tags = holder.tags(getName());
if (tags.length == 0) {
return null;
}
out.setOutput(toString(tags[0]));
return out;
}
out.addContent(new RawHtml(encodedText));
return out;
}
}