click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r757949 - in /incubator/click/trunk/click/documentation/xdocs/src: css/html/ docbook/click/ images/pages/ styles/html/ styles/pdf/
Date Tue, 24 Mar 2009 18:46:12 GMT
Author: sabob
Date: Tue Mar 24 18:46:09 2009
New Revision: 757949

URL: http://svn.apache.org/viewvc?rev=757949&view=rev
Log:
added docs for HEAD elements

Modified:
    incubator/click/trunk/click/documentation/xdocs/src/css/html/stylesheet.css
    incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-best-practices.xml
    incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-configuration.xml
    incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-controls.xml
    incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml
    incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml
    incubator/click/trunk/click/documentation/xdocs/src/docbook/click/click-book.xml
    incubator/click/trunk/click/documentation/xdocs/src/images/pages/get-sequence-diagram.png
    incubator/click/trunk/click/documentation/xdocs/src/styles/html/custom.xsl
    incubator/click/trunk/click/documentation/xdocs/src/styles/pdf/custom.xsl

Modified: incubator/click/trunk/click/documentation/xdocs/src/css/html/stylesheet.css
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/css/html/stylesheet.css?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/css/html/stylesheet.css (original)
+++ incubator/click/trunk/click/documentation/xdocs/src/css/html/stylesheet.css Tue Mar 24
18:46:09 2009
@@ -100,7 +100,6 @@
 div.section {
 }
 
