Author: jkuhnert
Date: Wed Jul 18 20:43:59 2007
New Revision: 557478
URL: http://svn.apache.org/viewvc?view=rev&rev=557478
Log:
Fixes TAPESTRY-1522. Added COMPONENT_ID parameter for BrowserEvent. Simple
enough.
Modified:
tapestry/tapestry4/trunk/pom.xml
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/DirectService.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/event/BrowserEvent.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectEventServiceTest.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectServiceTest.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/event/BrowserEventTest.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java
Modified: tapestry/tapestry4/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/pom.xml?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
--- tapestry/tapestry4/trunk/pom.xml (original)
+++ tapestry/tapestry4/trunk/pom.xml Wed Jul 18 20:43:59 2007
@@ -201,7 +201,7 @@
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-test</artifactId>
- <version>4.1.2</version>
+ <version>4.1.3-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script
Wed Jul 18 20:43:59 2007
@@ -19,7 +19,7 @@
tapestry.cleanConnect(dojo.byId("${clientId}"), "${event[0]}",
"event${event[1]}");
tapestry.event${event[1]}=function( event ){
- var content={beventname:"${event[0]}"};
+ var content={beventname:"${event[0]}",
bcomponentid:"${component.id}"};
tapestry.event.buildEventProperties( event, content,
arguments);
if (!content["beventtarget.id"]) {
@@ -36,7 +36,7 @@
tapestry.cleanConnect(dojo.byId("${clientId}"),
"${formEvent[0]}",
"formEvent${formEvent[4]}");
tapestry.formEvent${formEvent[4]}=function(e){
- var content={beventname:"${formEvent[0]}"};
+ var content={beventname:"${formEvent[0]}",
bcomponentid:"${component.id}"};
tapestry.event.buildEventProperties(e, content, arguments);
if (!content["beventtarget.id"]){
content["beventtarget.id"]="${clientId}";
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script
Wed Jul 18 20:43:59 2007
@@ -18,7 +18,7 @@
<foreach expression="events" key="event">
tapestry.cleanConnect(dojo.widget.byId("${clientId}"),
"${event[0]}", "event${event[1]}");
tapestry.event${event[1]}=function(e){
- var content={beventname:"${event[0]}"};
+ var content={beventname:"${event[0]}",
bcomponentid:"${component.id}"};
tapestry.event.buildEventProperties(e, content, arguments);
if (!content["beventtarget.id"])
content["beventtarget.id"]="${clientId}";
tapestry.bind("${url}", content);
@@ -31,7 +31,7 @@
tapestry.cleanConnect(dojo.widget.byId("${clientId}"),
"${formEvent[0]}",
"formEvent${formEvent[4]}");
tapestry.formEvent${formEvent[4]}=function(e){
- var content={beventname:"${formEvent[0]}"};
+ var content={beventname:"${formEvent[0]}",
bcomponentid:"${component.id}"};
tapestry.event.buildEventProperties(e, content, arguments);
if (!content["beventtarget.id"])
content["beventtarget.id"]="${clientId}";
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/DirectService.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/DirectService.java?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/DirectService.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/DirectService.java
Wed Jul 18 20:43:59 2007
@@ -151,8 +151,8 @@
protected void triggerComponent(IRequestCycle cycle, IDirect direct,
Object[] parameters)
{
- if (BrowserEvent.hasBrowserEvent(cycle)) {
-
+ if (BrowserEvent.hasBrowserEvent(cycle))
+ {
BrowserEvent event = new BrowserEvent(cycle);
Object[] parms = new Object[parameters.length + 1];
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/event/BrowserEvent.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/event/BrowserEvent.java?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/event/BrowserEvent.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/event/BrowserEvent.java
Wed Jul 18 20:43:59 2007
@@ -40,6 +40,7 @@
public static final String TARGET="beventtarget";
public static final String TARGET_ATTR_ID="id";
+ public static final String COMPONENT_ID = "bcomponentid";
public static final String METHOD_ARGUMENTS="methodArguments";
@@ -52,7 +53,8 @@
private String _layerX;
private String _layerY;
private EventTarget _target;
-
+ private String _componentId;
+
private String _methodArguments;
private JSONArray _methodArgumentsArray;
@@ -75,6 +77,7 @@
_pageY = cycle.getParameter(PAGE_Y);
_layerX = cycle.getParameter(LAYER_X);
_layerY = cycle.getParameter(LAYER_Y);
+ _componentId = cycle.getParameter(COMPONENT_ID);
Map props = new HashMap();
_target = new EventTarget(props);
@@ -97,8 +100,22 @@
*/
public BrowserEvent(String name, EventTarget target)
{
+ this(name, null, target);
+ }
+
+ /**
+ * Creates a new browser event with the specified
+ * name/target properties.
+ *
+ * @param name The name of the event, ie "onClick", "onBlur", etc..
+ * @param componentId Component targeted.
+ * @param target The target of the client side event.
+ */
+ public BrowserEvent(String name, String componentId, EventTarget target)
+ {
_name = name;
_target = target;
+ _componentId = componentId;
}
/**
@@ -124,6 +141,18 @@
return _target;
}
+ /**
+ * Only when the event targeted a [EMAIL PROTECTED]
org.apache.tapestry.IComponent} - will return the originating
+ * components id as returned from [EMAIL PROTECTED]
org.apache.tapestry.IComponent#getId()}. <em>Not</em> present
+ * on element events.
+ *
+ * @return The originating component id that generated the event.
+ */
+ public String getComponentId()
+ {
+ return _componentId;
+ }
+
/**
* @return the charCode
*/
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/internal/event/impl/ComponentEventInvoker.java
Wed Jul 18 20:43:59 2007
@@ -28,15 +28,12 @@
import org.apache.tapestry.listener.ListenerInvoker;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.IEventListener;
-import org.apache.tapestry.util.IdAllocator;
import java.util.*;
/**
* Implementation of [EMAIL PROTECTED] IComponentEventInvoker}.
- *
- * @author jkuhnert
*/
public class ComponentEventInvoker implements IComponentEventInvoker,
ResetEventListener
{
@@ -60,12 +57,12 @@
Defense.notNull(component, "component");
Defense.notNull(cycle, "cycle");
Defense.notNull(event, "event");
-
+
invokeComponentListeners(component, cycle, event);
-
+
invokeElementListeners(component, cycle, event);
}
-
+
/**
* [EMAIL PROTECTED]
*/
@@ -74,189 +71,195 @@
Defense.notNull(formSupport, "formSupport");
Defense.notNull(cycle, "cycle");
Defense.notNull(event, "event");
-
+
IForm form = formSupport.getForm();
String formIdPath = form.getExtendedId();
String targetId = (String)event.getTarget().get("id");
- String strippedId = IdAllocator.convertAllocatedComponentId(targetId);
+ String componentId = event.getComponentId();
+
if (targetId == null)
return;
-
+
List comps = getFormEventListeners(formIdPath);
if (comps == null)
return;
-
+
boolean disableFocus = false;
-
- for (int i=0; i < comps.size(); i++) {
-
+
+ for (int i=0; i < comps.size(); i++)
+ {
IComponentSpecification spec =
(IComponentSpecification)comps.get(i);
EventBoundListener[] listeners = spec.getFormEvents(formIdPath,
event);
-
+
IComponent target = null;
- if (spec.isPageSpecification()) {
-
+ if (spec.isPageSpecification())
+ {
target = form.getPage();
} else {
-
target =
findComponent(form.getPage().getComponents().values(), spec);
}
-
- for (int e=0; e < listeners.length; e++) {
-
+
+ for (int e=0; e < listeners.length; e++)
+ {
// ensure ~only~ the method that targeted this event gets
called!
-
- if (!listeners[e].getComponentId().endsWith(strippedId))
+
+ if (!listeners[e].getComponentId().endsWith(componentId))
continue;
// clear validation errors but not input if async validation is
// disabled
- if (!listeners[e].isValidateForm()) {
-
+ if (!listeners[e].isValidateForm())
+ {
form.getDelegate().clearErrors();
}
// handle disabling focus
if (!disableFocus && !listeners[e].shouldFocusForm())
disableFocus = true;
-
+
// defer execution until after form is done rewinding
-
+
form.addDeferredRunnable(
- new
FormRunnable(target.getListeners().getListener(listeners[e].getMethodName()),
- target,
- cycle));
+ new
FormRunnable(target.getListeners().getListener(listeners[e].getMethodName()),
+ target,
+ cycle));
}
}
-
+
// Form uses cycle attributes to test whether or not to focus .
// The attribute existing at all is enough to bypass focusing.
- if (disableFocus) {
-
+
+ if (disableFocus)
+ {
cycle.disableFocus();
}
}
-
+
void invokeComponentListeners(IComponent component, IRequestCycle cycle,
BrowserEvent event)
{
String idPath = component.getExtendedId();
List listeners = getEventListeners(idPath);
if (listeners == null)
return;
-
- for (int i = 0; i < listeners.size(); i++) {
-
+
+ for (int i = 0; i < listeners.size(); i++)
+ {
IComponentSpecification listener =
(IComponentSpecification)listeners.get(i);
-
- IComponent target = null;
- ComponentEventProperty props = null;
-
- if (listener.isPageSpecification()) {
-
+
+ IComponent target;
+ ComponentEventProperty props;
+
+ if (listener.isPageSpecification())
+ {
target = component.getPage();
props = listener.getComponentEvents(idPath);
- } else {
-
+ } else
+ {
target =
findComponent(component.getPage().getComponents().values(), listener);
props = target.getSpecification().getComponentEvents(idPath);
}
+
if (props == null)
continue;
-
+
List clisteners = props.getEventListeners(event.getName());
- for (int e=0; e < clisteners.size(); e++) {
-
+ for (int e=0; e < clisteners.size(); e++)
+ {
EventBoundListener eventListener =
(EventBoundListener)clisteners.get(e);
-
+
_invoker.invokeListener(target.getListeners().getListener(eventListener.getMethodName()),
target, cycle);
}
-
+
}
}
-
+
void invokeElementListeners(IComponent component, IRequestCycle cycle,
BrowserEvent event)
{
String targetId = (String)event.getTarget().get("id");
if (targetId == null)
return;
-
+
ComponentEventProperty prop =
component.getSpecification().getElementEvents(targetId);
if (prop == null)
return;
-
+
List listeners = prop.getEventListeners(event.getName());
-
- for (int i=0; i < listeners.size(); i++) {
-
+
+ for (int i=0; i < listeners.size(); i++)
+ {
EventBoundListener listener = (EventBoundListener)listeners.get(i);
-
+
_invoker.invokeListener(component.getListeners().getListener(listener.getMethodName()),
component, cycle);
}
}
-
+
IComponent findComponent(Collection comps, IComponentSpecification spec)
{
IComponent ret = null;
-
+
Iterator it = comps.iterator();
-
- while (it.hasNext()) {
+
+ while (it.hasNext())
+ {
IComponent comp = (IComponent)it.next();
-
- if (comp.getSpecification().equals(spec)) {
+
+ if (comp.getSpecification().equals(spec))
+ {
ret = comp;
break;
}
-
+
ret = findComponent(comp.getComponents().values(), spec);
if (ret != null)
break;
}
-
+
return ret;
}
-
+
/** Local runnable for deferred form connections. */
class FormRunnable implements Runnable {
-
+
private IActionListener _listener;
private IComponent _component;
private IRequestCycle _cycle;
-
+
public FormRunnable(IActionListener listener, IComponent comp,
IRequestCycle cycle)
{
_listener = listener;
_component = comp;
_cycle = cycle;
}
-
+
public void run()
{
_invoker.invokeListener(_listener, _component, _cycle);
}
}
-
+
/**
* [EMAIL PROTECTED]
*/
public void addEventListener(String componentId, IComponentSpecification
listener)
{
List listeners = (List)_components.get(componentId);
-
- if (listeners == null) {
+
+ if (listeners == null)
+ {
listeners = new ArrayList();
_components.put(componentId, listeners);
}
-
- if (!listeners.contains(listener)) {
+
+ if (!listeners.contains(listener))
+ {
listeners.add(listener);
}
-
+
_propertyCache.remove(componentId);
}
-
+
/**
* [EMAIL PROTECTED]
*/
@@ -264,7 +267,7 @@
{
if (componentId == null)
return null;
-
+
return (List)_components.get(componentId);
}
@@ -272,7 +275,7 @@
{
if (componentIdPath == null)
return EMPTY_PROPERTIES;
-
+
ComponentEventProperty[] ret =
(ComponentEventProperty[])_propertyCache.get(componentIdPath);
if (ret != null)
return ret;
@@ -282,8 +285,8 @@
return EMPTY_PROPERTIES;
List props = new ArrayList();
- for (int i=0; i < listeners.size(); i++) {
-
+ for (int i=0; i < listeners.size(); i++)
+ {
IEventListener listener = (IEventListener)listeners.get(i);
props.add(listener.getComponentEvents(componentIdPath));
@@ -302,17 +305,19 @@
public void addFormEventListener(String formId, IComponentSpecification
listener)
{
List listeners = (List)_formComponents.get(formId);
-
- if (listeners == null) {
+
+ if (listeners == null)
+ {
listeners = new ArrayList();
_formComponents.put(formId, listeners);
}
-
- if (!listeners.contains(listener)) {
+
+ if (!listeners.contains(listener))
+ {
listeners.add(listener);
}
}
-
+
/**
* [EMAIL PROTECTED]
*/
@@ -320,10 +325,10 @@
{
if (formId == null)
return null;
-
+
return (List)_formComponents.get(formId);
}
-
+
/**
* [EMAIL PROTECTED]
*/
@@ -333,7 +338,7 @@
_formComponents.clear();
_propertyCache.clear();
}
-
+
/** Injected. */
public void setInvoker(ListenerInvoker invoker)
{
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java
Wed Jul 18 20:43:59 2007
@@ -84,26 +84,13 @@
}
/**
- * Utility for stripping out the standard allocator generated portion of a
component id string
- * in order to get what the most likely original component id was.
- *
- * @param input
- * The generated component id.
- * @return The id stripped of any allocated id meta, if any was found.
- */
- public static String convertAllocatedComponentId(String input)
- {
- if (input == null)
- return null;
-
- int index = input.indexOf(SEPARATOR);
-
- return index > -1 ? input.substring(0, index) : input;
- }
-
- /**
* Allocates the id. Repeated calls for the same name will return "name",
* "name_0", "name_1", etc.
+ *
+ * @param name
+ * The base id to allocate new unique ids from.
+ *
+ * @return A unique version of the passed in id.
*/
public String allocateId(String name)
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectEventServiceTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectEventServiceTest.java?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectEventServiceTest.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectEventServiceTest.java
Wed Jul 18 20:43:59 2007
@@ -208,7 +208,6 @@
trainGetParameter(cycle, ServiceConstants.CONTAINER, null);
trainGetParameter(cycle, ServiceConstants.PAGE, "ActivePage");
trainGetParameter(cycle, ServiceConstants.SESSION, null);
- trainGetParameter(cycle, BrowserEvent.METHOD_ARGUMENTS, null);
trainGetPage(cycle, "ActivePage", page);
cycle.activate(page);
@@ -254,18 +253,14 @@
trainGetParameter(cycle, ServiceConstants.CONTAINER, "ComponentPage");
trainGetParameter(cycle, ServiceConstants.PAGE, "ActivePage");
trainGetParameter(cycle, ServiceConstants.SESSION, null);
- trainGetParameter(cycle, BrowserEvent.METHOD_ARGUMENTS, null);
trainGetPage(cycle, "ActivePage", page);
-
cycle.activate(page);
trainGetPage(cycle, "ComponentPage", componentPage);
-
trainGetNestedComponent(componentPage, "fred.barney", d);
trainExtractListenerParameters(lf, cycle, parameters);
-
trainExtractBrowserEvent(cycle);
cycle.setListenerParameters(isA(Object[].class));
@@ -340,7 +335,6 @@
trainGetParameter(cycle, ServiceConstants.CONTAINER, null);
trainGetParameter(cycle, ServiceConstants.PAGE, "ActivePage");
trainGetParameter(cycle, ServiceConstants.SESSION, "T");
- trainGetParameter(cycle, BrowserEvent.METHOD_ARGUMENTS, null);
trainGetPage(cycle, "ActivePage", page);
cycle.activate(page);
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectServiceTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectServiceTest.java?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectServiceTest.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/engine/DirectServiceTest.java
Wed Jul 18 20:43:59 2007
@@ -261,15 +261,12 @@
trainGetParameter(cycle, ServiceConstants.CONTAINER, null);
trainGetParameter(cycle, ServiceConstants.PAGE, "ActivePage");
trainGetParameter(cycle, ServiceConstants.SESSION, null);
- trainGetParameter(cycle, BrowserEvent.METHOD_ARGUMENTS, null);
trainGetPage(cycle, "ActivePage", page);
cycle.activate(page);
-
trainGetNestedComponent(page, "fred.barney", d);
trainExtractListenerParameters(lf, cycle, parameters);
-
trainExtractBrowserEvent(cycle);
cycle.setListenerParameters(isA(Object[].class));
@@ -293,7 +290,7 @@
* The complex case is where the component is contained on a different
page than the active (at
* the time of render) page.
*/
- public void testServiceComplex() throws Exception
+ public void test_Service_Complex() throws Exception
{
Object[] parameters = new Object[0];
IRequestCycle cycle = newCycle();
@@ -337,7 +334,7 @@
verify();
}
- public void testServiceNotDirect() throws Exception
+ public void test_Service_Not_Direct() throws Exception
{
IRequestCycle cycle = newCycle();
IPage page = newPage();
@@ -378,7 +375,7 @@
verify();
}
- public void testSessionActiveAndRequired() throws Exception
+ public void test_Session_Active_And_Required() throws Exception
{
Object[] parameters = new Object[0];
IRequestCycle cycle = newCycle();
@@ -432,7 +429,7 @@
expect(direct.isStateful()).andReturn(isStateful);
}
- public void testStaleSession() throws Exception
+ public void test_Stale_Session() throws Exception
{
IRequestCycle cycle = newCycle();
IPage page = newPage();
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/event/BrowserEventTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/event/BrowserEventTest.java?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/event/BrowserEventTest.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/event/BrowserEventTest.java
Wed Jul 18 20:43:59 2007
@@ -46,6 +46,7 @@
public void test_Unparseable_JSON_Method_Arguments()
{
IRequestCycle cycle = newCycle();
+
trainCycleForStandardBrowserEvent(cycle);
expect(cycle.getParameter(BrowserEvent.METHOD_ARGUMENTS)).andReturn("*/utterRubb�sh");
@@ -70,7 +71,8 @@
expect(cycle.getParameter(BrowserEvent.PAGE_Y)).andReturn("1243");
expect(cycle.getParameter(BrowserEvent.LAYER_X)).andReturn(null);
expect(cycle.getParameter(BrowserEvent.LAYER_Y)).andReturn(null);
-
+ expect(cycle.getParameter(BrowserEvent.COMPONENT_ID)).andReturn(null);
+
expect(cycle.getParameter(BrowserEvent.TARGET + "." +
BrowserEvent.TARGET_ATTR_ID)).andReturn("element1");
}
}
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java
Wed Jul 18 20:43:59 2007
@@ -272,7 +272,6 @@
form.setEventInvoker(invoker);
trainExtractBrowserEvent(cycle);
-
expect(cycle.getParameter(BrowserEvent.METHOD_ARGUMENTS)).andReturn("null");
replay();
@@ -657,7 +656,6 @@
form.setEventInvoker(invoker);
trainExtractBrowserEvent(cycle);
-
expect(cycle.getParameter(BrowserEvent.METHOD_ARGUMENTS)).andReturn("null");
invoker.invokeFormListeners(eq(fs), eq(cycle),
isA(BrowserEvent.class));
@@ -859,7 +857,6 @@
form.setEventInvoker(invoker);
trainExtractBrowserEvent(cycle);
-
expect(cycle.getParameter(BrowserEvent.METHOD_ARGUMENTS)).andReturn("null");
invoker.invokeFormListeners(eq(fs), eq(cycle),
isA(BrowserEvent.class));
@@ -1015,7 +1012,6 @@
form.setEventInvoker(invoker);
trainExtractBrowserEvent(cycle);
-
expect(cycle.getParameter(BrowserEvent.METHOD_ARGUMENTS)).andReturn("null");
invoker.invokeFormListeners(eq(fs), eq(cycle),
isA(BrowserEvent.class));
@@ -1304,7 +1300,6 @@
form.setEventInvoker(invoker);
trainExtractBrowserEvent(cycle);
-
expect(cycle.getParameter(BrowserEvent.METHOD_ARGUMENTS)).andReturn("null");
invoker.invokeFormListeners(eq(fs), eq(cycle),
isA(BrowserEvent.class));
@@ -1339,7 +1334,6 @@
trainCycleForRewind(cycle, "", null);
trainExtractBrowserEvent(cycle);
-
expect(cycle.getParameter(BrowserEvent.METHOD_ARGUMENTS)).andReturn("null");
writer.print("DEFERRED");
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java?view=diff&rev=557478&r1=557477&r2=557478
==============================================================================
---
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java
(original)
+++
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/internal/event/impl/ComponentEventInvokerTest.java
Wed Jul 18 20:43:59 2007
@@ -208,7 +208,7 @@
Map tprops = new HashMap();
tprops.put("id", "form1");
- BrowserEvent event = new BrowserEvent("onSelect", new
EventTarget(tprops));
+ BrowserEvent event = new BrowserEvent("onSelect", "form1", new
EventTarget(tprops));
ComponentEventInvoker invoker = new ComponentEventInvoker();
invoker.setInvoker(listenerInvoker);
@@ -264,7 +264,7 @@
Map tprops = new HashMap();
tprops.put("id", "form1");
- BrowserEvent event = new BrowserEvent("onSelect", new
EventTarget(tprops));
+ BrowserEvent event = new BrowserEvent("onSelect", "form1", new
EventTarget(tprops));
ComponentEventInvoker invoker = new ComponentEventInvoker();
invoker.setInvoker(listenerInvoker);