Java Web Application Development With Click Framework/Extras

Click Extras provides a library of 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:

  • Cayenne - provides Cayenne data aware controls
  • Control - provides extra controls
  • Filter - provides GZIP compression Filter
  • Graphics - provides graphic controls
  • Hibernate - provides Hibernate data aware controls
  • Panel - provides Page Panel containers
  • Spring - provides Spring integration SpringClickServlet

Contributing edit

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 edit

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 edit

Components and controls should have minimal dependencies. This is to support easy deployment of the click-examples and keeps the click build process simple.

Please Note the Cayenne and Spring dependencies are only required if you use these particular features. For example if you are using Hibernate for your persistence framework, the CayenneForm control will not cause any issues as this class would never be loaded by your application.

Auto File Deployment edit

The Click framework uses the Velocity Tools WebappLoader for loading templates. This avoids issues associate with using the Velocity ClasspathResourceLoader and FileResourceLoader on JEE 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 enable your controls to deploy resources on startup it should use the Control onDeploy() method. Click extra controls which use this method should be registered in Click Extras JAR extras-controls.xml file.

Coding Style and Practices edit

Click follows the Sun conversions for Java code style. Other style conventions and practices include:

  • indents are 4 spaces wide and no tabs are used
  • public and protected visibility members require Javadoc
  • private and package visibility members do not require Javadoc
  • favor the use of unchecked RuntimeException and avoid creating new Exception classes
  • check method parameters and throw IllegalArguementException if parameters are null or invalid
  • avoid creating any more classes than you need to get the job done
  • localize control messages in the classe's properties files
  • use the Context.getLocale() method to obtain a users locale
  • before checking in code run the Ant task: ant format-java