You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by an...@apache.org on 2007/09/28 12:25:08 UTC

svn commit: r580287 - in /tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry: html/ExceptionDisplay.html html/ExceptionDisplay.java html/ExceptionDisplay.jwc pages/Exception.css

Author: andyhot
Date: Fri Sep 28 03:25:07 2007
New Revision: 580287

URL: http://svn.apache.org/viewvc?rev=580287&view=rev
Log:
TAPESTRY-1787: Support hightlighting packages in stacktraces.

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.html
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.jwc
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.css

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.html?rev=580287&r1=580286&r2=580287&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.html Fri Sep 28 03:25:07 2007
@@ -4,18 +4,12 @@
 <body>
 
 <span jwcid="$content$">
-<span jwcid="eException">
-	<a jwcid="@Any" href="" class="ognl:(index == (exceptions.length - 1)) ? 'toggle toggleSelected' : 'toggle'" 
-	   onClick="ognl:'return toggleDisplay(\'excdisplay'+index+'\', this)'">[&nbsp;+/-&nbsp;] Exception:</a>
-	   <span jwcid="@Insert" value="ognl:exception.message">A message describing the exception.</span>
-	
-	<table jwcid="@Any" id="ognl:'excdisplay' + index" class="exception-display toggleContent">
+<span jwcid="eException" class="exception-block">
+    <a jwcid="tLink@Any" href="#" class="toggle exception-link">[&nbsp;+/-&nbsp;] Exception:</a>
+	   <span jwcid="@Insert" value="ognl:exception.message">A message describing the exception.</span>	
+	<table jwcid="@Any" id="ognl:components.tLink.clientId + 'Data'" class="exception-display toggleContent">
 		<tr class="exception-name">
 			<td colspan="2"><span jwcid="insertClass">some.exception.Class</span></td>
-		</tr>
-		
-		<tr class="exception-message">
-			<td colspan="2"><span jwcid="insertMessage">A message describing the exception.</span></td>
 		</tr>
 		
 		<tr jwcid="eProperty">

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.java?rev=580287&r1=580286&r2=580287&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.java Fri Sep 28 03:25:07 2007
@@ -14,6 +14,7 @@
 
 package org.apache.tapestry.html;
 
+import java.util.List;
 import org.apache.tapestry.BaseComponent;
 import org.apache.tapestry.IMarkupWriter;
 import org.apache.tapestry.IRequestCycle;
@@ -42,6 +43,11 @@
 
     public abstract ExceptionDescription[] getExceptions();
     
+    /** @since 4.1.4 */
+    public abstract List getPackages();
+    
+    public abstract String getTrace();
+    
     /**
      * Each time the current exception is set, as a side effect, the evenOdd
      * helper bean is reset to even.
@@ -81,5 +87,23 @@
     public boolean isLast()
     {
         return getIndex() == (getCount() - 1);
+    }
+    
+    public boolean isInPackage() {
+        List packages = getPackages();
+        if (packages == null) 
+            return false;
+        
+        String trace = getTrace();
+        for (int i=0; i<packages.size(); i++) {
+            if (trace.startsWith((String)packages.get(i)))
+                return true;
+        }
+        
+        return false;
+    }
+    
+    public String getStackClass() {
+        return isInPackage() ? "stackSelected" : null;
     }
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.jwc?rev=580287&r1=580286&r2=580287&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ExceptionDisplay.jwc Fri Sep 28 03:25:07 2007
@@ -33,6 +33,13 @@
     </description>
   </parameter>
   
+  <parameter name="packages" required="no">
+    <description>
+    A list of Strings that contain package names that should be highlighted
+    when printing out the stack traces.
+    </description>
+  </parameter>  
+  
   <bean name="evenOdd" class="org.apache.tapestry.bean.EvenOdd"/>
   
   <!-- Store the current ExceptionProperty -->
@@ -55,10 +62,6 @@
     <binding name="value" value="exception.exceptionClassName"/>
   </component>
   
-  <component id="insertMessage" type="Insert">
-    <binding name="value" value="exception.message"/>
-  </component>
-  
   <component id="eProperty" type="For">
   	<binding name="element" value="literal:tr"/>
   	<binding name="class" value="beans.evenOdd.next"/>
@@ -86,6 +89,7 @@
     <binding name="element" value="literal:li"/>
     <binding name="source" value="exception.stackTrace"/>
     <binding name="value" value="trace"/>
+    <binding name="class" value="stackClass"/>    
   </component>
   
   <component id="insertStackTrace" type="Insert">

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.css?rev=580287&r1=580286&r2=580287&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.css (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/Exception.css Fri Sep 28 03:25:07 2007
@@ -47,9 +47,9 @@
 	width : 100%;	
 }
 
-TABLE.exception-display TR.stack-trace  {
+TABLE.exception-display TR.stack-trace TD  {
 	font-size : small;
-	font-family : sans-serif;
+        font-family: terminal,monospace;
 	text-align : left;
 }
 
@@ -70,10 +70,19 @@
 	font-weight: bold;
 }
 
+SPAN.exception-block, DIV.displayBlock {
+    margin:5px;
+    display:block;
+    border:1px solid #ccf;
+    padding:6px;
+    background:#f9f9f9;    
+}
+
 UL  {
 	margin-top : 0;
 	margin-bottom : 0;
 	margin-left : 20px;
+        list-style: none;
 }
 
 TABLE.exception-display TR.exception-name TD  {
@@ -125,14 +134,15 @@
 
 TABLE.location-content TD.line-number
 {
-  width: 1px; // Minimum; will expand to fit line numbers.
+  width: 1px; /* Minimum; will expand to fit line numbers.*/
   align: right;
   border-right: 1px dotted grey;
 }
 
 TABLE.location-content TD
 {
-  font: terminal;
+  font-family: terminal,monospace;
+  font-size: 10pt;
   padding: 0;
   margin: 0;
 }
@@ -162,7 +172,7 @@
 TABLE.described-object TH
 {
   text-align: right;
-  width: 1px; // Will stretch to fit.
+  width: 1px; /* Will stretch to fit. */
 }
 
 TABLE.described-object TR.even
@@ -191,4 +201,9 @@
 
 a.toggleSelected {
     background:#EDCC5F;
+}
+
+.stackSelected {
+    color:red;
+    text-decoration:underline;    
 }