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 2009/03/18 22:11:19 UTC

svn commit: r755737 - in /incubator/click/trunk/click/framework/src/org/apache/click: Control.java Page.java control/AbstractContainer.java control/AbstractControl.java

Author: sabob
Date: Wed Mar 18 21:11:19 2009
New Revision: 755737

URL: http://svn.apache.org/viewvc?rev=755737&view=rev
Log:
javadocs

Modified:
    incubator/click/trunk/click/framework/src/org/apache/click/Control.java
    incubator/click/trunk/click/framework/src/org/apache/click/Page.java
    incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractContainer.java
    incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java

Modified: incubator/click/trunk/click/framework/src/org/apache/click/Control.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/Control.java?rev=755737&r1=755736&r2=755737&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/Control.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/Control.java Wed Mar 18 21:11:19 2009
@@ -178,91 +178,94 @@
     public String getHtmlImports();
 
     /**
-     * Return the list of {@link org.apache.click.util.HtmlHeader HTML HEAD entries}
-     * to be included in the page. Example HTML headers include
-     * {@link org.apache.click.util.JavascriptImport JavascriptImport},
-     * {@link org.apache.click.util.Javascript inline Javascript},
-     * {@link org.apache.click.util.CssImport CssImport} and
-     * {@link org.apache.click.util.Css inline CSS}.
+     * Return the list of {@link org.apache.click.element.Element HEAD elements}
+     * to be included in the page. Example HEAD elements include
+     * {@link org.apache.click.element.JsImport JavaScript imports},
+     * {@link org.apache.click.element.JsScript inline JavasSript},
+     * {@link org.apache.click.util.CssImport Css imports} and
+     * {@link org.apache.click.util.Css inline Css}.
      * <p/>
-     * Controls can include their own list of HTML HEAD entries by implementing
+     * Controls can include their own list of HEAD elements by implementing
      * this method.
      * <p/>
      * The recommended approach when implementing this method is to use
-     * <tt>lazy loading</tt> to only add HTML headers <tt>once</tt> and when
+     * <tt>lazy loading</tt> to only add HEAD elements <tt>once</tt> and when
      * <tt>needed</tt>.
      * For example:
      *
      * <pre class="prettyprint">
      * public MyControl extends AbstractControl {
      *
-     *     public List getHtmlHeaders() {
+     *     public List getHeadElements() {
      *         // Use lazy loading to ensure the JS is only added the
      *         // first time this method is called.
-     *         if (htmlHeaders == null) {
-     *             // Get the header entries from the super implementation
-     *             htmlHeaders = super.getHtmlHeaders();
-     *
-     *             // Include the control's external Javascript resource
-     *             JavascriptImport jsImport = new JavascriptImport("/mycorp/mycontrol/mycontrol.js");
-     *             htmlHeaders.add(jsImport);
+     *         if (headElements == null) {
+     *             // Get the head elements from the super implementation
+     *             headElements = super.getHeadElements();
+     *
+     *             // Include the control's external JavaScript resource
+     *             JsImport jsImport = new JsImport("/mycorp/mycontrol/mycontrol.js");
+     *             headElements.add(jsImport);
      *
      *             // Include the control's external Css resource
      *             CssImport cssImport = new CssImport("/mycorp/mycontrol/mycontrol.css");
-     *             htmlHeaders.add(cssImport);
+     *             headElements.add(cssImport);
      *         }
-     *         return htmlHeaders;
+     *         return headElements;
      *     }
      * } </pre>
      *
-     * An alternative is to add the HTML headers in the Control's constructor:
+     * Alternative one can add the HEAD elements in the Control's constructor:
      *
      * <pre class="prettyprint">
      * public MyControl extends AbstractControl {
      *
      *     public MyControl() {
-     *         JavascriptImport jsImport = new JavascriptImport("/mycorp/mycontrol/mycontrol.js");
-     *         getHtmlHeaders().add(jsImport);
+     *         JsImport jsImport = new JsImport("/mycorp/mycontrol/mycontrol.js");
+     *         getHeadElements().add(jsImport);
      *         CssImport cssImport = new CssImport("/mycorp/mycontrol/mycontrol.css");
-     *         getHtmlHeaders().add(cssImport);
+     *         getHeadHeaders().add(cssImport);
      *     }
      * } </pre>
      *
-     * One can also add HTML headers from event handler methods such as
+     * One can also add HEAD elements from event handler methods such as
      * {@link #onInit()}, {@link #onProcess()}, {@link #onRender()}
-     * etc. However its possible the control will be added to a {@link Page#stateful Stateful}
-     * page, so you will need to set the HTML header list to <tt>null</tt> in the
-     * Control's {@link #onDestroy()} event handler, otherwise the HTML header
-     * list will continue to grow with each request:
+     * etc. <b>Please note:</b> when adding HEAD elements to 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 HTML headers
-     *         JavascriptImport jsImport = new JavascriptImport("/mycorp/mycontrol/mycontrol.js");
-     *         getHtmlHeaders().add(jsImport);
+     *         // Add HEAD elements
+     *         JsImport jsImport = new JsImport("/mycorp/mycontrol/mycontrol.js");
+     *         getHeadElements().add(jsImport);
      *         CssImport cssImport = new CssImport("/mycorp/mycontrol/mycontrol.css");
-     *         getHtmlHeaders().add(cssImport);
+     *         getHeadElements().add(cssImport);
      *     }
      *
      *     public void onDestroy() {
-     *         // Nullify the HTML headers
-     *         htmlHeaders = null;
+     *         // Nullify the HEAD elements
+     *         headElements = null;
      *     }
      * } </pre>
      *
      * The order in which JS and CSS files are included will be preserved in the
      * page.
      * <p/>
-     * <b>Note:</b> this method must never return null. If no HTML HEAD entries
+     * <b>Note:</b> this method must never return null. If no HEAD elements
      * are available this method must return an empty {@link java.util.List}.
      * <p/>
-     * <b>Also note:</b> a common problem when overriding getHtmlHeaders in
-     * subclasses is forgetting to call <em>super.getHtmlHeaders</em>. Consider
-     * carefully whether you should call <em>super.getHtmlHeaders</em> or not.
+     * <b>Also note:</b> a common problem when overriding getHeadElements in
+     * subclasses is forgetting to call <em>super.getHeadElements</em>. Consider
+     * carefully whether you should call <em>super.getHeadElements</em> or not.
      *
-     * @return the list of HTML HEAD entries to be included in the page
+     * @return the list of HEAD elements to be included in the page
      */
     public List getHeadElements();
 

