Author: hlship
Date: Tue Jan 9 11:36:13 2007
New Revision: 494537
URL: http://svn.apache.org/viewvc?view=rev&rev=494537
Log:
Improve the L&F of the ExceptionReport page.
Ensure that all Tapestry-provided CSS classes are prefixed with "t-".
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/DefaultValidationDecorator.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalConstants.java
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/pages/ExceptionReport.html
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java?view=diff&rev=494537&r1=494536&r2=494537
==============================================================================
---
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java
(original)
+++
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Errors.java
Tue Jan 9 11:36:13 2007
@@ -19,6 +19,7 @@
import org.apache.tapestry.annotations.ComponentClass;
import org.apache.tapestry.annotations.Environmental;
import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.internal.InternalConstants;
/**
* Standard validation error presenter. Must be enclosed by a [EMAIL
PROTECTED] Form} component.
@@ -30,7 +31,7 @@
private String _banner;
@Parameter
- private String _class = "tapestry-error";
+ private String _class = InternalConstants.TAPESTRY_ERROR_CLASS;
// Allow null so we can generate a better error message if missing
@Environmental(false)
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java?view=diff&rev=494537&r1=494536&r2=494537
==============================================================================
---
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java
(original)
+++
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java
Tue Jan 9 11:36:13 2007
@@ -205,7 +205,7 @@
// TODO: Informal parameters
- _div = writer.element("div", "style", "invisible");
+ _div = writer.element("div", "style", "t-invisible");
for (String parameterName : link.getParameterNames())
{
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/DefaultValidationDecorator.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/DefaultValidationDecorator.java?view=diff&rev=494537&r1=494536&r2=494537
==============================================================================
---
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/DefaultValidationDecorator.java
(original)
+++
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/DefaultValidationDecorator.java
Tue Jan 9 11:36:13 2007
@@ -28,8 +28,6 @@
{
private final Environment _environment;
- private static final String ERROR_CLASS = "tapestry-error";
-
public DefaultValidationDecorator(final Environment environment)
{
_environment = environment;
@@ -72,7 +70,8 @@
{
String current = element.getAttribute("class");
- String newValue = current == null ? ERROR_CLASS : current + " " +
ERROR_CLASS;
+ String newValue = current == null ?
InternalConstants.TAPESTRY_ERROR_CLASS : current + " "
+ + InternalConstants.TAPESTRY_ERROR_CLASS;
element.forceAttributes("class", newValue);
}
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalConstants.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalConstants.java?view=diff&rev=494537&r1=494536&r2=494537
==============================================================================
---
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalConstants.java
(original)
+++
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalConstants.java
Tue Jan 9 11:36:13 2007
@@ -36,6 +36,9 @@
*/
public static final String TEMPLATE_EXTENSION = "html";
+ /** All purpose CSS class name for anything related to Tapestry errors. */
+ public static final String TAPESTRY_ERROR_CLASS = "t-error";
+
private InternalConstants()
{
}
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/pages/ExceptionReport.html
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/pages/ExceptionReport.html?view=diff&rev=494537&r1=494536&r2=494537
==============================================================================
---
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/pages/ExceptionReport.html
(original)
+++
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/pages/ExceptionReport.html
Tue Jan 9 11:36:13 2007
@@ -3,45 +3,53 @@
<title>An Exception Has Occurred</title>
</head>
<body>
- <p> A runtime exception has occurred. </p>
+ <h1 class="t-exception-report">A runtime exception has occurred.</h1>
+
- <ul class="tapestry-exception-report">
- <t:comp type="Loop" source="prop:stack" value="prop:info">
- <li>${info.className} <dl>
- <t:comp type="If" test="prop:info.message">
- <dt>Message:</dt>
- <dd>${info.message}</dd>
- </t:comp>
- <t:comp type="Loop" source="prop:info.propertyNames"
- value="prop:propertyName">
- <dt>${propertyName}:</dt>
- <dd>${propertyValue}</dd>
- </t:comp>
- <t:comp type="If" test="prop:info.stackTrace">
- <dt>Stack trace:</dt>
- <dd>
- <ul>
- <t:comp type="Loop"
source="prop:info.stackTrace"
- value="prop:frame">
- <li>${frame}</li>
- </t:comp>
- </ul>
- </dd>
+ <div class="t-exception-report">
+ <ul>
+ <t:comp type="Loop" source="stack" value="info">
+ <li>
+ <span
class="t-exception-class-name">${info.className}</span>
+
+ <t:comp type="If" test="info.message">
+ <div class="t-exception-message">
+ ${info.message}
+ </div>
+ </t:comp>
+
+ <t:comp type="If" test="info.propertyNames">
+ <dl>
+ <t:comp type="Loop"
source="info.propertyNames" value="propertyName">
+ <dt>${propertyName}</dt>
+ <dd>${propertyValue}</dd>
+ </t:comp>
+ <t:comp type="If" test="info.stackTrace">
+ <dt>Stack trace</dt>
+ <dd>
+ <ul class="t-stack-trace">
+ <t:comp type="Loop"
source="info.stackTrace"
+ value="frame">
+ <li>${frame}</li>
+ </t:comp>
+ </ul>
+ </dd>
+ </t:comp>
+ </dl>
</t:comp>
- </dl>
- </li>
- </t:comp>
- </ul>
-
- <div class="tapestry-env-data">
- <t:comp type="If" test="prop:hasSession">
- <h2>Session</h2>
+ </li>
+ </t:comp>
+ </ul>
+ </div>
+ <div class="t-env-data">
+ <t:comp type="If" test="hasSession">
+ <h2>Session</h2>
<dl>
- <t:comp type="Loop" source="prop:session.attributeNames"
value="prop:attributeName">
- <dt>${attributeName}</dt>
+ <t:comp type="Loop" source="session.attributeNames"
value="attributeName">
+ <dt>${attributeName}</dt>
<dd>${attributeValue}</dd>
- </t:comp>
- </dl>
+ </t:comp>
+ </dl>
</t:comp>
</div>
</body>
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css?view=diff&rev=494537&r1=494536&r2=494537
==============================================================================
---
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css
(original)
+++
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css
Tue Jan 9 11:36:13 2007
@@ -1,13 +1,11 @@
-BODY {
- border: 1px solid silver;
- padding: 5px;
-}
-DIV.tapestry-error {
+/* Tapestry styles all start with "t-" */
+
+DIV.t-error {
border: 1px solid red;
padding: 0px;
margin: 4px 0px;
}
-DIV.tapestry-error DIV {
+DIV.t-error DIV {
padding: 2px;
display: block;
margin: 0px;
@@ -15,25 +13,90 @@
color: white;
font-weight: bold;
}
-DIV.tapestry-error UL {
+DIV.t-error UL {
margin: 2px 0px;
background-color:white;
color:red;
}
-DIV.tapestry-error LI {
+DIV.t-error LI {
margin-left: -20px;
}
-DIV.invisible {
+.t-invisible {
display: none;
}
-LABEL.tapestry-error
+LABEL.t-error
{
color:red;
}
-INPUT.tapestry-error, TEXTAREA.tapestry-error
+INPUT.t-error, TEXTAREA.t-error
{
background-color: red;
color: white;
-}
\ No newline at end of file
+}
+
+DIV.t-exception-message
+{
+ font-style: italic;
+ font-size: 12pt;
+ border: thin dotted silver;
+ margin: 5px 0px;
+ padding: 3px;
+}
+
+DIV.t-exception-report, DIV.t-env-data
+{
+ font-family: "Trebuchet MS", Arial, sans-serif;
+}
+
+DIV.t-exception-report LI
+{
+ margin-left: -40px;
+}
+
+DIV.t-exception-report DT, DIV.t-env-data DT
+{
+ color:green;
+ padding-left: 2px;
+}
+
+DIV.t-exception-report LI
+{
+ list-style: none;
+}
+
+SPAN.t-exception-class-name
+{
+ display: block;
+ margin-top: 15px;
+ font-size: 12pt;
+ background-color: #c0c0c0;
+ color: blue;
+ padding: 2px 3px;
+ font-weight: bold;
+}
+
+UL.t-stack-trace LI
+{
+ font-family: Monaco, Times, monospace;
+ font-size: 10pt;
+ margin-left: -25px;
+ list-style: square;
+}
+
+H1.t-exception-report
+{
+ font-family: "Trebuchet MS", Arial, sans-serif;
+ color: red;
+}
+
+DIV.t-exception-report DT:after
+{
+ content: ":";
+}
+
+DIV.t-exception-report DD, DIV.t-env-data DD
+{
+ margin-left: 10px;
+}
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=494537&r1=494536&r2=494537
==============================================================================
---
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
(original)
+++
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
Tue Jan 9 11:36:13 2007
@@ -428,10 +428,10 @@
// Check on decorations via the default validation decorator:
- assertText("//label[1]/@class", "tapestry-error");
- assertText("//label[2]/@class", "tapestry-error");
- assertText("//[EMAIL PROTECTED]'email']/@class", "tapestry-error");
- assertText("//[EMAIL PROTECTED]'message']/@class", "tapestry-error");
+ assertText("//label[1]/@class", "t-error");
+ assertText("//label[2]/@class", "t-error");
+ assertText("//[EMAIL PROTECTED]'email']/@class", "t-error");
+ assertText("//[EMAIL PROTECTED]'message']/@class", "t-error");
_selenium.type("email", "[EMAIL PROTECTED]");
_selenium.type("message", "Show me the money!");
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java?view=diff&rev=494537&r1=494536&r2=494537
==============================================================================
---
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java
(original)
+++
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java
Tue Jan 9 11:36:13 2007
@@ -60,7 +60,7 @@
decorator.insideLabel(field, e);
- assertEquals(writer.toString(), "<label accesskey=\"f\"
class=\"tapestry-error\"/>");
+ assertEquals(writer.toString(), "<label accesskey=\"f\"
class=\"t-error\"/>");
verify();
}
@@ -84,7 +84,7 @@
decorator.insideLabel(field, e);
- assertEquals(writer.toString(), "<label accesskey=\"f\" class=\"foo
tapestry-error\"/>");
+ assertEquals(writer.toString(), "<label accesskey=\"f\" class=\"foo
t-error\"/>");
verify();
}
@@ -122,7 +122,7 @@
assertEquals(
writer.toString(),
- "<input class=\"foo tapestry-error\" name=\"ex\" size=\"30\"
type=\"text\" value=\"freddy\"/>");
+ "<input class=\"foo t-error\" name=\"ex\" size=\"30\"
type=\"text\" value=\"freddy\"/>");
verify();
}