-
 div.authorgroup
 {
     text-align:     left;
@@ -113,7 +112,7 @@
 }
 
 .toc dt {
-    padding-bottom: 1px;
+    padding-bottom: 4px;
 }
 
 div.itemizedlist {

Modified: incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-best-practices.xml
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-best-practices.xml?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-best-practices.xml
(original)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-best-practices.xml
Tue Mar 24 18:46:09 2009
@@ -20,64 +20,10 @@
 <chapter id="chapter-best-practices" remap="h1">
   <title>Best Practices</title>
 
-  <para> This section discusses Best Practices for designing and building Click
-  application. The following topics are covered:
+  <para>This chapter discusses Best Practices for designing and building Click
+  applications.
   </para>
 
-  <orderedlist>
-    <listitem>
-      <para>
-        <link linkend="security">Security</link>  - use JEE role based security
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="packages-classes">Packages and Classes</link>  - project
-        package structures and page classes
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="automapping">Page Auto Mapping</link>  - use
-        Convention over Configuration
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="navigation">Navigation</link>  - use Page classes
-        to forward and redirect
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="templating">Templating</link>  - to standardize your
-        web application
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="menus">Menus</link>  - centralize your page navigation
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="logging">Logging</link>  - use Log4j in a base page
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="error-handling">Error Handling</link>  - use custom
-        error page
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="performance">Performance</link>  - enhancing page
-        performance
-      </para>
-    </listitem>
-  </orderedlist>
-
   <sect1 id="security" remap="h2">
     <title>Security</title>
 
@@ -926,16 +872,14 @@
 
     public void getPageImports () {
         PageImports pageImports = super.getPageImports();
-        String contextPath = getContext().getRequest().getContextPath();
 
-        String cssInclude = contextPath + "/assets/css/home-page.css";
-        pageImports.addImport("&lt;link type=\"text/javascript\" href=\"" + cssInclude
+ "\"/&gt;");
+        // Add the Page Css to the PageImports
+        pageImports.add(new CssImport("/assets/css/home-page.css"));
 
-        String jsInclude = contextPath + "/assets/js/home-page.js";
-        pageImports.addImport("&lt;script type=\"text/javascript\"
-            src=\"" + jsInclude + "\"&gt;&lt;/script&gt;");
+        // Add the Page JS to the PageImports
+        pageImports.add(new JsImport("/assets/js/home-page.js"));
 
-        // Set pageImports to initialized so that no other CSS and JavaScript
+        // Set pageImports to initialized so that no other Css and JavaScript
         // files will be included.
         pageImports.setInitialized(true);
     }
@@ -947,13 +891,13 @@
     <programlisting language="xml">&lt;html&gt;
   &lt;head&gt;
     &lt;title&gt;Click Examples&lt;/title&gt;
-    ${cssImports}
+    ${headElements}
   &lt;/head&gt;
   &lt;body&gt;
 
   ...
 
-  ${jsImports}
+  ${jsElements}
   &lt;/body&gt;
 &lt;/html&gt;</programlisting>
 

Modified: incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-configuration.xml
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-configuration.xml?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-configuration.xml
(original)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-configuration.xml
Tue Mar 24 18:46:09 2009
@@ -20,31 +20,9 @@
 <chapter id="chapter-configuration" remap="h1">
   <title>Configuration</title>
 
-  <para>This section discusses how to setup and configure a Click web application
-  and covers the following topics:
+  <para>This section discusses how to setup and configure a Click web application.
   </para>
 
-  <orderedlist>
-    <listitem>
-      <para>
-        <link linkend="servlet-configuration">Servlet Configuration</link>
-        - how to setup the ClickServlet
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="application-configuration">Application Configuration</link>
-        - how to configure the Click application descriptor
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="auto-deployed-files">Auto Deployed Files</link>
-        - automatically deployed Click files
-      </para>
-    </listitem>
-  </orderedlist>
-
   <para>The Click configuration files include:
   </para>
 

Modified: incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-controls.xml
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-controls.xml?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-controls.xml
(original)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-controls.xml
Tue Mar 24 18:46:09 2009
@@ -21,51 +21,14 @@
   <title>Controls</title>
 
   <para> Click provides a rich set of Controls which support client side
-  rendering and server side processing. This section covers the following topics:
+  rendering and server side processing. Please see the
+  <ulink url="../../click-api/org/apache/click/control/package-summary.html">Javadoc</ulink>,
+  which provides extensive information and examples of the core Controls.
   </para>
 
-  <orderedlist>
-    <listitem>
-      <para>
-        <link linkend="control-interface">Control Interface</link>  - describes
-        the Control interface
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="control-callback">Control Callback</link>  - control
-        event callback pattern
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="control-class">Control Classes</link>  - control Java
-        classes
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="control-message-properties">Control Message Properties</link>
-        - control message properties
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="container">Container</link>  - a Container is a Control
-        that can contain other Controls.
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="layout">Layouts</link>  - describes layout options and
-        how to create custom layouts.
-      </para>
-    </listitem>
-  </orderedlist>
+  <para>This chapter covers Control in detail including the Control life cycle,
+  Control event callbacks and localization.
 
-  <para>While this section provides an overview how Controls work please see the
-  <ulink url="../../click-api/org/apache/click/control/package-summary.html">Javadoc</ulink>,
-  which provides extensive information and examples.
   </para>
 
   <sect1 id="control-interface" remap="h2">
@@ -524,6 +487,92 @@
     </sect2>
   </sect1>
 
+  <sect1 id="control-head-elements" remap="h2">
+    <title>Control HEAD Elements</title>
+
+    <para>The Control interface provides the method
+    <ulink url="../../click-api/org/apache/click/Control.html#getHeadElements()">getHeadElements()</ulink>
+    which allows the Control to add Page HEAD
+    <ulink url="../../click-api/org/apache/click/element/Element.html">elements</ulink>
+    such as <ulink url="../../click-api/org/apache/click/element/JsImport.html">JsImport</ulink>,
+    <ulink url="../../click-api/org/apache/click/element/JsScript.html">JsScript</ulink>,
+    <ulink url="../../click-api/org/apache/click/element/CssImport.html">CssImport</ulink>
+    and <ulink url="../../click-api/org/apache/click/element/CssStyle.html">CssStyle</ulink>.
+    </para>
+
+    <para>Here is an example of adding new HEAD elements to a custom
+    <classname>Control</classname>:
+    </para>
+
+    <programlisting language="java">public class MyControl extends AbstractControl
{
+
+    public MyControl() {
+
+        /**
+         * Override the default getHeadElements implementation to return
+         * MyControl's list of HEAD elements.
+         *
+         * Note that the variable <varname>headElements</varname> is defined
+         * in AbstractControl.
+         *
+         * @return list the list of HEAD elements
+         */
+        public List getHeadElements() {
+
+            // Use lazy loading to only add the HEAD elements once and when needed.
+            if (headElements == null) {
+
+                // Get the head elements from the super implementation
+                headElements = super.getHeadElements();
+
+                // Add the JavaScript import "/mycontrol.js" to the control
+                headElements.add(new JsImport("/mycontrol.js"));
+
+                // Add the Css import "/mycontrol.css" to the control
+                headElements.add(new CssImport("/mycontrol.css"));
+            }
+            return headElements;
+        }
+    }
+
+    ...
+
+} </programlisting>
+
+    <para>In the example above we added the HEAD elements by overriding the
+    Control's <methodname>getHeadElements</methodname> method, however you can
+    add HEAD elements from anywhere in the Control including the event handlers
+    <literal>onInit</literal>, <literal>onGet</literal>,
+    <literal>onPost</literal>, <literal>onRender</literal> etc.
+    Please see <ulink url="../../click-api/org/apache/click/Page.html#getHeadElements()">getHeadElements()</ulink>
+    for more details.
+    </para>
+
+    <para><classname>MyControl</classname> will add the following HEAD
elements
+    to the Page HEAD section, together with HEAD elements added by the Page and
+    other controls (assume the application context is "/myapp"):
+    </para>
+
+    <programlisting language="xml">&lt;html&gt;
+  &lt;head&gt;
+    &lt;link rel="stylesheet" type="text/css" href="<symbol>/myapp/mycontrol.css</symbol>"&gt;&lt;/link&gt;
+  &lt;/head&gt;
+
+  &lt;body&gt;
+
+    ...
+
+    &lt;script type="text/javascript" src="<symbol>/myapp/mycontrol.js</symbol>"/&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt; </programlisting>
+
+  <para>A live demo showing how to add HEAD elements from a custom Control can
+  be seen <ulink url="http://www.avoka.com/click-examples/general/control-head-demo.htm">here</ulink>.
+  </para>
+
+  </sect1>
+
   <sect1 id="container" remap="h2">
     <title>Container</title>
 

Modified: incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml
(original)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml
Tue Mar 24 18:46:09 2009
@@ -20,84 +20,39 @@
 <chapter id="chapter-introduction">
   <title>Introduction to Click</title>
 
-  <sect1 id="preface">
-    <title>Preface</title>
-
-    <para>Click is a simple JEE web application framework for commercial
-    Java developers.
-    </para>
-
-    <para>Click is an open source project, licensed under the
-    <ulink url="../../LICENSE.txt"><citetitle>Apache license</citetitle>
-    </ulink>.
-    </para>
-
-    <para>Click uses an event based programming model for processing Servlet
-    requests and <ulink url="../../velocity/velocity.html">Velocity</ulink> for
-    rendering the response. (Note other template engines such as
-    <ulink url="http://java.sun.com/products/jsp/">JSP</ulink> and
-    <ulink url="http://freemarker.sourceforge.net/">Freemarker</ulink> are also
-    supported)
-    </para>
+  <para>Click is a simple JEE web application framework for commercial
+  Java developers.
+  </para>
 
-    <para>This framework uses a single servlet, called
-    <ulink url="../../click-api/org/apache/click/ClickServlet.html">ClickServlet</ulink>,
-    to act as a request dispatcher. When a request arrives ClickServlet creates
-    a <ulink url="../../click-api/org/apache/click/Page.html">Page</ulink>
-    object to process the request and then uses the page's Velocity template to
-    render the results.
-    </para>
+  <para>Click is an open source project, licensed under the
+  <ulink url="../../LICENSE.txt"><citetitle>Apache license</citetitle>
+  </ulink>.
+  </para>
 
-    <para>Pages provide a simple thread safe programming environment, with a new
-    page instance created for each servlet request.
-    </para>
+  <para>Click uses an event based programming model for processing Servlet
+  requests and <ulink url="../../velocity/velocity.html">Velocity</ulink> for
+  rendering the response. (Note other template engines such as
+  <ulink url="http://java.sun.com/products/jsp/">JSP</ulink> and
+  <ulink url="http://freemarker.sourceforge.net/">Freemarker</ulink> are also
+  supported)
+  </para>
 
-    <para>Possibly the best way to see how Click works is to dive right in and
-    look at some examples.
-    </para>
+  <para>This framework uses a single servlet, called
+  <ulink url="../../click-api/org/apache/click/ClickServlet.html">ClickServlet</ulink>,
+  to act as a request dispatcher. When a request arrives ClickServlet creates
+  a <ulink url="../../click-api/org/apache/click/Page.html">Page</ulink>
+  object to process the request and then uses the page's Velocity template to
+  render the results.
+  </para>
 
-    <itemizedlist>
-      <listitem>
-        <para>
-          <link linkend="hello-world">Hello World</link> - the Hello World
-          classic
-        </para>
-      </listitem>
-      <listitem>
-        <para>
-          <link linkend="control-listener">Control Listener</link> - an
-          ActionLink control listener example
-        </para>
-      </listitem>
-      <listitem>
-        <para>
-          <link linkend="simple-table">Simple Table</link> - a simple Table
-          control example
-        </para>
-      </listitem>
-      <listitem>
-        <para>
-          <link linkend="advanced-table">Advanced Table</link> - a more advanced
-          Table example
-        </para>
-      </listitem>
-      <listitem>
-        <para>
-          <link linkend="simple-form">Simple Form</link> - a simple Form example
-        </para>
-      </listitem>
-      <listitem>
-        <para>
-          <link linkend="advanced-form">Advanced Form</link> - a more advanced
-          Form example
-        </para>
-      </listitem>
-    </itemizedlist>
-  </sect1>
+  <para>Pages provide a simple thread safe programming environment, with a new
+  page instance created for each servlet request.
+  </para>
 
-  <para>These examples are available online at
+  <para>Possibly the best way to see how Click works is to dive right in and
+  look at some examples. (The examples are also available online at
   <ulink url="http://www.avoka.com/click-examples/">http://www.avoka.com/click-examples/</ulink>
-  under the menu "Intro Examples".
+  under the menu "Intro Examples".)
   </para>
 
   <sect1 id="hello-world">
@@ -336,22 +291,23 @@
 
     <programlisting language="xml">&lt;html&gt;
   &lt;head&gt;
-    <varname>$cssImports</varname>
+    <varname>$headElements</varname>
   &lt;/head&gt;
   &lt;body&gt;
 
     <varname>$table</varname>
 
-    <varname>$jsImports</varname>
+    <varname>$jsElements</varname>
 
   &lt;/body&gt;
 &lt;/html&gt;</programlisting>
 
-    <para>Note above we also specify the <varname>$cssImports</varname>
-    reference so the table can include any CSS imports or styles in the header,
-    and the <varname>$jsImports</varname> reference any JavaScript imports or
-    scripts at the bottom. At runtime Click automatically makes the variables
-    <varname>$cssImports</varname> and <varname>$jsImports</varname>
available
+    <para>Note from the example above that we specify the <varname>$headElements</varname>
+    reference so that the table can include any HEAD elements, which includes Css
+    imports and styles, in the header. Also note we specify the
+    <varname>$jsElements</varname> reference which include any JavaScript imports
+    and scripts at the bottom. At runtime Click automatically makes the variables
+    <varname>$headElements</varname> and <varname>$jsElements</varname>
available
     to the template.
     </para>
 
@@ -472,13 +428,13 @@
 
     <programlisting language="xml">&lt;html&gt;
   &lt;head&gt;
-    <varname>$cssImports</varname>
+    <varname>$headElements</varname>
   &lt;/head&gt;
   &lt;body&gt;
 
     <varname>$table</varname>
 
-    <varname>$jsImports</varname>
+    <varname>$jsElements</varname>
 
   &lt;/body&gt;
 &lt;/html&gt;</programlisting>
@@ -556,7 +512,7 @@
 
     <programlisting language="xml">&lt;html&gt;
   &lt;head&gt;
-    <varname>$cssImports</varname>
+    <varname>$headElements</varname>
   &lt;/head&gt;
   &lt;body&gt;
 
@@ -566,7 +522,7 @@
       &lt;div id="msgDiv"&gt; <varname>$msg</varname> &lt;/div&gt;
     <command>#end</command>
 
-    <varname>$jsImports</varname>
+    <varname>$jsElements</varname>
 
   &lt;/body&gt;
 &lt;/html&gt;</programlisting>
@@ -723,7 +679,7 @@
 
     <programlisting language="xml">&lt;html&gt;
   &lt;head&gt;
-    <varname>$cssImports</varname>
+    <varname>$headElements</varname>
   &lt;/head&gt;
   &lt;body&gt;
 
@@ -733,7 +689,7 @@
 
     <varname>$form</varname>
 
-    <varname>$jsImports</varname>
+    <varname>$headElements</varname>
 
   &lt;/body&gt;
 &lt;/html&gt;</programlisting>

Modified: incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml (original)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml Tue
Mar 24 18:46:09 2009
@@ -22,74 +22,9 @@
 
   <para>Pages are the heart of web applications. In Click, Pages encapsulate
   the processing of HTML requests and the rendering of HTML responses.
-  The section discusses Click pages and covers to following topics:
+  This chapter discusses Click pages in detail.
   </para>
 
-  <orderedlist>
-    <listitem>
-      <para>
-        <link linkend="classes">Classes</link>  - page Java classes
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="execution">Execution</link>  - page execution sequence
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="request-param-auto-binding">Request Param Auto Binding</link>
-        - request parameter to page field auto binding
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="page-security">Security</link>  - page security model
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="page-navigation">Navigation</link>  - navigation
-        between pages
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="page-templating">Page Templating</link>  - templating
-        common page content
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="page-direct-rendering">Direct Rendering</link>
-        - page direct rendering
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="stateful-pages">Stateful</link>  - stateful pages
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="page-error-handling">Error Handling</link>  - page
-        error handling
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="page-not-found">Page Not Found</link>  - page not
-        found handling
-      </para>
-    </listitem>
-    <listitem>
-      <para>
-        <link linkend="page-message-properties">Page Message Properties</link>
-        - pages message properties
-      </para>
-    </listitem>
-  </orderedlist>
-
   <para>In Click, a logical page is composed of a Java class and a Velocity
   template, with these components being defined in page elements of the
   <link linkend="application-configuration">click.xml</link>
@@ -261,28 +196,23 @@
         <para>context &nbsp;-&nbsp; the Servlet context path, e.g. /mycorp</para>
       </listitem>
       <listitem>
-        <para>cssImports &nbsp;-&nbsp; the CSS imports and style blocks to
include
-        in the pages header. Please see
-        <ulink url="../../click-api/org/apache/click/util/PageImports.html">PageImports</ulink>
-        for more details.
-        </para>
-      </listitem>
-      <listitem>
         <para>format &nbsp;-&nbsp; the
         <ulink url="../../click-api/org/apache/click/util/Format.html">Format</ulink>
         object for formatting the display of objects.
         </para>
       </listitem>
       <listitem>
-        <para>imports &nbsp;-&nbsp; the CSS and JavaScript imports to include
in the pages
-        header. Please see
+        <para>headElements &nbsp;-&nbsp; the HEAD <ulink url="../../click-api/org/apache/click/element/Element.html">elements</ulink>,
+        excluding JavaScript, to include in the page header. Please see
         <ulink url="../../click-api/org/apache/click/util/PageImports.html">PageImports</ulink>
         for more details.
         </para>
       </listitem>
       <listitem>
-        <para>jsImports &nbsp;-&nbsp; the JavaScript imports and script blocks
to include in the pages footer. Please see
-          <ulink url="../../click-api/org/apache/click/util/PageImports.html">PageImports</ulink>
for more details.
+        <para>jsElements &nbsp;-&nbsp; the JavaScript imports and script blocks
to
+        include in the pages footer. Please see
+        <ulink url="../../click-api/org/apache/click/util/PageImports.html">PageImports</ulink>
+        for more details.
         </para>
       </listitem>
       <listitem>
@@ -358,7 +288,7 @@
   </sect1>
 
   <sect1 id="request-param-auto-binding" remap="h2">
-    <title>Request Param Auto Binding</title>
+    <title>Request Parameter Auto Binding</title>
 
     <para>Click will automatically bind any request parameter values to public
     Page fields with the same name. When binding these values it will also
@@ -1269,6 +1199,7 @@
     </para>
 
   </sect1>
+
   <sect1 id="page-not-found" remap="h2">
     <title>Page Not Found</title>
 
@@ -1298,6 +1229,7 @@
     </para>
 
   </sect1>
+
   <sect1 id="page-message-properties" remap="h2">
     <title>Page Message Properties</title>
 
@@ -1338,4 +1270,101 @@
     </para>
 
   </sect1>
+
+  <sect1 id="page-head-elements" remap="h2">
+    <title>Page HEAD Elements</title>
+
+    <para>The Page class provides the method
+    <ulink url="../../click-api/org/apache/click/Page.html#getHeadElements()">getHeadElements()</ulink>
+    for contributing HEAD <ulink url="../../click-api/org/apache/click/element/Element.html">elements</ulink>
+    such as <ulink url="../../click-api/org/apache/click/element/JsImport.html">JsImport</ulink>,
+    <ulink url="../../click-api/org/apache/click/element/JsScript.html">JsScript</ulink>,
+    <ulink url="../../click-api/org/apache/click/element/CssImport.html">CssImport</ulink>
+    and <ulink url="../../click-api/org/apache/click/element/CssStyle.html">CssStyle</ulink>.
+    </para>
+
+    <para>Here is an example of adding new HEAD elements to the
+    <classname>MyPage</classname> class:
+    </para>
+
+    <programlisting language="java">public class MyPage extends Page {
+
+    public MyPage() {
+        // Add the JavaScript import "/mypage.js" to the page
+        getHeadElements().add(new JsImport("/mypage.js"));
+
+        // Add some inline JavaScript content to the page
+        getHeadElements().add(new JsScript("alert('Welcome to MyPage');"));
+
+        // Add the Css import "/mypage.css" to the page
+        getHeadElements().add(new CssImport("/mypage.css"));
+
+        // Add some inline Css content to the page
+        getHeadElements().add(new CssStyle("body { font-family: Verdana; }"));
+    }
+
+    ...
+
+} </programlisting>
+
+    <para>In the example above we added the HEAD elements from the Page constructor,
+    however you can add HEAD elements from anywhere in the Page including the
+    event handlers <literal>onInit</literal>, <literal>onGet</literal>,
+    <literal>onPost</literal>, <literal>onRender</literal> etc.
+    Please see <ulink url="../../click-api/org/apache/click/Page.html#getHeadElements()">getHeadElements()</ulink>
+    for more details.
+    </para>
+
+    <para>Below is the <filename>/my-page.htm</filename> template:
+    </para>
+
+    <programlisting language="xml">&lt;html&gt;
+  &lt;head&gt;
+    <varname>$headElements</varname>
+  &lt;/head&gt;
+
+  &lt;body&gt;
+
+    ...
+
+    <varname>$jsElements</varname>
+
+  &lt;/body&gt;
+&lt;/html&gt; </programlisting>
+
+    <para>The two variables, <varname>$headElements</varname> and
+    <varname>$jsElements</varname>, are automatically made available to the Page
+    template. These variables references the JavaScript and Css HEAD elements
+    specified in <classname>MyPage</classname>.
+    </para>
+
+    <para>The following HTML will be rendered (assuming the application context
+    is "/myapp"):
+    </para>
+
+    <programlisting language="xml">&lt;html&gt;
+  &lt;head&gt;
+    &lt;link rel="stylesheet" type="text/css" href="<symbol>/myapp/mypage.css</symbol>"&gt;&lt;/link&gt;
+    &lt;style rel="stylesheet" type="text/css"&gt;
+      <symbol>body { font-family: Verdana; }</symbol>
+    &lt;/style&gt;
+  &lt;/head&gt;
+
+  &lt;body&gt;
+
+    ...
+
+    &lt;script type="text/javascript" src="<symbol>/myapp/mypage.js</symbol>"/&gt;
+    &lt;script type="text/javascript"&gt;
+      <symbol>alert('Welcome to MyPage');</symbol>
+    &lt;/script&gt;
+
+  &lt;/body&gt;
+&lt;/html&gt; </programlisting>
+
+    <para>A live demo showing how to add HEAD elements to a Page can be seen
+    <ulink url="http://www.avoka.com/click-examples/general/page-head-demo.htm">here</ulink>.
+    </para>
+
+  </sect1>
 </chapter>

Modified: incubator/click/trunk/click/documentation/xdocs/src/docbook/click/click-book.xml
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/docbook/click/click-book.xml?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/click-book.xml (original)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/click-book.xml Tue Mar
24 18:46:09 2009
@@ -42,8 +42,8 @@
 		<authorgroup>
 			<corpauthor>Apache Click User Guide</corpauthor>
 		</authorgroup>
-		
-		<mediaobject>
+
+    <mediaobject>
 			<imageobject>
 				<imagedata fileref="images/click-logo.png" />
 			</imageobject>
@@ -59,7 +59,3 @@
   &chapter-best-practices;
 
 </book>
-
-
-
- 

Modified: incubator/click/trunk/click/documentation/xdocs/src/images/pages/get-sequence-diagram.png
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/images/pages/get-sequence-diagram.png?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
Binary files - no diff available.

Modified: incubator/click/trunk/click/documentation/xdocs/src/styles/html/custom.xsl
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/styles/html/custom.xsl?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/styles/html/custom.xsl (original)
+++ incubator/click/trunk/click/documentation/xdocs/src/styles/html/custom.xsl Tue Mar 24
18:46:09 2009
@@ -60,7 +60,6 @@
   <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
     <l:l10n language="en">
       <l:context name="title-numbered">
-        <l:template name="chapter" text="%n.&#160;%t"/>
         <l:template name="section" text="%n&#160;%t"/>
       </l:context>
     </l:l10n>

Modified: incubator/click/trunk/click/documentation/xdocs/src/styles/pdf/custom.xsl
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/styles/pdf/custom.xsl?rev=757949&r1=757948&r2=757949&view=diff
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/styles/pdf/custom.xsl (original)
+++ incubator/click/trunk/click/documentation/xdocs/src/styles/pdf/custom.xsl Tue Mar 24 18:46:09
2009
@@ -318,7 +318,6 @@
   <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
     <l:l10n language="en">
       <l:context name="title-numbered">
-        <l:template name="chapter" text="%n.&#160;%t"/>
         <l:template name="section" text="%n&#160;%t"/>
       </l:context>
       <l:context name="title">



Mime
View raw message