Modified: incubator/click/trunk/click/framework/src/org/apache/click/Page.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/Page.java?rev=755737&r1=755736&r2=755737&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/Page.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/Page.java Wed Mar 18 21:11:19 2009
@@ -658,61 +658,61 @@
     }
 
     /**
-     * Return the list of {@link org.apache.click.util.HtmlHeader HTML HEAD entries}
-     * to be included in the page. Example HTML headers include
-     * {@link org.apache.click.util.JavascriptImport JavascriptImport},
-     * {@link org.apache.click.util.Javascript inline Javascript},
-     * {@link org.apache.click.util.CssImport CssImport} and
-     * {@link org.apache.click.util.Css inline CSS}.
+     * Return the list of {@link org.apache.click.element.Element HEAD elements}
+     * to be included in the page. Example HEAD elements include
+     * {@link org.apache.click.element.JsImport JavaScript imports},
+     * {@link org.apache.click.element.JsScript inline JavasSript},
+     * {@link org.apache.click.util.CssImport Css imports} and
+     * {@link org.apache.click.util.Css inline Css}.
      * <p/>
-     * Pages can include their own list of HTML HEAD entries by implementing
+     * Pages can include their own list of HEAD elements by implementing
      * this method.
      * <p/>
      * The recommended approach when implementing this method is to use
-     * <tt>lazy loading</tt> to only add HTML headers once and when needed.
+     * <tt>lazy loading</tt> to only add HEAD elements once and when needed.
      * For example:
      *
      * <pre class="prettyprint">
      * public MyPage extends Page {
      *
-     *     public List getHtmlHeaders() {
+     *     public List getHeadElements() {
      *         // Use lazy loading to ensure the JS is only added the
      *         // first time this method is called.
-     *         if (htmlHeaders == null) {
-     *             // Get the header entries from the super implementation
-     *             htmlHeaders = super.getHtmlHeaders();
+     *         if (headElements == null) {
+     *             // Get the head elements from the super implementation
+     *             headElements = super.getHeadElements();
      *
      *             // Include the page's external Javascript resource
-     *             JavascriptImport jsImport = new JavascriptImport("/mycorp/js/mypage.js");
-     *             htmlHeaders.add(jsImport);
+     *             JsImport jsImport = new JsImport("/mycorp/js/mypage.js");
+     *             headElements.add(jsImport);
      *
      *             // Include the page's external Css resource
      *             CssImport cssImport = new CssImport("/mycorp/js/mypage.css");
-     *             htmlHeaders.add(cssImport);
+     *             headElements.add(cssImport);
      *         }
-     *         return htmlHeaders;
+     *         return headElements;
      *     }
      * } </pre>
      *
-     * An alternative is to add the HTML headers in the Page constructor:
+     * An alternative is to add the HEAD elements in the Page constructor:
      *
      * <pre class="prettyprint">
      * public MyPage extends Page {
      *
      *     public MyPage() {
-     *         JavascriptImport jsImport = new JavascriptImport("/mycorp/js/mypage.js");
-     *         getHtmlHeaders().add(jsImport);
+     *         JsImport jsImport = new JsImport("/mycorp/js/mypage.js");
+     *         getHeadElements().add(jsImport);
      *         CssImport cssImport = new CssImport("/mycorp/js/mypage.css");
-     *         getHtmlHeaders().add(cssImport);
+     *         getHeadElements().add(cssImport);
      *     }
      * } </pre>
      *
-     * One can also add HTML headers from event handler methods such as
+     * One can also add HEAD elements from event handler methods such as
      * {@link #onInit()}, {@link #onGet()}, {@link #onPost()}, {@link #onRender()}
-     * etc. However when using {@link #stateful Stateful} pages, you will need to
-     * set the HTML header list to <tt>null</tt> in the {@link #onDestroy()} event
-     * handler, otherwise the HTML header list will continue to grow with each
-     * request:
+     * etc. <b>Please note:</b> when using {@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 {
@@ -722,31 +722,32 @@
      *         setStateful(true);
      *     }
      *
+     *     // Set HEAD elements in the onInit event handler
      *     public void onInit() {
-     *         // Add HTML headers
-     *         JavascriptImport jsImport = new JavascriptImport("/mycorp/js/mypage.js");
-     *         getHtmlHeaders().add(jsImport);
+     *         // Add HEAD elements
+     *         JsImport jsImport = new JsImport("/mycorp/js/mypage.js");
+     *         getHeadElements().add(jsImport);
      *         CssImport cssImport = new CssImport("/mycorp/js/mypage.css");
-     *         getHtmlHeaders().add(cssImport);
+     *         getHeadElements().add(cssImport);
      *     }
      *
      *     public void onDestroy() {
-     *         // Nullify the HTML headers
-     *         htmlHeaders = null;
+     *         // Nullify the HEAD elements
+     *         headElements = null;
      *     }
      * } </pre>
      *
      * The order in which JS and CSS files are included will be preserved in the
      * page.
      * <p/>
-     * <b>Note:</b> this method must never return null. If no HTML HEAD entries
+     * <b>Note:</b> this method must never return null. If no HEAD elements
      * are available this method must return an empty {@link java.util.List}.
      * <p/>
-     * <b>Also note:</b> a common problem when overriding getHtmlHeaders in
-     * subclasses is forgetting to call <em>super.getHtmlHeaders</em>. Consider
-     * carefully whether you should call <em>super.getHtmlHeaders</em> or not.
+     * <b>Also note:</b> a common problem when overriding getHeadElements in
+     * subclasses is forgetting to call <em>super.getHeadElements</em>. Consider
+     * carefully whether you should call <em>super.getHeadElements</em> or not.
      *
-     * @return the list of HTML HEAD entries to be included in the page
+     * @return the list of HEAD elements to be included in the page
      */
     public List getHeadElements() {
         if (headElements == null) {

Modified: incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractContainer.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractContainer.java?rev=755737&r1=755736&r2=755737&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractContainer.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractContainer.java Wed Mar 18 21:11:19 2009
@@ -277,7 +277,7 @@
     /**
      * @see org.apache.click.Control#getHtmlImports()
      *
-     * @deprecated use the new {@link #getHtmlHeaders()} instead
+     * @deprecated use the new {@link #getHeadElements()} instead
      *
      * @return the HTML includes statements for the container and child Controls,
      * or null if no includes are available

Modified: incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java?rev=755737&r1=755736&r2=755737&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java Wed Mar 18 21:11:19 2009
@@ -548,7 +548,7 @@
     /**
      * @see org.apache.click.Control#getHtmlImports()
      *
-     * @deprecated use the new {@link #getHtmlHeaders()} instead
+     * @deprecated use the new {@link #getHeadElements()} instead
      *
      * @return the HTML includes statements for the control stylesheet and
      * JavaScript files
@@ -560,7 +560,7 @@
     /**
      * @see org.apache.click.Control#getHeadElements()
      *
-     * @return the list of HTML HEAD elements to be included in the page
+     * @return the list of HEAD elements to be included in the page
      */
     public List getHeadElements() {
         if (headElements == null) {