Remove auto binding from examples CLK-742
git-svn-id: https://svn.apache.org/repos/asf/click/trunk/click@1052238 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/examples/src/org/apache/click/examples/page/velocity/ActionTable.java b/examples/src/org/apache/click/examples/page/velocity/ActionTable.java
index d131937..b640486 100644
--- a/examples/src/org/apache/click/examples/page/velocity/ActionTable.java
+++ b/examples/src/org/apache/click/examples/page/velocity/ActionTable.java
@@ -29,7 +29,6 @@
import org.apache.click.examples.page.BorderPage;
import org.apache.click.examples.page.EditCustomer;
import org.apache.click.examples.service.CustomerService;
-import org.apache.click.util.Bindable;
import org.springframework.stereotype.Component;
/**
@@ -44,11 +43,9 @@
private static final long serialVersionUID = 1L;
- @Bindable protected List<Customer> customers;
- @Bindable protected Customer customerDetail;
- @Bindable protected ActionLink viewLink = new ActionLink(this, "onViewClick");
- @Bindable protected PageLink editLink = new PageLink(EditCustomer.class);
- @Bindable protected ActionLink deleteLink = new ActionLink(this, "onDeleteClick");
+ private ActionLink viewLink = new ActionLink("viewLink", this, "onViewClick");
+ private PageLink editLink = new PageLink("editLink", EditCustomer.class);
+ private ActionLink deleteLink = new ActionLink("deleteLink", this, "onDeleteClick");
@Resource(name="customerService")
private CustomerService customerService;
@@ -57,13 +54,18 @@
public void onInit() {
super.onInit();
- String path = getContext().getPagePath(getClass());
- editLink.setParameter("referrer", path);
+ addControl(viewLink);
+ addControl(editLink);
+ addControl(deleteLink);
+
+ String pagePath = getContext().getPagePath(getClass());
+ editLink.setParameter("referrer", pagePath);
}
public boolean onViewClick() {
Integer id = viewLink.getValueInteger();
- customerDetail = customerService.getCustomerForID(id);
+ Customer customerDetail = customerService.getCustomerForID(id);
+ addModel("customerDetail", customerDetail);
return true;
}
@@ -83,7 +85,8 @@
*/
@Override
public void onRender() {
- customers = customerService.getCustomersSortedByName(7);
+ List<Customer> customers = customerService.getCustomersSortedByName(7);
+ addModel("customers", customers);
getFormat().setEmptyString(" ");
}
diff --git a/examples/src/org/apache/click/examples/page/velocity/VelocityMacro.java b/examples/src/org/apache/click/examples/page/velocity/VelocityMacro.java
index 73a54ef..9f6b9ff 100644
--- a/examples/src/org/apache/click/examples/page/velocity/VelocityMacro.java
+++ b/examples/src/org/apache/click/examples/page/velocity/VelocityMacro.java
@@ -29,7 +29,6 @@
import org.apache.click.extras.control.EmailField;
import org.apache.click.extras.control.IntegerField;
import org.apache.click.extras.control.PageSubmit;
-import org.apache.click.util.Bindable;
/**
* Provides a Velocity Macro example.
@@ -38,9 +37,10 @@
private static final long serialVersionUID = 1L;
- @Bindable protected Form form = new Form();
+ private Form form = new Form("form");
public VelocityMacro() {
+ addControl(form);
TextField nameField = new TextField("name", true);
nameField.setMinLength(5);
nameField.setTitle("Customer full name");