Provides renderable HTML controls.


Interface Summary
Container Provides the interface for a container which holds a list of child controls.
Decorator Provides a decorator interface for delegating object rendering.
Renderable Provides an interface for rendering output to an efficient string buffer.

Class Summary
AbstractContainer Provides a default implementation of the Container interface to make it easier for developers to create their own containers.
AbstractControl Provides a default implementation of the Control interface to make it easier for developers to create their own controls.
AbstractLink Provides a Abstract Link control:   <a href=""></a>.
ActionButton Provides a ActionButton control:   <input type="button"/>.
ActionLink Provides a Action Link control:   <a href=""></a>.
Button Provides a Button control:   <input type='button'/>.
Checkbox Provides a Checkbox control:   <input type='checkbox'>.
Column Provides the Column table data <td> and table header <th> renderer.
Field Provides an abstract form Field control.
FieldSet Provides a FieldSet container control:   <fieldset>.
FileField Provides a File Field control:   <input type='file'>.
Form Provides a Form control:   <form method='post'>.
HiddenField Provides a Hidden Field control:   <input type='hidden'>.
ImageSubmit Provides an ImageSubmit control:   <input type='image' src='edit.gif'>.
Label Provides a Label display control.
Option Provides a select Option element:   <option></option>.
OptionGroup Provides a select Option Group element:   <optgroup></optgroup>.
PageLink Provides a Page Link control:   <a href="" ></a>.
Panel Provides a Panel container that has its own Panel.template and Panel.model.
PasswordField Provides a Password Field control:   <input type='password'>.
Radio Provides a Radio control:   <input type='radio'>.
RadioGroup Provides a RadioGroup control.
Reset Provides a Reset control:   <input type='reset'>.
Select Provides a Select control:   <select></select>.
Submit Provides a Submit control:   <input type='submit'>.
Table Provides a HTML Table control: <table>.
TablePaginator Provides the default Table Paginator.
TextArea Provides a TextArea control:   <textarea></textarea>.
TextField Provides a Text Field control:   <input type='text'>.

Package Description

Provides renderable HTML controls. Controls implement the Control interface to perform server side request processing. At the top level a Pages controls are processed by the ClickServlet. Some controls can contain child controls which they will inturn process. These container controls include Form, FieldSet, Panel and Table.

Using these controls are similar to traditional Swing GUI programming. While these controls do not provide a full Swing style MVC implementation, they provide a simplified programming model and high performance.

Action Listeners

Controls extending AbstractControl can use an action listener event callback mechanism similar the java.awt.ActionListener callback.

Click supports two styles of action listeners, the first is using the ActionListener interface which provides compile time safety. The second is to register the action listener via the setListener(Object, String) 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.

Examples of these two action listener styles are provided below:

public class ActionDemo extends Page {

    // Uses listener style 1
    @Bindable public ActionLink link = new ActionLink();

    // Uses listener style 2
    @Bindable public ActionButton button = new ActionButton();

    public ActionDemo() {

        // Verbose but provides compile time safety
        link.setActionListener(new ActionListener() {
            public boolean onAction(Control source) {
                return onLinkClick(source);

        // Succinct but typos will cause runtime errors
        button.setListener(this, "onButtonClick");

    // Event Handlers --------------------------------------------------------- 

    public boolean onLinkClick(Control source) {
        return true;

    public boolean onButtonClick() {
        return true;
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.