You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by me...@apache.org on 2009/04/25 15:50:30 UTC
svn commit: r768530 [1/2] - in /incubator/click/trunk/click: ./ build/
examples/ examples/src/ examples/src/org/apache/click/examples/page/
examples/src/org/apache/click/examples/page/ajax/
examples/src/org/apache/click/examples/page/cayenne/ examples/...
Author: medgar
Date: Sat Apr 25 13:50:28 2009
New Revision: 768530
URL: http://svn.apache.org/viewvc?rev=768530&view=rev
Log:
CLK-534
Added:
incubator/click/trunk/click/examples/webapp/WEB-INF/spring-beans.xml
- copied, changed from r764291, incubator/click/trunk/click/examples/src/applicationContext.xml
incubator/click/trunk/click/extras/src/org/apache/click/extras/spring/PageScopeResolver.java
Removed:
incubator/click/trunk/click/examples/src/applicationContext.xml
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/SpringPage.java
Modified:
incubator/click/trunk/click/.classpath
incubator/click/trunk/click/build/build.properties
incubator/click/trunk/click/build/build.xml
incubator/click/trunk/click/examples/build.xml
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/BorderPage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/EditCustomer.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/SourceViewer.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomer.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomerLiveGrid.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDataGrid.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxSelect.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AutoCompletePage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/CayenneFormPage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/FormTablePage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/TabbedCayenneFormPage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/ExtraControlsForm.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/StandardControlsForm.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedForm.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedTable.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/jsp/CustomerTable.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/LastPage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/NextPage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/FilterPanelDemo.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ListPanelDemo.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/PanelColumnDemo.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/TabbedPanelDemo.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditFormTablePage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditTable.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/FormTablePage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/LargeDatasetDemo.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/SearchTablePage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/TableDecorator.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/TableFooter.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/TablePaginatorPage.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/TablePaging.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/TableSorting.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/TableStyles.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/velocity/ActionTable.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/page/wizard/SelectPostCode.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/service/BookingService.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/service/ClientService.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/service/CustomerService.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/service/PostCodeService.java
incubator/click/trunk/click/examples/src/org/apache/click/examples/service/UserService.java
incubator/click/trunk/click/examples/webapp/WEB-INF/menu.xml
incubator/click/trunk/click/examples/webapp/WEB-INF/web.xml
incubator/click/trunk/click/extras/src/org/apache/click/extras/spring/SpringClickServlet.java
incubator/click/trunk/click/framework/src/org/apache/click/service/ConfigService.java
incubator/click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java
incubator/click/trunk/click/lib/ (props changed)
Modified: incubator/click/trunk/click/.classpath
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/.classpath?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/.classpath (original)
+++ incubator/click/trunk/click/.classpath Sat Apr 25 13:50:28 2009
@@ -1,36 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry path="examples/src" kind="src"/>
- <classpathentry path="template/src" kind="src"/>
- <classpathentry path="mock/src" kind="src"/>
- <classpathentry path="extras/src" kind="src"/>
- <classpathentry path="extras/test" kind="src"/>
- <classpathentry path="framework/src" kind="src"/>
- <classpathentry path="framework/test" kind="src"/>
- <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4" kind="con"/>
- <classpathentry path="lib/commons-codec-1.3.jar" kind="lib"/>
- <classpathentry path="lib/commons-collections-3.1.jar" kind="lib"/>
- <classpathentry path="lib/junit-3.8.1.jar" kind="lib"/>
- <classpathentry path="lib/servlet-api-2.3.jar" kind="lib"/>
- <classpathentry path="lib/ognl-2.6.9.jar" kind="lib"/>
- <classpathentry path="lib/log4j-1.2.14.jar" kind="lib"/>
- <classpathentry path="lib/velocity-1.5.jar" kind="lib"/>
- <classpathentry path="EXAMPLES/ashwood-1.1.jar" kind="var"/>
- <classpathentry path="EXAMPLES/cayenne-nodeps-2.0.4.jar" kind="var"/>
- <classpathentry path="EXAMPLES/commons-logging-1.0.4.jar" kind="var"/>
- <classpathentry path="EXAMPLES/hsqldb-1.8.0.1.jar" kind="var"/>
- <classpathentry path="EXAMPLES/jstl-1.1.2.jar" kind="var"/>
- <classpathentry path="EXAMPLES/log4j-1.2.14.jar" kind="var"/>
- <classpathentry path="EXAMPLES/oro-2.0.8.jar" kind="var"/>
- <classpathentry path="examples/webapp/WEB-INF/lib/poi-3.0-FINAL.jar" kind="lib"/>
- <classpathentry path="lib/commons-fileupload-1.2.1.jar" kind="lib"/>
- <classpathentry path="lib/commons-lang-2.4.jar" kind="lib"/>
- <classpathentry path="lib/freemarker-2.3.12.jar" kind="lib"/>
- <classpathentry path="lib/hibernate-3.2.6.ga.jar" kind="lib"/>
- <classpathentry path="lib/spring-beans-2.5.4.jar" kind="lib"/>
- <classpathentry path="lib/spring-context-2.5.4.jar" kind="lib"/>
- <classpathentry path="lib/spring-core-2.5.4.jar" kind="lib"/>
- <classpathentry path="lib/commons-io-1.4.jar" kind="lib"/>
- <classpathentry path="lib/spring-web-2.5.4.jar" kind="lib"/>
- <classpathentry path="bin" kind="output"/>
+ <classpathentry kind="src" path="examples/src"/>
+ <classpathentry kind="src" path="template/src"/>
+ <classpathentry kind="src" path="mock/src"/>
+ <classpathentry kind="src" path="extras/src"/>
+ <classpathentry kind="src" path="extras/test"/>
+ <classpathentry kind="src" path="framework/src"/>
+ <classpathentry kind="src" path="framework/test"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jrockit-R27.5.0-jdk1.5.0_14"/>
+ <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
+ <classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
+ <classpathentry kind="lib" path="lib/junit-3.8.1.jar"/>
+ <classpathentry kind="lib" path="lib/servlet-api-2.3.jar"/>
+ <classpathentry kind="lib" path="lib/ognl-2.6.9.jar"/>
+ <classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
+ <classpathentry kind="var" path="EXAMPLES/ashwood-1.1.jar"/>
+ <classpathentry kind="var" path="EXAMPLES/cayenne-nodeps-2.0.4.jar"/>
+ <classpathentry kind="var" path="EXAMPLES/commons-logging-1.0.4.jar"/>
+ <classpathentry kind="var" path="EXAMPLES/hsqldb-1.8.0.1.jar"/>
+ <classpathentry kind="var" path="EXAMPLES/jstl-1.1.2.jar"/>
+ <classpathentry kind="var" path="EXAMPLES/log4j-1.2.14.jar"/>
+ <classpathentry kind="var" path="EXAMPLES/oro-2.0.8.jar"/>
+ <classpathentry kind="lib" path="examples/webapp/WEB-INF/lib/poi-3.0-FINAL.jar"/>
+ <classpathentry kind="lib" path="lib/commons-fileupload-1.2.1.jar"/>
+ <classpathentry kind="lib" path="lib/commons-lang-2.4.jar"/>
+ <classpathentry kind="lib" path="lib/freemarker-2.3.12.jar"/>
+ <classpathentry kind="lib" path="lib/hibernate-3.2.6.ga.jar"/>
+ <classpathentry kind="lib" path="lib/commons-io-1.4.jar"/>
+ <classpathentry kind="lib" path="lib/spring-2.5.6.jar"/>
+ <classpathentry kind="lib" path="lib/velocity-1.6.2.jar"/>
+ <classpathentry kind="lib" path="examples/webapp/WEB-INF/lib/geronimo-annotation_1.0_spec-1.1.1.jar"/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
Modified: incubator/click/trunk/click/build/build.properties
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/build/build.properties?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/build/build.properties (original)
+++ incubator/click/trunk/click/build/build.properties Sat Apr 25 13:50:28 2009
@@ -19,7 +19,7 @@
version=2.1.0
# App Server deployment directory by Ant target 'deploy-webapps'
-dir.appserver=C:/Users/medgar/java/apache-tomcat-5.5.25/webapps
+dir.appserver=C:/Users/medgar/java/apache-tomcat-6.0/webapps
# Proxy hostname used by Ant target 'get-deps-proxy'
proxy.host=192.168.0.3
Modified: incubator/click/trunk/click/build/build.xml
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/build/build.xml?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/build/build.xml (original)
+++ incubator/click/trunk/click/build/build.xml Sat Apr 25 13:50:28 2009
@@ -42,12 +42,9 @@
<property name="jar.log4j" value="log4j-1.2.14.jar"/>
<property name="jar.ognl" value="ognl-2.6.9.jar"/>
<property name="jar.servlet" value="servlet-api-2.3.jar"/>
- <property name="jar.spring-beans" value="spring-beans-2.5.4.jar"/>
- <property name="jar.spring-context" value="spring-context-2.5.4.jar"/>
- <property name="jar.spring-core" value="spring-core-2.5.4.jar"/>
- <property name="jar.spring-web" value="spring-web-2.5.4.jar"/>
+ <property name="jar.spring" value="spring-2.5.6.jar"/>
<property name="jar.upload" value="commons-fileupload-1.2.1.jar"/>
- <property name="jar.velocity" value="velocity-1.5.jar"/>
+ <property name="jar.velocity" value="velocity-1.6.2.jar"/>
<property name="javac.source" value="1.4"/>
<property name="repository" value="http://repo1.maven.org"/>
<property name="maven-bundle" value="../maven-upload"/>
@@ -139,10 +136,7 @@
<pathelement location="lib/${jar.hibernate}"/>
<pathelement location="lib/${jar.log4j}"/>
<pathelement location="lib/${jar.servlet}"/>
- <pathelement location="lib/${jar.spring-beans}"/>
- <pathelement location="lib/${jar.spring-context}"/>
- <pathelement location="lib/${jar.spring-core}"/>
- <pathelement location="lib/${jar.spring-web}"/>
+ <pathelement location="lib/${jar.spring}"/>
<pathelement location="lib/${jar.freemarker}"/>
<pathelement location="dist/${click}.jar"/>
</path>
@@ -559,14 +553,11 @@
<downloadMacro name="${jar.upload}" path="commons-fileupload"/>
<downloadMacro name="${jar.junit}" path="junit"/>
<downloadMacro name="${jar.servlet}" path="javax.servlet"/>
- <downloadMacro name="${jar.spring-beans}" path="org.springframework"/>
- <downloadMacro name="${jar.spring-context}" path="org.springframework"/>
- <downloadMacro name="${jar.spring-core}" path="org.springframework"/>
- <downloadMacro name="${jar.spring-web}" path="org.springframework"/>
- <get src="${repository}/maven/velocity/jars/${jar.velocity}"
- dest="lib/${jar.velocity}"
- verbose="true"
- usetimestamp="true"/>
+ <downloadMacro name="${jar.spring}" path="org.springframework"/>
+ <get src="${repository}/maven2/org/apache/velocity/velocity/1.6.2/${jar.velocity}"
+ dest="lib/${jar.velocity}"
+ verbose="true"
+ usetimestamp="true"/>
<get src="${repository}/maven2/org/apache/cayenne/cayenne-nodeps/2.0.4/${jar.cayenne}"
dest="lib/${jar.cayenne}"
verbose="true"
Modified: incubator/click/trunk/click/examples/build.xml
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/build.xml?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/build.xml (original)
+++ incubator/click/trunk/click/examples/build.xml Sat Apr 25 13:50:28 2009
@@ -26,6 +26,7 @@
<property file="../build/build.properties"/>
<property name="name" value="click-examples"/>
+ <property name="jar.annotation" value="geronimo-annotation_1.0_spec-1.1.1.jar"/>
<property name="jar.ashwood" value="ashwood-1.1.jar"/>
<property name="jar.cayenne" value="cayenne-nodeps-2.0.4.jar"/>
<property name="jar.click" value="click-${version}-incubating.jar"/>
@@ -37,11 +38,9 @@
<property name="jar.poi" value="poi-3.0-FINAL.jar"/>
<property name="jar.oro" value="oro-2.0.8.jar"/>
<property name="jar.servlet" value="servlet-api-2.3.jar"/>
- <property name="jar.spring-beans" value="spring-beans-2.5.4.jar"/>
- <property name="jar.spring-context" value="spring-context-2.5.4.jar"/>
- <property name="jar.spring-core" value="spring-core-2.5.4.jar"/>
- <property name="jar.spring-web" value="spring-web-2.5.4.jar"/>
+ <property name="jar.spring" value="spring-2.5.6.jar"/>
<property name="jar.standard" value="standard-1.1.2.jar"/>
+ <property name="javac.source" value="1.5"/>
<property name="dir.deploy" value="../dist"/>
<property name="dir.webapp" value="webapp"/>
@@ -136,7 +135,7 @@
destdir="${dir.webapp}/WEB-INF/classes"
debug="true"
encoding="ISO-8859-1"
- source="1.4">
+ source="${javac.source}">
<classpath refid="classpath"/>
</javac>
</target>
@@ -157,15 +156,16 @@
<webDownloadMacro name="${jar.log4j}" path="log4j"/>
<webDownloadMacro name="${jar.oro}" path="oro"/>
<webDownloadMacro name="${jar.poi}" path="poi"/>
- <webDownloadMacro name="${jar.spring-beans}" path="org.springframework"/>
- <webDownloadMacro name="${jar.spring-context}" path="org.springframework"/>
- <webDownloadMacro name="${jar.spring-core}" path="org.springframework"/>
- <webDownloadMacro name="${jar.spring-web}" path="org.springframework"/>
+ <webDownloadMacro name="${jar.spring}" path="org.springframework"/>
<webDownloadMacro name="${jar.standard}" path="taglibs"/>
<get src="${repository}/maven2/org/apache/cayenne/cayenne-nodeps/2.0.4/${jar.cayenne}"
dest="${dir.weblib}/${jar.cayenne}"
verbose="true"
usetimestamp="true"/>
+ <get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/geronimo/specs/geronimo-annotation_1.0_spec/1.1.1/${jar.annotation}"
+ dest="${dir.weblib}/${jar.annotation}"
+ verbose="true"
+ usetimestamp="true"/>
</target>
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/BorderPage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/BorderPage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/BorderPage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/BorderPage.java Sat Apr 25 13:50:28 2009
@@ -18,6 +18,7 @@
*/
package org.apache.click.examples.page;
+import org.apache.click.Page;
import org.apache.click.extras.control.Menu;
import org.apache.click.util.ClickUtils;
@@ -32,7 +33,7 @@
*
* @author Malcolm Edgar
*/
-public class BorderPage extends SpringPage {
+public class BorderPage extends Page {
/**
* The root menu. Note this transient variable is reinitialized in onInit()
@@ -89,6 +90,7 @@
// ------------------------------------------------------ Protected Methods
+ @SuppressWarnings("unchecked")
protected Object getSessionObject(Class aClass) {
if (aClass == null) {
throw new IllegalArgumentException("Null class parameter.");
@@ -110,6 +112,7 @@
}
}
+ @SuppressWarnings("unchecked")
protected void removeSessionObject(Class aClass) {
if (getContext().hasSession() && aClass != null) {
getContext().getSession().removeAttribute(aClass.getName());
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/EditCustomer.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/EditCustomer.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/EditCustomer.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/EditCustomer.java Sat Apr 25 13:50:28 2009
@@ -18,6 +18,8 @@
*/
package org.apache.click.examples.page;
+import javax.annotation.Resource;
+
import org.apache.click.Page;
import org.apache.click.control.Checkbox;
import org.apache.click.control.FieldSet;
@@ -27,10 +29,12 @@
import org.apache.click.control.TextField;
import org.apache.click.examples.control.InvestmentSelect;
import org.apache.click.examples.domain.Customer;
+import org.apache.click.examples.service.CustomerService;
import org.apache.click.extras.control.DateField;
import org.apache.click.extras.control.DoubleField;
import org.apache.click.extras.control.EmailField;
import org.apache.click.extras.control.IntegerField;
+import org.springframework.stereotype.Component;
/**
* Provides an edit Customer Form example. The Customer business object
@@ -42,6 +46,7 @@
*
* @author Malcolm Edgar
*/
+@Component
public class EditCustomer extends BorderPage {
// Public controls are automatically added to the page
@@ -53,6 +58,9 @@
private HiddenField idField = new HiddenField("id", Integer.class);
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
public EditCustomer() {
form.add(referrerField);
@@ -93,7 +101,7 @@
*/
public void onGet() {
if (id != null) {
- Customer customer = getCustomerService().getCustomerForID(id);
+ Customer customer = customerService.getCustomerForID(id);
if (customer != null) {
form.copyFrom(customer);
@@ -104,14 +112,14 @@
public boolean onOkClick() {
if (form.isValid()) {
Integer id = (Integer) idField.getValueObject();
- Customer customer = getCustomerService().getCustomerForID(id);
+ Customer customer = customerService.getCustomerForID(id);
if (customer == null) {
customer = new Customer();
}
form.copyTo(customer);
- getCustomerService().saveCustomer(customer);
+ customerService.saveCustomer(customer);
String referrer = referrerField.getValue();
if (referrer != null) {
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/SourceViewer.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/SourceViewer.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/SourceViewer.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/SourceViewer.java Sat Apr 25 13:50:28 2009
@@ -76,7 +76,8 @@
"login-config", "auth-method", "realm-name", "security-role",
"url-pattern", "welcome-file-list", "welcome-file", "Context",
"ResourceLink", "menu", "?xml", "controls", "control",
- "listener-class", "listener" };
+ "listener-class", "listener", "beans", "context-param",
+ "context:component-scan" };
private static final String[] VELOCITY_KEYWORDS = { "#if", "#if(",
"#elseif", "#elseif(", "#else", "#else(", "#end", "#set", "#set(",
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomer.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomer.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomer.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomer.java Sat Apr 25 13:50:28 2009
@@ -18,9 +18,12 @@
*/
package org.apache.click.examples.page.ajax;
+import javax.annotation.Resource;
+
import org.apache.click.Page;
import org.apache.click.examples.domain.Customer;
-import org.apache.click.examples.page.SpringPage;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Retrieves the Customer details using the given customerId parameter and
@@ -37,10 +40,14 @@
*
* @author Malcolm Edgar
*/
-public class AjaxCustomer extends SpringPage {
+@Component
+public class AjaxCustomer extends Page {
public Customer customer;
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
/**
* Process the AJAX request and return XML customer table.
*
@@ -49,7 +56,7 @@
public void onGet() {
String customerId = getContext().getRequest().getParameter("customerId");
- customer = getCustomerService().findCustomerByID(customerId);
+ customer = customerService.findCustomerByID(customerId);
}
/**
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomerLiveGrid.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomerLiveGrid.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomerLiveGrid.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxCustomerLiveGrid.java Sat Apr 25 13:50:28 2009
@@ -20,7 +20,12 @@
import java.util.List;
-import org.apache.click.examples.page.SpringPage;
+import javax.annotation.Resource;
+
+import org.apache.click.Page;
+import org.apache.click.examples.domain.Customer;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Retrieves the current page and "buffered" Customer list using the given offset
@@ -36,7 +41,11 @@
*
* @author Phil Barnes
*/
-public class AjaxCustomerLiveGrid extends SpringPage {
+@Component
+public class AjaxCustomerLiveGrid extends Page {
+
+ @Resource(name="customerService")
+ private CustomerService customerService;
/**
* Process the AJAX request and return XML customer table. This method
@@ -51,9 +60,9 @@
String pageSize = getContext().getRequest().getParameter("page_size");
if (offset != null && pageSize != null) {
- List customers = getCustomerService().getCustomersForPage(
- Integer.parseInt(offset),
- Integer.parseInt(pageSize));
+ List<Customer> customers =
+ customerService.getCustomersForPage(Integer.parseInt(offset),
+ Integer.parseInt(pageSize));
// Add the BUFFERED paginated results to the model for XML response
addModel("customers", customers);
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDataGrid.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDataGrid.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDataGrid.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxDataGrid.java Sat Apr 25 13:50:28 2009
@@ -20,21 +20,31 @@
import java.util.List;
+import javax.annotation.Resource;
+
+import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Provides an Ajax demo of Rico's LiveGrid.
*
* @author Phil Barnes
*/
+@Component
public class AjaxDataGrid extends BorderPage {
public String headInclude = "ajax/ajax-data-grid-include.htm";
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
+ @Override
public void onInit() {
super.onInit();
- List customerList = getCustomerService().getCustomers();
+ List<Customer> customerList = customerService.getCustomers();
addModel("customers", customerList);
addModel("totalRows", new Integer(customerList.size()));
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxSelect.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxSelect.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxSelect.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxSelect.java Sat Apr 25 13:50:28 2009
@@ -21,30 +21,38 @@
import java.util.Iterator;
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.Option;
import org.apache.click.control.Select;
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Provides an Ajax select example Page.
*
* @author Malcolm Edgar
*/
+@Component
public class AjaxSelect extends BorderPage {
public String jsInclude = "ajax/ajax-select-include.htm";
public Select customerSelect = new Select("customerSelect");
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
+ @Override
public void onInit() {
super.onInit();
customerSelect.setAttribute("onchange", "onCustomerChange(this);");
- List customerList = getCustomerService().getCustomersSortedByName(8);
- for (Iterator i = customerList.iterator(); i.hasNext();) {
- Customer customer = (Customer) i.next();
+ List<Customer> customerList = customerService.getCustomersSortedByName(8);
+ for (Customer customer : customerList) {
customerSelect.add(new Option(customer.getId(), customer.getName()));
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AutoCompletePage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AutoCompletePage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AutoCompletePage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AutoCompletePage.java Sat Apr 25 13:50:28 2009
@@ -20,30 +20,40 @@
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.FieldSet;
import org.apache.click.control.Form;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.PostCodeService;
import org.apache.click.extras.control.AutoCompleteTextField;
+import org.springframework.stereotype.Component;
/**
* Provides AJAX AutoCompleteTextField example page.
*
* @author Malcolm Edgar
*/
+@Component
public class AutoCompletePage extends BorderPage {
public Form form = new Form();
+ @Resource(name="postCodeService")
+ private PostCodeService postCodeService;
+
// ------------------------------------------------------------ Constructor
+ @SuppressWarnings({"serial", "unchecked"})
public AutoCompletePage() {
FieldSet fieldSet = new FieldSet("Enter a Suburb Location");
fieldSet.setStyle("background-color", "");
form.add(fieldSet);
AutoCompleteTextField locationField = new AutoCompleteTextField("location") {
+
public List getAutoCompleteList(String criteria) {
- return getPostCodeService().getPostCodeLocations(criteria);
+ return postCodeService.getPostCodeLocations(criteria);
}
};
locationField.setSize(40);
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/CayenneFormPage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/CayenneFormPage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/CayenneFormPage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/CayenneFormPage.java Sat Apr 25 13:50:28 2009
@@ -20,16 +20,19 @@
import java.util.List;
+import javax.annotation.Resource;
+
+import org.apache.cayenne.DataObject;
import org.apache.click.control.Column;
import org.apache.click.control.FieldSet;
import org.apache.click.control.TextField;
import org.apache.click.examples.domain.Client;
+import org.apache.click.examples.service.ClientService;
import org.apache.click.extras.cayenne.QuerySelect;
import org.apache.click.extras.control.DateField;
import org.apache.click.extras.control.EmailField;
import org.apache.click.extras.control.IntegerField;
-
-import org.apache.cayenne.DataObject;
+import org.springframework.stereotype.Component;
/**
* Provides a CayenneForm and QuerySelect control demonstration.
@@ -38,8 +41,12 @@
*
* @author Malcolm Edgar
*/
+@Component
public class CayenneFormPage extends FormTablePage {
+ @Resource(name="clientService")
+ private ClientService clientService;
+
// ------------------------------------------------------------ Constructor
/**
@@ -95,12 +102,13 @@
* @see FormTablePage#getDataObject(Object)
*/
public DataObject getDataObject(Object id) {
- return getClientService().getClient(id);
+ return clientService.getClient(id);
}
/**
* @see FormTablePage#getDataObjectClass()
*/
+ @SuppressWarnings("unchecked")
public Class getDataObjectClass() {
return Client.class;
}
@@ -108,8 +116,9 @@
/**
* @see FormTablePage#getRowList()
*/
+ @SuppressWarnings("unchecked")
public List getRowList() {
- return getClientService().getClients();
+ return clientService.getClients();
}
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/FormTablePage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/FormTablePage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/FormTablePage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/FormTablePage.java Sat Apr 25 13:50:28 2009
@@ -20,6 +20,8 @@
import java.util.List;
+import org.apache.cayenne.DataObject;
+import org.apache.cayenne.access.DataContext;
import org.apache.click.control.ActionLink;
import org.apache.click.control.Column;
import org.apache.click.control.Form;
@@ -29,8 +31,6 @@
import org.apache.click.extras.cayenne.CayenneForm;
import org.apache.click.extras.control.LinkDecorator;
-import org.apache.cayenne.DataObject;
-
/**
* Provides an abstract CayenneForm and Table Page for creating and editing
* DataObjects.
@@ -158,6 +158,7 @@
/**
* @see org.apache.click.Page#onRender()
*/
+ @Override
public void onRender() {
List list = getRowList();
table.setRowList(list);
@@ -183,6 +184,7 @@
*
* @return the DataObject class to edit and display
*/
+ @SuppressWarnings("unchecked")
public abstract Class getDataObjectClass();
/**
@@ -190,6 +192,7 @@
*
* @return the
*/
+ @SuppressWarnings("unchecked")
public abstract List getRowList();
// --------------------------------------------------------- Public Methods
@@ -211,7 +214,7 @@
*/
public void saveDataObject(DataObject dataObject) {
if (dataObject != null) {
- getDataContext().commitChanges();
+ DataContext.getThreadDataContext().commitChanges();
}
}
@@ -222,8 +225,8 @@
*/
public void deleteDataObject(DataObject dataObject) {
if (dataObject != null) {
- getDataContext().deleteObject(dataObject);
- getDataContext().commitChanges();
+ DataContext.getThreadDataContext().deleteObject(dataObject);
+ DataContext.getThreadDataContext().commitChanges();
}
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/TabbedCayenneFormPage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/TabbedCayenneFormPage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/TabbedCayenneFormPage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/cayenne/TabbedCayenneFormPage.java Sat Apr 25 13:50:28 2009
@@ -20,18 +20,21 @@
import java.util.List;
+import javax.annotation.Resource;
+
+import org.apache.cayenne.DataObject;
import org.apache.click.control.Column;
import org.apache.click.control.FieldSet;
import org.apache.click.control.TextField;
import org.apache.click.examples.domain.Client;
+import org.apache.click.examples.service.ClientService;
import org.apache.click.extras.cayenne.CayenneForm;
import org.apache.click.extras.cayenne.QuerySelect;
import org.apache.click.extras.cayenne.TabbedCayenneForm;
import org.apache.click.extras.control.DateField;
import org.apache.click.extras.control.EmailField;
import org.apache.click.extras.control.IntegerField;
-
-import org.apache.cayenne.DataObject;
+import org.springframework.stereotype.Component;
/**
* Provides a TabbedCayenneForm and QuerySelect control demonstration.
@@ -40,8 +43,12 @@
*
* @author Malcolm Edgar
*/
+@Component
public class TabbedCayenneFormPage extends FormTablePage {
+ @Resource(name="clientService")
+ private ClientService clientService;
+
/**
* Create a TabbedCayenneFormPage object.
*/
@@ -104,12 +111,13 @@
* @see FormTablePage#getDataObject(Object)
*/
public DataObject getDataObject(Object id) {
- return getClientService().getClient(id);
+ return clientService.getClient(id);
}
/**
* @see FormTablePage#getDataObjectClass()
*/
+ @SuppressWarnings("unchecked")
public Class getDataObjectClass() {
return Client.class;
}
@@ -117,8 +125,9 @@
/**
* @see FormTablePage#getRowList()
*/
+ @SuppressWarnings("unchecked")
public List getRowList() {
- return getClientService().getClients();
+ return clientService.getClients();
}
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/ExtraControlsForm.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/ExtraControlsForm.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/ExtraControlsForm.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/ExtraControlsForm.java Sat Apr 25 13:50:28 2009
@@ -22,6 +22,8 @@
import java.util.Iterator;
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.Checkbox;
import org.apache.click.control.Field;
import org.apache.click.control.FieldSet;
@@ -29,14 +31,30 @@
import org.apache.click.control.Submit;
import org.apache.click.examples.page.BorderPage;
import org.apache.click.examples.page.HomePage;
-import org.apache.click.extras.control.*;
+import org.apache.click.examples.service.CustomerService;
+import org.apache.click.extras.control.CheckList;
+import org.apache.click.extras.control.ColorPicker;
+import org.apache.click.extras.control.CountrySelect;
+import org.apache.click.extras.control.CreditCardField;
+import org.apache.click.extras.control.DateField;
+import org.apache.click.extras.control.DoubleField;
+import org.apache.click.extras.control.EmailField;
+import org.apache.click.extras.control.IntegerField;
+import org.apache.click.extras.control.LongField;
+import org.apache.click.extras.control.NumberField;
+import org.apache.click.extras.control.PageSubmit;
+import org.apache.click.extras.control.RegexField;
+import org.apache.click.extras.control.TelephoneField;
+import org.apache.click.extras.control.VirtualKeyboard;
import org.apache.click.util.ClickUtils;
+import org.springframework.stereotype.Component;
/**
* Provides a form containing all the Click Extras Controls.
*
* @author Malcolm Edgar
*/
+@Component
public class ExtraControlsForm extends BorderPage {
/** Form options holder. */
@@ -53,6 +71,9 @@
private Checkbox allFieldsRequired = new Checkbox("allFieldsRequired");
private Checkbox jsValidate = new Checkbox("jsValidate", "JavaScript Validate");
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public ExtraControlsForm() {
@@ -92,10 +113,11 @@
/**
* @see org.apache.click.Page#onInit()
*/
+ @Override
public void onInit() {
super.onInit();
- List customers = getCustomerService().getCustomers();
+ List customers = customerService.getCustomers();
checkList.addAll(customers, "id", "name");
applyOptions();
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/SearchForm.java Sat Apr 25 13:50:28 2009
@@ -20,12 +20,16 @@
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.Form;
import org.apache.click.control.Select;
import org.apache.click.control.Submit;
import org.apache.click.control.TextField;
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Provides a search form example demonstrating how to layout a form manually
@@ -33,6 +37,7 @@
*
* @author Malcolm Edgar
*/
+@Component
public class SearchForm extends BorderPage {
public Form form = new Form();
@@ -40,6 +45,9 @@
private TextField textField;
private Select typeSelect;
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
public SearchForm() {
textField = new TextField("search");
form.add(textField);
@@ -56,22 +64,23 @@
/**
* @see org.apache.click.Page#onPost()
*/
+ @Override
public void onPost() {
Customer customer = null;
String value = textField.getValue().trim();
String type = typeSelect.getValue().toLowerCase();
if (type.equals("id")) {
- customer = getCustomerService().findCustomerByID(value);
+ customer = customerService.findCustomerByID(value);
}
else if (type.equals("name")) {
- List list = getCustomerService().getCustomersForName(value);
+ List<Customer> list = customerService.getCustomersForName(value);
if (!list.isEmpty()) {
customer = (Customer) list.get(0);
}
}
else if (type.equals("age")) {
- List list = getCustomerService().getCustomersForAge(value);
+ List<Customer> list = customerService.getCustomersForAge(value);
if (!list.isEmpty()) {
customer = (Customer) list.get(0);
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/StandardControlsForm.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/StandardControlsForm.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/StandardControlsForm.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/form/StandardControlsForm.java Sat Apr 25 13:50:28 2009
@@ -22,6 +22,8 @@
import java.util.Iterator;
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.Button;
import org.apache.click.control.Checkbox;
import org.apache.click.control.Field;
@@ -40,14 +42,18 @@
import org.apache.click.control.Submit;
import org.apache.click.control.TextArea;
import org.apache.click.control.TextField;
+import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
import org.apache.click.util.ClickUtils;
+import org.springframework.stereotype.Component;
/**
* Provides a form containing all the Standard Click Controls.
*
* @author Malcolm Edgar
*/
+@Component
public class StandardControlsForm extends BorderPage {
/** Form options holder. */
@@ -64,6 +70,9 @@
private Checkbox allFieldsRequired = new Checkbox("allFieldsRequired");
private Checkbox jsValidate = new Checkbox("jsValidate", "JavaScript Validate");
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public StandardControlsForm() {
@@ -113,10 +122,11 @@
/**
* @see org.apache.click.Page#onInit()
*/
+ @Override
public void onInit() {
super.onInit();
- List customers = getCustomerService().getCustomers();
+ List<Customer> customers = customerService.getCustomers();
select.add(new Option("[Select]"));
select.addAll(customers, "id", "name");
applyOptions();
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java Sat Apr 25 13:50:28 2009
@@ -22,6 +22,7 @@
import java.io.OutputStream;
import java.util.List;
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.apache.click.ActionListener;
@@ -29,6 +30,7 @@
import org.apache.click.control.ActionLink;
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
import org.apache.click.util.ClickUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
@@ -38,16 +40,22 @@
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.springframework.stereotype.Component;
/**
* Provides a Excel Export page example using the Apache POI library.
*
* @author Malcolm Edgar
*/
+@Component
public class ExcelExportPage extends BorderPage {
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// -------------------------------------------------------- Event Handlers
+ @Override
public void onInit() {
super.onInit();
@@ -159,7 +167,7 @@
int rowIndex = 4;
- List customers = getCustomerService().getCustomers();
+ List<Customer> customers = customerService.getCustomers();
for (int i = 0; i < customers.size(); i++) {
Customer customer = (Customer) customers.get(i);
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedForm.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedForm.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedForm.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedForm.java Sat Apr 25 13:50:28 2009
@@ -18,6 +18,8 @@
*/
package org.apache.click.examples.page.introduction;
+import javax.annotation.Resource;
+
import org.apache.click.Page;
import org.apache.click.control.Checkbox;
import org.apache.click.control.FieldSet;
@@ -32,12 +34,14 @@
import org.apache.click.examples.service.CustomerService;
import org.apache.click.extras.control.DateField;
import org.apache.click.extras.control.EmailField;
+import org.springframework.stereotype.Component;
/**
* Provides an advanced form example.
*
* @author Malcolm Edgar
*/
+@Component
public class AdvancedForm extends BorderPage {
public Form form = new Form();
@@ -45,6 +49,9 @@
private Select investmentSelect = new Select("investment");
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public AdvancedForm() {
@@ -72,10 +79,10 @@
/**
* @see Page#onInit()
*/
+ @Override
public void onInit() {
super.onInit();
- CustomerService customerService = getCustomerService();
investmentSelect.add(Option.EMPTY_OPTION);
investmentSelect.addAll(customerService.getInvestmentCatetories());
}
@@ -90,7 +97,7 @@
Customer customer = new Customer();
form.copyTo(customer);
- getCustomerService().saveCustomer(customer);
+ customerService.saveCustomer(customer);
form.clearValues();
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedTable.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedTable.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedTable.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/AdvancedTable.java Sat Apr 25 13:50:28 2009
@@ -20,6 +20,8 @@
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.Page;
import org.apache.click.control.AbstractLink;
import org.apache.click.control.ActionLink;
@@ -28,19 +30,25 @@
import org.apache.click.control.Table;
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.extras.control.LinkDecorator;
+import org.springframework.stereotype.Component;
/**
* Provides an advanced Table usage example Page.
*
* @author Malcolm Edgar
*/
+@Component
public class AdvancedTable extends BorderPage {
public Table table = new Table();
public PageLink editLink = new PageLink("Edit", EditCustomer.class);
public ActionLink deleteLink = new ActionLink("Delete", this, "onDeleteClick");
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public AdvancedTable() {
@@ -80,7 +88,7 @@
public boolean onDeleteClick() {
Integer id = deleteLink.getValueInteger();
- getCustomerService().deleteCustomer(id);
+ customerService.deleteCustomer(id);
return true;
}
@@ -88,7 +96,7 @@
* @see Page#onRender()
*/
public void onRender() {
- List list = getCustomerService().getCustomers();
+ List list = customerService.getCustomers();
table.setRowList(list);
}
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/introduction/SimpleTablePage.java Sat Apr 25 13:50:28 2009
@@ -20,20 +20,29 @@
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.Page;
import org.apache.click.control.Column;
import org.apache.click.control.Table;
+import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Provides an simple Table usage example Page.
*
* @author Malcolm Edgar
*/
+@Component
public class SimpleTablePage extends BorderPage {
public Table table = new Table();
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public SimpleTablePage() {
@@ -50,8 +59,9 @@
/**
* @see Page#onRender()
*/
+ @Override
public void onRender() {
- List list = getCustomerService().getCustomersSortedByName(10);
+ List<Customer> list = customerService.getCustomersSortedByName(10);
table.setRowList(list);
}
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/jsp/CustomerTable.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/jsp/CustomerTable.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/jsp/CustomerTable.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/jsp/CustomerTable.java Sat Apr 25 13:50:28 2009
@@ -20,7 +20,11 @@
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Provides JSP Page example where a JSP page and JSP border template is used to
@@ -28,15 +32,20 @@
*
* @author Malcolm Edgar
*/
+@Component
public class CustomerTable extends BorderPage {
public List customers = null;
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
/**
* @see org.apache.click.Page#onRender()
*/
+ @Override
public void onRender() {
- customers = getCustomerService().getCustomersSortedByName(10);
+ customers = customerService.getCustomersSortedByName(10);
}
/**
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/LastPage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/LastPage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/LastPage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/LastPage.java Sat Apr 25 13:50:28 2009
@@ -18,17 +18,30 @@
*/
package org.apache.click.examples.page.pageflow;
+import javax.annotation.Resource;
+
import org.apache.click.examples.domain.CourseBooking;
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.BookingService;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Provides the last page of a multi page work flow.
*
* @author Malcolm Edgar
*/
+@Component
public class LastPage extends BorderPage {
+ @Resource(name="bookingService")
+ private BookingService bookingService;
+
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
+ @Override
public void onInit() {
super.onInit();
@@ -37,13 +50,13 @@
if (bookingId != null) {
Integer id = new Integer(bookingId);
CourseBooking courseBooking =
- getBookingService().findCourseBookingByID(id);
+ bookingService.findCourseBookingByID(id);
if (courseBooking != null) {
addModel("courseBooking", courseBooking);
Customer customer =
- getCustomerService().findCustomerByID(courseBooking.getCustomerId());
+ customerService.findCustomerByID(courseBooking.getCustomerId());
addModel("customer", customer);
}
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/NextPage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/NextPage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/NextPage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/NextPage.java Sat Apr 25 13:50:28 2009
@@ -18,24 +18,36 @@
*/
package org.apache.click.examples.page.pageflow;
+import javax.annotation.Resource;
+
import org.apache.click.control.Form;
import org.apache.click.control.HiddenField;
import org.apache.click.control.Submit;
import org.apache.click.examples.domain.CourseBooking;
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.BookingService;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Provides the next page of a multi page work flow.
*
* @author Malcolm Edgar
*/
+@Component
public class NextPage extends BorderPage {
private Form form = new Form("form");
private HiddenField courseField;
private CourseBooking courseBooking;
+ @Resource(name="bookingService")
+ private BookingService bookingService;
+
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public NextPage() {
@@ -53,6 +65,7 @@
/**
* @see org.apache.click.Page#onInit()
*/
+ @Override
public void onInit() {
super.onInit();
@@ -60,7 +73,7 @@
courseField.setValueObject(courseBooking);
Customer customer =
- getCustomerService().findCustomerByID(courseBooking.getCustomerId());
+ customerService.findCustomerByID(courseBooking.getCustomerId());
addModel("customer", customer);
addModel("courseBooking", courseBooking);
@@ -81,7 +94,7 @@
public boolean onConfirmClick() {
CourseBooking booking = (CourseBooking) courseField.getValueObject();
Integer bookingId =
- getBookingService().insertCourseBooking(booking);
+ bookingService.insertCourseBooking(booking);
String path = getContext().getPagePath(LastPage.class);
setRedirect(path + "?bookingId=" + bookingId);
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java Sat Apr 25 13:50:28 2009
@@ -18,9 +18,10 @@
*/
package org.apache.click.examples.page.pageflow;
-import java.util.Iterator;
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.Form;
import org.apache.click.control.Option;
import org.apache.click.control.Select;
@@ -31,13 +32,16 @@
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
import org.apache.click.examples.page.HomePage;
+import org.apache.click.examples.service.CustomerService;
import org.apache.click.extras.control.DateField;
+import org.springframework.stereotype.Component;
/**
* Provides the start page of a multi page work flow.
*
* @author Malcolm Edgar
*/
+@Component
public class StartPage extends BorderPage {
public String jsInclude = "ajax/ajax-select-include.htm";
@@ -51,6 +55,9 @@
private CourseBooking courseBooking;
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public StartPage() {
@@ -89,13 +96,13 @@
/**
* @see org.apache.click.Page#onInit()
*/
+ @Override
public void onInit() {
super.onInit();
- List customerList = getCustomerService().getCustomers();
- customerSelect.add(new Option(""));
- for (Iterator i = customerList.iterator(); i.hasNext();) {
- Customer customer = (Customer) i.next();
+ List<Customer> customerList = customerService.getCustomers();
+ customerSelect.add(Option.EMPTY_OPTION);
+ for (Customer customer : customerList) {
customerSelect.add(new Option(customer.getId(), customer.getName()));
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/FilterPanelDemo.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/FilterPanelDemo.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/FilterPanelDemo.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/FilterPanelDemo.java Sat Apr 25 13:50:28 2009
@@ -21,21 +21,30 @@
import java.util.Date;
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.Column;
import org.apache.click.control.Table;
import org.apache.click.examples.control.FilterPanel;
+import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
+import org.springframework.stereotype.Component;
/**
* Provides example usage of a custom date range FilterPanel control.
*
* @author Malcolm Edgar
*/
+@Component
public class FilterPanelDemo extends BorderPage {
public FilterPanel filterPanel = new FilterPanel();
public Table table = new Table();
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
public FilterPanelDemo() {
// Setup customers table
table.setClass("isi");
@@ -64,11 +73,12 @@
/**
* @see org.apache.click.Page#onRender()
*/
+ @Override
public void onRender() {
Date from = filterPanel.getStartDate();
Date to = filterPanel.getEndDate();
- List customers = getCustomerService().getCustomers(from, to);
+ List<Customer> customers = customerService.getCustomers(from, to);
table.setRowList(customers);
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ListPanelDemo.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ListPanelDemo.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ListPanelDemo.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/ListPanelDemo.java Sat Apr 25 13:50:28 2009
@@ -20,9 +20,13 @@
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.Panel;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
import org.apache.click.extras.panel.ListPanel;
+import org.springframework.stereotype.Component;
/**
* Provides an ListPanel demonstration.
@@ -32,11 +36,15 @@
*
* @author Phil Barnes
*/
+@Component
public class ListPanelDemo extends BorderPage {
public ListPanel listPanel = new ListPanel();
public List customers;
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
public ListPanelDemo() {
listPanel.add(new Panel("panel1", "/panel/customersPanel1.htm"));
listPanel.add(new Panel("panel2", "/panel/customersPanel2.htm"));
@@ -46,8 +54,9 @@
/**
* @see org.apache.click.Page#onRender()
*/
+ @Override
public void onRender() {
- customers = getCustomerService().getCustomersSortedByName(12);
+ customers = customerService.getCustomersSortedByName(12);
}
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/PanelColumnDemo.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/PanelColumnDemo.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/PanelColumnDemo.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/PanelColumnDemo.java Sat Apr 25 13:50:28 2009
@@ -20,20 +20,25 @@
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.Form;
import org.apache.click.control.Panel;
import org.apache.click.control.Submit;
import org.apache.click.control.Table;
import org.apache.click.control.TextField;
+import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
-
+import org.apache.click.examples.service.CustomerService;
import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
/**
* Demonstrates usage of the Panel Column Control.
*
* @author rlecheta
*/
+@Component
public class PanelColumnDemo extends BorderPage {
public Panel panel = new Panel("panel", "/panel/customerDetailsPanel.htm");
@@ -43,6 +48,9 @@
private TextField textName = new TextField("name", true);
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public PanelColumnDemo() {
@@ -76,6 +84,7 @@
/**
* @see org.apache.click.Page#onGet()
*/
+ @Override
public void onGet() {
if (StringUtils.isNotEmpty(nameSearch)) {
@@ -96,7 +105,7 @@
*/
private void processSearch(String value) {
// Search for user entered value
- List list = getCustomerService().getCustomersForName(value);
+ List<Customer> list = customerService.getCustomersForName(value);
table.setRowList(list);
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/TabbedPanelDemo.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/TabbedPanelDemo.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/TabbedPanelDemo.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/panel/TabbedPanelDemo.java Sat Apr 25 13:50:28 2009
@@ -20,20 +20,28 @@
import java.util.List;
+import javax.annotation.Resource;
+
import org.apache.click.control.Panel;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
import org.apache.click.extras.panel.TabbedPanel;
+import org.springframework.stereotype.Component;
/**
* Provides an TabbedPanel demonstration.
*
* @author Phil Barnes
*/
+@Component
public class TabbedPanelDemo extends BorderPage {
public TabbedPanel tabbedPanel = new TabbedPanel();
public List customers;
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
public TabbedPanelDemo() {
Panel panel1 = new Panel("panel1", "panel/customersPanel1.htm");
panel1.setLabel("The First Panel");
@@ -59,8 +67,9 @@
/**
* @see org.apache.click.Page#onRender()
*/
+ @Override
public void onRender() {
- customers = getCustomerService().getCustomersSortedByName(12);
+ customers = customerService.getCustomersSortedByName(12);
}
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/security/Login.java Sat Apr 25 13:50:28 2009
@@ -18,6 +18,8 @@
*/
package org.apache.click.examples.page.security;
+import javax.annotation.Resource;
+
import org.apache.click.control.Form;
import org.apache.click.control.HiddenField;
import org.apache.click.control.PasswordField;
@@ -26,15 +28,17 @@
import org.apache.click.examples.domain.User;
import org.apache.click.examples.page.BorderPage;
import org.apache.click.examples.page.HomePage;
+import org.apache.click.examples.service.UserService;
import org.apache.click.extras.control.PageSubmit;
-
import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
/**
* Provides a user authentication login Page.
*
* @author Malcolm Edgar
*/
+@Component
public class Login extends BorderPage {
public Form form = new Form();
@@ -43,6 +47,9 @@
private TextField usernameField = new TextField("username", true);
private PasswordField passwordField = new PasswordField("password", true);
+ @Resource(name="userService")
+ private UserService userService;
+
// ------------------------------------------------------------ Constructor
public Login() {
@@ -63,6 +70,7 @@
// --------------------------------------------------------- Event Handlers
+ @Override
public void onInit() {
super.onInit();
@@ -86,9 +94,9 @@
User user = new User();
form.copyTo(user);
- if (getUserService().isAuthenticatedUser(user)) {
+ if (userService.isAuthenticatedUser(user)) {
- user = getUserService().getUser(user.getUsername());
+ user = userService.getUser(user.getUsername());
getContext().setSessionAttribute("user", user);
getContext().setCookie("username",
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditFormTablePage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditFormTablePage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditFormTablePage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditFormTablePage.java Sat Apr 25 13:50:28 2009
@@ -21,6 +21,9 @@
import java.util.Date;
import java.util.List;
+import javax.annotation.Resource;
+
+import org.apache.cayenne.access.DataContext;
import org.apache.click.control.ActionLink;
import org.apache.click.control.Checkbox;
import org.apache.click.control.Column;
@@ -32,6 +35,7 @@
import org.apache.click.examples.control.InvestmentSelect;
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
import org.apache.click.extras.control.DateField;
import org.apache.click.extras.control.DoubleField;
import org.apache.click.extras.control.EmailField;
@@ -39,6 +43,7 @@
import org.apache.click.extras.control.FormTable;
import org.apache.click.extras.control.LinkDecorator;
import org.apache.click.extras.control.NumberField;
+import org.springframework.stereotype.Component;
/**
* Provides a CRUD demonstration using Form and FormTable.
@@ -57,6 +62,7 @@
* @author Malcolm Edgar
* @author Bob Schellink
*/
+@Component
public class EditFormTablePage extends BorderPage {
private static final int NUM_ROWS = 20;
@@ -87,6 +93,9 @@
}
};
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public EditFormTablePage() {
@@ -192,7 +201,7 @@
if (form.isValid()) {
// Please note with Cayenne ORM this will persist any changes
// to data objects submitted by the form.
- getDataContext().commitChanges();
+ DataContext.getThreadDataContext().commitChanges();
}
return true;
}
@@ -200,7 +209,7 @@
public boolean onCancelClick() {
// Rollback any changes made to the customers, which are stored in
// the data context
- getDataContext().rollbackChanges();
+ DataContext.getThreadDataContext().rollbackChanges();
refreshTableCustomers();
@@ -213,7 +222,7 @@
public boolean onDeleteClick() {
Integer id = deleteCustomer.getValueInteger();
- getCustomerService().deleteCustomer(id);
+ customerService.deleteCustomer(id);
// The FormTable customer were already set in the onInit phase. Because
// a customer was deleted we refresh the FormTable row list
@@ -226,7 +235,7 @@
Customer customer = new Customer();
customer.setName("Alpha");
customer.setDateJoined(new Date());
- getCustomerService().saveCustomer(customer);
+ customerService.saveCustomer(customer);
// The FormTable customer were already set in the onInit phase. Because
// a customer was deleted we refresh the FormTable row list
@@ -239,7 +248,7 @@
if (customerForm.isValid()) {
Customer customer = new Customer();
customerForm.copyTo(customer);
- getCustomerService().saveCustomer(customer);
+ customerService.saveCustomer(customer);
// The FormTable customer was set in the onInit phase. Since we just
// added a new customer we refresh the FormTable row list
@@ -249,8 +258,8 @@
}
private void refreshTableCustomers() {
- List allCustomers = getCustomerService().getCustomersSortedBy(Customer.DATE_JOINED_PROPERTY, false);
- List customers = allCustomers.subList(0, NUM_ROWS);
+ List<Customer> allCustomers = customerService.getCustomersSortedBy(Customer.DATE_JOINED_PROPERTY, false);
+ List<Customer> customers = allCustomers.subList(0, NUM_ROWS);
table.setRowList(customers);
}
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditTable.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditTable.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditTable.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/EditTable.java Sat Apr 25 13:50:28 2009
@@ -20,6 +20,9 @@
import java.util.List;
+import javax.annotation.Resource;
+
+import org.apache.cayenne.access.DataContext;
import org.apache.click.control.ActionLink;
import org.apache.click.control.Column;
import org.apache.click.control.FieldSet;
@@ -29,11 +32,13 @@
import org.apache.click.control.TextField;
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
import org.apache.click.extras.cayenne.CayenneForm;
import org.apache.click.extras.control.DateField;
import org.apache.click.extras.control.DoubleField;
import org.apache.click.extras.control.EmailField;
import org.apache.click.extras.control.LinkDecorator;
+import org.springframework.stereotype.Component;
/**
* Provides an demonstration of Table and Form editor pattern, and the use
@@ -41,6 +46,7 @@
*
* @author Malcolm Edgar
*/
+@Component
public class EditTable extends BorderPage {
public CayenneForm form = new CayenneForm("form", Customer.class);
@@ -48,6 +54,9 @@
public ActionLink editLink = new ActionLink("edit", "Edit", this, "onEditClick");
public ActionLink deleteLink = new ActionLink("delete", "Delete", this, "onDeleteClick");
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public EditTable() {
@@ -101,7 +110,7 @@
public boolean onEditClick() {
Integer id = editLink.getValueInteger();
- Customer customer = getCustomerService().getCustomerForID(id);
+ Customer customer = customerService.getCustomerForID(id);
if (customer != null) {
form.setDataObject(customer);
}
@@ -110,7 +119,7 @@
public boolean onDeleteClick() {
Integer id = deleteLink.getValueInteger();
- getCustomerService().deleteCustomer(id);
+ customerService.deleteCustomer(id);
return true;
}
@@ -119,14 +128,14 @@
// Please note with Cayenne ORM this will persist any changes
// to data objects submitted by the form.
form.getDataObject();
- getDataContext().commitChanges();
+ DataContext.getThreadDataContext().commitChanges();
form.setDataObject(null);
}
return true;
}
public boolean onCancelClick() {
- getDataContext().rollbackChanges();
+ DataContext.getThreadDataContext().rollbackChanges();
form.setDataObject(null);
form.clearErrors();
return true;
@@ -152,8 +161,9 @@
/**
* @see org.apache.click.Page#onRender()
*/
+ @Override
public void onRender() {
- List customers = getCustomerService().getCustomers();
+ List<Customer> customers = customerService.getCustomers();
table.setRowList(customers);
}
Modified: incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/FormTablePage.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/FormTablePage.java?rev=768530&r1=768529&r2=768530&view=diff
==============================================================================
--- incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/FormTablePage.java (original)
+++ incubator/click/trunk/click/examples/src/org/apache/click/examples/page/table/FormTablePage.java Sat Apr 25 13:50:28 2009
@@ -20,6 +20,9 @@
import java.util.List;
+import javax.annotation.Resource;
+
+import org.apache.cayenne.access.DataContext;
import org.apache.click.control.Checkbox;
import org.apache.click.control.Column;
import org.apache.click.control.Form;
@@ -28,23 +31,29 @@
import org.apache.click.control.TextField;
import org.apache.click.examples.control.InvestmentSelect;
import org.apache.click.examples.page.BorderPage;
+import org.apache.click.examples.service.CustomerService;
import org.apache.click.extras.control.DateField;
import org.apache.click.extras.control.EmailField;
import org.apache.click.extras.control.FieldColumn;
import org.apache.click.extras.control.FormTable;
import org.apache.click.extras.control.NumberField;
+import org.springframework.stereotype.Component;
/**
* Provides an demonstration of Table control paging.
*
* @author Malcolm Edgar
*/
+@Component
public class FormTablePage extends BorderPage {
private static final int NUM_ROWS = 20;
public FormTable table = new FormTable();
+ @Resource(name="customerService")
+ private CustomerService customerService;
+
// ------------------------------------------------------------ Constructor
public FormTablePage() {
@@ -93,13 +102,14 @@
/**
* @see org.apache.click.Page#onInit()
*/
+ @Override
public void onInit() {
super.onInit();
// Please note the FormTable rowList MUST be populated before the
// control is processed, i.e. do not populate the FormTable in the
// Pages onRender() method.
- List customers = getCustomerService().getCustomersSortedByName(NUM_ROWS);
+ List customers = customerService.getCustomersSortedByName(NUM_ROWS);
table.setRowList(customers);
}
@@ -107,7 +117,7 @@
if (table.getForm().isValid()) {
// Please note with Cayenne ORM this will persist any changes
// to data objects submitted by the form.
- getDataContext().commitChanges();
+ DataContext.getThreadDataContext().commitChanges();
// With other ORM frameworks like Hibernate you would retrieve
// rows for the table as persist those objects. For example:
@@ -125,9 +135,9 @@
public boolean onCancelClick() {
// Rollback any changes made to the customers, which are stored in
// the data context
- getDataContext().rollbackChanges();
+ DataContext.getThreadDataContext().rollbackChanges();
- List customers = getCustomerService().getCustomersSortedByName(NUM_ROWS);
+ List customers = customerService.getCustomersSortedByName(NUM_ROWS);
table.setRowList(customers);
table.setRenderSubmittedValues(false);