tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bobhar...@apache.org
Subject git commit: Fixed TAP5-2013: "Parameters" table often too wide in component javadocs Also fixed broken tapestry.png image on JavaDoc index page
Date Sun, 21 Oct 2012 14:57:18 GMT
Updated Branches:
  refs/heads/5.3 742fac0e2 -> aac42f1fd


Fixed TAP5-2013: "Parameters" table often too wide in component javadocs
Also fixed broken tapestry.png image on JavaDoc index page

Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/aac42f1f
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/aac42f1f
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/aac42f1f

Branch: refs/heads/5.3
Commit: aac42f1fde8d8b16e45ed96bc3262ac5646cdb82
Parents: 742fac0
Author: bharner <bobharner@apache.org>
Authored: Sun Oct 21 10:56:52 2012 -0400
Committer: bharner <bobharner@apache.org>
Committed: Sun Oct 21 10:56:52 2012 -0400

----------------------------------------------------------------------
 src/javadoc/stylesheet.css                         |   47 ++++++++--
 .../tapestry5/javadoc/TapestryDocTaglet.java       |   66 +++++++++++----
 2 files changed, 88 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/aac42f1f/src/javadoc/stylesheet.css
----------------------------------------------------------------------
diff --git a/src/javadoc/stylesheet.css b/src/javadoc/stylesheet.css
index c120a86..f478c88 100644
--- a/src/javadoc/stylesheet.css
+++ b/src/javadoc/stylesheet.css
@@ -28,7 +28,7 @@ a:hover
 /* Headings */
 h1
 {
-     background: url(images/tapestry.png) no-repeat;
+     background: url(tapestry.png) no-repeat;
         font-size:28px;
         color:#007c00;
         padding: 2.0em;
@@ -36,7 +36,12 @@ h1
 h1,h2,h3 {
         color: #569D2F;
 }
- 
+
+wbr:after
+{
+        content: "\00200B";  /* IE fix */
+}
+
 /* Table colors */
 
 table
@@ -62,13 +67,41 @@ th
 .TableHeadingColor th
 {
         background-color: #569D2F;
-        background-image: url(doc-files/th-background.png);
         background-repeat: repeat-x;
         color:#fff;
         font-size:14px;
         height:26px;
 }
- 
+.TableHeadingColor th font[size="+2"] 
+{ 
+        font-size: 10pt; 
+}
+table.parameters tbody th 
+{
+        background: #F4F4F4;
+        color: #333;
+        border: 1px dotted #ccc;
+        font-weight: normal;
+}
+table.parameters thead tr.columnHeaders th 
+{
+	   background: #e6e6e6; 
+	   color: #6e6e6e; 
+       border-left: 1px dotted #999;
+       border-right: 1px dotted #999;
+}
+body > dt > b 
+{ 
+        display: block; 
+        padding: 0.3em 0 0 0.3em; 
+        margin-top: 1em; 
+        background: #569D2F; 
+        color: #fff; 
+        border: 1px solid black;
+        font-size: 14px; 
+        height: 26px; 
+}
+
 .TableSubHeadingColor  
 {
         background: #f7ffee;
@@ -169,9 +202,3 @@ tr.TableRowColor:hover
 {
         border:none;
 }
- 
-/* Override sizes in font tags */
-font
-{
-        font: inherit !important;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/aac42f1f/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 260ca26..f4bb4d1 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
@@ -166,10 +166,16 @@ public class TapestryDocTaglet implements Taglet, ClassDescriptionSource
         if (cd.parameters.isEmpty())
             return;
 
-        writer.write("<dt><b>Parameters:</b></dt><dd>");
-
-        writer.write("<table border='1' cellpadding='3' cellspacing='0'>"
-                + "<tr><th>Name</th><th>Type</th><th>Flags</th><th>Default</th><th>Default
Prefix</th><th>Since</th><th>Description</th></tr>");
+        writer.write("</dl>"
+        		+ "<table width='100%' cellspacing='0' cellpadding='3' border='1' class='parameters'>"
+        		+ "<thead><tr class='TableHeadingColor' bgcolor='#CCCCFF'>"
+        		+ "<th align='left' colspan='7'>"
+        		+ "<font size='+2'><b>Component Parameters</b></font>"
+        		+ "</th></tr>"
+        		+ "<tr class='columnHeaders'>"
+        		+ "<th>Name</th><th>Description</th><th>Type</th><th>Flags</th><th>Default</th>"
+                + "<th>Default Prefix</th><th>Since</th>"
+        		+ "</tr></thead><tbody>");
 
         for (String name : InternalUtils.sortedKeys(cd.parameters))
         {
@@ -178,15 +184,20 @@ public class TapestryDocTaglet implements Taglet, ClassDescriptionSource
             writerParameter(pd, writer);
         }
 
-        writer.write("</table></dd>");
+        writer.write("</tbody></table></dd>");
     }
 
     private void writerParameter(ParameterDescription pd, Writer writer) throws IOException
     {
         writer.write("<tr>");
 
-        element(writer, "td", pd.name);
-        element(writer, "td", pd.type);
+        element(writer, "th", pd.name);
+
+        writer.write("<td>");
+        pd.writeDescription(writer);
+        writer.write("</td>");
+
+        element(writer, "td", addWordBreaks(shortenClassName(pd.type)));
 
         List<String> flags = CollectionFactory.newList();
 
@@ -200,15 +211,11 @@ public class TapestryDocTaglet implements Taglet, ClassDescriptionSource
             flags.add("Not Null");
 
         element(writer, "td", InternalUtils.join(flags));
-        element(writer, "td", pd.defaultValue);
+        element(writer, "td", addWordBreaks(pd.defaultValue));
         element(writer, "td", pd.defaultPrefix);
         element(writer, "td", pd.since);
 
-        writer.write("<td>");
-
-        pd.writeDescription(writer);
-
-        writer.write("</td></tr>");
+        writer.write("</tr>");
     }
 
     private void writeEvents(ClassDescription cd, Writer writer) throws IOException
@@ -216,7 +223,10 @@ public class TapestryDocTaglet implements Taglet, ClassDescriptionSource
         if (cd.events.isEmpty())
             return;
 
-        writer.write("<dt><b>Events:</b></dt><dd><dl>");
+        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>");
 
         for (String name : InternalUtils.sortedKeys(cd.events))
         {
@@ -230,7 +240,33 @@ public class TapestryDocTaglet implements Taglet, ClassDescriptionSource
             }
         }
 
-        writer.write("</dl></dd>");
+        writer.write("</dl>");
+    }
+    
+    /**
+	 * Insert a <wbr/> tag after each period and colon in the given string, to
+	 * allow browsers to break words at those points. (Otherwise the Parameters
+	 * tables are too wide.)
+	 * 
+	 * @param words
+	 *            any string, possibly containing periods or colons
+	 * @return the new string, possibly containing <wbr/> tags
+	 */
+    private String addWordBreaks(String words)
+    {
+		return words.replace(".", ".<wbr/>").replace(":", ":<wbr/>");
+    }
+    
+    /**
+     * Shorten the given class name by removing built-in Java packages
+     * (currently just java.lang)
+     * 
+     * @param className name of class, with package
+     * @return potentially shorter class name
+     */
+    private String shortenClassName(String name)
+    {
+    	return name.replace("java.lang.", "");
     }
 
     private void streamXdoc(ClassDoc classDoc, Writer writer) throws Exception


Mime
View raw message