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/07/24 17:47:07 UTC
svn commit: r978886 - in /click/trunk/click:
examples/src/org/apache/click/examples/page/ajax/
examples/src/org/apache/click/examples/page/ajax/compare/
examples/src/org/apache/click/examples/page/ajax/content/
examples/src/org/apache/click/examples/pa...
Author: sabob
Date: Sat Jul 24 15:47:06 2010
New Revision: 978886
URL: http://svn.apache.org/viewvc?rev=978886&view=rev
Log:
renamed Partial to ActionResult
Added:
click/trunk/click/framework/src/org/apache/click/ActionResult.java
- copied, changed from r964058, click/trunk/click/framework/src/org/apache/click/Partial.java
Modified:
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxBehaviorPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxFallbackPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/PageActionPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/JsonResponsePage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/XmlResponsePage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/select/AjaxSelect.java
click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java
click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionImage.java
click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionLink.java
click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java
click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java
click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
click/trunk/click/framework/src/org/apache/click/Behavior.java
click/trunk/click/framework/src/org/apache/click/ClickServlet.java
click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxBehaviorPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxBehaviorPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxBehaviorPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxBehaviorPage.java Sat Jul 24 15:47:06 2010
@@ -19,7 +19,7 @@
package org.apache.click.examples.page.ajax;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
@@ -27,8 +27,8 @@ import org.apache.click.examples.page.Bo
/**
* Demonstrates how to handle AJAX requests with an Ajax Behavior. The Behavior
* is added to the ActionLink and its onAction method is invoked to handle the
- * AJAX request. The onAction method returns a Partial response that is streamed
- * back to the browser.
+ * AJAX request. The onAction method returns an ActionResult that is rendered
+ * to the browser.
*
* The client-side is implemented using the jQuery library.
*/
@@ -49,13 +49,13 @@ public class AjaxBehaviorPage extends Bo
link.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Formatted date instance that will be added to the
String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
String msg = "AjaxBehavior <tt>onAction()</tt> method invoked at: " + now;
- // Return a partial containing the message
- return new Partial(msg, Partial.HTML);
+ // Return an action result containing the message
+ return new ActionResult(msg, ActionResult.HTML);
}
});
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxFallbackPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxFallbackPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxFallbackPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/AjaxFallbackPage.java Sat Jul 24 15:47:06 2010
@@ -20,7 +20,7 @@ package org.apache.click.examples.page.a
import org.apache.click.ActionListener;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
@@ -44,13 +44,13 @@ public class AjaxFallbackPage extends Bo
link.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Formatted date instance that will be added to the
String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
String msg = "AjaxBehavior <tt>onAction()</tt> method invoked at: " + now;
- // Return a partial containing the message
- return new Partial(msg, Partial.HTML);
+ // Return an action result containing the message
+ return new ActionResult(msg, ActionResult.HTML);
}
});
@@ -62,7 +62,7 @@ public class AjaxFallbackPage extends Bo
String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
String msg = "ActionListener <tt>onAction()</tt> method invoked at: " + now;
- // Return a partial containing the message
+ // Return an action result containing the message
addModel("msg", msg);
return true;
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/PageActionPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/PageActionPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/PageActionPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/PageActionPage.java Sat Jul 24 15:47:06 2010
@@ -18,19 +18,19 @@
*/
package org.apache.click.examples.page.ajax;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
/**
* Demonstrates how a Page Action can be used to handle an AJAX request.
* The Page Action is invoked by Click to handle the AJAX request.
- * The Page Action method returns a Partial response that is streamed back to the
+ * The Page Action method returns an ActionResult that is rendered to the
* browser.
*
* A Page Action is a regular method defined on a Page with the following signature:
* - the method must take no arguments
- * - the method must return a Partial
+ * - the method must return an ActionResult
*
* PageActions provide the simplest way to handle Ajax requests.
*
@@ -46,14 +46,14 @@ public class PageActionPage extends Bord
addControl(link);
}
- // Note the pageAction method signature: a no-arg method returning a Partial
- public Partial onLinkClicked() {
+ // Note the pageAction method signature: a no-arg method returning an ActionResult
+ public ActionResult onLinkClicked() {
// Formatted date instance that will be returned to the browser
String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
String msg = "PageAction method <tt>onLinkClicked()</tt> invoked at: " + now;
- // Return a partial containing the message
- return new Partial(msg, Partial.HTML);
+ // Return an action result containing the message
+ return new ActionResult(msg, ActionResult.HTML);
}
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JavascriptAjaxDemoPage.java Sat Jul 24 15:47:06 2010
@@ -19,7 +19,7 @@
package org.apache.click.examples.page.ajax.compare;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
@@ -44,13 +44,13 @@ public class JavascriptAjaxDemoPage exte
link.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Formatted date instance that will be added to the
String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
String msg = "Hello from JavaScript at: " + now;
- // Return a partial containing the message
- return new Partial(msg, Partial.HTML);
+ // Return an action result containing the message
+ return new ActionResult(msg, ActionResult.HTML);
}
});
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/JqueryAjaxDemoPage.java Sat Jul 24 15:47:06 2010
@@ -19,7 +19,7 @@
package org.apache.click.examples.page.ajax.compare;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
@@ -44,13 +44,13 @@ public class JqueryAjaxDemoPage extends
link.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Formatted date instance that will be added to the
String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
String msg = "Hello from jQuery at: " + now;
- // Return a partial containing the message
- return new Partial(msg, Partial.HTML);
+ // Return an action result containing the message
+ return new ActionResult(msg, ActionResult.HTML);
}
});
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/compare/PrototypeAjaxDemoPage.java Sat Jul 24 15:47:06 2010
@@ -19,7 +19,7 @@
package org.apache.click.examples.page.ajax.compare;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
@@ -44,13 +44,13 @@ public class PrototypeAjaxDemoPage exten
link.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Formatted date instance that will be added to the
String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
String msg = "Hello from Prototype at: " + now;
- // Return a partial containing the message
- return new Partial(msg, Partial.HTML);
+ // Return an action result containing the message
+ return new ActionResult(msg, ActionResult.HTML);
}
});
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/JsonResponsePage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/JsonResponsePage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/JsonResponsePage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/JsonResponsePage.java Sat Jul 24 15:47:06 2010
@@ -19,13 +19,13 @@
package org.apache.click.examples.page.ajax.content;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
/**
- * Demonstrates how a Partial can return a JSON response.
+ * Demonstrates how an ActionResult can return a JSON response.
*/
public class JsonResponsePage extends BorderPage {
@@ -44,13 +44,13 @@ public class JsonResponsePage extends Bo
link.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Formatted date instance that will be added to the
String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
String msg = "{\"msg\": \"JSON returned at: \", \"date\": \"" + now + "\"}";
- // Return a partial containing the message
- return new Partial(msg, Partial.JSON);
+ // Return an action result containing the message
+ return new ActionResult(msg, ActionResult.JSON);
}
});
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/XmlResponsePage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/XmlResponsePage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/XmlResponsePage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/content/XmlResponsePage.java Sat Jul 24 15:47:06 2010
@@ -19,13 +19,13 @@
package org.apache.click.examples.page.ajax.content;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.page.BorderPage;
/**
- * Demonstrates how a Partial can return an XML response.
+ * Demonstrates how an ActionResult can return an XML response.
*/
public class XmlResponsePage extends BorderPage {
@@ -44,7 +44,7 @@ public class XmlResponsePage extends Bor
link.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Formatted date instance that will be added to the
String now = format.currentDate("MMM, yyyy dd HH:MM:ss");
@@ -52,8 +52,8 @@ public class XmlResponsePage extends Bor
+ "<msg>XML returned at: </msg>"
+ "<date>" + now + "</date>"
+ "</payload>";
- // Return a partial containing the message
- return new Partial(msg, Partial.XML);
+ // Return an action result containing the message
+ return new ActionResult(msg, ActionResult.XML);
}
});
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/AdvancedFormAjaxPage.java Sat Jul 24 15:47:06 2010
@@ -22,7 +22,7 @@ import java.util.HashMap;
import java.util.List;
import org.apache.click.Control;
import org.apache.click.ControlRegistry;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.Form;
import org.apache.click.control.Submit;
@@ -61,20 +61,20 @@ public class AdvancedFormAjaxPage extend
save.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Update the form which might contain errors
- return new Partial(form.toString(), Partial.HTML);
+ return new ActionResult(form.toString(), ActionResult.HTML);
}
});
cancel.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Update the form and ensure errors and values have been cleared
form.clearValues();
form.clearErrors();
- return new Partial(form.toString(), Partial.HTML);
+ return new ActionResult(form.toString(), ActionResult.HTML);
}
});
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/form/SimpleFormAjaxPage.java Sat Jul 24 15:47:06 2010
@@ -21,7 +21,7 @@ package org.apache.click.examples.page.a
import java.util.HashMap;
import java.util.List;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.Field;
import org.apache.click.control.Form;
@@ -49,10 +49,10 @@ public class SimpleFormAjaxPage extends
saveBtn.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// Return a success response
// Form data can be saved here
- return new Partial("Hello " + nameFld.getValue(), Partial.HTML);
+ return new ActionResult("Hello " + nameFld.getValue(), ActionResult.HTML);
}
});
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/scroller/AjaxLiveScroller.java Sat Jul 24 15:47:06 2010
@@ -22,7 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.element.Element;
import org.apache.click.element.JsImport;
@@ -62,20 +62,20 @@ public class AjaxLiveScroller extends Bo
* A pageAction method that is called when the user scrolled to the bottom
* of the page and more data is needed.
*/
- public Partial onScroll() {
+ public ActionResult onScroll() {
// Check if the offset parameter was received.
int offset = NumberUtils.toInt(getContext().getRequest().getParameter("offset"));
List<Customer> customers = loadCustomers(offset, pageSize);
// Return customers between the given offset and pageSize
- Map partialModel = new HashMap();
- partialModel.put("customers", customers);
- partialModel.put("format", getFormat());
-
- // Return a partial for the customers.htm template and customers
- Partial partial = new Partial("/ajax/scroller/customers.htm", partialModel, Partial.HTML);
- return partial;
+ Map actionResultModel = new HashMap();
+ actionResultModel.put("customers", customers);
+ actionResultModel.put("format", getFormat());
+
+ // Return an action result for the customers.htm template and customers
+ ActionResult actionResult = new ActionResult("/ajax/scroller/customers.htm", actionResultModel, ActionResult.HTML);
+ return actionResult;
}
@Override
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/select/AjaxSelect.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/select/AjaxSelect.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/select/AjaxSelect.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/select/AjaxSelect.java Sat Jul 24 15:47:06 2010
@@ -26,7 +26,7 @@ import javax.annotation.Resource;
import org.apache.click.Context;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.Option;
import org.apache.click.control.Select;
@@ -58,8 +58,8 @@ public class AjaxSelect extends BorderPa
// Event Handlers ---------------------------------------------------------
// A pageAction that handles Ajax requests for a particular customer
- public Partial onChangeCustomer() {
- Partial partial = new Partial();
+ public ActionResult onChangeCustomer() {
+ ActionResult actionResult = new ActionResult();
// Lookup customer based on request parameter 'customerId'
String customerId = getContext().getRequest().getParameter("customerId");
@@ -67,13 +67,13 @@ public class AjaxSelect extends BorderPa
// CustomerPanel will render the customer as an HTML snippet
CustomerPanel customerPanel = new CustomerPanel(this, customer);
- partial.setContent(customerPanel.toString());
+ actionResult.setContent(customerPanel.toString());
// Set content type and character encoding
- partial.setCharacterEncoding("UTF-8");
- partial.setContentType(Partial.HTML);
+ actionResult.setCharacterEncoding("UTF-8");
+ actionResult.setContentType(ActionResult.HTML);
- return partial;
+ return actionResult;
}
@Override
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/ajax/table/TableAjaxPage.java Sat Jul 24 15:47:06 2010
@@ -22,7 +22,7 @@ import java.util.HashMap;
import java.util.List;
import javax.annotation.Resource;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.ActionLink;
import org.apache.click.control.Column;
@@ -59,9 +59,9 @@ public class TableAjaxPage extends Borde
editLink.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
Customer customer = customerService.getCustomerForID(editLink.getValue());
- return new Partial("Edit Clicked for customer: " + customer.getName(), Partial.TEXT);
+ return new ActionResult("Edit Clicked for customer: " + customer.getName(), ActionResult.TEXT);
}
});
@@ -69,22 +69,22 @@ public class TableAjaxPage extends Borde
deleteLink.addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
Customer customer = customerService.getCustomerForID(deleteLink.getValue());
- return new Partial("Delete Clicked for customer: " + customer.getName(), Partial.TEXT);
+ return new ActionResult("Delete Clicked for customer: " + customer.getName(), ActionResult.TEXT);
}
});
table.getControlLink().addBehavior(new AjaxBehavior() {
@Override
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
// NOTE: Ajax requests only process the target Control. Here we
// process the table in order to update paging and sorting state
table.onProcess();
- return new Partial(table.toString(), Partial.HTML);
+ return new ActionResult(table.toString(), ActionResult.HTML);
}
});
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/general/ExcelExportPage.java Sat Jul 24 15:47:06 2010
@@ -25,7 +25,7 @@ import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.control.ActionLink;
import org.apache.click.examples.domain.Customer;
import org.apache.click.examples.page.BorderPage;
@@ -71,9 +71,9 @@ public class ExcelExportPage extends Bor
* This is a "pageAction" method and will render the Excel spreadsheet.
*
* Note the signature of the pageAction: a public, no-argument method
- * returning a Partial instance.
+ * returning an ActionResult instance.
*/
- public Partial renderSpreadsheet() {
+ public ActionResult renderSpreadsheet() {
HttpServletResponse response = getContext().getResponse();
HSSFWorkbook wb = createWorkbook();
@@ -86,9 +86,9 @@ public class ExcelExportPage extends Bor
wb.write(baos);
String contentTyype = ClickUtils.getMimeType(".xls");
- Partial partial = new Partial(baos.toByteArray(), contentTyype);
+ ActionResult actionResult = new ActionResult(baos.toByteArray(), contentTyype);
- return partial;
+ return actionResult;
} catch (IOException ioe) {
throw new RuntimeException(ioe);
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionImage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionImage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionImage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionImage.java Sat Jul 24 15:47:06 2010
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import javax.servlet.ServletContext;
import org.apache.click.Context;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.examples.page.BorderPage;
import org.apache.click.util.ClickUtils;
import org.apache.commons.io.IOUtils;
@@ -36,25 +36,25 @@ public class PageActionImage extends Bor
private static final long serialVersionUID = 1L;
/**
- * This page method is invoked from the <img> element and returns a Partial
+ * This page method is invoked from the <img> element and returns an ActionResult
* instance containing the static image data.
*/
- public Partial getStaticImageData() {
+ public ActionResult getStaticImageData() {
// Load the static image 'click-icon-blue-32.png'
byte[] imageData = loadImageData("click-icon-blue-32.png");
// Lookup the contentType for a PNG image
String contentType = ClickUtils.getMimeType("png");
- // Return a Partial containing the image data
- return new Partial(imageData, contentType);
+ // Return an ActionResult containing the image data
+ return new ActionResult(imageData, contentType);
}
/**
- * This page method is invoked from the <img> element and returns a Partial
+ * This page method is invoked from the <img> element and returns an ActionResult
* instance containing the image data specified by the imageName parameter.
*/
- public Partial getDynamicImageData() {
+ public ActionResult getDynamicImageData() {
Context context = getContext();
// Retrieve the image name parameter from the request
@@ -66,8 +66,8 @@ public class PageActionImage extends Bor
// Lookup the contentType for a PNG image
String contentType = ClickUtils.getMimeType("png");
- // Return a Partial containing the image data
- return new Partial(imageData, contentType);
+ // Return an ActionResult containing the image data
+ return new ActionResult(imageData, contentType);
}
private byte[] loadImageData(String imageName) {
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionLink.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionLink.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionLink.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/general/PageActionLink.java Sat Jul 24 15:47:06 2010
@@ -18,14 +18,14 @@
*/
package org.apache.click.examples.page.general;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.control.PageLink;
import org.apache.click.examples.page.BorderPage;
/**
* Provides a PageAction demo. The PageLink sets a PAGE_ACTION to the page method
* 'getDate'. Clicking on the PageLink will invoke the 'getDate' method and render
- * the Partial response.
+ * the ActionResult.
*/
public class PageActionLink extends BorderPage {
@@ -43,7 +43,7 @@ public class PageActionLink extends Bord
/**
* This method will be invoked when the link is clicked.
*/
- public Partial getDate() {
- return new Partial(format.currentDate("MMM dd, yyyy HH:MM:ss"));
+ public ActionResult getDate() {
+ return new ActionResult(format.currentDate("MMM dd, yyyy HH:MM:ss"));
}
}
Modified: click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java (original)
+++ click/trunk/click/examples/src/org/apache/click/examples/page/pageflow/StartPage.java Sat Jul 24 15:47:06 2010
@@ -25,7 +25,7 @@ import java.util.Map;
import javax.annotation.Resource;
import org.apache.click.Context;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.control.Form;
import org.apache.click.control.Option;
import org.apache.click.control.Select;
@@ -116,8 +116,8 @@ public class StartPage extends BorderPag
}
// A pageAction that handles Ajax requests for a particular customer
- public Partial onChangeCustomer() {
- Partial partial = new Partial();
+ public ActionResult onChangeCustomer() {
+ ActionResult actionResult = new ActionResult();
// Lookup customer based on request parameter 'customerId'
String customerId = getContext().getRequest().getParameter("customerId");
@@ -125,13 +125,13 @@ public class StartPage extends BorderPag
// CustomerPanel will render the customer as an HTML snippet
CustomerPanel customerPanel = new CustomerPanel(this, customer);
- partial.setContent(customerPanel.toString());
+ actionResult.setContent(customerPanel.toString());
// Set content type and character encoding
- partial.setCharacterEncoding("UTF-8");
- partial.setContentType(Partial.HTML);
+ actionResult.setCharacterEncoding("UTF-8");
+ actionResult.setContentType(ActionResult.HTML);
- return partial;
+ return actionResult;
}
/**
Modified: click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java Sat Jul 24 15:47:06 2010
@@ -27,7 +27,7 @@ import org.apache.click.Behavior;
import org.apache.click.Context;
import org.apache.click.Control;
import org.apache.click.Page;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
import org.apache.click.ajax.AjaxBehavior;
import org.apache.click.control.TextField;
import org.apache.click.element.CssImport;
@@ -454,19 +454,19 @@ public abstract class AutoCompleteTextFi
private static final long serialVersionUID = 1L;
@Override
- public Partial onAction(Control source) {
- Partial partial = new Partial();
+ public ActionResult onAction(Control source) {
+ ActionResult actionResult = new ActionResult();
String contentType = getPage().getContentType();
- partial.setContentType(contentType);
+ actionResult.setContentType(contentType);
List<?> autocompleteList = getAutoCompleteList(getValue());
if (autocompleteList != null) {
HtmlStringBuffer buffer = new HtmlStringBuffer(10 + (autocompleteList.size() * 20));
renderAutoCompleteList(buffer, autocompleteList);
- partial.setContent(buffer.toString());
+ actionResult.setContent(buffer.toString());
}
- return partial;
+ return actionResult;
}
};
Modified: click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java Sat Jul 24 15:47:06 2010
@@ -83,10 +83,10 @@ public class ActionEventDispatcher {
Set<Control> behaviorSourceSet;
/**
- * The {@link org.apache.click.Partial} response to render. This partial is
- * set from the target Behavior.
+ * The {@link org.apache.click.ActionResult} to render. This action result is
+ * returned from the target Behavior.
*/
- Partial partial;
+ ActionResult actionResult;
/** The application log service. */
LogService logger;
@@ -307,33 +307,34 @@ public class ActionEventDispatcher {
if (isRequestTarget) {
- // The first non-null Partial returned will be rendered, other Partials are ignored
- Partial behaviorPartial = behavior.onAction(source);
- if (partial == null && behaviorPartial != null) {
- partial = behaviorPartial;
+ // The first non-null ActionResult returned will be rendered, other
+ // ActionResult instances are ignored
+ ActionResult behaviorActionResult = behavior.onAction(source);
+ if (actionResult == null && behaviorActionResult != null) {
+ actionResult = behaviorActionResult;
}
if (logger.isTraceEnabled()) {
String behaviorClassName = ClassUtils.getShortClassName(behavior.getClass());
- String partialClassName = null;
+ String actionResultClassName = null;
- if (behaviorPartial != null) {
- partialClassName = ClassUtils.getShortClassName(behaviorPartial.getClass());
+ if (behaviorActionResult != null) {
+ actionResultClassName = ClassUtils.getShortClassName(behaviorActionResult.getClass());
}
HtmlStringBuffer buffer = new HtmlStringBuffer();
buffer.append(" invoked: ");
buffer.append(behaviorClassName);
buffer.append(".onAction() : ");
- buffer.append(partialClassName);
+ buffer.append(actionResultClassName);
- if (partial == behaviorPartial && behaviorPartial != null) {
- buffer.append(" (Partial content will be rendered)");
+ if (actionResult == behaviorActionResult && behaviorActionResult != null) {
+ buffer.append(" (ActionResult will be rendered)");
} else {
- if (behaviorPartial == null) {
- buffer.append(" (Partial is null and will be ignored)");
+ if (behaviorActionResult == null) {
+ buffer.append(" (ActionResult is null and will be ignored)");
} else {
- buffer.append(" (Partial will be ignored since another Behavior already retuned a non-null Partial)");
+ buffer.append(" (ActionResult will be ignored since another Behavior already retuned a non-null ActionResult)");
}
}
@@ -441,12 +442,12 @@ public class ActionEventDispatcher {
}
/**
- * Return the Partial Ajax response or null if no behavior was dispatched.
+ * Return the Behavior's action result or null if no behavior was dispatched.
*
- * @return the Partial Ajax response or null if no behavior was dispatched
+ * @return the Behavior's action result or null if no behavior was dispatched
*/
- Partial getPartial() {
- return partial;
+ ActionResult getActionResult() {
+ return actionResult;
}
/**
Copied: click/trunk/click/framework/src/org/apache/click/ActionResult.java (from r964058, click/trunk/click/framework/src/org/apache/click/Partial.java)
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ActionResult.java?p2=click/trunk/click/framework/src/org/apache/click/ActionResult.java&p1=click/trunk/click/framework/src/org/apache/click/Partial.java&r1=964058&r2=978886&rev=978886&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Partial.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ActionResult.java Sat Jul 24 15:47:06 2010
@@ -31,22 +31,22 @@ import javax.servlet.http.HttpServletRes
import org.apache.click.util.ClickUtils;
/**
- * Partial encapsulates a fragment of an HTTP response and is used to stream
- * back a response to the browser. So instead of returning the entire Page to
- * the browser, only a portion of the Page is returned by the Partial.
+ * Provides an ActionResult that is returned by Page Actions and Ajax Behaviors.
+ * ActionResults are often used to return a partial response to the browser
+ * instead of the full page content.
* <p/>
- * A Partial response can be a String (HTML, JSON, XML, plain text) or a byte
- * array (jpg, gif, png, pdf or excel documents). The Partial {@link #contentType}
- * must be set appropriately in order for the browser to recognize the response.
+ * An ActionResult can consist of a String (HTML, JSON, XML, plain text) or a byte
+ * array (jpg, gif, png, pdf or excel documents). The ActionResult {@link #contentType}
+ * must be set appropriately in order for the browser to recognize the action result.
* <p/>
- * Partials are used by {@link org.apache.click.ajax.AjaxBehavior Ajax Behaviors}
- * and <tt>pageAction</tt> methods.
+ * ActionResults are returned by {@link org.apache.click.ajax.AjaxBehavior Ajax Behaviors}
+ * and <tt>Page Action</tt> methods.
*
* <h3>Ajax Behavior</h3>
*
* Ajax requests are handled by adding an {@link org.apache.click.ajax.AjaxBehavior Ajax Behavior}
* to a control. The AjaxBehavior {@link org.apache.click.Behavior#onAction(org.apache.click.Control) onAction}
- * method will handle the request and return a Partial instance that contains
+ * method will handle the request and return a ActionResult instance that contains
* the response, thus bypassing the rendering of the Page template. For example:
*
* <pre class="prettyprint">
@@ -57,11 +57,11 @@ import org.apache.click.util.ClickUtils;
*
* link.addBehavior(new AjaxBehavior() {
*
- * // The onAction method must return a Partial
- * public Partial onAction(Control source) {
- * // Create a new partial containing an HTML snippet and the content type of HTML
- * Partial partial = new Partial("<span>Hello World</span>", Partial.HTML);
- * return partial;
+ * // The onAction method must return a ActionResult
+ * public ActionResult onAction(Control source) {
+ * // Create a new action result containing an HTML snippet and HTML content type
+ * ActionResult actionResult = new ActionResult("<span>Hello World</span>", ActionResult.HTML);
+ * return actionResult;
* }
* });
* } </pre>
@@ -69,8 +69,8 @@ import org.apache.click.util.ClickUtils;
* <h3>Page Action</h3>
*
* A <tt>Page Action</tt> is a method on a Page that can be invoked directly
- * from the browser. The Page Action method returns a Partial instance that
- * contains the response, thus bypassing the rendering of the Page template.
+ * from the browser. The Page Action method returns an ActionResult instance that
+ * is rendered to the browser, thus bypassing the rendering of the Page template.
*
* <pre class="prettyprint">
* private ActionLink link = new ActionLink("link");
@@ -87,28 +87,28 @@ import org.apache.click.util.ClickUtils;
* * This is a "pageAction" method that will render an HTML response.
* *
* * Note the signature of the pageAction: a public, no-argument method
- * * returning a Partial instance.
+ * * returning a ActionResult instance.
* */
- * public Partial renderHelloWorld() {
- * Partial partial = new Partial("<span>Hello World</span>", Partial.HTML);
- * return partial;
+ * public ActionResult renderHelloWorld() {
+ * ActionResult actionResult = new ActionResult("<span>Hello World</span>", ActionResult.HTML);
+ * return actionResult;
* } </pre>
*
* <h3>Content Type</h3>
*
- * The {@link #contentType} of the Partial must be set to the appropriate type
- * in order for the client to recognize the response. Partial provides constants
+ * The {@link #contentType} of the ActionResult must be set to the appropriate type
+ * in order for the client to recognize the response. ActionResult provides constants
* for some of the more common <tt>content types</tt>, including: {@value XML},
* {@value HTML}, {@value JSON}, {@value TEXT}.
* <p/>
* For example:
* <pre class="prettyprint">
- * Partial partial = new Partial("alert('hello world');", Partial.JAVASCRIPT);
+ * ActionResult actionResult = new ActionResult("alert('hello world');", ActionResult.JAVASCRIPT);
*
* ...
*
* // content type can also be set through the setContentType method
- * partial.setContentType(Partial.JAVASCRIPT);
+ * actionResult.setContentType(ActionResult.JAVASCRIPT);
*
* ...
* </pre>
@@ -117,9 +117,9 @@ import org.apache.click.util.ClickUtils;
* <pre class="prettyprint">
* // lookup content type for PNG
* String contentType = ClickUtils.getMimeType("png");
- * partial.setContentType(contentType); </pre>
+ * actionResult.setContentType(contentType); </pre>
*/
-public class Partial {
+public class ActionResult {
// Constants --------------------------------------------------------------
@@ -141,10 +141,10 @@ public class Partial {
/** The xml content type constant: <tt>text/xml</tt>. */
public static final String XML = "text/xml";
- /** The Partial writer buffer size. */
+ /** The ActionResult writer buffer size. */
private static final int WRITER_BUFFER_SIZE = 256; // For text, set a small response size
- /** The Partial output buffer size. */
+ /** The ActionResult output buffer size. */
private static final int OUTPUT_BUFFER_SIZE = 4 * 1024; // For binary, set a a large response size
// Variables --------------------------------------------------------------
@@ -167,21 +167,21 @@ public class Partial {
/** The response character encoding. */
private String characterEncoding;
- /** Indicates whether the Partial should be cached by browser. */
- private boolean cachePartial = false;
+ /** Indicates whether the ActionResult should be cached by browser. */
+ private boolean cacheActionResult = false;
- /** The path of the partial template to render. */
+ /** The path of the actionResult template to render. */
private String template;
- /** The model for the Partial {@link #template}. */
+ /** The model for the ActionResult {@link #template}. */
private Map<String, Object> model;
// Constructors -----------------------------------------------------------
/**
- * Construct the Partial for the given template and model.
+ * Construct the ActionResult for the given template and model.
* <p/>
- * When the Partial is rendered the template and model will be merged and
+ * When the ActionResult is rendered the template and model will be merged and
* the result will be streamed back to the client.
* <p/>
* For example:
@@ -191,15 +191,15 @@ public class Partial {
*
* Behavior behavior = new DefaultAjaxBehavior() {
*
- * public Partial onAction() {
+ * public ActionResult onAction() {
*
* Map model = new HashMap();
* model.put("id", "link");
*
* // Note: we set XML as the content type
- * Partial partial = new Partial("/js/partial.xml", model, Partial.XML);
+ * ActionResult actionResult = new ActionResult("/js/actionResult.xml", model, ActionResult.XML);
*
- * return partial;
+ * return actionResult;
* }
* }
* }
@@ -209,80 +209,80 @@ public class Partial {
* @param model the template data model
* @param contentType the response content type
*/
- public Partial(String template, Map<String, Object> model, String contentType) {
+ public ActionResult(String template, Map<String, Object> model, String contentType) {
this.template = template;
this.model = model;
this.contentType = contentType;
}
/**
- * Construct the Partial for the given reader and content type.
+ * Construct the ActionResult for the given reader and content type.
*
* @param reader the reader which characters must be streamed back to the
* client
* @param contentType the response content type
*/
- public Partial(Reader reader, String contentType) {
+ public ActionResult(Reader reader, String contentType) {
this.reader = reader;
this.contentType = contentType;
}
/**
- * Construct the Partial for the given inputStream and content type.
+ * Construct the ActionResult for the given inputStream and content type.
*
* @param inputStream the input stream to stream back to the client
* @param contentType the response content type
*/
- public Partial(InputStream inputStream, String contentType) {
+ public ActionResult(InputStream inputStream, String contentType) {
this.inputStream = inputStream;
this.contentType = contentType;
}
/**
- * Construct the Partial for the given String content and content type.
+ * Construct the ActionResult for the given String content and content type.
*
* @param content the String content to stream back to the client
* @param contentType the response content type
*/
- public Partial(String content, String contentType) {
+ public ActionResult(String content, String contentType) {
this.content = content;
this.contentType = contentType;
}
/**
- * Construct the Partial for the given byte array and content type.
+ * Construct the ActionResult for the given byte array and content type.
*
* @param bytes the byte array to stream back to the client
* @param contentType the response content type
*/
- public Partial(byte[] bytes, String contentType) {
+ public ActionResult(byte[] bytes, String contentType) {
this.bytes = bytes;
this.contentType = contentType;
}
/**
- * Construct the Partial for the given content. The
+ * Construct the ActionResult for the given content. The
* <tt>{@link javax.servlet.http.HttpServletResponse#setContentType(java.lang.String) response content type}</tt>
* will default to {@link #TEXT}, unless overridden.
*
* @param content the content to stream back to the client
*/
- public Partial(String content) {
+ public ActionResult(String content) {
this.content = content;
}
/**
- * Construct a new empty Partial. The
+ * Construct a new empty ActionResult. The
* <tt>{@link javax.servlet.http.HttpServletResponse#setContentType(java.lang.String) response content type}</tt>
* will default to {@link #TEXT}, unless overridden.
*/
- public Partial() {
+ public ActionResult() {
}
// Public Methods ---------------------------------------------------------
/**
- * Set whether the partial content should be cached by the client browser or
+ * Set whether the action result should be cached by the client browser or
* not.
* <p/>
* If false, Click will set the following headers to prevent browsers
@@ -292,57 +292,57 @@ public class Partial {
* response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
* response.setDateHeader("Expires", new Date(1L).getTime()); </pre>
*
- * @param cachePartial indicates whether the partial content should be cached
+ * @param cacheActionResult indicates whether the action result should be cached
* by the client browser or not
*/
- public void setCachePartial(boolean cachePartial) {
- this.cachePartial = cachePartial;
+ public void setCacheActionResult(boolean cacheActionResult) {
+ this.cacheActionResult = cacheActionResult;
}
/**
- * Return true if the partial content should be cached by the client browser,
- * defaults to false. It is highly unlikely that you would turn partial caching
- * on.
+ * Return true if the action result should be cached by the client browser,
+ * defaults to false. It is highly unlikely that you would turn action result
+ * caching on.
*
- * @return true if the partial content should be cached by the client browser,
+ * @return true if the action result should be cached by the client browser,
* false otherwise
*/
- public boolean isCachePartial() {
- return cachePartial;
+ public boolean isCacheActionRestul() {
+ return cacheActionResult;
}
/**
- * Return the partial character encoding. If no character encoding is specified
+ * Return the action result character encoding. If no character encoding is specified
* the request character encoding will be used.
*
- * @return the partial character encoding
+ * @return the action result character encoding
*/
public String getCharacterEncoding() {
return characterEncoding;
}
/**
- * Set the partial character encoding. If no character encoding is set the
+ * Set the action result character encoding. If no character encoding is set the
* request character encoding will be used.
*
- * @param characterEncoding the partial character encoding
+ * @param characterEncoding the action result character encoding
*/
public void setCharacterEncoding(String characterEncoding) {
this.characterEncoding = characterEncoding;
}
/**
- * Set the partial response content type. If no content type is set it will
+ * Set the action result response content type. If no content type is set it will
* default to {@value #TEXT}.
*
- * @param contentType the partial response content type
+ * @param contentType the action result response content type
*/
public void setContentType(String contentType) {
this.contentType = contentType;
}
/**
- * Return the partial content type, default is {@value #TEXT}.
+ * Return the action result content type, default is {@value #TEXT}.
*
* @return the response content type
*/
@@ -427,9 +427,9 @@ public class Partial {
}
/**
- * Return the data model for the Partial {@link #template}.
+ * Return the data model for the ActionResult {@link #template}.
*
- * @return the data model for the Partial template
+ * @return the data model for the ActionResult template
*/
public Map<String, Object> getModel() {
if (model == null) {
@@ -439,7 +439,7 @@ public class Partial {
}
/**
- * Set the model of the Partial template to render.
+ * Set the model of the ActionResult template to render.
* <p/>
* If the {@link #template} property is set, the template and {@link #model}
* will be merged and the result will be streamed back to the client.
@@ -451,43 +451,43 @@ public class Partial {
}
/**
- * Return the template to render for this partial.
+ * Return the template to render for this ActionResult.
*
- * @return the template to render for this partial
+ * @return the template to render for this ActionResult
*/
public String getTemplate() {
return template;
}
/**
- * Set the template to render for this partial.
+ * Set the template to render for this ActionResult.
*
- * @param template the template to render for this partial
+ * @param template the template to render for this ActionResult
*/
public void setTemplate(String template) {
this.template = template;
}
/**
- * Render the partial response to the client.
+ * Render the ActionResult to the client.
*
* @param context the request context
*/
public final void render(Context context) {
prepare(context);
- renderPartial(context);
+ renderActionResult(context);
}
// Protected Methods ------------------------------------------------------
/**
- * Render the partial response to the client. This method can be overridden
+ * Render the ActionResult to the client. This method can be overridden
* by subclasses if custom rendering or direct access to the
* HttpServletResponse is required.
*
* @param context the request context
*/
- protected void renderPartial(Context context) {
+ protected void renderActionResult(Context context) {
HttpServletResponse response = context.getResponse();
@@ -546,14 +546,14 @@ public class Partial {
// Private Methods --------------------------------------------------------
/**
- * Prepare the partial for rendering.
+ * Prepare the ActionResult for rendering.
*
* @param context the request context
*/
private void prepare(Context context) {
HttpServletResponse response = context.getResponse();
- if (!cachePartial) {
+ if (!isCacheActionRestul()) {
// Set headers to disable cache
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
Modified: click/trunk/click/framework/src/org/apache/click/Behavior.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/Behavior.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/Behavior.java (original)
+++ click/trunk/click/framework/src/org/apache/click/Behavior.java Sat Jul 24 15:47:06 2010
@@ -25,7 +25,7 @@ package org.apache.click;
* to Controls.
* <p/>
* To handle an Ajax request Behavior exposes the listener method: {@link #onAction(org.apache.click.Control) onAction}.
- * The <tt>onAction</tt> method returns a Partial response that is rendered back
+ * The <tt>onAction</tt> method returns an ActionResult that is rendered back
* to the browser. Before Click invokes the <tt>onAction</tt> method it checks
* whether the request is targeted at that Behavior by calling the method
* {@link #isRequestTarget(org.apache.click.Context) Behavior.isRequestTarget()}.
@@ -60,9 +60,9 @@ public interface Behavior {
* TODO: javadoc
*
* @param source the control the behavior is attached to
- * @return the partial
+ * @return the action result instance
*/
- public Partial onAction(Control source);
+ public ActionResult onAction(Control source);
/**
* Return true if the behavior is the request target, false otherwise.
@@ -96,7 +96,7 @@ public interface Behavior {
* return StringUtils.equalsIgnoreCase(this.eventType, eventType);
* }
*
- * public Partial onAction(Control source) {
+ * public ActionResult onAction(Control source) {
* // If isRequestTarget returned true, the onAction method will be
* // invoked
* ...
Modified: click/trunk/click/framework/src/org/apache/click/ClickServlet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ClickServlet.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickServlet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickServlet.java Sat Jul 24 15:47:06 2010
@@ -590,13 +590,13 @@ public class ClickServlet extends HttpSe
boolean continueProcessing = performOnSecurityCheck(page, context);
- Partial partial = null;
+ ActionResult actionResult = null;
if (continueProcessing && !errorOccurred) {
// Handle page method
String pageAction = context.getRequestParameter(Page.PAGE_ACTION);
if (pageAction != null) {
- // Returned partial could be null
- partial = performPageAction(page, pageAction, context);
+ // Returned actionResult could be null
+ actionResult = performPageAction(page, pageAction, context);
continueProcessing = false;
}
}
@@ -615,7 +615,7 @@ public class ClickServlet extends HttpSe
controlRegistry.processPreResponse(context);
controlRegistry.processPreGetHeadElements(context);
- performRender(page, context, partial);
+ performRender(page, context, actionResult);
}
/**
@@ -638,15 +638,15 @@ public class ClickServlet extends HttpSe
}
/**
- * Perform the page action for the given page and return the Partial response.
+ * Perform the page action for the given page and return the action result.
*
* @param page the page which action to perform
* @param pageAction the name of the page action
* @param context the request context
- * @return the page action Partial response
+ * @return the page action ActionResult instance
*/
- protected Partial performPageAction(Page page, String pageAction, Context context) {
- Partial partial = ClickUtils.invokeAction(page, pageAction);
+ protected ActionResult performPageAction(Page page, String pageAction, Context context) {
+ ActionResult actionResult = ClickUtils.invokeAction(page, pageAction);
if (logger.isTraceEnabled()) {
HtmlStringBuffer buffer = new HtmlStringBuffer();
@@ -654,14 +654,14 @@ public class ClickServlet extends HttpSe
buffer.append(" invoked: ");
buffer.append(pageClassName);
buffer.append(".").append(pageAction).append("() : ");
- if (partial == null) {
- buffer.append("null (*no* Partial was returned by PageAction)");
+ if (actionResult == null) {
+ buffer.append("null (*no* ActionResult was returned by PageAction)");
} else {
- buffer.append(ClassUtils.getShortClassName(partial.getClass()));
+ buffer.append(ClassUtils.getShortClassName(actionResult.getClass()));
}
logger.trace(buffer.toString());
}
- return partial;
+ return actionResult;
}
/**
@@ -831,10 +831,10 @@ public class ClickServlet extends HttpSe
*
* @param page page to render
* @param context the request context
- * @param partial the partial response object
+ * @param actionResult the action result
* @throws java.lang.Exception if error occurs
*/
- protected void performRender(Page page, Context context, Partial partial)
+ protected void performRender(Page page, Context context, ActionResult actionResult)
throws Exception {
// Process page interceptors, and abort rendering if specified
@@ -882,13 +882,13 @@ public class ClickServlet extends HttpSe
dispatcher.forward(request, response);
}
- } else if (partial != null) {
- renderPartial(partial, page, context);
+ } else if (actionResult != null) {
+ renderActionResult(actionResult, page, context);
} else if (page.getPath() != null) {
// Render template unless the request was a page action. This check
// guards against the scenario where the page action returns null
- // instead of a partial instance
+ // instead of a action result
if (context.getRequestParameter(Page.PAGE_ACTION) == null) {
String pagePath = page.getPath();
@@ -1014,21 +1014,21 @@ public class ClickServlet extends HttpSe
}
/**
- * Render the given Partial response. If the partial is null, nothing is
+ * Render the given ActionResult. If the action result is null, nothing is
* rendered.
*
- * @param partial the partial response to render
+ * @param actionResult the action result to render
* @param page the requested page
* @param context the request context
*/
- protected void renderPartial(Partial partial, Page page, Context context) {
- if (partial == null) {
+ protected void renderActionResult(ActionResult actionResult, Page page, Context context) {
+ if (actionResult == null) {
return;
}
long startTime = System.currentTimeMillis();
- partial.render(context);
+ actionResult.render(context);
if (!configService.isProductionMode()) {
HtmlStringBuffer buffer = new HtmlStringBuffer(50);
@@ -1036,10 +1036,10 @@ public class ClickServlet extends HttpSe
buffer.append(" ");
}
- buffer.append("renderPartial (");
- buffer.append(partial.getContentType());
+ buffer.append("renderActionResult (");
+ buffer.append(actionResult.getContentType());
buffer.append(")");
- String template = partial.getTemplate();
+ String template = actionResult.getTemplate();
if (template != null) {
buffer.append(": ");
buffer.append(template);
@@ -1803,7 +1803,7 @@ public class ClickServlet extends HttpSe
boolean continueProcessing = performOnSecurityCheck(page, context);
- Partial partial = null;
+ ActionResult actionResult = null;
if (continueProcessing) {
// Handle page method
@@ -1811,13 +1811,13 @@ public class ClickServlet extends HttpSe
if (pageAction != null) {
continueProcessing = false;
- // Returned partial could be null
- partial = performPageAction(page, pageAction, context);
+ // Returned action result could be null
+ actionResult = performPageAction(page, pageAction, context);
controlRegistry.processPreResponse(context);
controlRegistry.processPreGetHeadElements(context);
- renderPartial(partial, page, context);
+ renderActionResult(actionResult, page, context);
}
}
@@ -1832,7 +1832,7 @@ public class ClickServlet extends HttpSe
processAjaxTargetControls(context, eventDispatcher, controlRegistry);
// Fire behaviors registered during the onProcess event
- // The target behavior will set the eventDispatcher partial instance
+ // The target behavior will set the eventDispatcher action result instance
// to render
eventDispatcher.fireBehaviors(context);
@@ -1841,10 +1841,10 @@ public class ClickServlet extends HttpSe
controlRegistry.processPreResponse(context);
controlRegistry.processPreGetHeadElements(context);
- partial = eventDispatcher.getPartial();
+ actionResult = eventDispatcher.getActionResult();
- // Render the partial
- renderPartial(partial, page, context);
+ // Render the actionResult
+ renderActionResult(actionResult, page, context);
} else {
@@ -1878,7 +1878,7 @@ public class ClickServlet extends HttpSe
}
} else {
// If security check fails for an Ajax request, Click returns without
- // any rendering. It is up to the user to render a Partial response
+ // any rendering. It is up to the user to render an ActionResult
// in the onSecurityCheck event
// Note: this code path is also followed if a pageAction is invoked
}
Modified: click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java?rev=978886&r1=978885&r2=978886&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ajax/AjaxBehavior.java Sat Jul 24 15:47:06 2010
@@ -22,7 +22,7 @@ import java.io.Serializable;
import org.apache.click.Behavior;
import org.apache.click.Context;
import org.apache.click.Control;
-import org.apache.click.Partial;
+import org.apache.click.ActionResult;
/**
* Provides an abstract implementation of the Behavior interface.
@@ -45,9 +45,9 @@ public class AjaxBehavior implements Beh
* @see org.apache.click.Behavior#onAction(org.apache.click.Control)
*
* @param source the control the behavior is attached to
- * @return the partial response
+ * @return the action result
*/
- public Partial onAction(Control source) {
+ public ActionResult onAction(Control source) {
return null;
}