click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r1052472 - in /click/trunk/click/examples/src/org/apache/click/examples/page/security: Login.java Logout.java Secure.java
Date Fri, 24 Dec 2010 10:15:02 GMT
Author: sabob
Date: Fri Dec 24 10:15:01 2010
New Revision: 1052472

URL: http://svn.apache.org/viewvc?rev=1052472&view=rev
Log:
Remove auto binding from examples CLK-742

Modified:
    click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java
    click/trunk/click/examples/src/org/apache/click/examples/page/security/Logout.java
    click/trunk/click/examples/src/org/apache/click/examples/page/security/Secure.java

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java?rev=1052472&r1=1052471&r2=1052472&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java Fri
Dec 24 10:15:01 2010
@@ -30,7 +30,6 @@ import org.apache.click.examples.page.Bo
 import org.apache.click.examples.page.HomePage;
 import org.apache.click.examples.service.UserService;
 import org.apache.click.extras.control.PageSubmit;
-import org.apache.click.util.Bindable;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.stereotype.Component;
 
@@ -41,8 +40,8 @@ import org.springframework.stereotype.Co
 public class Login extends BorderPage {
 
     private static final long serialVersionUID = 1L;
-    @Bindable protected Form form = new Form();
-    @Bindable protected HiddenField redirectField = new HiddenField("redirect", String.class);
+    private Form form = new Form("form");
+    private HiddenField redirectField = new HiddenField("redirect", String.class);
 
     private TextField usernameField = new TextField("username", true);
     private PasswordField passwordField = new PasswordField("password", true);
@@ -53,6 +52,10 @@ public class Login extends BorderPage {
     // Constructor ------------------------------------------------------------
 
     public Login() {
+        // Add form to page
+        addControl(form);
+
+        // Setup form
         usernameField.setMaxLength(20);
         usernameField.setMinLength(5);
         usernameField.setFocus(true);
@@ -103,9 +106,9 @@ public class Login extends BorderPage {
                                        user.getUsername(),
                                        Integer.MAX_VALUE);
 
-                String redirect = redirectField.getValue();
-                if (StringUtils.isNotBlank(redirect)) {
-                    setRedirect(redirect);
+                String redirectValue = redirectField.getValue();
+                if (StringUtils.isNotBlank(redirectValue)) {
+                    setRedirect(redirectValue);
 
                 } else {
                     setRedirect(Secure.class);

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/security/Logout.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/security/Logout.java?rev=1052472&r1=1052471&r2=1052472&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/security/Logout.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/security/Logout.java Fri
Dec 24 10:15:01 2010
@@ -30,8 +30,6 @@ public class Logout extends BorderPage {
 
     private static final long serialVersionUID = 1L;
 
-    @Bindable protected User user;
-
     /**
      * @see Page#onInit()
      */
@@ -39,9 +37,10 @@ public class Logout extends BorderPage {
     public void onInit() {
         super.onInit();
 
-        user = (User) getContext().getSessionAttribute("user");
+        User user = (User) getContext().getSessionAttribute("user");
         if (user != null) {
             getContext().removeSessionAttribute("user");
+            addModel("user", user);
         }
     }
 

Modified: click/trunk/click/examples/src/org/apache/click/examples/page/security/Secure.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/security/Secure.java?rev=1052472&r1=1052471&r2=1052472&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/security/Secure.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/security/Secure.java Fri
Dec 24 10:15:01 2010
@@ -38,9 +38,9 @@ public class Secure extends BorderPage {
             return true;
 
         } else {
-            String path = getContext().getPagePath(Login.class);
-            path += "?redirect=" + getPath();
-            setRedirect(path);
+            String pagePath = getContext().getPagePath(Login.class);
+            pagePath += "?redirect=" + getPath();
+            setRedirect(pagePath);
             return false;
         }
     }



Mime
View raw message