Integrate a "Reset Page State" button into the navbar

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

Branch: refs/heads/5.4-js-rewrite
Commit: 966b139ac85ee0ae8106afbf18de52e2836c152c
Parents: b927ceb
Author: Howard M. Lewis Ship <[email protected]>
Authored: Tue Nov 20 07:08:53 2012 -0800
Committer: Howard M. Lewis Ship <[email protected]>
Committed: Tue Nov 20 07:08:53 2012 -0800

----------------------------------------------------------------------
 .../integration/app1/components/Border.java        |   11 +++++++++
 .../integration/app1/components/Border.tml         |   17 +++++++--------
 2 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/966b139a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
index f7dcf7d..f50d7a7 100644
--- 
a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
+++ 
b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
@@ -14,6 +14,7 @@
 
 package org.apache.tapestry5.integration.app1.components;
 
+import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.annotations.Import;
 import org.apache.tapestry5.annotations.Property;
 import org.apache.tapestry5.ioc.annotations.Inject;
@@ -31,9 +32,19 @@ public class Border
     @Property
     private Request request;
 
+    @Inject
+    private ComponentResources resources;
+
     public String getSecure()
     {
         return request.isSecure() ? "secure" : "insecure";
     }
 
+    boolean onActionFromReset()
+    {
+        resources.discardPersistentFieldChanges();
+
+        return true;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/966b139a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
----------------------------------------------------------------------
diff --git 
a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
 
b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
index 7a31b5d..a73a723 100644
--- 
a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
+++ 
b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml
@@ -14,16 +14,15 @@
 
             <ul class="nav">
                 <li class="navbar-text">
-                    Page: <span 
id="activePageName">${componentResources.pageName}</span>
+                    <p>
+                        Page: <span 
id="activePageName">${componentResources.pageName}</span>,
+                        <span id="secure">${secure}</span>,
+                        locale
+                        <span 
id="pagelocale">${componentResources.locale}</span>
+                    </p>
                 </li>
-                <li class="divider-vertical"></li>
-                <li class="navbar-text">
-                    Access:
-                    <span id="secure">${secure}</span>
-                </li>
-                <li class="divider-vertical"></li>
-                <li class="navbar-text">
-                    Locale: ${componentResources.locale}
+                <li>
+                    <t:actionlink t:id="reset">Reset Page State</t:actionlink>
                 </li>
             </ul>
         </div>

Reply via email to