You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by bo...@apache.org on 2014/02/24 04:04:34 UTC
git commit: Made parameter table in javadocs visually compatible with
Java 7 style; put events into a similar table
Repository: tapestry-5
Updated Branches:
refs/heads/master a18373ed4 -> 1ab4d2c78
Made parameter table in javadocs visually compatible with Java 7 style;
put events into a similar table
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/1ab4d2c7
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/1ab4d2c7
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/1ab4d2c7
Branch: refs/heads/master
Commit: 1ab4d2c786101c33ec522eddc1feefa89927f592
Parents: a18373e
Author: Bob Harner <bo...@apache.org>
Authored: Sun Feb 23 22:00:50 2014 -0500
Committer: Bob Harner <bo...@apache.org>
Committed: Sun Feb 23 22:00:50 2014 -0500
----------------------------------------------------------------------
src/javadoc/stylesheet7.css | 28 +++++++-
.../tapestry5/javadoc/TapestryDocTaglet.java | 67 +++++++++++---------
2 files changed, 63 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1ab4d2c7/src/javadoc/stylesheet7.css
----------------------------------------------------------------------
diff --git a/src/javadoc/stylesheet7.css b/src/javadoc/stylesheet7.css
index 0f3be7d..c84f9b2 100644
--- a/src/javadoc/stylesheet7.css
+++ b/src/javadoc/stylesheet7.css
@@ -341,7 +341,7 @@ table tr td dl, table tr td dl dt, table tr td dl dd {
/*
Table styles
*/
-.contentContainer table, .classUseContainer table, .constantValuesContainer table {
+.contentContainer table, .classUseContainer table, .constantValuesContainer table .parameters table {
border-bottom:1px solid #9eadc0;
width:100%;
}
@@ -409,7 +409,7 @@ ul.blockList ul.blockList li.blockList table {
text-align:left;
padding:3px 3px 3px 7px;
}
-th.colFirst, th.colLast, th.colOne, .constantValuesContainer th {
+th.colFirst, th.colLast, th.colOne, .constantValuesContainer th, .parameters th {
background:#dee3e9;
border-top:1px solid #9eadc0;
border-bottom:1px solid #9eadc0;
@@ -474,4 +474,26 @@ h1.hidden {
}
.strong {
font-weight:bold;
-}
\ No newline at end of file
+}
+div.description table.parameters {
+ border-collapse: collapse;
+ border-bottom: 1px solid #ccc;
+ margin-bottom: 2em;
+}
+table.parameters tr td {
+ border: none;
+ border-left: 1px solid #ccc;
+ border-right: 1px solid #ccc;
+}
+table.parameters tr.values td {
+ border-bottom: none;
+ color: brown;
+}
+div.description table.parameters td.colFirst {
+ color: black;
+ font-weight: bold;
+ vertical-align: top;
+}
+table.parameters td.description {
+ border-top: none;
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1ab4d2c7/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java
----------------------------------------------------------------------
diff --git a/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java b/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java
index af9a0e6..c468847 100644
--- a/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java
+++ b/tapestry-javadoc/src/main/java/org/apache/tapestry5/javadoc/TapestryDocTaglet.java
@@ -147,7 +147,7 @@ public class TapestryDocTaglet implements Taglet, ClassDescriptionSource
}
}
- private void element(Writer writer, String elementName, String text) throws IOException
+ private void writeElement(Writer writer, String elementName, String text) throws IOException
{
writer.write(String.format("<%s>%s</%1$s>", elementName,
InternalUtils.isBlank(text) ? " " : text));
@@ -166,34 +166,33 @@ public class TapestryDocTaglet implements Taglet, ClassDescriptionSource
return;
writer.write("</dl>"
- + "<table width='100%' cellspacing='0' cellpadding='3' border='1' class='parameters'>"
- + "<thead><tr class='TableHeadingColor' bgcolor='#CCCCFF'>"
- + "<th align='left' colspan='5'>"
- + "<font size='+2'><b>Component Parameters</b></font>"
- + "</th></tr>"
+ + "<table class='parameters'>"
+ + "<caption><span>Component Parameters</span><span class='tabEnd'> </span>"
+ "<tr class='columnHeaders'>"
- + "<th>Name</th><th>Type</th><th>Flags</th><th>Default</th>"
- + "<th>Default Prefix</th>"
- + "</tr></thead><tbody>");
+ + "<th class='colFirst'>Name</th><th>Type</th><th>Flags</th><th>Default</th>"
+ + "<th class='colLast'>Default Prefix</th>"
+ + "</tr><tbody>");
+ int toggle = 0;
for (String name : InternalUtils.sortedKeys(cd.parameters))
{
ParameterDescription pd = cd.parameters.get(name);
- writerParameter(pd, writer);
+ writerParameter(pd, alternateCssClass(toggle++), writer);
}
writer.write("</tbody></table></dd>");
}
- private void writerParameter(ParameterDescription pd, Writer writer) throws IOException
+ private void writerParameter(ParameterDescription pd, String rowClass, Writer writer) throws IOException
{
- writer.write("<td><strong>");
+ writer.write("<tr class='values " + rowClass + "'>");
+ writer.write("<td rowspan='2' class='colFirst'>");
writer.write(pd.name);
- writer.write("</strong></td>");
+ writer.write("</td>");
- element(writer, "td", addWordBreaks(shortenClassName(pd.type)));
+ writeElement(writer, "td", addWordBreaks(shortenClassName(pd.type)));
List<String> flags = CollectionFactory.newList();
@@ -216,9 +215,9 @@ public class TapestryDocTaglet implements Taglet, ClassDescriptionSource
flags.add("Since " + pd.since);
}
- element(writer, "td", InternalUtils.join(flags));
- element(writer, "td", addWordBreaks(pd.defaultValue));
- element(writer, "td", pd.defaultPrefix);
+ writeElement(writer, "td", InternalUtils.join(flags));
+ writeElement(writer, "td", addWordBreaks(pd.defaultValue));
+ writeElement(writer, "td class='colLast'", pd.defaultPrefix);
writer.write("</tr>");
@@ -227,37 +226,47 @@ public class TapestryDocTaglet implements Taglet, ClassDescriptionSource
if (description.length() > 0)
{
- writer.write("<tr>");
- writer.write("<td colspan='5' class='parameter-description'>");
+ writer.write("<tr class='" + rowClass + "'>");
+ writer.write("<td colspan='4' class='description colLast'>");
writer.write(description);
writer.write("</td>");
writer.write("</tr>");
}
}
+ /**
+ * Return alternating CSS class names based on the input, which the caller
+ * should increment with each call.
+ */
+ private String alternateCssClass(int num) {
+ return num % 2 == 0 ? "altColor" : "rowColor";
+ }
+
private void writeEvents(ClassDescription cd, Writer writer) throws IOException
{
if (cd.events.isEmpty())
return;
- writer.write("<p><table width='100%' cellspacing='0' cellpadding='3' border='1' class='parameters'>"
- + "<thead><tr class='TableHeadingColor' bgcolor='#CCCCFF'>"
- + "<th align='left'>"
- + "<font size='+2'><b>Events:</b></font></th></tr></thead></table></p><dl>");
+ writer.write("<p><table class='parameters'>"
+ + "<caption><span>Component Events</span><span class='tabEnd'> </span>"
+ + "<tr class='columnHeaders'>"
+ + "<th class='colFirst'>Name</th><th class='colLast'>Description</th>"
+ + "</tr><tbody>");
+ int toggle = 0;
for (String name : InternalUtils.sortedKeys(cd.events))
{
- element(writer, "dt", name);
+ writer.write("<tr class='" + alternateCssClass(toggle++) + "'>");
+ writeElement(writer, "td class='colFirst'", name);
String value = cd.events.get(name);
- if (value.length() > 0)
- {
- element(writer, "dd", value);
- }
+ writeElement(writer, "td class='colLast'", value);
+
+ writer.write("</tr>");
}
- writer.write("</dl>");
+ writer.write("</table></p>");
}
/**