Updated Branches: refs/heads/master bec5a5c77 -> 9c94bc607
Format the exception stack trace as a 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/9c94bc60 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9c94bc60 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9c94bc60 Branch: refs/heads/master Commit: 9c94bc6079fb0f5c4c76f414dfaf2b82d1de9e16 Parents: bec5a5c Author: Howard M. Lewis Ship <[email protected]> Authored: Mon Nov 4 12:16:50 2013 -0800 Committer: Howard M. Lewis Ship <[email protected]> Committed: Mon Nov 4 12:16:50 2013 -0800 ---------------------------------------------------------------------- .../modules/t5/core/exception-display.coffee | 2 +- .../corelib/components/ExceptionDisplay.java | 43 +++++++++++++++++++- .../META-INF/assets/core/ExceptionDisplay.css | 26 +++++++++--- .../corelib/components/ExceptionDisplay.tml | 22 ++++++---- 4 files changed, 79 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9c94bc60/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-display.coffee ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-display.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-display.coffee index 32d868f..581100d 100644 --- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-display.coffee +++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-display.coffee @@ -22,7 +22,7 @@ define ["./dom"], dom.onDocument "click", "[data-behavior=stack-trace-filter-toggle]", -> checked = @element.checked - for traceList in dom.body.find "ul.stack-trace" + for traceList in dom.body.find ".stack-trace" traceList[if checked then "addClass" else "removeClass"] "filtered" return http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9c94bc60/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java index fbacdca..c1afa24 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/ExceptionDisplay.java @@ -1,4 +1,4 @@ -// Copyright 2008, 2009, 2010, 2011, 2012 The Apache Software Foundation +// Copyright 2008-2013 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -89,4 +89,45 @@ public class ExceptionDisplay return result; } + + public Object getLineNumberForFrame() + { + if (frame.getLineNumber() < 1) + { + return ""; + } + + return frame.getLineNumber(); + } + + public String getFramePackageName() + { + return splitClass()[0]; + } + + public String getFrameClassName() + { + return splitClass()[1]; + } + + private String[] splitClass() + { + String name = frame.getClassName(); + + int dotx = name.lastIndexOf('.'); + + // For generated classes in root package: + if (dotx < 0) + { + return new String[]{"", name}; + } + + // For normal classes: + + return new String[]{ + name.substring(0, dotx), + name.substring(dotx) + }; + } } + http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9c94bc60/tapestry-core/src/main/resources/META-INF/assets/core/ExceptionDisplay.css ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/resources/META-INF/assets/core/ExceptionDisplay.css b/tapestry-core/src/main/resources/META-INF/assets/core/ExceptionDisplay.css index e997d75..ca8699b 100644 --- a/tapestry-core/src/main/resources/META-INF/assets/core/ExceptionDisplay.css +++ b/tapestry-core/src/main/resources/META-INF/assets/core/ExceptionDisplay.css @@ -1,17 +1,33 @@ -UL.stack-trace LI { +TABLE.stack-trace { font-size: small; } -LI.usercode-frame { +TABLE.stack-trace TR.usercode-frame { font-weight: bold; color: blue; } -LI.omitted-frame { +TABLE.stack-trace TR.omitted-frame { color: gray; - list-style: square; } -UL.filtered LI.omitted-frame { +TABLE.stack-trace.filtered TR.omitted-frame { display: none; } + +TABLE.stack-trace TD.class-name { + text-align: right; +} + +TABLE.stack-trace .package-name { + font-size: xx-small; +} + +TABLE.stack-trace TD.method-name { + font-weight: bold; +} + +TABLE.stack-trace TD.file-name { + font-size: x-small; + text-align: right; +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9c94bc60/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/ExceptionDisplay.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/ExceptionDisplay.tml b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/ExceptionDisplay.tml index 214d866..944f49b 100644 --- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/ExceptionDisplay.tml +++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/ExceptionDisplay.tml @@ -5,7 +5,9 @@ <h3>${info.className}</h3> <t:if test="info.message"> - <p><strong>${info.message}</strong></p> + <p> + <strong>${info.message}</strong> + </p> </t:if> <t:if test="info.propertyNames"> @@ -25,16 +27,22 @@ <div> <div class="pull-right"> <label class="checkbox"> - <input type="checkbox" data-behavior="stack-trace-filter-toggle" checked="true"/> Filter Frames? + <input type="checkbox" data-behavior="stack-trace-filter-toggle" checked="true"/> + Filter Frames? </label> </div> <h4>Stack trace:</h4> </div> - <ul class="stack-trace filtered"> - <li t:type="loop" source="info.stackTrace" value="frame" class="${frameClass}"> - ${frame} - </li> - </ul> + <table class="stack-trace filtered table table-condensed table-hover table-striped"> + <tr t:type="loop" source="info.stackTrace" value="frame" class="${frameClass}"> + <td class="class-name" xml:space="preserve"> + <span class="package-name">${framePackageName}</span>${frameClassName} + </td> + <td class="method-name">${frame.methodName}()</td> + <td class="file-name">${frame.fileName}</td> + <td>${lineNumberForFrame}</td> + </tr> + </table> </t:if> </t:loop> </div> \ No newline at end of file
