Skip to content

Commit

Permalink
Merged the toString(Tag) and expand(Tag) methods, and complete all ou…
Browse files Browse the repository at this point in the history
…tput

Change-Id: I25383304ea41e5232c1cc428f759a67f26e22101
  • Loading branch information
egonw committed Aug 6, 2012
1 parent 2f3b542 commit 1dc58bf
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/main/net/sf/cdk/tools/doclets/CDKIOOptionsTaglet.java
Expand Up @@ -80,19 +80,6 @@ public static void register(Map<String, CDKIOOptionsTaglet> tagletMap) {
}

public String toString(Tag tag) {
return "<DT><B>IO options: </B><DD>"
+ expand(tag) + "</DD>\n";
}

public String toString(Tag[] tags) {
if (tags.length == 0) {
return null;
} else {
return toString(tags[0]);
}
}

private String expand(Tag tag) {
// create a table with IOOptions
StringBuffer tableContent = new StringBuffer();
SourcePosition file = tag.position();
Expand All @@ -105,20 +92,35 @@ private String expand(Tag tag) {
Object ioInstance = ioClass.newInstance();
if (ioInstance instanceof IChemObjectIO) {
IChemObjectIO objectIO = (IChemObjectIO)ioInstance;
tableContent.append("<table>");
if (objectIO.getIOSettings().length == 0) return "";
tableContent.append("<table>");
for (IOSetting setting : objectIO.getIOSettings()) {
tableContent.append("<tr>");
tableContent.append("<td>" + setting.getName() + "</td>");
tableContent.append("<td></td>");
tableContent.append("<td><b>" + setting.getName() + "</b></td>");
tableContent.append(
"<td>" + setting.getQuestion() +
" [Default: " + setting.getDefaultSetting() + "]</td>"
);
tableContent.append("</tr>");
}
tableContent.append("</table>");
} else {
return "";
}
} catch (Exception e) {
e.printStackTrace();
return "";
}
return tableContent.toString();
return "<DT><B>IO options: </B><DD>"
+ tableContent.toString() + "</DD>\n";
}

public String toString(Tag[] tags) {
if (tags.length == 0) {
return null;
} else {
return toString(tags[0]);
}
}

}

0 comments on commit 1dc58bf

Please sign in to comment.