You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2009/03/11 19:55:50 UTC
svn commit: r752572 [3/3] - in /incubator/click/trunk/click/documentation:
./ docs/ xdocs/ xdocs/src/ xdocs/src/css/ xdocs/src/css/html/
xdocs/src/docbook/ xdocs/src/docbook/click/ xdocs/src/images/
xdocs/src/images/best-practices/ xdocs/src/images/con...
Added: 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=752572&view=auto
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml (added)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml Wed Mar 11 18:55:49 2009
@@ -0,0 +1,792 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<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>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>Pages provide a simple thread safe programming environment, with a new
+ page instance created for each servlet request.
+ </para>
+
+ <para>Possibly the best way to see how Click works is to dive right in and
+ look at some examples.
+ </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>These examples are available online at
+ <ulink url="http://www.avoka.com/click-examples/">http://www.avoka.com/click-examples/</ulink>
+ under the menu "Intro Examples".
+ </para>
+
+ <sect1 id="hello-world">
+ <title>Hello World Example</title>
+
+ <para>A Hello World example in Click would look something like this.
+ </para>
+
+ <para>First we create a <classname>HelloWorld</classname> page class:
+ </para>
+
+ <programlisting language="java">package <symbol>examples.page</symbol>;
+
+import java.util.Date;
+import org.apache.click.Page;
+
+public HelloWorld extends Page {
+
+ private Date time = new Date(); <co id="co-hello-world-date" linkends="ca-hello-world-date"/>
+
+ public HelloWorld() {
+ addModel("time", time); <co id="co-hello-world-addmodel" linkends="ca-hello-world-addmodel"/>
+ }
+
+}</programlisting>
+
+ <calloutlist>
+ <callout arearefs="co-hello-world-date" id="ca-hello-world-date">
+ <para>Assign a new Date instance to the <literal>time</literal> variable.
+ </para>
+ </callout>
+ <callout arearefs="co-hello-world-addmodel" id="ca-hello-world-addmodel">
+ <para>Add the <literal>time</literal> variable to the Page model under
+ the name <varname>"time"</varname>. Click ensures all objects added
+ to the Page model is automatically available in the Page template.
+ </para>
+ </callout>
+ </calloutlist>
+
+ <para>Next we have a page template <varname>hello-world.htm</varname>,
+ <indexterm><primary>Big Cats</primary><secondary>Tigers</secondary></indexterm>
+ where we can access the Page's <literal>time</literal> variable using the
+ reference <varname>$time</varname>:
+ </para>
+
+ <programlisting language="xml"><html>
+ <body>
+
+ <h2>Hello World</h2>
+
+ Hello world from Click at <varname>$time</varname>
+
+ </body>
+</html></programlisting>
+
+ <para>Click is smart enough to figure out that the <classname>HelloWorld</classname>
+ page class maps to the template <varname>hello-world.htm</varname>. We only
+ have to inform Click of the <package>package</package> of the HelloWorld
+ class, in this case <symbol>examples.page</symbol>. We do that through the
+ <link linkend="application-configuration">click.xml</link> configuration
+ file which allows Click to map <varname>hello-world.htm</varname> requests
+ to the <classname>examples.page.HelloWorld</classname> page class.
+ </para>
+
+ <programlisting language="xml"><click-app>
+ <pages package="<symbol>examples.page</symbol>"/>
+</click-app></programlisting>
+
+ <para>At runtime the following sequence of events occur. The ClickSerlvet
+ maps a GET <varname>hello-world.htm</varname> request to our page class
+ <classname>example.page.HelloWorld</classname> and creates a new instance.
+ The HelloWorld page creates a new private <emphasis>Date</emphasis> object,
+ which is added to the page's model under the name <varname>time</varname>.
+ </para>
+
+ <para>The page model is then merged with the template which substitutes
+ the <varname>$time</varname> reference with the <emphasis>Date</emphasis>
+ object. Velocity then renders the merged template which looks something like:
+ </para>
+
+ <figure id="hello-world-screenshot">
+ <title>Hello World Screenshot</title>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/introduction/hello-world-screenshot.png" format="PNG" scale="85"/>
+ </imageobject>
+ </inlinemediaobject>
+ </figure>
+
+ </sect1>
+
+ <sect1 id="control-listener">
+ <title>Control Listener Example</title>
+
+ <para>Click includes a library of <link linkend="chapter-controls">Controls</link>
+ which provide user interface functionality.
+ </para>
+
+ <para>One of the commonly used controls is the
+ <ulink url="../../click-api/org/apache/click/control/ActionLink.html">ActionLink</ulink>,
+ which you can use to have an HTML link call a method on a Page object.
+ For example:
+ </para>
+
+ <programlisting language="java">public class ControlListenerPage extends Page {
+
+ public ActionLink myLink = new ActionLink();
+
+ public String msg;
+
+ // ------------------------------------------------------- Constructors
+
+ /**
+ * Create a new Page instance.
+ */
+ public ControlListenerPage() {
+ myLink.setListener(this, "onMyLinkClick");
+ }
+
+ // ----------------------------------------------------- Event Handlers
+
+ /**
+ * Handle the myLink control click event.
+ */
+ public boolean onMyLinkClick() {
+ msg = "ControlListenerPage#" + hashCode()
+ + " object method <tt>onMyLinkClick()</tt> invoked.";
+
+ return true;
+ }
+}</programlisting>
+
+ <para>In the Page class we create an ActionLink called
+ <varname>myLink</varname> and define the control's listener to be the page
+ method <methodname>onMyLinkClick()</methodname>. When a user clicks on
+ <varname>myLink</varname> control it will invoke the listener method
+ <methodname>onMyLinkClick()</methodname>.
+ </para>
+
+ <para>In Click a control listener method can have any name but it must
+ return a boolean value. The boolean return value specifies whether
+ processing of page events should continue. This control listener pattern
+ provides a short hand way for wiring up action listener methods without
+ having to define anonymous inner classes.
+ </para>
+
+ <para>Back to our example, in the page template we define a HTML link and
+ have the <varname>myLink</varname> control render the link's href attribute:
+ </para>
+
+ <programlisting language="xml"><html>
+ <head>
+ <link type="text/css" rel="stylesheet" href="style.css"></link>
+ </head>
+ <body>
+
+ Click myLink control <a href="<varname>$myLink.href</varname>">here</a>.
+
+ <command>#if</command> (<varname>$msg</varname>)
+ <div id="msgDiv"> <varname>$msg</varname> </div>
+ <command>#end</command>
+
+ </body>
+</html></programlisting>
+
+ <para>At runtime this page would be rendered as:</para>
+
+ <literallayout>Click myLink control <varname>here</varname>.</literallayout>
+
+ <para>When a user clicks on the link the <methodname>onMyLinkClick()</methodname>
+ method is invoked. This method then creates <varname>msg</varname> model
+ value, which is rendered in the page as:
+ </para>
+
+ <literallayout>Click myLink control <varname>here</varname>.
+
+<computeroutput>ControlListenerPage#12767107 object method onMyLinkClick() invoked.</computeroutput></literallayout>
+
+ </sect1>
+
+ <sect1 id="simple-table">
+ <title>Simple Table Example</title>
+
+ <para>One of the most useful Click controls is the
+ <ulink url="../../click-api/org/apache/click/control/Table.html">Table</ulink>
+ control.
+ </para>
+
+ <para>An example usage of the Table control in a customers Page is provided
+ below:
+ </para>
+
+ <programlisting language="java">public class SimpleTablePage extends Page {
+
+ public Table table = new Table();
+
+ // -------------------------------------------------------- Constructor
+
+ public SimpleTablePage() {
+ table.setClass(Table.CLASS_ITS);
+
+ table.addColumn(new Column("id"));
+ table.addColumn(new Column("name"));
+ table.addColumn(new Column("email"));
+ table.addColumn(new Column("investments"));
+ }
+
+ // ----------------------------------------------------- Event Handlers
+
+ /**
+ * @see Page#onRender()
+ */
+ public void onRender() {
+ List list = getCustomerService().getCustomersSortedByName(10);
+ table.setRowList(list);
+ }
+}</programlisting>
+
+ <para>In this Page code example a Table control is declared, we set the
+ table's HTML class, and then define a number of table
+ <ulink url="../../click-api/org/apache/click/control/Column.html">Column</ulink>
+ objects. In the column definitions we specify the name of the column in the
+ constructor, which is used for the table column header and also to specify
+ the row object property to render.
+ </para>
+
+ <para>The last thing we need to do is populate the table with data. To do
+ this we override the Page onRender() method and set the table row list
+ before it is rendered.
+ </para>
+
+ <para>In our Page template we simply reference the <varname>$table</varname>
+ object which is rendered when its <methodname>toString()</methodname> method
+ is called.
+ </para>
+
+ <programlisting language="xml"><html>
+ <head>
+ <varname>$cssImports</varname>
+ </head>
+ <body>
+
+ <varname>$table</varname>
+
+ <varname>$jsImports</varname>
+
+ </body>
+</html></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
+ to the template.
+ </para>
+
+ <para>At runtime the Table would be rendered in the page as:</para>
+
+ <figure id="simple-table-image">
+ <title>Simple Table</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/introduction/simple-table.png" scale="85"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ </sect1>
+
+ <sect1 id="advanced-table">
+ <title>Advanced Table Example</title>
+
+ <para>The Table control also provides support for:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>automatic rendering</para>
+ </listitem>
+
+ <listitem>
+ <para>column formatting and custom rendering</para>
+ </listitem>
+
+ <listitem>
+ <para>automatic pagination</para>
+ </listitem>
+
+ <listitem>
+ <para>link control support</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>A more advanced Table example is provided below:</para>
+
+ <programlisting language="java">public class CustomerPage extends Page {
+
+ public Table table = new Table();
+ public PageLink editLink = new PageLink("Edit", EditCustomer.class);
+ public ActionLink deleteLink = new ActionLink("Delete", this, "onDeleteClick");
+
+ // ------------------------------------- Constructor
+
+ public CustomersPage() {
+ table.setClass(Table.CLASS_ITS);
+ table.setPageSize(10);
+ table.setShowBanner(true);
+ table.setSortable(true);
+
+ table.addColumn(new Column("id"));
+
+ table.addColumn(new Column("name"));
+
+ Column column = new Column("email");
+ column.setAutolink(true);
+ column.setTitleProperty("name");
+ table.addColumn(column);
+
+ table.addColumn(new Column("investments"));
+
+ editLink.setImageSrc("/images/table-edit.png");
+ editLink.setTitle("Edit customer details");
+ editLink.setParameter("referrer", "/introduction/advanced-table.htm");
+
+ deleteLink.setImageSrc("/images/table-delete.png");
+ deleteLink.setTitle("Delete customer record");
+ deleteLink.setAttribute("onclick",
+ "return window.confirm('Are you sure you want to delete this record?');");
+
+ column = new Column("Action");
+ column.setTextAlign("center");
+ AbstractLink[] links = new AbstractLink[] { editLink, deleteLink };
+ column.setDecorator(new LinkDecorator(table, links, "id"));
+ column.setSortable(false);
+ table.addColumn(column);
+ }
+
+ // ---------------------------------- Event Handlers
+
+ /**
+ * Handle the delete row click event.
+ */
+ public boolean onDeleteClick() {
+ Integer id = deleteLink.getValueInteger();
+ getCustomerService().deleteCustomer(id);
+ return true;
+ }
+
+ /**
+ * @see Page#onRender()
+ */
+ public void onRender() {
+ List list = getCustomerService().getCustomersByName();
+ table.setRowList(list);
+ }
+}</programlisting>
+
+ <para>In this Page code example a Table control is declared and a number of
+ <ulink url="../../click-api/org/apache/click/control/Column.html">Column</ulink>
+ objects are added. A deleteLink
+ <ulink url="../../click-api/org/apache/click/control/ActionLink.html">ActionLink</ulink>
+ control is used as a decorator for the "Action" column. This control will
+ invoke the Page <methodname>onDeleteClick()</methodname> method when it is
+ clicked. Finally we have the Page <methodname>onRender()</methodname> method
+ which is used to populate the Table control with rows before it is rendered.
+ </para>
+
+ <para>In our Page template we simply reference the <varname>$table</varname>
+ object which is rendered when its <methodname>toString()</methodname> method
+ is called.
+ </para>
+
+ <programlisting language="xml"><html>
+ <head>
+ <varname>$cssImports</varname>
+ </head>
+ <body>
+
+ <varname>$table</varname>
+
+ <varname>$jsImports</varname>
+
+ </body>
+</html></programlisting>
+
+ <para>At runtime the Table would be rendered in the page as:</para>
+
+ <figure id="advanced-table-image">
+ <title>Advanced Table</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/introduction/advanced-table.png" scale="85"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>In this example if a user click on the Delete link, the
+ <methodname>onDeleteClick()</methodname> method will be called on the Page
+ deleting the customer record.
+ </para>
+
+ </sect1>
+
+ <sect1 id="simple-form">
+ <title>Simple Form Example</title>
+
+ <para>The <ulink url="../../click-api/org/apache/click/control/Form.html">Form</ulink>
+ and <ulink url="../../click-api/org/apache/click/control/Field.html">Field</ulink>
+ controls are also some of the most commonly used controls in the Click Framework.
+ </para>
+
+ <para>The SimpleForm page below provides a demonstration of using these
+ controls.
+ </para>
+
+ <para>In our example code we have the page's constructor adding a
+ <ulink url="../../click-api/org/apache/click/control/TextField.html">TextField</ulink>
+ field and a <ulink url="../../click-api/org/apache/click/control/Submit.html">Submit</ulink>
+ button to the form. A page method is also set as a control listener on the
+ form. Also note in this example the page's public <varname>form</varname>
+ field is automatically added to its list of controls.
+ </para>
+
+ <programlisting language="java">public class SimpleForm extends Page {
+
+ public Form form = new Form();
+ public String msg;
+
+ // -------------------------------------------------------- Constructor
+
+ public SimpleForm() {
+ form.add(new TextField("name", true));
+ form.add(new Submit("OK"));
+
+ form.setListener(this, "onSubmit");
+ }
+
+ // ----------------------------------------------------- Event Handlers
+
+ /**
+ * Handle the form submit event.
+ */
+ public boolean onSubmit() {
+ if (form.isValid()) {
+ msg = "Your name is " + form.getFieldValue("name");
+ }
+ return true;
+ }
+}</programlisting>
+
+ <para>Next we have the SimpleForm template <varname>simple-form.htm</varname>.
+ The Click application automatically associates the
+ <varname>simple-form.htm</varname> template with the
+ <classname>SimpleForm</classname> class.
+ </para>
+
+ <programlisting language="xml"><html>
+ <head>
+ <varname>$cssImports</varname>
+ </head>
+ <body>
+
+ <varname>$form</varname>
+
+ <command>#if</command> (<varname>$msg</varname>)
+ <div id="msgDiv"> <varname>$msg</varname> </div>
+ <command>#end</command>
+
+ <varname>$jsImports</varname>
+
+ </body>
+</html></programlisting>
+
+ <para>When the SimpleForm page is first requested the <varname>$form</varname>
+ object will automatically render itself as:
+ </para>
+
+ <figure id="simple-form-image">
+ <title>Simple Form</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/introduction/simple-form.png" scale="85"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Say the user does not enter their name and presses the OK button to
+ submit the form. The <classname>ClickServlet</classname> creates a new
+ SimpleForm page and processes the form control.
+ </para>
+
+ <para>The form control processes its fields and determines that it is
+ invalid. The form then invokes the listener method
+ <methodname>onSubmit()</methodname>. As the form is not valid this method
+ simply returns true and the form renders the field validation errors.
+ </para>
+
+ <figure id="simple-form-error-image">
+ <title>Form after an invalid request</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/introduction/simple-form-error.png" scale="85"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Note the form will automatically maintain the entered state during the
+ post and validate cycle.
+ </para>
+
+ <para>Now if the user enters their name and clicks the OK button, the form
+ will be valid and the <methodname>onSubmit()</methodname> add a
+ <varname>msg</varname> to the Pages model. This will be rendered as:
+ </para>
+
+ <figure id="simple-form-success-image">
+ <title>Form after a valid request</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/introduction/simple-form-success.png" scale="85"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ </sect1>
+
+ <sect1 id="advanced-form">
+ <title>Advanced Form Example</title>
+
+ <para>The <classname>AdvancedForm</classname> page below provides a more
+ advanced demonstration of using Form, Field and FielsSet controls.
+ </para>
+
+ <para>First we have an <classname>AdvancedForm</classname> class which
+ setups up a <ulink url="../../click-api/org/apache/click/control/Form.html">Form</ulink>
+ in its constructor. The form's investment
+ <ulink url="../../click-api/org/apache/click/control/Select.html">Select</ulink>
+ list is populated in the page's <methodname>onInit()</methodname> method. At
+ this point any page dependencies such as the CustomerService should be
+ available.
+ </para>
+
+ <para>Note in this example the page's public <varname>form</varname> field
+ is automatically added to its list of controls. The <varname>msg</varname>
+ field is added to the page's model.
+ </para>
+
+ <programlisting language="java">public class AdvancedForm extends Page {
+
+ public Form form = new Form();
+ public String msg;
+
+ private Select investmentSelect = new Select("investment");
+
+ // -------------------------------------------------------- Constructor
+
+ public AdvancedForm() {
+ FieldSet fieldSet = new FieldSet("Customer");
+ form.add(fieldSet);
+
+ TextField nameField = new TextField("name", true);
+ nameField.setMinLength(5);
+ nameField.setFocus(true);
+ fieldSet.add(nameField);
+
+ fieldSet.add(new EmailField("email", true));
+
+ fieldSet.add(investmentSelect);
+
+ fieldSet.add(new DateField("dateJoined", true));
+ fieldSet.add(new Checkbox("active"));
+
+ form.add(new Submit("ok", " OK ", this, "onOkClicked"));
+ form.add(new Submit("cancel", this, "onCancelClicked"));
+ }
+
+ // ----------------------------------------------------- Event Handlers
+
+ /**
+ * @see Page#onInit()
+ */
+ public void onInit() {
+ CustomerService customerService = getCustomerService();
+ investmentSelect.add(Option.EMPTY_OPTION);
+ investmentSelect.addAll(customerService.getInvestmentCatetories());
+ }
+
+ /**
+ * Handle the OK button click event.
+ *
+ * @return true
+ */
+ public boolean onOkClicked() {
+ if (form.isValid()) {
+ Customer customer = new Customer();
+ form.copyTo(customer);
+
+ getCustomerService().saveCustomer(customer);
+
+ form.clearValues();
+
+ msg = "A new customer record has been created.";
+ }
+ return true;
+ }
+
+ /**
+ * Handle the Cancel button click event.
+ *
+ * @return false
+ */
+ public boolean onCancelClicked() {
+ setRedirect(HomePage.class);
+ return false;
+ }
+}</programlisting>
+
+ <para>Next we have the AdvancedForm template
+ <filename>advanced-form.htm</filename>. The Click application automatically
+ associates the <filename>advanced-form.htm</filename> template with the
+ <classname>AdvancedForm</classname> class.
+ </para>
+
+ <programlisting language="xml"><html>
+ <head>
+ <varname>$cssImports</varname>
+ </head>
+ <body>
+
+ <command>#if</command> (<varname>$msg</varname>)
+ <div id="msgDiv"> <varname>$msg</varname> </div>
+ <command>#end</command>
+
+ <varname>$form</varname>
+
+ <varname>$jsImports</varname>
+
+ </body>
+</html></programlisting>
+
+ <para>When the AdvancedForm page is first requested the
+ <varname>$form</varname> object will automatically render itself as:
+ </para>
+
+ <figure id="advanced-form-image">
+ <title>Advanced Form</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/introduction/advanced-form.png" scale="85"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>In this example when the OK button is clicked the
+ <methodname>onOkClicked()</methodname> method is invoked. If the form is
+ valid a new customer object is created and the forms field values are copied
+ to the new object using the Form
+ <ulink url="../../click-api/org/apache/click/control/Form.html#copyTo(java.lang.Object)">copyTo()</ulink>
+ method. The customer object is then saved, the form's field values are
+ cleared and an info message is presented to the user.
+ </para>
+
+ <para>If the user clicks on the Cancel button the request is redirected to
+ the applications HomePage.
+ </para>
+
+ <sect2 id="form-layout">
+ <title>Form Layout</title>
+
+ <para>In the example above the Form control automatically renders the form
+ and the fields HTML markup. This is a great feature for quickly building
+ screens, and the form control provides a number of layout options. See the
+ Click Examples for an interactive
+ <ulink url="http://www.avoka.com/click-examples/form/form-properties.htm">Form Properties demo</ulink>.
+ </para>
+
+ <para>For fine grained page design you can specifically layout form and
+ fields in your page template. See the
+ <link linkend="template-layout">Template Layout</link> section and
+ <ulink url="../../click-api/org/apache/click/control/Form.html#form-layout">Form</ulink>
+ Javadoc for more details.
+ </para>
+
+ <para>An alternative to page template design is using a programmatic
+ approach. See <link linkend="programmatic-layout">Programmatic Layout</link>
+ for more details.
+ </para>
+
+ </sect2>
+
+ </sect1>
+</chapter>
Added: 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=752572&view=auto
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml (added)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml Wed Mar 11 18:55:49 2009
@@ -0,0 +1,1341 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<chapter id="chapter-pages" remap="h1">
+ <title>Pages</title>
+
+ <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:
+ </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>
+ file:
+ </para>
+
+ <literallayout><page path="<varname>search.htm</varname>" classname="<token>com.mycorp.page.Search</token>"/></literallayout>
+
+ <para>The path attribute specifies the location of the page Velocity template,
+ and the classname attribute specifies the page Java class name. If you use
+ the Freemarker template engine instead of Velocity, the setup is the same.
+ </para>
+
+ <para>The template path must have an <varname>.htm</varname> extension which
+ is specified in <link linkend="servlet-configuration">web.xml</link> to route
+ *.htm requests to the <classname>ClickServlet</classname>. Please note that
+ currently Click only accepts <varname>.htm</varname> requests, and cannot be
+ mapped to a different extension in <filename>web.xml</filename>.
+ </para>
+
+ <para>If you use JSP pages for rendering the <varname>.jsp</varname> extension
+ must be used. For example:
+ </para>
+
+ <literallayout><page path="<varname>search.jsp</varname>" classname="<token>com.mycorp.page.Search</token>"/></literallayout>
+
+ <para>At runtime Click automatically converts the page path from
+ <varname>.jsp</varname> to <varname>.htm</varname> and back, so there is no
+ need to map the <varname>.jsp</varname> extension in <filename>web.xml</filename>.
+ </para>
+
+ <sect1 id="classes" remap="h2">
+ <title>Classes</title>
+
+ <para> All custom Click pages must subclass the
+ <ulink url="../../click-api/org/apache/click/Page.html">Page</ulink> base class.
+ The Page class and its associated companion classes, Context and Control,
+ are depicted in the figure below.
+ </para>
+
+ <figure id="page-class-diagram">
+ <title>Page Class Diagram - created with Enterprise Architect
+ courtesy <ulink url="http://www.sparxsystems.com.au">Sparx Systems</ulink>
+ </title>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/pages/click-class-diagram.png" format="PNG" scale="85"/>
+ </imageobject>
+ </inlinemediaobject>
+ </figure>
+
+ <para>The Page class provides a
+ <ulink url="../../click-api/org/apache/click/Page.html#model">model</ulink>
+ attribute which is used to hold all the objects that are rendered in the
+ page's Velocity template. The model may also contain
+ <ulink url="../../click-api/org/apache/click/Control.html">Control</ulink>
+ objects, which provide user interface controls on the Page.
+ </para>
+
+ <para>Pages also have an associated
+ <ulink url="../../click-api/org/apache/click/Context.html">Context</ulink>
+ object which references all the javax.servlet objects associated with the
+ request. When programming in Click you use the Context object to access
+ HttpServletRequest attributes, parameters and the HttpSession object.
+ </para>
+
+ </sect1>
+
+ <sect1 id="execution" remap="h2">
+ <title>Execution</title>
+
+ <para>The Page class provide a number of empty handler methods which
+ subclasses can override to provide functionality:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <ulink url="../../click-api/org/apache/click/Page.html#onSecurityCheck()">onSecurityCheck()</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="../../click-api/org/apache/click/Page.html#onInit()">onInit()</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="../../click-api/org/apache/click/Page.html#onGet()">onGet()</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="../../click-api/org/apache/click/Page.html#onPost()">onPost()</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="../../click-api/org/apache/click/Page.html#onRender()">onRender()</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="../../click-api/org/apache/click/Page.html#onDestroy()">onDestroy()</ulink>
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <para>The ClickServlet relies on instantiating Pages using a public no
+ arguments constructor, so when you create Page subclasses you must ensure
+ you don't add an incompatible constructor. The GET request execution sequence
+ for Pages is summarized below in the Figure 2.
+ </para>
+
+ <figure id="get-sequence-diagram">
+ <title>GET Request Sequence Diagram - created with Enterprise
+ Architect courtesy <ulink url="http://www.sparxsystems.com.au">Sparx Systems</ulink>
+ </title>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/pages/get-sequence-diagram.png" format="PNG" scale="85"/>
+ </imageobject>
+ </inlinemediaobject>
+ </figure>
+
+ <para>Stepping through this GET request sequence, a new Page instance is
+ created and the attributes for the Page are set (context, format, headers,
+ path). Next, request parameter values are bound to any matching public
+ Page fields.
+ </para>
+
+ <para>Then the <methodname>onSecurityCheck()</methodname> handler is executed.
+ This method can be used to ensure the user is authorized to access the page,
+ and if necessary abort any further processing.
+ </para>
+
+ <para>The next method invoked is <methodname>onInit()</methodname>, this is
+ where you place any post constructor initialization code.
+ <methodname>onInit()</methodname> is the ideal place to create controls such
+ as Forms, Fields and Tables. As illustrated by the diagram, after a Page's
+ <methodname>onInit()</methodname> is called, each Control, available at that
+ stage, will have their <methodname>onInit()</methodname> method called.
+ </para>
+
+ <para>
+ The next step is the processing of the Page's
+ <ulink url="../../click-api/org/apache/click/Page.html#controls">controls</ulink>.
+ The ClickSerlvet gets the list of Controls from the page and then iterates
+ through the list calling <methodname>onProcess()</methodname>. If any of the
+ Control's <methodname>onProcess()</methodname> methods return false,
+ processing of subsequent controls and the Page's <methodname>onGet()</methodname>
+ method is aborted.
+ </para>
+
+ <para>If everything is executing normally the Page's
+ <methodname>onGet()</methodname> method is now called.
+ </para>
+
+ <para>The next step is rendering the page template to generate the displayed
+ HTML. The ClickServlet gets the model (<classname>Map</classname>) from the
+ Page then adds the following objects to the model:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>any public Page fields using the fields name</para>
+ </listitem>
+ <listitem>
+ <para>context - the Servlet context path, e.g. /mycorp</para>
+ </listitem>
+ <listitem>
+ <para>cssImports - 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 - 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 - the CSS and JavaScript imports 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>jsImports - 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>
+ <para>messages - the
+ <ulink url="../../click-api/org/apache/click/util/MessagesMap.html">MessagesMap</ulink>
+ adaptor for the Page
+ <ulink url="../../click-api/org/apache/click/Page.html#getMessage(java.lang.String)">getMessage()</ulink>
+ method
+ </para>
+ </listitem>
+ <listitem>
+ <para>path - the
+ <ulink url="../../click-api/org/apache/click/Page.html#path">path</ulink> of
+ the page template to render
+ </para>
+ </listitem>
+ <listitem>
+ <para>request - the pages
+ <ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletRequest.html">HttpServletRequest</ulink>
+ object
+ </para>
+ </listitem>
+ <listitem>
+ <para>response - the pages
+ <ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html">HttpServletResponse</ulink>
+ object
+ </para>
+ </listitem>
+ <listitem>
+ <para>session - the
+ <ulink url="../../click-api/org/apache/click/util/SessionMap.html">SessionMap</ulink>
+ adaptor for the users
+ <ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpSession.html">HttpSession</ulink>
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <para>It then merges the template with the page model and writes out results
+ to the HttpServletResponse. When the model is being merged with the template,
+ any Controls in the model may be rendered using their
+ <methodname>toString()</methodname> method.
+ </para>
+
+ <para>The final step in this sequence is invoking each control's
+ <methodname>onDestroy()</methodname> method and lastly invoke the Page's
+ <methodname>onDestroy()</methodname> method. This method can be used to
+ clean up resource associated with the Control or Page before it is garbage
+ collected. The <methodname>onDestroy()</methodname> method is guaranteed to
+ be called even if an exception occurs in the previous steps.
+ </para>
+
+ <para>The execution sequence for POST requests is almost identical, except
+ the <methodname>onPost()</methodname> method is invoked instead on
+ <methodname>onGet()</methodname>. See the
+ <ulink url="../../../images/post-sequence-diagram.png">POST Request Sequence Diagram</ulink>.
+ </para>
+
+ <para>Another view on the execution flow of Pages is illustrated in the
+ Activity diagram below.
+ </para>
+
+ <figure id="activity-diagram">
+ <title>Page Execution Activity Diagram - created with Enterprise
+ Architect courtesy <ulink url="http://www.sparxsystems.com.au">Sparx Systems</ulink>
+ </title>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/pages/activity-diagram-small.png" format="PNG" scale="85"/>
+ </imageobject>
+ </inlinemediaobject>
+ </figure>
+
+ </sect1>
+
+ <sect1 id="request-param-auto-binding" remap="h2">
+ <title>Request Param 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
+ attempt to convert them to the correct type.
+ </para>
+
+ <para>The best way to understand this is to walk through an example. Our
+ application recieves a GET request:
+ </para>
+
+ <literallayout>http://localhost:8080/mycorp/customer-details.htm?<varname>customerId</varname>=<symbol>7203</symbol></literallayout>
+
+ <para>This request is automatically handled by our
+ <classname>CustomerDetails</classname> page:
+ </para>
+
+ <programlisting language="java">package com.mycorp.page;
+
+public class CustomerDetails extends Page {
+
+ public Integer <varname>customerId</varname>;
+}</programlisting>
+
+ <para>After the CustomerDetails page has been created the
+ "<varname>customerId</varname>" request parameter value "<symbol>7023</symbol>"
+ will be converted into an Integer and assigned to the public page field
+ <varname>customerId</varname>.
+ </para>
+
+ <para>Another feature of Click is that any public Page fields are
+ automatically added to the page's model before it is rendered. This will
+ make these values available in the page template for display. In our example
+ the public <varname>customerId</varname> field will be added to the Page
+ model and will be available for rendering in the page template.
+ </para>
+
+ <para>Our customer-details.htm page template contains:
+ </para>
+
+ <programlisting language="xml"><html>
+<body>
+
+ Customer ID: <symbol>$</symbol><varname>customerId</varname>
+
+</body>
+</html></programlisting>
+
+ <para>After processing the request our page would be rendered as:
+ </para>
+
+ <literallayout>Customer ID: 7203</literallayout>
+
+ <sect2 id="customizing-auto-binding" remap="h3">
+ <title>Customizing Auto Binding</title>
+
+ <para>Auto binding supports the conversion of request string parameters
+ into the Java classes: Integer, Double, Boolean, Byte, Character, Short,
+ Long, Float, BigInteger, BigDecimal, String and the various Date classes.
+ </para>
+
+ <para>By default type conversion is performed by the
+ <ulink url="../../click-api/org/apache/click/util/RequestTypeConverter.html">RequestTypeConverter</ulink>
+ class which is used by the ClickServlet method
+ <ulink url="../../click-api/org/apache/click/ClickServlet.html#getTypeConverter()">getTypeConverter()</ulink>.
+ </para>
+
+ <para>If you need to add support for additional types, you would write your
+ own type converter class and subclass the ClickSerlvet to use your custom
+ converter.
+ </para>
+
+ <para>For example if we wanted to automatically load a
+ <classname>Customer</classname> object from the database when a customer
+ id request parameter is specified, you could write your own type converter:
+ </para>
+
+ <programlisting language="java">public class CustomTypeConverter extends RequestTypeConverter {
+
+ private CustomerService customerService = new CustomerService();
+
+ /**
+ * @see RequestTypeConverter#convertValue(Object, Class)
+ */
+ protected Object convertValue(Object value, Class toType) {
+ if (toType == Customer.class) {
+ return customerService.getCustomerForId(value);
+
+ } else {
+ return super.convertValue(value, toType);
+ }
+ }
+}</programlisting>
+
+ <para>This type converter would handle the following request:
+ </para>
+
+ <literallayout>http://localhost:8080/mycorp/customer-details.htm?<varname>customer</varname>=<symbol>7203</symbol></literallayout>
+
+ <para>This request will load the <varname>customer</varname> object from
+ the database using "<symbol>7203</symbol>" as the customer id value. The
+ ClickServlet would then assign this <varname>customer</varname> object to
+ the matching page field:
+ </para>
+
+ <programlisting language="java">package com.mycorp.page;
+
+public class CustomerDetails extends Page {
+
+ public Customer <varname>customer</varname>;
+
+}</programlisting>
+
+ <para>To make your custom type converter available you will need to
+ subclass ClickServlet and override the
+ <methodname>getTypeConverter()</methodname> method. For example:
+ </para>
+
+ <programlisting language="java">public class CustomClickServlet extends ClickServlet {
+
+ /**
+ * @see ClickServlet#getTypeConverter()
+ */
+ protected TypeConverter getTypeConverter() {
+ if (typeConverter == null) {
+ typeConverter = new CustomTypeConverter();
+ }
+ return typeConverter;
+ }
+}</programlisting>
+
+ </sect2>
+ </sect1>
+
+ <sect1 id="page-security" remap="h2">
+ <title>Security</title>
+
+ <para>Pages provide an
+ <ulink url="../../click-api/org/apache/click/Page.html#onSecurityCheck()">onSecurityCheck</ulink>
+ event handler which application pages can override to implement a
+ programmatic security model.
+ </para>
+
+ <para>Please note you generally don't need to use this capability, and where
+ possible you should use the declarative JEE security model. See the Best
+ Practices <link linkend="security">Security</link> topic for more details.
+ </para>
+
+ <sect2 id="applications-authentication" remap="h3">
+ <title>Application Authentication</title>
+
+ <para>Applications can use the <methodname>onSecurityCheck()</methodname>
+ method to implement their own security model. The example class below
+ provides a base Secure page class which other pages can extend to ensure
+ the user is logged in. In this example the login page creates a session
+ when a user successfully authenticates. This Secure page then checks to
+ make sure the user has a session, otherwise the request is redirected to
+ the login page.
+ </para>
+
+ <programlisting language="java">public class Secure extends Page {
+
+ /**
+ * @see Page#onSecurityCheck()
+ */
+ public boolean onSecurityCheck() {
+
+ if (getContext().hasSession()) {
+ return true;
+
+ } else {
+ setRedirect(LoginPage.class);
+ return false;
+ }
+ }
+}</programlisting>
+ </sect2>
+
+ <sect2 id="container-authentication" remap="h3">
+ <title>Container Authentication</title>
+
+ <para>Alternatively you can also use the security services provided by
+ the JEE Servlet Container. For instance to ensure users have been
+ authenticated by the Serlvet Container you could use a Secure page of:
+ </para>
+
+ <programlisting language="java">public class Secure extends Page {
+
+ /**
+ * @see Page#onSecurityCheck()
+ */
+ public boolean onSecurityCheck() {
+
+ if (getContext().getRequest().<ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletRequest.html#getRemoteUser()"><varname>getRemoteUser</varname></ulink>() != null) {
+ return true;
+
+ } else {
+ setRedirect(LoginPage.class);
+ return false;
+ }
+ }
+}</programlisting>
+
+ </sect2>
+
+ <sect2 id="container-access-control" remap="h3">
+ <title>Container Access Control</title>
+
+ <para>The Servlet Container also provides facilities to enforce role
+ based access control (authorization). The example below is a base page
+ to ensure only users in the "admin" role can access the page, otherwise
+ users are redirected to the login page. Application Admin pages would
+ extend this secure page to provide their functionality.
+ </para>
+
+ <programlisting language="java">public class AdminPage extends Page {
+
+ /**
+ * @see Page#onSecurityCheck()
+ */
+ public boolean onSecurityCheck() {
+
+ if (getContext().getRequest().<ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletRequest.html#isUserInRole(java.lang.String)"><varname>isUserInRole</varname></ulink>("admin")) {
+ return true;
+
+ } else {
+ setRedirect(LoginPage.class);
+ return false;
+ }
+ }
+}</programlisting>
+
+ </sect2>
+
+ <sect2 id="logging-out" remap="h3">
+ <title>Logging Out</title>
+
+ <para>To logout using the application or container based security models
+ you would simply invalidate the session.
+ </para>
+
+ <programlisting language="java">public class Logout extends Page {
+
+ /**
+ * @see Page#onInit()
+ */
+ public void onInit() {
+ getContext().getSession().<ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpSession.html#invalidate()"><varname>invalidate</varname></ulink>();
+ }
+}</programlisting>
+
+ </sect2>
+ </sect1>
+
+ <sect1 id="page-navigation" remap="h2">
+ <title>Page Navigation</title>
+
+ <para> Navigation between pages is achieved by using forwards, redirects
+ and by setting the page template path.
+ </para>
+
+ <sect2 id="forward" remap="h3">
+ <title>Forward</title>
+
+ <para> To forward to another page using the servlet
+ <ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/RequestDispatcher.html">RequestDispatcher</ulink>,
+ set the Page's forward property. For example to forward to a page with a
+ path <varname>index.htm</varname>:
+ </para>
+
+ <programlisting language="java">/**
+ * @see Page#onPost()
+ */
+public void onPost() {
+ // Process form post
+ ..
+
+ setForward("index.htm");
+}</programlisting>
+
+ <para>This will invoke a new Page class instance mapped to the path
+ <varname>index.htm</varname>.
+ </para>
+
+ <para><emphasis role="bold">Please note</emphasis> when a request is
+ forwarded to another Page, the controls on the second page will not be
+ processed. This prevents confusion and bugs, like a form on the second page
+ trying to process a POST request from the first page.
+ </para>
+
+ <sect3 id="forward-parameter-passing" remap="h4">
+ <title>Forward Parameter Passing</title>
+
+ <para>When you forward to another page the request parameters are
+ maintained. This is a handy way of passing through state information
+ with the request. For example you could add a customer object as a
+ request parameter which is displayed in the template of the forwarded
+ page.
+ </para>
+
+ <programlisting language="java">public boolean onViewClick() {
+ Long id = viewLink.getValueLong();
+ Customer customer = CustomerDAO.findByPK(id);
+
+ // Set the customer object as a request parameter
+ getContext().setRequestAttribute("customer", customer);
+ setForward("view-customer.htm");
+
+ return false;
+}</programlisting>
+
+ <para>The snippet above forwards to the page template
+ <varname>view-customer.htm</varname>:
+ </para>
+
+ <programlisting language="xml"><html>
+ <head>
+ <title>Customer Details</title>
+ </head>
+ <body>
+ <h1>Customer Details</h1>
+ <pre>
+ Full Name: <varname>$customer.fullName</varname>
+ Email: <varname>$customer.email</varname>
+ Telephone: <varname>$customer.telephone</varname>
+ </pre>
+ </body>
+</html></programlisting>
+
+ <para>Request attributes are automatically added to the Velocity Context
+ object so are available in the page template.
+ </para>
+ </sect3>
+
+ <sect3 id="page-forwarding" remap="h4">
+ <title>Page Forwarding</title>
+
+ <para>Page forwarding is another way of passing information between
+ pages. In this case you create the page to be forwarded to using the
+ Context <ulink url="../../click-api/org/apache/click/Context.html#createPage(java.lang.String)">createPage(String)</ulink>
+ method and then set properties directly on the Page. Finally set this
+ page as the page to forward the request to. For example:
+ </para>
+
+ <programlisting language="java">public boolean onEditClick() {
+ Long id = viewLink.getValueLong();
+ Customer customer = CustomerDAO.findByPK(id);
+
+ // Create a new EditPage instance based on the specified path
+ EditPage editPage = (EditPage) getContext().createPage("/edit-customer.htm");
+ editPage.setCustomer(customer);
+ setForward(editPage);
+
+ return false;
+}</programlisting>
+
+ <para>When creating a page with the <methodname>createPage()</methodname>
+ method, ensure you prefix the page path with the <varname>"/"</varname>
+ character.
+ </para>
+
+ <para>You can also specify the target page using its class as long as
+ the Page has a unique path. Using this technique the above code becomes:
+ </para>
+
+ <programlisting language="java">public boolean onEditClick() {
+ Long id = viewLink.getValueLong();
+ Customer customer = CustomerDAO.findByPK(id);
+
+ // Create a new EditPage instance based on its class
+ EditPage editPage = (EditPage) getContext().createPage(EditPage.class);
+ editPage.setCustomer(customer);
+ setForward(editPage);
+
+ return false;
+}</programlisting>
+
+ <para>This Page forwarding technique is best practice as it provides you
+ with compile time safety and alleviates you from having to specify page
+ paths in your code. Please always use the Context
+ <methodname>createPage()</methodname> methods to allow Click to inject
+ Page dependencies.
+ </para>
+
+ <para>Although uncommon it is possible to map more than one path to the
+ same class. In these cases invoking Context
+ <methodname>createPage(Class)</methodname> will throw an exception, because
+ Click will not be able to determine which path to use for the Page.
+ </para>
+
+ </sect3>
+ </sect2>
+
+ <sect2 id="template-path" remap="h3">
+ <title>Template Path</title>
+
+ <para>An alternative method of forwarding to a new page is to simply set
+ the current Page's path to the new page template to render. With this
+ approach the page template being rendered must have everything it needs
+ without having its associated Page object created. Our modified example
+ would be:
+ </para>
+
+ <programlisting language="java">public boolean onViewClick() {
+ Long id = viewLink.getValueLong();
+ Customer customer = CustomerDAO.findByPK(id);
+
+ addModel("customer", customer);
+
+ // Set the Page's path to a new value
+ setPath("view-customer.htm");
+
+ return false;
+}</programlisting>
+
+ <para>Note how the <varname>customer</varname> object is passed through to
+ the template in the Page model. This approach of using the Page model is
+ not available when you forward to another Page, as the first Page object is
+ "<ulink url="../../click-api/org/apache/click/Page.html#onDestroy()">destroyed</ulink>"
+ before the second Page object is created and any model values would be lost.
+ </para>
+
+ </sect2>
+ <sect2 id="redirect" remap="h3">
+ <title>Redirect</title>
+
+ <para>Redirects are another very useful way to navigate between pages.
+ See HttpServletResponse.
+ <ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String)">sendRedirect</ulink>
+ (location) for details.
+ </para>
+
+ <para>The great thing about redirects are that they provide a clean URL in
+ the users browser which matches the page that they are viewing. This is
+ important for when users want to bookmark a page. The downside of
+ redirects are that they involve a communications round trip with the users
+ browser which requests the new page. Not only does this take time, it also
+ means that all the page and request information is lost.
+ </para>
+
+ <para>An example of a redirect to a <varname>logout.htm</varname> page is
+ provided below:
+ </para>
+
+ <programlisting language="java">public boolean onLogoutClick() {
+ setRedirect("/logout.htm");
+ return false;
+}</programlisting>
+
+ <para>If the redirect location begins with a <symbol>"/"</symbol> character
+ the redirect location will be prefixed with the web applications context
+ path. For example if an application is deployed to the context
+ <varname>"mycorp"</varname> calling
+ <methodname>setRedirect(<varname>"/customer/details.htm"</varname>)</methodname>
+ will redirect the request to: <varname>"/mycorp/customer/details.htm"</varname>.
+ </para>
+
+ <para>You can also obtain the redirect path via the target Page's class.
+ For example:
+ </para>
+
+ <programlisting language="java">public boolean onLogoutClick() {
+ String path = getContext().getPagePath(Logout.class);
+ setRedirect(path);
+ return false;
+}</programlisting>
+
+ <para>Note when using this redirect method, the target Page class must have
+ a unique path.
+ </para>
+
+ <para>A short hand way of redirecting is to simply specify the target Page
+ class in the redirect method. For example:
+ </para>
+
+ <programlisting language="java">public boolean onLogoutClick() {
+ setRedirect(Logout.class);
+ return false;
+}</programlisting>
+
+ <sect3 id="redirect-parameter-passing" remap="h4">
+ <title>Redirect Parameter Passing</title>
+
+ <para>You can pass information between redirected pages using URL
+ request parameters. The ClickServlet will encode the URL for you using
+ HttpServletResponse.<ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html#encodeRedirectURL(java.lang.String)">encodeRedirectURL</ulink>
+ (url).
+ </para>
+
+ <para>In the example below a user will click on an OK button to confirm
+ a payment. The <methodname>onOkClick()</methodname> button handler
+ processes the payment, gets the payment transaction id, and then
+ redirects to the <varname>trans-complete.htm</varname> page with the
+ transaction id encoded in the URL.
+ </para>
+
+ <programlisting language="java">public class Payment extends Page {
+ ..
+
+ public boolean onOkClick() {
+ if (form.isValid()) {
+ // Process payment
+ ..
+
+ // Get transaction id
+ Long transId = OrderDAO.purchase(order);
+
+ setRedirect("trans-complete.htm?transId=" + transId);
+
+ return false;
+ }
+ return true;
+ }
+}</programlisting>
+
+ <para>The Page class for the trans-complete.htm page can then get the
+ transaction id through the request parameter <varname>"transId"</varname>:
+ </para>
+
+ <programlisting language="java">public class TransComplete extends Page {
+ /**
+ * @see Page#onInit()
+ */
+ public void onInit() {
+ String transId = getContext().getRequest().getParameter("transId");
+
+ if (transId != null) {
+
+ // Get order details
+ Order order = OrderDAO.findOrderByPK(new Long(transId));
+ if (order != null) {
+ addModel("order", order);
+ }
+ }
+ }
+}</programlisting>
+
+ </sect3>
+
+ <sect3 id="post-redirect" remap="h4">
+ <title>Post Redirect</title>
+
+ <para>The parameter passing example above is also an example of a Post
+ Redirect. The Post Redirect technique is a very useful method of
+ preventing users from submitting a form twice by hitting the refresh
+ button.
+ </para>
+
+ </sect3>
+ </sect2>
+ </sect1>
+
+ <sect1 id="page-templating" remap="h2">
+ <title>Page Templating</title>
+
+ <para>Click supports page templating (a.k.a. <emphasis>Tiles</emphasis> in
+ Struts) enabling you to create a standardized look and feel for your web
+ application and greatly reducing the amount of HTML you need to maintain.
+ </para>
+
+ <para>To implement templating define a border template base Page which
+ content Pages should extend. The template base Page class overrides the Page
+ <ulink url="../../click-api/org/apache/click/Page.html#getTemplate()">getTemplate()</ulink>
+ method, returning the path of the border template to render. For example:
+ </para>
+
+ <programlisting language="java">public class BorderedPage extends Page {
+
+ /**
+ * @see Page#getTemplate()
+ */
+ public String getTemplate() {
+ return "/border.htm";
+ }
+}</programlisting>
+
+ <para>The BorderedPage template <varname>border.htm</varname>:
+ </para>
+
+ <programlisting language="xml"><html>
+ <head>
+ <title><varname>$title</varname></title>
+ <link rel="stylesheet" type="text/css" href="style.css" title="Style"/>
+ </head>
+ <body>
+
+ <h2 class="title"><varname>$title</varname></h2>
+
+ <command>#parse</command>(<varname>$path</varname>)
+
+ </body>
+</html>
+ </programlisting>
+
+ <para>Other pages insert their content into this template using the Velocity
+ <ulink url="../../velocity/vtl-reference-guide.html#parse">#parse</ulink>
+ directive, passing it their contents pages
+ <ulink url="../../click-api/org/apache/click/Page.html#path">path</ulink>. The
+ <varname>$path</varname> value is automatically added to the VelocityContext
+ by the ClickServlet.
+ </para>
+
+ <para>An example bordered Home page is provided below:
+ </para>
+
+ <literallayout><page path="<varname>home.htm</varname>" classname="<token>Home</token>"/></literallayout>
+
+ <programlisting language="java">public class Home extends BorderedPage {
+
+ public String title = "Home";
+
+}</programlisting>
+
+ <para>The Home page's content <varname>home.htm</varname>:
+ </para>
+
+ <literallayout><b>Welcome</b> to Home page your starting point for the application.</literallayout>
+
+ <?dbfo-need height="1.2in" ?>
+
+ <para>When a request is made for the Home page (home.htm) Velocity will
+ merge the <varname>border.htm</varname> page and <varname>home.htm</varname>
+ page together returning:
+ </para>
+
+ <programlisting language="xml"><html>
+ <head>
+ <title>Home</title>
+ <link rel="stylesheet" type="text/css" href="style.css" title="Style"/>
+ </head>
+ <body>
+
+ <h2 class="title">Home</h2>
+
+ <b>Welcome</b> to Home page your application starting point.
+
+ </body>
+</html></programlisting>
+
+ <para>Which may be rendered as:
+ </para>
+
+ <figure id="home-page-screenshot">
+ <title>Home Page</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/pages/home-page-screenshot.png" format="PNG" scale="85"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Note how the Home page class defines a <varname>title</varname> model
+ value which is referenced in the <varname>border.htm</varname> template as
+ <varname>$title</varname>. Each bordered page can define their own title
+ which is rendered in this template.
+ </para>
+
+ <para>Templating with JSP pages is also supported using the same pattern.
+ Please see the Click Examples application for a demonstration.
+ </para>
+
+ </sect1>
+
+ <sect1 id="page-direct-rendering" remap="h2">
+ <title>Direct Rendering</title>
+
+ <para>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:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para> get the servlet response object</para>
+ </listitem>
+ <listitem>
+ <para> set the content type on the response</para>
+ </listitem>
+ <listitem>
+ <para> get the response output stream</para>
+ </listitem>
+ <listitem>
+ <para> write to the output stream</para>
+ </listitem>
+ <listitem>
+ <para> close the output stream</para>
+ </listitem>
+ <listitem>
+ <para> set the page path to null to inform the ClickServlet that
+ rendering has been completed</para>
+ </listitem>
+ </itemizedlist>
+
+ <?dbfo-need height="1.2in" ?>
+
+ <para>A direct rendering example is provided below.
+ </para>
+
+ <programlisting language="java">/**
+ * Render the Java source file as "text/plain".
+ *
+ * @see Page#onGet()
+ */
+public void onGet() {
+ String filename = ..
+
+ HttpServletResponse response = getContext().getResponse();
+
+ response.setContentType("text/plain");
+ response.setHeader("Pragma", "no-cache");
+
+ ServletContext context = getContext().getServletContext();
+
+ InputStream inputStream = null;
+ try {
+ inputStream = context.getResourceAsStream(filename);
+
+ PrintWriter writer = response.getWriter();
+
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+
+ String line = reader.readLine();
+
+ while (line != null) {
+ writer.println(line);
+ line = reader.readLine();
+ }
+
+ setPath(null);
+
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+
+ } finally {
+ ClickUtils.close(inputStream);
+ }
+}</programlisting>
+
+ </sect1>
+ <sect1 id="stateful-pages" remap="h2">
+ <title>Stateful Pages</title>
+
+ <para>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:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+
+ <para>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.
+ </para>
+
+ </listitem>
+ <listitem>
+
+ <para>Complex pages with multiple forms and or tables which need to
+ maintain their state between interactions.
+ </para>
+
+ </listitem>
+ </itemizedlist>
+
+ <para>To make a page stateful you simply need to set the page
+ <ulink url="../../click-api/org/apache/click/Page.html#stateful">stateful</ulink>
+ property to true, have the page implement the <classname>Serializable</classname>
+ interface and set the <literal>serialVersionUID</literal> indicator.
+ For example:
+ </para>
+
+ <programlisting language="java">package com.mycorp.page;
+
+import java.io.Serializable;
+
+import org.apache.click.Page;
+
+public class SearchPage extends Page implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public SearchPage() {
+ setStateful(true);
+ ..
+ }
+}</programlisting>
+
+ <para>Stateful page instances are stored in the user's
+ <ulink url="http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpSession.html">HttpSession</ulink>
+ 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:
+ <classname>com.mycorp.page.SearchPage</classname>
+ </para>
+
+ <sect2 id="page-creation" remap="h3">
+ <title>Page Creation</title>
+
+ <para>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 <methodname>onInit()</methodname> method.
+ </para>
+
+ <para>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
+ <methodname>onInit()</methodname> method which will be invoked with each
+ request.
+ </para>
+
+ <para>If you have dynamic control creation code you would typically place
+ this in the <methodname>onInit()</methodname> method, but you will need to
+ take care that controls and or models are not already present in the page.
+ </para>
+
+ </sect2>
+ <sect2 id="page-execution" remap="h3">
+ <title>Page Execution</title>
+
+ <para>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.
+ </para>
+
+ </sect2>
+ <sect2 id="page-destruction" remap="h3">
+ <title>Page Destruction</title>
+
+ <para>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 <classname>HttpSession</classname> so
+ care needs to be take not to store too many objects in stateful page
+ instances which may cause memory and performance issues.
+ </para>
+
+ <para>When pages have completed their execution, all the Page's controls
+ <methodname>onDestroy()</methodname> methods are invoked, and then the
+ Page's <methodname>onDestroy()</methodname> 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
+ <ulink url="../../click-api/org/apache/click/control/Table.html#onDestroy()">onDestory()</ulink>
+ method.
+ </para>
+
+ </sect2>
+ </sect1>
+
+ <sect1 id="page-error-handling" remap="h2">
+ <title>Error Handling</title>
+
+ <para>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
+ <ulink url="../../click-api/org/apache/click/util/ErrorPage.html">ErrorPage</ulink>,
+ which is automatically configured as:
+ </para>
+
+ <literallayout><page path="<varname>click/error.htm</varname>" classname="<symbol>org.apache.click.util.ErrorPage</symbol>"/></literallayout>
+
+ <para>To register an alternative error handler you must subclass ErrorPage
+ and define your page using the path <varname>"click/error.htm"</varname>.
+ For example:
+ </para>
+
+ <literallayout><page path="<varname>click/error.htm</varname>" classname="<symbol>com.mycorp.page.ErrorPage</symbol>"/></literallayout>
+
+ <para>When the ClickSevlet starts up it checks to see whether the
+ <varname>error.htm</varname> template exists in the <varname>click</varname>
+ web sub directory. If it cannot find the page the ClickServlet will
+ automatically deploy one. You can tailor the <varname>click/error.htm</varname>
+ template to suite you own tastes, and the ClickServlet will
+ not overwrite it.
+ </para>
+
+ <para>The default error template will display extensive debug information
+ when the application is in <literal>development</literal> or
+ <literal>debug</literal> mode. Example error page displays include:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <ulink url="../../error-npe.html">NullPointerException</ulink> - in a page
+ method
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="../../error-parsing.html">ParseErrorException</ulink> - in a
+ page template
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <para>When the application is in <literal>production</literal> mode only
+ a simple error message is displayed. See
+ <link linkend="application-mode">Configuration</link> for details on how to
+ set the application mode.
+ </para>
+
+ <para>Please also see the <ulink url="../../examples.html">Examples</ulink> web
+ app Exception Demo for demonstrations of Clicks error handling.
+ </para>
+
+ </sect1>
+ <sect1 id="page-not-found" remap="h2">
+ <title>Page Not Found</title>
+
+ <para>If the ClickServlet cannot find a requested page in the
+ <literal>click.xml</literal> config file it will use the registered
+ <ulink url="../../not-found.html">not-found.htm</ulink> page.
+ </para>
+
+ <para>The Click <literal>not found page</literal> is automatically configured
+ as:
+ </para>
+
+ <literallayout><page path="<varname>click/not-found.htm</varname>" classname="<symbol>org.apache.click.Page</symbol>"/></literallayout>
+
+ <para>You can override the default configuration and specify your own class,
+ but you cannot change the path.
+ </para>
+
+ <para>When the ClickSevlet starts up it checks to see whether the
+ <varname>not-found.htm</varname> template exists in the <varname>click</varname>
+ web sub directory. If it cannot find the page the ClickServlet will
+ automatically deploy one.
+ </para>
+
+ <para>You can tailor the <varname>click/not-found.htm</varname> template to
+ suite you own needs. This page template has access to the usual Click objects.
+ </para>
+
+ </sect1>
+ <sect1 id="page-message-properties" remap="h2">
+ <title>Page Message Properties</title>
+
+ <para>The Page class provides a
+ <ulink url="../../click-api/org/apache/click/Page.html#messages">messages</ulink>
+ property which is a
+ <ulink url="../../click-api/org/apache/click/util/MessagesMap.html">MessagesMap</ulink>
+ of localized messages for the page. These messages are made available in the
+ VelocityContext when the page is rendered under the key
+ <literal>messages</literal>. So for example if you had a page title message
+ you would access it in your page template as:
+ </para>
+
+ <literallayout><h1> <symbol>$</symbol><varname>messages.title</varname> </h1></literallayout>
+
+ <para>This messages map is loaded from the page class property bundle. For
+ example if you had a page class <classname>com.mycorp.page.CustomerList</classname>
+ you could have an associated property file containing the pages localized
+ messages:
+ </para>
+
+ <literallayout>/com/mycorp/page/CustomerList.properties</literallayout>
+
+ <para>You can also defined a application global page messages properties file:
+ </para>
+
+ <literallayout>/click-page.properties</literallayout>
+
+ <para>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.
+ </para>
+
+ <para>Page messages can also be used to override Control messages, see the
+ Controls <link linkend="control-message-properties">Message Properties</link>
+ topic for more details.
+ </para>
+
+ </sect1>
+</chapter>
Added: 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=752572&view=auto
==============================================================================
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/click-book.xml (added)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/click-book.xml Wed Mar 11 18:55:49 2009
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
+ "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+ <!ENTITY chapter-introduction SYSTEM "chapter-introduction.xml" >
+ <!ENTITY chapter-pages SYSTEM "chapter-pages.xml" >
+ <!ENTITY chapter-controls SYSTEM "chapter-controls.xml" >
+ <!ENTITY chapter-configuration SYSTEM "chapter-configuration.xml" >
+ <!ENTITY chapter-best-practices SYSTEM "chapter-best-practices.xml" >
+ ]>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<book lang="en">
+ <title>Apache Click</title>
+
+ <bookinfo>
+ <copyright>
+ <year>2009</year>
+
+ <holder>The Apache Software Foundation</holder>
+ </copyright>
+
+ <releaseinfo>V 2.1.0</releaseinfo>
+
+ <productname>Click</productname>
+
+ <authorgroup>
+ <corpauthor>Apache Click User Guide</corpauthor>
+ </authorgroup>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/click-logo.png" />
+ </imageobject>
+ </mediaobject>
+ </bookinfo>
+
+ <toc></toc>
+
+ &chapter-introduction;
+ &chapter-pages;
+ &chapter-controls;
+ &chapter-configuration;
+ &chapter-best-practices;
+
+</book>
+
+
+
+
Added: incubator/click/trunk/click/documentation/xdocs/src/images/click-logo.png
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/images/click-logo.png?rev=752572&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/click/trunk/click/documentation/xdocs/src/images/click-logo.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/click/trunk/click/documentation/xdocs/src/images/external.png
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/images/external.png?rev=752572&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/click/trunk/click/documentation/xdocs/src/images/external.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream