You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2010/12/26 05:46:46 UTC
svn commit: r1052832 - in /click/trunk/click:
documentation/xdocs/src/docbook/click/
examples/src/org/apache/click/examples/page/introduction/
Author: sabob
Date: Sun Dec 26 04:46:46 2010
New Revision: 1052832
URL: http://svn.apache.org/viewvc?rev=1052832&view=rev
Log:
Remove auto binding from examples CLK-742
Modified:
click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml
click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType1Page.java
click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType2Page.java
Modified: click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml
URL: http://svn.apache.org/viewvc/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml?rev=1052832&r1=1052831&r2=1052832&view=diff
==============================================================================
--- click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml (original)
+++ click/trunk/click/documentation/xdocs/src/docbook/click/chapter-introduction.xml Sun Dec 26 04:46:46 2010
@@ -160,9 +160,15 @@ public HelloWorld extends Page {
<programlisting language="java">public class ControlListenerType1Page extends Page {
/* Set the listener to this object's "onLinkClick" method. */
- @Bindable protected ActionLink myLink = new ActionLink(this, "onLinkClick"); <co id="co-bindable" linkends="ca-bindable"/>
+ private ActionLink myLink = new ActionLink("myLink", this, "onLinkClick")
- @Bindable protected String msg;
+ private String msg;
+
+ // --------------------------------------------------------- Constructors
+
+ public ControlListenerType1Page() {
+ addControl(myLink); <co id="co-addcontrol" linkends="ca-addcontrol"/>
+ }
// --------------------------------------------------------- Event Handlers
@@ -170,8 +176,9 @@ public HelloWorld extends Page {
* Handle the ActionLink control click event.
*/
public boolean onLinkClick() {
- msg = "ControlListenerPage#" + hashCode()
+ String msg = "ControlListenerPage#" + hashCode()
+ " object method <tt>onLinkClick()</tt> invoked.";
+ addModel("msg", msg);
return true;
}
@@ -179,12 +186,10 @@ public HelloWorld extends Page {
}</programlisting>
<calloutlist>
- <callout arearefs="co-bindable" id="ca-bindable">
- <para>Variables annotated with <literal>@Bindable</literal>
- is a short-hand way of instructing Click to automatically bind request
- parameters to Page variables. In addition these variables will
- automatically be added to the Page model. For more information please see the
- section <link linkend="request-param-auto-binding">Request Parameter Auto Binding</link>.
+ <callout arearefs="co-addcontrol" id="ca-addcontrol">
+ <para>Add the link to the page. The link will be made available to the
+ page template under the variable <varname>myLink</varname>, which
+ is the name of the control.
</para>
</callout>
</calloutlist>
@@ -254,10 +259,7 @@ public HelloWorld extends Page {
<programlisting language="java">public class ControlListenerType2Page extends Page {
- /* Public scope controls are automatically added to the page. */
- @Bindable protected ActionLink myLink = new ActionLink();
-
- @Bindable protected String msg;
+ private ActionLink myLink = new ActionLink("myLink");
// ------------------------------------------------------------ Constructor
@@ -265,22 +267,25 @@ public HelloWorld extends Page {
* Create a new Page instance.
*/
public ControlListenerType2Page() {
+ addControl(myLink);
+
myLink.setActionListener(new ActionListener() {
public boolean onAction(Control control) {
- msg = "ControlListenerPage#" + hashCode()
+ String msg = "ControlListenerPage#" + hashCode()
+ " object method <tt>onAction()</tt> invoked.";
+ addModel("msg", msg);
return true;
}
});
}
-
+
}</programlisting>
<para>In the Page class we create an ActionLink called
<varname>myLink</varname>. In the Page constructor we set the control's
- action listener to an anonymous inner class which implements the
- <methodname>onAction()</methodname>. When a user clicks on
+ action listener to an anonymous inner class which implements the method
+ <methodname>onAction()</methodname>. When a user clicks on the
<varname>myLink</varname> control it will invoke the action listener method
<methodname>onAction()</methodname>.
</para>
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType1Page.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType1Page.java?rev=1052832&r1=1052831&r2=1052832&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType1Page.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType1Page.java Sun Dec 26 04:46:46 2010
@@ -20,7 +20,6 @@ package org.apache.click.examples.page.i
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
-import org.apache.click.util.Bindable;
/**
* Provides a control listener example Page using the runtime binding of the
@@ -35,9 +34,13 @@ public class ControlListenerType1Page ex
private static final long serialVersionUID = 1L;
/* Set the listener to this object's "onLinkClick" method. */
- @Bindable protected ActionLink myLink = new ActionLink(this, "onLinkClick");
+ private ActionLink myLink = new ActionLink("myLink", this, "onLinkClick");
- @Bindable protected String msg;
+ // Constructors -----------------------------------------------------------
+
+ public ControlListenerType1Page() {
+ addControl(myLink);
+ }
// Event Handlers ---------------------------------------------------------
@@ -45,8 +48,9 @@ public class ControlListenerType1Page ex
* Handle the ActionLink control click event.
*/
public boolean onLinkClick() {
- msg = "ControlListenerPage#" + hashCode()
+ String msg = "ControlListenerPage#" + hashCode()
+ " object method <tt>onLinkClick()</tt> invoked.";
+ addModel("msg", msg);
return true;
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType2Page.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType2Page.java?rev=1052832&r1=1052831&r2=1052832&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType2Page.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/introduction/ControlListenerType2Page.java Sun Dec 26 04:46:46 2010
@@ -22,7 +22,6 @@ import org.apache.click.ActionListener;
import org.apache.click.Control;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
-import org.apache.click.util.Bindable;
/**
* Provides a control listener example Page using the compile time binding of
@@ -36,9 +35,7 @@ public class ControlListenerType2Page ex
private static final long serialVersionUID = 1L;
- @Bindable protected ActionLink myLink = new ActionLink();
-
- @Bindable protected String msg;
+ private ActionLink myLink = new ActionLink("myLink");
// Constructor ------------------------------------------------------------
@@ -46,12 +43,15 @@ public class ControlListenerType2Page ex
* Create a new Page instance.
*/
public ControlListenerType2Page() {
+ addControl(myLink);
+
myLink.setActionListener(new ActionListener() {
private static final long serialVersionUID = 1L;
public boolean onAction(Control control) {
- msg = "ControlListenerPage#" + hashCode()
+ String msg = "ControlListenerPage#" + hashCode()
+ " object method <tt>onAction()</tt> invoked.";
+ addModel("msg", msg);
return true;
}