Source Viewer : WEB-INF/classes/org/apache/click/examples/page/introduction/ControlListenerType1Page.java
package org.apache.click.examples.page.introduction;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
/**
* Provides a control listener example Page using the runtime binding of the
* control listener.
* <p/>
* The advantage of this control listener binding style is
* that you write less lines of code, the disadvantage is that there is no
* compile time checking.
*/
public class ControlListenerType1Page extends BorderPage {
private static final long serialVersionUID = 1L;
/* Set the listener to this object's "onLinkClick" method. */
private ActionLink myLink = new ActionLink("myLink", this, "onLinkClick");
// Constructors -----------------------------------------------------------
public ControlListenerType1Page() {
addControl(myLink);
}
// Event Handlers ---------------------------------------------------------
/**
* Handle the ActionLink control click event.
*/
public boolean onLinkClick() {
String msg = "ControlListenerPage#" + hashCode()
+ " object method <tt>onLinkClick()</tt> invoked.";
addModel("msg", msg);
return true;
}
}