You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by ta...@apache.org on 2010/02/12 00:36:29 UTC
svn commit: r909177 [3/11] - in
/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide:
./ css/ images/ images/best-practices/ images/callouts/ images/colorsvg/
images/configuration/ images/controls/ images/introduction/ images/pa...
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s07.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s07.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s07.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s07.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,47 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>2.7. Direct Rendering</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch02.html" title="Chapter 2. Pages"><link rel="prev" href="ch02s06.html" title="2.6. Page Templating"><link rel="next" href="ch02s08.html" title="2.8. Stateful Pages"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.7. Direct Rendering</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s06.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Pages</th><td width="20%" align="right"> <a accesskey="n" href="ch02s08.html">Next</a></td></tr></table><hr></div><div class="sect1" title="2.7. Direct Rendering"><div c
lass="titlepage"><div><div><h2 class="title" style="clear: both"><a name="page-direct-rendering"></a>2.7. Direct Rendering</h2></div></div></div><p>Pages support a direct rendering mode where you can render directly
+ to the servlet response and bypass the page template rendering. This is
+ useful for scenarios where you want to render non HTML content to the
+ response, such as a PDF or Excel document. To do this:
+ </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p> get the servlet response object</p></li><li class="listitem"><p> set the content type on the response</p></li><li class="listitem"><p> get the response output stream</p></li><li class="listitem"><p> write to the output stream</p></li><li class="listitem"><p> close the output stream</p></li><li class="listitem"><p> set the page path to null to inform the ClickServlet that
+ rendering has been completed</p></li></ul></div><p>A direct rendering example is provided below.
+ </p><pre class="programlisting"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">/**
+ * Render the Java source file as "text/plain".
+ *
+ * @see Page#onGet()
+ */</span>
+<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">void</span> onGet() {
+ String filename = ..
+
+ HttpServletResponse response = getContext().getResponse();
+
+ response.setContentType(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"text/plain"</span>);
+ response.setHeader(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"Pragma"</span>, <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"no-cache"</span>);
+
+ ServletContext context = getContext().getServletContext();
+
+ InputStream inputStream = null;
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">try</span> {
+ inputStream = context.getResourceAsStream(filename);
+
+ PrintWriter writer = response.getWriter();
+
+ BufferedReader reader = <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> BufferedReader(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> InputStreamReader(inputStream));
+
+ String line = reader.readLine();
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">while</span> (line != null) {
+ writer.println(line);
+ line = reader.readLine();
+ }
+
+ setPath(null);
+
+ } <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">catch</span> (IOException ioe) {
+ ioe.printStackTrace();
+
+ } <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">finally</span> {
+ ClickUtils.close(inputStream);
+ }
+}</pre></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.6. Page Templating </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.8. Stateful Pages</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s07.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s08.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s08.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s08.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s08.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,66 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>2.8. Stateful Pages</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch02.html" title="Chapter 2. Pages"><link rel="prev" href="ch02s07.html" title="2.7. Direct Rendering"><link rel="next" href="ch02s09.html" title="2.9. Error Handling"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.8. Stateful Pages</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s07.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Pages</th><td width="20%" align="right"> <a accesskey="n" href="ch02s09.html">Next</a></td></tr></table><hr></div><div class="sect1" title="2.8. Stateful Pages"><div class=
"titlepage"><div><div><h2 class="title" style="clear: both"><a name="stateful-pages"></a>2.8. Stateful Pages</h2></div></div></div><p>Click supports stateful pages where the state of the page is saved
+ between the users requests. Stateful pages are useful in a number of
+ scenarios including:
+ </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Search page and edit page interactions. In this scenario you
+ navigage from a stateful search page which may have filter criteria
+ applied to an object edit page. Once object update has been completed
+ on the edit page, the user is redirected to the search page and the
+ stateful filter criteria still applies.
+ </p></li><li class="listitem"><p>Complex pages with multiple forms and or tables which need to
+ maintain their state between interactions.
+ </p></li></ul></div><p>To make a page stateful you simply need to set the page
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Page.html#stateful" target="_blank">stateful</a>
+ property to true, have the page implement the <code class="classname">Serializable</code>
+ interface and set the <code class="literal">serialVersionUID</code> indicator.
+ For example:
+ </p><pre class="programlisting"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">package</span> com.mycorp.page;
+
+<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">import</span> java.io.Serializable;
+
+<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">import</span> org.apache.click.Page;
+
+<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">class</span> SearchPage <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">extends</span> Page <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">implements</span> Serializable {
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">private</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">static</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">final</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">long</span> serialVersionUID = <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="lit">1L</span>;
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> SearchPage() {
+ setStateful(true);
+ ..
+ }
+}</pre><p>Stateful page instances are stored in the user's
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpSession.html" target="_blank">HttpSession</a>
+ using the pages class name as the key. In the example above the page would
+ be stored in the users session using the class name:
+ <code class="classname">com.mycorp.page.SearchPage</code>
+ </p><div class="sect2" title="2.8.1. Page Creation"><div class="titlepage"><div><div><h3 class="title"><a name="page-creation"></a>2.8.1. Page Creation</h3></div></div></div><p>With stateful pages they are only created once, after which they
+ are retrieved from the session. However page event handlers are invoked
+ for each request, including the <code class="methodname">onInit()</code> method.
+ </p><p>When you are creating stateful pages you typically place all your
+ control creation code in the Pages constructor so it is invoked only once.
+ It is important not to place control creation code in the
+ <code class="methodname">onInit()</code> method which will be invoked with each
+ request.
+ </p><p>If you have dynamic control creation code you would typically place
+ this in the <code class="methodname">onInit()</code> method, but you will need to
+ take care that controls and or models are not already present in the page.
+ </p></div><div class="sect2" title="2.8.2. Page Execution"><div class="titlepage"><div><div><h3 class="title"><a name="page-execution"></a>2.8.2. Page Execution</h3></div></div></div><p>The default Click page execution model is thread safe as a new
+ Page instance is created for each request and thread. With stateful
+ pages a user will have a single page instance which is reused in multiple
+ requests and threads. To ensure page execution is thread safe, users page
+ instances are synchronized so only one request thread can execute a page
+ instance at any one time.
+ </p></div><div class="sect2" title="2.8.3. Page Destruction"><div class="titlepage"><div><div><h3 class="title"><a name="page-destruction"></a>2.8.3. Page Destruction</h3></div></div></div><p>After normal page instances have been executed, they are
+ de-referenced and garbage collected by the JVM. However with stateful
+ pages they are stored in the users <code class="classname">HttpSession</code> so
+ care needs to be take not to store too many objects in stateful page
+ instances which may cause memory and performance issues.
+ </p><p>When pages have completed their execution, all the Page's controls
+ <code class="methodname">onDestroy()</code> methods are invoked, and then the
+ Page's <code class="methodname">onDestroy()</code> method is invoked. This is
+ your opportunity to de-reference any large sets or graphs. For example the
+ Table control by default de-references its rowList in its
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/Table.html#onDestroy()" target="_blank">onDestory()</a>
+ method.
+ </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.7. Direct Rendering </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.9. Error Handling</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s08.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s09.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s09.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s09.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s09.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,32 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>2.9. Error Handling</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch02.html" title="Chapter 2. Pages"><link rel="prev" href="ch02s08.html" title="2.8. Stateful Pages"><link rel="next" href="ch02s10.html" title="2.10. Page Not Found"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.9. Error Handling</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s08.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Pages</th><td width="20%" align="right"> <a accesskey="n" href="ch02s10.html">Next</a></td></tr></table><hr></div><div class="sect1" title="2.9. Error Handling"><div class="
titlepage"><div><div><h2 class="title" style="clear: both"><a name="page-error-handling"></a>2.9. Error Handling</h2></div></div></div><p>If an Exception occurs processing a Page object or rendering a
+ template the error is delegated to the registered handler. The default
+ Click error handler is the
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/util/ErrorPage.html" target="_blank">ErrorPage</a>,
+ which is automatically configured as:
+ </p><div class="literallayout"><p><page path="<code class="varname">click/error.htm</code>" classname="<span class="symbol">org.apache.click.util.ErrorPage</span>"/></p></div><p>To register an alternative error handler you must subclass ErrorPage
+ and define your page using the path <code class="varname">"click/error.htm"</code>.
+ For example:
+ </p><div class="literallayout"><p><page path="<code class="varname">click/error.htm</code>" classname="<span class="symbol">com.mycorp.page.ErrorPage</span>"/></p></div><p>When the ClickSevlet starts up it checks to see whether the
+ <code class="varname">error.htm</code> template exists in the <code class="varname">click</code>
+ web sub directory. If it cannot find the page the ClickServlet will
+ automatically deploy one. You can tailor the <code class="varname">click/error.htm</code>
+ template to suite you own tastes, and the ClickServlet will
+ not overwrite it.
+ </p><p>The default error template will display extensive debug information
+ when the application is in <code class="literal">development</code> or
+ <code class="literal">debug</code> mode. Example error page displays include:
+ </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../error-npe.html" target="_blank">NullPointerException</a> - in a page
+ method
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../error-parsing.html" target="_blank">ParseErrorException</a> - in a
+ page template
+ </p></li></ul></div><p>When the application is in <code class="literal">production</code> mode only
+ a simple error message is displayed. See
+ <a class="link" href="ch04s02.html#application-mode" title="4.2.6. Mode">Configuration</a> for details on how to
+ set the application mode.
+ </p><p>Please also see the <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../examples.html" target="_blank">Examples</a> web
+ app Exception Demo for demonstrations of Clicks error handling.
+ </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s08.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s10.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.8. Stateful Pages </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.10. Page Not Found</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s09.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s10.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s10.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s10.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s10.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,16 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>2.10. Page Not Found</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch02.html" title="Chapter 2. Pages"><link rel="prev" href="ch02s09.html" title="2.9. Error Handling"><link rel="next" href="ch02s11.html" title="2.11. Page Message Properties"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.10. Page Not Found</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s09.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Pages</th><td width="20%" align="right"> <a accesskey="n" href="ch02s11.html">Next</a></td></tr></table><hr></div><div class="sect1" title="2.10. Page Not Found">
<div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="page-not-found"></a>2.10. Page Not Found</h2></div></div></div><p>If the ClickServlet cannot find a requested page in the
+ <code class="literal">click.xml</code> config file it will use the registered
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../not-found.html" target="_blank">not-found.htm</a> page.
+ </p><p>The Click <code class="literal">not found page</code> is automatically configured
+ as:
+ </p><div class="literallayout"><p><page path="<code class="varname">click/not-found.htm</code>" classname="<span class="symbol">org.apache.click.Page</span>"/></p></div><p>You can override the default configuration and specify your own class,
+ but you cannot change the path.
+ </p><p>When the ClickSevlet starts up it checks to see whether the
+ <code class="varname">not-found.htm</code> template exists in the <code class="varname">click</code>
+ web sub directory. If it cannot find the page the ClickServlet will
+ automatically deploy one.
+ </p><p>You can tailor the <code class="varname">click/not-found.htm</code> template to
+ suite you own needs. This page template has access to the usual Click objects.
+ </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s09.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s11.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.9. Error Handling </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.11. Page Message Properties</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s10.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s11.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s11.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s11.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s11.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,23 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>2.11. Page Message Properties</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch02.html" title="Chapter 2. Pages"><link rel="prev" href="ch02s10.html" title="2.10. Page Not Found"><link rel="next" href="ch02s12.html" title="2.12. Page HEAD Elements"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.11. Page Message Properties</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s10.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Pages</th><td width="20%" align="right"> <a accesskey="n" href="ch02s12.html">Next</a></td></tr></table><hr></div><div class="sect1" title="2.11. Pa
ge Message Properties"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="page-message-properties"></a>2.11. Page Message Properties</h2></div></div></div><p>The Page class provides a
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Page.html#messages" target="_blank">messages</a>
+ property which is a
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/util/MessagesMap.html" target="_blank">MessagesMap</a>
+ of localized messages for the page. These messages are made available in the
+ VelocityContext when the page is rendered under the key
+ <code class="literal">messages</code>. So for example if you had a page title message
+ you would access it in your page template as:
+ </p><div class="literallayout"><p><h1> <span class="symbol">$</span><code class="varname">messages.title</code> </h1></p></div><p>This messages map is loaded from the page class property bundle. For
+ example if you had a page class <code class="classname">com.mycorp.page.CustomerList</code>
+ you could have an associated property file containing the pages localized
+ messages:
+ </p><div class="literallayout"><p>/com/mycorp/page/CustomerList.properties</p></div><p>You can also defined a application global page messages properties file:
+ </p><div class="literallayout"><p>/click-page.properties</p></div><p>Messages defined in this file will be available to all pages throughout
+ your application. Note messages defined in your page class properties file
+ will override any messages defined in the application global page properties
+ file.
+ </p><p>Page messages can also be used to override Control messages, see the
+ Controls <a class="link" href="ch03s04.html" title="3.4. Message Properties">Message Properties</a>
+ topic for more details.
+ </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s10.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s12.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.10. Page Not Found </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.12. Page HEAD Elements</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s11.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s12.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s12.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s12.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s12.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,75 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>2.12. Page HEAD Elements</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch02.html" title="Chapter 2. Pages"><link rel="prev" href="ch02s11.html" title="2.11. Page Message Properties"><link rel="next" href="ch03.html" title="Chapter 3. Controls"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.12. Page HEAD Elements</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s11.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Pages</th><td width="20%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr></table><hr></div><div class="sect1" title="2.12. Page HEAD
Elements"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="page-head-elements"></a>2.12. Page HEAD Elements</h2></div></div></div><p>The Page class provides the method
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Page.html#getHeadElements()" target="_blank">getHeadElements()</a>
+ for contributing HEAD <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/Element.html" target="_blank">elements</a>
+ such as <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/JsImport.html" target="_blank">JsImport</a>,
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/JsScript.html" target="_blank">JsScript</a>,
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/CssImport.html" target="_blank">CssImport</a>
+ and <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/CssStyle.html" target="_blank">CssStyle</a>.
+ </p><p>Here is an example of adding HEAD elements to the
+ <code class="classname">MyPage</code> class:
+ </p><pre class="programlisting"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">class</span> MyPage <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">extends</span> Page {
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> MyPage() {
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Add the JavaScript import "/mypage.js" to the page</span>
+ getHeadElements().add(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> JsImport(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"/mypage.js"</span>));
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Add some inline JavaScript content to the page</span>
+ getHeadElements().add(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> JsScript(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"alert('Welcome to MyPage');"</span>));
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Add the Css import "/mypage.css" to the page</span>
+ getHeadElements().add(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> CssImport(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"/mypage.css"</span>));
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Add some inline Css content to the page</span>
+ getHeadElements().add(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> CssStyle(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"body { font-family: Verdana; }"</span>));
+ }
+
+ ...
+
+} </pre><p>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 <code class="literal">onInit</code>, <code class="literal">onGet</code>,
+ <code class="literal">onPost</code>, <code class="literal">onRender</code> etc.
+ Please see <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Page.html#getHeadElements()" target="_blank">getHeadElements()</a>
+ for more details.
+ </p><p>Below is the <code class="filename">/my-page.htm</code> template:
+ </p><pre class="programlisting"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><html></span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><head></span>
+ <code class="varname">$headElements</code>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></head></span>
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><body></span>
+
+ ...
+
+ <code class="varname">$jsElements</code>
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></body></span>
+<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></html></span> </pre><p>The two variables, <code class="varname">$headElements</code> and
+ <code class="varname">$jsElements</code>, are automatically made available to the Page
+ template. These variables references the JavaScript and Css HEAD elements
+ specified in <code class="classname">MyPage</code>.
+ </p><p>The following HTML will be rendered (assuming the application context
+ is "/myapp"):
+ </p><pre class="programlisting"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><html></span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><head></span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><link</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">rel</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"stylesheet"</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">type</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"text/css"</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">href</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"</span><span class="symbol">/myapp/mypage.css</span>"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></link></span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><style</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">rel</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"stylesheet"</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">type</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"text/css"</span><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag">></span>
+ <span class="symbol">body { font-family: Verdana; }</span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></style></span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></head></span>
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><body></span>
+
+ ...
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><script</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">type</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"text/javascript"</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">src</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"</span><span class="symbol">/myapp/mypage.js</span>"/>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><script</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">type</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"text/javascript"</span><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag">></span>
+ <span class="symbol">alert('Welcome to MyPage');</span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></script></span>
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></body></span>
+<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></html></span> </pre><p>A live demo showing how to add HEAD elements to a Page can be seen
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="http://www.avoka.com/click-examples/general/page-head-demo.htm" target="_blank">here</a>.
+ </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s11.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.11. Page Message Properties </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 3. Controls</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch02s12.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,53 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>Chapter 3. Controls</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="index.html" title="Apache Click"><link rel="prev" href="ch02s12.html" title="2.12. Page HEAD Elements"><link rel="next" href="ch03s02.html" title="3.2. Control Callback"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. Controls</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s12.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch03s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 3. Controls"><div class="titlepage"
><div><div><h2 class="title"><a name="chapter-controls"></a>Chapter 3. Controls</h2></div></div></div><div class="toc"><dl><dt><span class="sect1"><a href="ch03.html#control-interface">3.1. Control Interface</a></span></dt><dt><span class="sect1"><a href="ch03s02.html">3.2. Control Callback</a></span></dt><dt><span class="sect1"><a href="ch03s03.html">3.3. Control Classes</a></span></dt><dt><span class="sect1"><a href="ch03s04.html">3.4. Message Properties</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch03s04.html#message-resolution">3.4.1. Message Resolution</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#control-properties">3.4.2. Control Properties</a></span></dt><dt><span class="sect2"><a href="ch03s04.html#accessing-messages">3.4.3. Accessing Messages</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch03s05.html">3.5. Control HEAD Elements</a></span></dt><dt><span class="sect1"><a href="ch03s06.html">3.6. Container</a></span></d
t><dd><dl><dt><span class="sect2"><a href="ch03s06.html#abstractcontainer">3.6.1. AbstractContainer</a></span></dt><dt><span class="sect2"><a href="ch03s06.html#abstractcontainerfield">3.6.2. AbstractContainerField</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch03s07.html">3.7. Layouts</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch03s07.html#template-layout">3.7.1. Template layout</a></span></dt><dt><span class="sect2"><a href="ch03s07.html#programmatic-layout">3.7.2. Programmatic layout</a></span></dt></dl></dd></dl></div><p>Apache Click provides a rich set of Controls which support client side
+ rendering and server side processing. Please see the
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/package-summary.html" target="_blank">Javadoc</a>,
+ which provides extensive information and examples of the core Controls.
+ </p><p>This chapter covers Control in detail including the Control life cycle,
+ Control event callbacks and localization.
+
+ </p><div class="sect1" title="3.1. Control Interface"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="control-interface"></a>3.1. Control Interface</h2></div></div></div><p> Controls provide the server side components that process user input,
+ and render their display to the user. Controls are equivalent to Visual
+ Basic Controls or Delphi Components.
+ </p><p>Controls handle the processing of user input in the
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#onProcess()" target="_blank">onProcess</a>
+ method and render their HTML display using the toString() method. The
+ execution sequence for a Control being processed and rendered is illustrated
+ in the figure below.
+ </p><div class="figure"><a name="control-post-sequence-diagram"></a><div class="figure-contents"><span class="inlinemediaobject"><img src="images/controls/control-post-sequence-diagram.png" alt="Post Sequence Diagram"></span></div><p xmlns:fo="http://www.w3.org/1999/XSL/Format" class="title"><i>Figure 3.1. Post Sequence Diagram
+ </i></p></div><br class="figure-break"><p>In Click all control classes must implement the
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html" target="_blank">Control</a> interface.
+ The Control interface is depicted in the figure below.
+ </p><div class="figure"><a name="control-class-diagram"></a><div class="figure-contents"><span class="inlinemediaobject"><img src="images/controls/control-class-diagram.png" alt="Control Interface Diagram"></span></div><p xmlns:fo="http://www.w3.org/1999/XSL/Format" class="title"><i>Figure 3.2. Control Interface Diagram
+ </i></p></div><br class="figure-break"><p>Methods on the Control interface include:
+ </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#getHeadElements" target="_blank">getHeadElements()</a>
+ - defines the controls HTML header imports.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#getMessages()" target="_blank">getMessages()</a>
+ - defines the controls localized messages map.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#getName()" target="_blank">getName()</a> /
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#setName(java.lang.String)" target="_blank">setName()</a>
+ - defines the controls name in the Page model or Form fields.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#getParent()" target="_blank">getParent()</a> /
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#setParent(java.lang.Object)" target="_blank">setParent()</a>
+ - defines the controls parent.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#onDeploy(javax.servlet.ServletContext)" target="_blank">onDeploy()</a>
+ - deploy resources on startup.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#onInit()" target="_blank">onInit()</a>
+ - on initialize event handler.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#onProcess()" target="_blank">onProcess()</a>
+ - process request event handler.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#onDestroy()" target="_blank">onDestroy()</a>
+ - on destroy event handler.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#render(org.apache.click.util.HtmlStringBuffer)" target="_blank">render()</a>
+ - generate the control's HTML representation.
+ </p></li></ul></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s12.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch03s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.12. Page HEAD Elements </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.2. Control Callback</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s02.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s02.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s02.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s02.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,57 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>3.2. Control Callback</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch03.html" title="Chapter 3. Controls"><link rel="prev" href="ch03.html" title="Chapter 3. Controls"><link rel="next" href="ch03s03.html" title="3.3. Control Classes"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.2. Control Callback</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Controls</th><td width="20%" align="right"> <a accesskey="n" href="ch03s03.html">Next</a></td></tr></table><hr></div><div class="sect1" title="3.2. Control Callback"><
div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="control-callback"></a>3.2. Control Callback</h2></div></div></div><p>Click Controls provide an event callback mechanism similar to a
+ <code class="classname">java.awt.ActionListener</code> callback.
+ </p><p>Click supports two styles of action listeners. The first is using the
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/ActionListener.html" target="_blank">ActionListener</a>
+ interface and
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/AbstractControl.html#setActionListener(org.apache.click.ActionListener)" target="_blank">setActionListener(ActionListener)</a>
+ method which provides compile time safety.
+ </p><p>The second is to register the action listener via the
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#setListener(java.lang.Object, java.lang.String)" target="_blank">setListener(Object, String)</a>
+ method where you specify the call back method via its name. This second style
+ uses less lines of code, but has no compile time safety.
+ </p><p>Examples of these two action listener styles are provided below:
+ </p><pre class="programlisting"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">class</span> ActionDemo <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">extends</span> BorderPage {
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Uses listener style 1</span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> ActionLink link = <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> ActionLink();
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Uses listener style 2</span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> ActionButton button = <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> ActionButton();
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> ActionDemo() {
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Verbose but provides compile time safety</span>
+ link.setActionListener(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> ActionListener() {
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">boolean</span> onAction(Control source) {
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">return</span> onLinkClick(source);
+ }
+ });
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Succinct but typos will cause runtime errors</span>
+ button.setListener(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">this</span>, <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"onButtonClick"</span>);
+ }
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Event Handlers ---------------------------------------------------------</span>
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">boolean</span> onLinkClick(Control source) {
+ ..
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">return</span> true;
+ }
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">boolean</span> onButtonClick() {
+ ..
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">return</span> true;
+ }
+}</pre><p>All call back listener methods must return a boolean value. If they
+ return true the further processing of other controls and page methods should
+ continue. Otherwise if they return false, then any further processing should
+ be aborted. By returning false you can effectively exit at this point and
+ redirect or forward to another page. This execution logic is illustrated in
+ the <a class="link" href="ch02s02.html#activity-diagram" title="Figure 2.3. Page Execution Activity Diagram">Page Execution Activity Diagram</a>.
+ </p><p>Being able to stop further processing and do something else can be very
+ handy. For example your Pages onRender() method may perform an expensive database
+ operation. By returning false in an event handler you can skip this step and
+ render the template or forward to the next page.
+ </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Controls </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.3. Control Classes</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s02.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s03.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s03.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s03.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s03.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,34 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>3.3. Control Classes</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch03.html" title="Chapter 3. Controls"><link rel="prev" href="ch03s02.html" title="3.2. Control Callback"><link rel="next" href="ch03s04.html" title="3.4. Message Properties"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.3. Control Classes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Controls</th><td width="20%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr></div><div class="sect1" title="3.3. Control Classes
"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="control-class"></a>3.3. Control Classes</h2></div></div></div><p>Core control classes are defined in the package
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/package-summary.html" target="_blank">org.apache.click.control</a>.
+ This package includes controls for the essential HTML elements.
+ </p><p>Extended control classes are provided in the Click Extras package
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../extras-api/org/apache/click/extras/control/package-summary.html" target="_blank">org.apache.click.extras.control</a>.
+ Click Extras classes can contain dependencies to 3rd party frameworks.
+ </p><p>A subset of these control classes are depicted in the figure below.
+ </p><div class="figure"><a name="control-package-class-diagram"></a><div class="figure-contents"><span class="inlinemediaobject"><img src="images/controls/control-package-class-diagram.png" alt="Package Class Diagram"></span></div><p xmlns:fo="http://www.w3.org/1999/XSL/Format" class="title"><i>Figure 3.3. Package Class Diagram
+ </i></p></div><br class="figure-break"><p>The key control classes include:
+ </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/ActionLink.html" target="_blank">ActionLink</a>
+ - provides an anchor link which can invoke callback listeners.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/Field.html" target="_blank">Field</a>
+ - provides the abstract form field control.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/Form.html" target="_blank">Form</a>
+ - provides a form control for processing, validation and rendering.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/Submit.html" target="_blank">Submit</a>
+ - provides an input type submit control which can invoke callback listeners.
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/TextField.html" target="_blank">TextField</a>
+ - provides an input type text control which can invoke callback listeners.
+ </p></li></ul></div><p>The control classes are designed to support subclassing for customized
+ behaviour. All control fields have protected visibility and have public
+ accessor methods.
+ </p><p>You can also aggregate controls to build more complex controls. For
+ example the <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../extras-api/org/apache/click/extras/control/CreditCardField.html" target="_blank">CreditCardField</a>
+ uses a <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/Select.html" target="_blank">Select</a>
+ control to render the different credit card types.
+ </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.2. Control Callback </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.4. Message Properties</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s03.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s04.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s04.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s04.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s04.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,102 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>3.4. Message Properties</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch03.html" title="Chapter 3. Controls"><link rel="prev" href="ch03s03.html" title="3.3. Control Classes"><link rel="next" href="ch03s05.html" title="3.5. Control HEAD Elements"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.4. Message Properties</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Controls</th><td width="20%" align="right"> <a accesskey="n" href="ch03s05.html">Next</a></td></tr></table><hr></div><div class="sect1" title="3.4. Message
Properties"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="control-message-properties"></a>3.4. Message Properties</h2></div></div></div><p>Control strings for field validation messages and HTML formatting
+ strings are externalized in the properties file. By using these properties
+ files you can localize a Click application for your particular language and
+ dialect.
+ </p><div class="sect2" title="3.4.1. Message Resolution"><div class="titlepage"><div><div><h3 class="title"><a name="message-resolution"></a>3.4.1. Message Resolution</h3></div></div></div><p>Messages are looked up in a particular order enabling taylor specific
+ messages, for your controls, individual pages or across your entire
+ application. The order in which localized messages are resolved is:
+ </p><div class="variablelist"><dl><dt><span class="term"><span class="bold"><strong>Page scope messages</strong></span></span></dt><dd><p>Message lookups are first resolved to the Page classes message
+ bundle if it exists. For example a <code class="classname">Login</code> page
+ may define the message properties:
+ </p><div class="literallayout"><p>/com/mycorp/page/Login.properties</p></div><p>If you want to tailor messages for a particular page this is
+ where to place them.
+ </p></dd><dt><span class="term"><span class="bold"><strong>Global page scope messages</strong></span></span></dt><dd><p>Next message lookups are resolved to the global pages message
+ bundle if it exists.
+ </p><div class="literallayout"><p>/click-page.properties</p></div><p>If you want messages to be used across your entire application
+ this is where to place them.
+ </p></dd><dt><span class="term"><span class="bold"><strong>Control scope messages</strong></span></span></dt><dd><p>Next message lookups are resolved to the Control classes
+ message bundle if it exists. For example a
+ <code class="classname">CustomTextField</code> control may define the
+ message properties:
+ </p><div class="literallayout"><p>/com/mycorp/control/CustomTextField.properties</p></div><p>A custom control's messages can be placed here
+ (or the global control scope covered next) and overridden by one of the
+ above options.
+ </p></dd><dt><span class="term"><span class="bold"><strong>Global control scope messages</strong></span></span></dt><dd><p>Finally message lookups are resolved to the global application
+ control message bundle if the message has not already been found.
+ The global control properties file is:
+ </p><div class="literallayout"><p>/click-control.properties</p></div><p>Control messages can be placed here and overridden by one of
+ the above options.
+ </p></dd></dl></div></div><div class="sect2" title="3.4.2. Control Properties"><div class="titlepage"><div><div><h3 class="title"><a name="control-properties"></a>3.4.2. Control Properties</h3></div></div></div><p>To customize the <code class="filename">click-control.properties</code> simply
+ add this file to your classpath and tailor the specific values.
+ </p><p>Note when customizing the message properties you must include all
+ the properties, not just the ones you want to override.
+ </p><div class="literallayout"><p># Click Control messages<br>
+field-maxlength-error={0} must be no longer than {1} characers<br>
+field-minlength-error={0} must be at least {1} characters<br>
+field-required-error=You must enter a value for {0}<br>
+<br>
+file-required-error=You must enter a filename for {0}<br>
+<br>
+label-required-prefix=<br>
+label-required-suffix=<span class="required">*</span><br>
+label-not-required-prefix=<br>
+label-not-required-suffix=&nbsp;<br>
+<br>
+not-checked-error=You must select {0}<br>
+<br>
+number-maxvalue-error={0} must not be larger than {1}<br>
+number-minvalue-error={0} must not be smaller than {1}<br>
+<br>
+select-error=You must select a value for {0}<br>
+<br>
+table-first-label=First<br>
+table-first-title=Go to first page<br>
+table-previous-label=Prev<br>
+table-previous-title=Go to previous page<br>
+table-next-label=Next<br>
+table-next-title=Go to next page<br>
+table-last-label=Last<br>
+table-last-title=Go to last page<br>
+table-goto-title=Go to page<br>
+table-page-banner=<span class="pagebanner">{0} items found, displaying {1} to {2}.</span><br>
+table-page-banner-nolinks=<br>
+ <span class="pagebanner-nolinks">{0} items found, displaying {1} to {2}.</span><br>
+table-page-links=<span class="pagelinks">[{0}/{1}] {2} [{3}/{4}]</span><br>
+table-page-links-nobanner=<span class="pagelinks-nobanner">[{0}/{1}] {2} [{3}/{4}]</span><br>
+table-no-rows-found=No records found.<br>
+<br>
+table-inline-first-image=/click/paging-first.gif<br>
+table-inline-first-disabled-image=/click/paging-first-disabled.gif<br>
+table-inline-previous-image=/click/paging-prev.gif<br>
+table-inline-previous-disabled-image=/click/paging-prev-disabled.gif<br>
+table-inline-next-image=/click/paging-next.gif<br>
+table-inline-next-disabled-image=/click/paging-next-disabled.gif<br>
+table-inline-last-image=/click/paging-last.gif<br>
+table-inline-last-disabled-image=/click/paging-last-disabled.gif<br>
+table-inline-page-links=Page {0} {1} {2} {3} {4}<br>
+<br>
+# Message displayed when a error occurs when the application is in "production" mode<br>
+production-error-message=<br>
+ <div id='errorReport' class='errorReport'>The application encountered an unexpected error.<br>
+ </div><br>
+ </p></div></div><div class="sect2" title="3.4.3. Accessing Messages"><div class="titlepage"><div><div><h3 class="title"><a name="accessing-messages"></a>3.4.3. Accessing Messages</h3></div></div></div><p>Field classes support a hierarchy of resource bundles for displaying
+ validation error messages and display messages. These localized messages
+ can be accessed through the Field methods:
+ </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/AbstractControl.html#getMessage(java.lang.String)" target="_blank">getMessage(String)</a>
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/AbstractControl.html#getMessage(java.lang.String,%20java.lang.Object)" target="_blank">getMessage(String, Object)</a>
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/AbstractControl.html#getMessage(java.lang.String,%20java.lang.Object[])" target="_blank">getMessage(String, Object[])</a>
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/AbstractControl.html#getMessages()" target="_blank">getMessages()</a>
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/Field.html#setErrorMessage(java.lang.String)" target="_blank">setErrorMessage(String)</a>
+ </p></li><li class="listitem"><p>
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/control/Field.html#setErrorMessage(java.lang.String,%20java.lang.Object)" target="_blank">setErrorMessage(String, Object)</a>
+ </p></li></ul></div><p>These methods use the <code class="literal">Locale</code> of the request to
+ lookup the string resource bundle, and use <code class="classname">MessageFormat</code>
+ for any string formatting.
+ </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.3. Control Classes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.5. Control HEAD Elements</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s04.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s05.html
URL: http://svn.apache.org/viewvc/click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s05.html?rev=909177&view=auto
==============================================================================
--- click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s05.html (added)
+++ click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s05.html Thu Feb 11 23:36:18 2010
@@ -0,0 +1,69 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ <title>3.5. Control HEAD Elements</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.0"><link rel="home" href="index.html" title="Apache Click"><link rel="up" href="ch03.html" title="Chapter 3. Controls"><link rel="prev" href="ch03s04.html" title="3.4. Message Properties"><link rel="next" href="ch03s06.html" title="3.6. Container"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.5. Control HEAD Elements</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Controls</th><td width="20%" align="right"> <a accesskey="n" href="ch03s06.html">Next</a></td></tr></table><hr></div><div class="sect1" title="3.5. Control HE
AD Elements"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="control-head-elements"></a>3.5. Control HEAD Elements</h2></div></div></div><p>The Control interface provides the method
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Control.html#getHeadElements()" target="_blank">getHeadElements()</a>
+ which allows the Control to add Page HEAD
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/Element.html" target="_blank">elements</a>
+ such as <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/JsImport.html" target="_blank">JsImport</a>,
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/JsScript.html" target="_blank">JsScript</a>,
+ <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/CssImport.html" target="_blank">CssImport</a>
+ and <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/element/CssStyle.html" target="_blank">CssStyle</a>.
+ </p><p>Here is an example of adding HEAD elements to a custom
+ <code class="classname">Control</code>:
+ </p><pre class="programlisting"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">class</span> MyControl <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">extends</span> AbstractControl {
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> MyControl() {
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">/**
+ * Override the default getHeadElements implementation to return
+ * MyControl's list of HEAD elements.
+ *
+ * Note that the variable headElements is defined in AbstractControl.
+ *
+ * @return list the list of HEAD elements
+ */</span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">public</span> List getHeadElements() {
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Use lazy loading to only add the HEAD elements once and when needed.</span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">if</span> (headElements == null) {
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Get the head elements from the super implementation</span>
+ headElements = <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">super</span>.getHeadElements();
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Add the JavaScript import "/mycontrol.js" to the control</span>
+ headElements.add(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> JsImport(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"/mycontrol.js"</span>));
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="com">// Add the Css import "/mycontrol.css" to the control</span>
+ headElements.add(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">new</span> CssImport(<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="str">"/mycontrol.css"</span>));
+ }
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="kwd">return</span> headElements;
+ }
+ }
+
+ ...
+
+} </pre><p>In the example above we added the HEAD elements by overriding the
+ Control's <code class="methodname">getHeadElements</code> method, however you can
+ add HEAD elements from anywhere in the Control including the event handlers
+ <code class="literal">onInit</code>, <code class="literal">onGet</code>,
+ <code class="literal">onPost</code>, <code class="literal">onRender</code> etc.
+ Please see <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="../../click-api/org/apache/click/Page.html#getHeadElements()" target="_blank">getHeadElements()</a>
+ for more details.
+ </p><p><code class="classname">MyControl</code> 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"):
+ </p><pre class="programlisting"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><html></span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><head></span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><link</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">rel</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"stylesheet"</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">type</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"text/css"</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">href</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"</span><span class="symbol">/myapp/mycontrol.css</span>"><span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></link></span>
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></head></span>
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><body></span>
+
+ ...
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"><script</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">type</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"text/javascript"</span> <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="atn">src</span>=<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="pln">"</span><span class="symbol">/myapp/mycontrol.js</span>"/>
+
+ <span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></body></span>
+<span xmlns:fo="http://www.w3.org/1999/XSL/Format" class="tag"></html></span> </pre><p>A live demo showing how to add HEAD elements from a custom Control can
+ be seen <a xmlns:fo="http://www.w3.org/1999/XSL/Format" class="external" href="http://www.avoka.com/click-examples/general/control-head-demo.htm" target="_blank">here</a>.
+ </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.4. Message Properties </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.6. Container</td></tr></table></div></body></html>
\ No newline at end of file
Propchange: click/trunk/tools/eclipse/org.apache.click.eclipse/documentation/user-guide/ch03s05.html
------------------------------------------------------------------------------
svn:mime-type = text/plain