In the future version, many other JavaScript libraries will be supported!
6/20/2008
prototype.js and script.aculo.us
The page auto mapping without templates
However Click maps page classes to request-path from HTML templates. So page classes which do not have corresponded HTML template is not mapped automatically.
For example:
- pages which share a HTML template
- the page which returns JSON or file (response is written in the page class)
@Path("/file-download.htm")
public class FileDonwloadPage extends Page {
/**
* Writes response for file downloading in this method.
*/
@Override public void onRender() {
HttpServletResponse res = getContext().getResponse();
OutputStream out = res.getOutputStream();
...
}
/**
* This method returns null to not render template,
* because this class writes response contents for file download.
*/
public String getPath(){
return null;
}
}
This is one idea of using annotation in Click Framework.
4/22/2008
JavaScript Formatter
EclipseHTMLEditor (a part of Amateras) provides the JavaScript editor. I added JavaScript source code formatter to the JavaScript editor. We can format JavaScript source code from the context menu.
Please wait for the next release of EclipseHTMLEditor!
4/21/2008
JJUG Cross Community Conference 2008 Spring
JJUG Cross Community Conference 2008 Spring will be held at Japan 30 Apr.
JJUG is an abbreviation of Japan Java User Group. In this conference, top Java engineers in Japan talk about hot topics in Java such as Web frameworks, EclipseLink, JAM, Scala and New Swing APIs.
I'll talk about Click Framework in this conference and join panel discussion with speakers of Grails, JRuby on Rails and Wicket.
I wish to make efforts to spread Click Framework in Japan.
3/14/2008
File download in Click Framework
Click Framework provides FileField to upload file, however Click does not provide any support for file downloading. I made AbstractDownloadPage to download file.
Usage:
public class SampleDownloadPage extends AbstractDownloadPage {
public SampleDownloadPage(){
setFileName("sample.txt");
setContents(SampleDownloadPage.class.getResourceAsStream("sample.txt"));
}
}
This page class does not have a template because response is written by this class. So auto-mapping does not work for file download pages. The extended page class have to be registered to click.xml.
3/10/2008
Click Framework + LiveValidation
Click controls provide JavaScript validation, but they are not easy to customize. Now I'm writing JavaScript validation framework for Click using LiveValidation.
In the page class, ready the LivaValiator control like below:
Form form = new Form("form");
form.add(new TextField("name", true));
form.add(new PasswordField("password", true));
form.add(new Submit("login"));
addControl(new LivaValidator("validator", form));
In the page template, generates LiveValidation JavaScript code by the LiveValidator control:
<body>
$form
<script type="text/javascript">
$validator
</script>
</body>
We can also add customized validation rules by use of Validate.Custom.
3/09/2008
OVal: The simple validation framework for Java
OVal is the simple validation framework for Java. You can specify validation rules using annotations.
public class Person {
@NotNull
public String name;
}
Usage:
Validator v = new Validator();
Person p = new Person();
for(ConstraintViolation error: v.validate(p)){
System.out.println(error.getMessage());
}
OVal can switch validation rules by profiles.
public class Person {
@NotNull(profiles={"profile1"})
public String name;
@NotNull(profiles={"profile1", "profile2"})
public String email;
}
Switch profiles like following:
// Enable all profiles
v.enableAllProfiles();
// Enable a specified profile
v.enableProfile("profile1");
// Disable all profiles
v.disableAllProfiles();
// Disable a specified profile
v.disableProfile("profile1");



