Click Extras
Click Extras provide additional controls and components which are outside
of the core Click framework. Click Extras are packaged as a separated JAR which
you can deploy with your application. Extra packages include:
- Panel
- provides Page Panel containers
- Table
- provides a HTML Table control
Contributing
Click Extras provides a place for people to contribute their own code to the
Click project and have it package with the standard distribution. Contributed
code will be subject to review and may require modifications before it is
included in the Click distribution.
Design
One of the overriding design principles with Click is to keep it simple, this
makes to code easier to understand and more reliable.
Another guiding principle is YAGNI (You Ain't Going to Need It), or don't build
it until you really really need it. Click is trying to provide an 80/20 rule framework
where 80% of peoples needs are meet by a framework which is only 20% in size.
When developing Click Extras contributions please follow these principles.
Dependencies
Components and controls should have minimal dependencies. This is to support easy
deployment of the click-examples and keeps the click build process simple.
Current available dependencies include:
- Click framework*
- Commons Codec*
- Commons Collections*
- Commons Lang*
- Commons Logging*
- JDOM*
- Velocity*
* : marked libraries are included in click.jar
* : marked libraries are included in click-extras.jar
Extras controls and components should use Commons Logging API for logging. Please
do not use the ClickLogger which is for internal use by the Click and
Velocity runtimes.
Auto File Deployment
The Click framework uses the Velocity Tools WebappLoader for loading templates.
This avoids issues associate with using the Velocity ClasspathResourceLoader and
FileResourceLoader on J2EE application servers.
To make preconfigured resources (templates, stylesheets, etc.) available to web applications
Click automatically deploys configured classpath resources to the /click
directory at startup (existing files will not be overwritten).
To register classpath resources to be automatically deployed add an entry to the Click Extras
/click-deploy.properties file.
# Define list files to be deployed
click.deploy.files=ListPanel,TabbedPanel,table
# Define file resource paths
click.deploy.path.ListPanel=/net/sf/click/extras/panel/ListPanel.htm
click.deploy.path.TabbedPanel=/net/sf/click/extras/panel/TabbedPanel.htm
click.deploy.path.table=/net/sf/click/extras/table/table.css
Coding Style and Practices
Click follows the Sun conversions for Java code style. Other style convertions
and practices include:
- indents are 4 spaces wide and no tabs are used
- public and protected visibility members require Javadoc
- private and package visiblity members do not require Javadoc
- favour the use of unchecked RuntimeException and avoid creating new Exception classes
- check method parametes and throw IllegalArguementException if parameters are null or invalid
- avoid creating any more classes than you need to get the job done
- localize messages in /click-extras.properties
- use the Context.getLocale() method to obtain a users locale
- before checking in code run the Ant task: ant format-java