You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2010/07/24 11:43:18 UTC

svn commit: r978836 - in /click/trunk/click/framework/src/org/apache/click: Control.java Page.java

Author: sabob
Date: Sat Jul 24 09:43:18 2010
New Revision: 978836

URL: http://svn.apache.org/viewvc?rev=978836&view=rev
Log:
deprecated stateful pages. CLK-715

Modified:
    click/trunk/click/framework/src/org/apache/click/Control.java
    click/trunk/click/framework/src/org/apache/click/Page.java

Modified: click/trunk/click/framework/src/org/apache/click/Control.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/Control.java?rev=978836&r1=978835&r2=978836&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Control.java (original)
+++ click/trunk/click/framework/src/org/apache/click/Control.java Sat Jul 24 09:43:18 2010
@@ -183,10 +183,6 @@ public interface Control extends Seriali
      *     }
      * } </pre>
      *
-     * The above approach is safe to use with controls added to <tt>stateful</tt>
-     * pages since the HEAD elements are only added to the list once, when the
-     * method is invoked the first time.
-     * <p/>
      * Alternatively one can add the HEAD elements in the Control's constructor:
      *
      * <pre class="prettyprint">
@@ -206,33 +202,6 @@ public interface Control extends Seriali
      * {@link #onInit()}, {@link #onProcess()}, {@link #onRender()}
      * etc.
      * <p/>
-     * <b>Please note:</b> when adding HEAD elements from event handlers,
-     * its possible that the control will be added to a
-     * {@link Page#stateful Stateful} page, so you will need to set the HEAD
-     * elements list to <tt>null</tt> in the Control's {@link #onDestroy()}
-     * event handler, otherwise the HEAD elements list will continue to grow
-     * with each request:
-     *
-     * <pre class="prettyprint">
-     * public MyControl extends AbstractControl {
-     *
-     *     // Set HEAD elements in the onInit event handler
-     *     public void onInit() {
-     *
-     *         // Add HEAD elements
-     *         JsImport jsImport = new JsImport("/mycorp/mycontrol/mycontrol.js");
-     *         getHeadElements().add(jsImport);
-     *
-     *         CssImport cssImport = new CssImport("/mycorp/mycontrol/mycontrol.css");
-     *         getHeadElements().add(cssImport);
-     *     }
-     *
-     *     public void onDestroy() {
-     *         // Nullify the HEAD elements
-     *         headElements = null;
-     *     }
-     * } </pre>
-     *
      * The order in which JS and CSS files are included will be preserved in the
      * page.
      * <p/>

Modified: click/trunk/click/framework/src/org/apache/click/Page.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/Page.java?rev=978836&r1=978835&r2=978836&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Page.java (original)
+++ click/trunk/click/framework/src/org/apache/click/Page.java Sat Jul 24 09:43:18 2010
@@ -196,6 +196,9 @@ public class Page implements Serializabl
     /**
      * The page is stateful and should be saved to the users HttpSession
      * between requests, default value is false.
+     *
+     * @deprecated stateful pages are not supported anymore, use stateful
+     * Controls instead
      */
     protected boolean stateful;
 
@@ -350,9 +353,6 @@ public class Page implements Serializabl
      * <p/>
      * This method is guaranteed to be called before the Page object reference
      * goes out of scope and is available for garbage collection.
-     * <p/>
-     * Stateful pages will have this method invoked before they are saved to
-     * the session.
      */
     public void onDestroy() {
     }
@@ -681,10 +681,6 @@ public class Page implements Serializabl
      *     }
      * } </pre>
      *
-     * The above approach can safely be used with <tt>stateful</tt> pages since
-     * the HEAD elements are only added to the list once, when the method is
-     * invoked the first time.
-     * <p/>
      * Alternatively one can add the HEAD elements in the Page constructor:
      *
      * <pre class="prettyprint">
@@ -703,36 +699,6 @@ public class Page implements Serializabl
      * {@link #onInit()}, {@link #onGet()}, {@link #onPost()}, {@link #onRender()}
      * etc.
      * <p/>
-     * <b>Please note:</b> when adding HEAD elements from event handlers on
-     * {@link #stateful Stateful} pages, you will need to set the HEAD elements
-     * list to <tt>null</tt> in the {@link #onDestroy()} event handler,
-     * otherwise the HEAD elements list will continue to grow with each request:
-     *
-     * <pre class="prettyprint">
-     * public MyPage extends Page {
-     *
-     *     public MyPage() {
-     *         // Activate stateful page
-     *         setStateful(true);
-     *     }
-     *
-     *     // Set HEAD elements in the onInit event handler
-     *     public void onInit() {
-     *
-     *         // Add HEAD elements
-     *         JsImport jsImport = new JsImport("/mycorp/js/mypage.js");
-     *         getHeadElements().add(jsImport);
-     *
-     *         CssImport cssImport = new CssImport("/mycorp/js/mypage.css");
-     *         getHeadElements().add(cssImport);
-     *     }
-     *
-     *     public void onDestroy() {
-     *         // Nullify the HEAD elements
-     *         headElements = null;
-     *     }
-     * } </pre>
-     *
      * The order in which JS and CSS files are included will be preserved in the
      * page.
      * <p/>
@@ -1005,6 +971,9 @@ public class Page implements Serializabl
      * Return true if the page is stateful and should be saved in the users
      * HttpSession between requests, default value is false.
      *
+     * @deprecated stateful pages are not supported anymore, use stateful
+     * Controls instead
+     *
      * @return true if the page is stateful and should be saved in the users
      * session
      */
@@ -1029,6 +998,9 @@ public class Page implements Serializabl
      * point Click will remove the Page from the HttpSession, freeing up memory
      * for the server.
      *
+     * @deprecated stateful pages are not supported anymore, use stateful
+     * Controls instead
+     *
      * @param stateful the flag indicating whether the page should be saved
      *         between user requests
      */