Use 1.5 enums for choosing the event type for AjaxEventBehavior and friends. In that way the user isn't responsible for typing the event name as a string and having to worry about if it's spelled correctly.
Attached to this is both a patch for core 2.0 and extensions 2.0. This patch also fixes some failing unit tests in the wicket.ajax.* packages. Regards Frank Bille Avaleo
Index: src/java/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java =================================================================== --- src/java/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java (revision 6242) +++ src/java/wicket/extensions/ajax/markup/html/AjaxEditableLabel.java (working copy) @@ -23,6 +23,7 @@ import wicket.ajax.AbstractDefaultAjaxBehavior; import wicket.ajax.AjaxEventBehavior; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.markup.ComponentTag; import wicket.markup.html.basic.Label; import wicket.markup.html.form.TextField; @@ -112,7 +113,7 @@ * * @param event */ - private LabeAjaxBehavior(String event) + private LabeAjaxBehavior(ClientEvent event) { super(event); } @@ -159,7 +160,7 @@ label = new Label(this, "label", model); label.setOutputMarkupId(true); - label.add(new LabeAjaxBehavior("onClick")); + label.add(new LabeAjaxBehavior(ClientEvent.CLICK)); editor = new TextField<T>(this, "editor", model); editor.setOutputMarkupId(true); Index: src/java/wicket/extensions/ajax/markup/html/repeater/data/sort/AjaxFallbackOrderByLink.java =================================================================== --- src/java/wicket/extensions/ajax/markup/html/repeater/data/sort/AjaxFallbackOrderByLink.java (revision 6242) +++ src/java/wicket/extensions/ajax/markup/html/repeater/data/sort/AjaxFallbackOrderByLink.java (working copy) @@ -2,6 +2,7 @@ import wicket.ajax.AjaxEventBehavior; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.ajax.IAjaxCallDecorator; import wicket.ajax.calldecorator.CancelEventIfNoAjaxDecorator; import wicket.extensions.markup.html.repeater.data.sort.ISortStateLocator; @@ -86,7 +87,7 @@ { super(parent, id, property, stateLocator, cssProvider); - add(new AjaxEventBehavior("onclick") + add(new AjaxEventBehavior(ClientEvent.CLICK) { private static final long serialVersionUID = 1L;
Index: src/java/wicket/ajax/AjaxEventBehavior.java =================================================================== --- src/java/wicket/ajax/AjaxEventBehavior.java (revision 6237) +++ src/java/wicket/ajax/AjaxEventBehavior.java (working copy) @@ -21,7 +21,6 @@ import java.io.Serializable; import wicket.markup.ComponentTag; -import wicket.util.string.Strings; import wicket.util.time.Duration; /** @@ -32,7 +31,7 @@ * * <pre> * DropDownChoice choice=new DropDownChoice(...); - * choice.add(new AjaxEventBehavior("onchange") { + * choice.add(new AjaxEventBehavior(ClientEvent.CHANGE) { * protected void onEvent(AjaxRequestTarget target) { * System.out.println("ajax here!"); * } @@ -53,11 +52,11 @@ private static final long serialVersionUID = 1L; - private String event; + private ClientEvent event; private ThrottlingSettings throttlingSettings; - + /** * Construct. * @@ -64,9 +63,9 @@ * @param event * event this behavior will be attached to */ - public AjaxEventBehavior(final String event) + public AjaxEventBehavior(final ClientEvent event) { - if (Strings.isEmpty(event)) + if (event == null) { throw new IllegalArgumentException("argument [event] cannot be null or empty"); } @@ -106,7 +105,7 @@ protected void onComponentTag(final ComponentTag tag) { super.onComponentTag(tag); - tag.put(event, getEventHandler()); + tag.put(event.getEvent(), getEventHandler()); } /** @@ -116,7 +115,7 @@ protected CharSequence getEventHandler() { CharSequence handler = getCallbackScript(); - if (event.equalsIgnoreCase("href")) + if (event == ClientEvent.HREF) { handler = "javascript:" + handler; } @@ -141,7 +140,7 @@ * * @param event */ - protected void onCheckEvent(final String event) + protected void onCheckEvent(final ClientEvent event) { } @@ -149,7 +148,7 @@ * * @return event */ - protected final String getEvent() + protected final ClientEvent getEvent() { return event; } Index: src/java/wicket/ajax/ClientEvent.java =================================================================== --- src/java/wicket/ajax/ClientEvent.java (revision 0) +++ src/java/wicket/ajax/ClientEvent.java (revision 0) @@ -0,0 +1,140 @@ +/* + * $Id: AjaxSelfUpdatingTimerBehavior.java,v 1.2 2006/02/02 11:40:46 jdonnerstag + * Exp $ $Revision: 5816 $ $Date: 2006-05-23 18:43:32 +0000 (Tue, 23 May 2006) $ + * + * ============================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package wicket.ajax; + +/** + * When using an AjaxEventBehavior, this is used to determine on which client + * side (javascript) event the behavior should be executed. + * <p> + * Please note, that not all events works on all tags in all browsers. + * <p> + * Wicket doesn't test if a specific ClientEvent is supported on the tag it's + * being attached to. + * + * @since 2.0 + * + * @author Frank Bille + */ +public enum ClientEvent { + /** + * Matches the onabort event + */ + ABORT("onabort"), + /** + * Matches the onblur event + */ + BLUR("onblur"), + /** + * Matches the onchange event + */ + CHANGE("onchange"), + /** + * Matches the onclick event + */ + CLICK("onclick"), + /** + * Matches the ondblclick event + */ + DBLCLICK("ondblclick"), + /** + * Matches the onerror event + */ + ERROR("onerror"), + /** + * Matches the onfocus event + */ + FOCUS("onfocus"), + /** + * Matches the onkeydown event + */ + KEYDOWN("onkeydown"), + /** + * Matches the onkeypress event + */ + KEYPRESS("onkeypress"), + /** + * Matches the onkeyup event + */ + KEYUP("onkeyup"), + /** + * Matches the onload event + */ + LOAD("onload"), + /** + * Matches the onmousedown event + */ + MOUSEDOWN("onmousedown"), + /** + * Matches the onmousemove event + */ + MOUSEMOVE("onmousemove"), + /** + * Matches the onmouseover event + */ + MOUSEOVER("onmouseover"), + /** + * Matches the onmouseout event + */ + MOUSEOUT("onmouseout"), + /** + * Matches the onmouseup event + */ + MOUSEUP("onmouseup"), + /** + * Matches the onreset event + */ + RESET("onreset"), + /** + * Matches the onresize event + */ + RESIZE("onresize"), + /** + * Matches the onselect event + */ + SELECT("onselect"), + /** + * Matches the onsubmit event + */ + SUBMIT("onsubmit"), + /** + * Matches the onunload event + */ + UNLOAD("onunload"), + /** + * Special type, which is used for putting the action on the href attribute + * of a <a> tag. + */ + HREF("href"); + + private final String event; + + private ClientEvent(String event) + { + this.event = event; + } + + /** + * Get the actual event string which can be used to put on the tag. + * + * @return the event string, like "onclick" for an [EMAIL PROTECTED] ClientEvent#CLICK} + */ + public String getEvent() + { + return event; + } +} \ No newline at end of file Index: src/java/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java =================================================================== --- src/java/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java (revision 6237) +++ src/java/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java (working copy) @@ -21,6 +21,7 @@ import wicket.WicketRuntimeException; import wicket.ajax.AjaxEventBehavior; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.markup.html.form.FormComponent; import wicket.markup.html.form.persistence.IValuePersister; import wicket.util.string.AppendingStringBuffer; @@ -45,7 +46,7 @@ * @param event * event to trigger this behavior */ - public AjaxFormComponentUpdatingBehavior(final String event) + public AjaxFormComponentUpdatingBehavior(final ClientEvent event) { super(event); } @@ -89,9 +90,9 @@ * @see wicket.ajax.AjaxEventBehavior#onCheckEvent(java.lang.String) */ @Override - protected void onCheckEvent(String event) + protected void onCheckEvent(ClientEvent event) { - if ("href".equalsIgnoreCase(event)) + if (event == ClientEvent.HREF) { throw new IllegalArgumentException( "this behavior cannot be attached to an 'href' event"); Index: src/java/wicket/ajax/form/AjaxFormSubmitBehavior.java =================================================================== --- src/java/wicket/ajax/form/AjaxFormSubmitBehavior.java (revision 6237) +++ src/java/wicket/ajax/form/AjaxFormSubmitBehavior.java (working copy) @@ -20,6 +20,7 @@ import wicket.ajax.AjaxEventBehavior; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.markup.html.form.Button; import wicket.markup.html.form.Form; import wicket.markup.html.form.FormComponent; @@ -57,7 +58,7 @@ * @param event * javascript event this behavior is attached to, like onclick */ - public AjaxFormSubmitBehavior(Form form, String event) + public AjaxFormSubmitBehavior(Form form, ClientEvent event) { super(event); this.form = form; Index: src/java/wicket/ajax/form/AjaxFormValidatingBehavior.java =================================================================== --- src/java/wicket/ajax/form/AjaxFormValidatingBehavior.java (revision 6237) +++ src/java/wicket/ajax/form/AjaxFormValidatingBehavior.java (working copy) @@ -21,6 +21,7 @@ import wicket.Component; import wicket.Component.IVisitor; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.feedback.IFeedback; import wicket.markup.html.form.Form; import wicket.markup.html.form.FormComponent; @@ -48,7 +49,7 @@ * javascript event this behavior will be invoked on, like * onclick */ - public AjaxFormValidatingBehavior(Form form, String event) + public AjaxFormValidatingBehavior(Form form, ClientEvent event) { super(form, event); } @@ -73,7 +74,7 @@ * @param form * @param event */ - public static void addToAllFormComponents(final Form form, final String event) + public static void addToAllFormComponents(final Form form, final ClientEvent event) { addToAllFormComponents(form, event, null); } @@ -85,7 +86,7 @@ * @param event * @param throttleDelay */ - public static void addToAllFormComponents(final Form form, final String event, + public static void addToAllFormComponents(final Form form, final ClientEvent event, final Duration throttleDelay) { form.visitChildren(FormComponent.class, new IVisitor() Index: src/java/wicket/ajax/markup/html/AjaxFallbackLink.java =================================================================== --- src/java/wicket/ajax/markup/html/AjaxFallbackLink.java (revision 6237) +++ src/java/wicket/ajax/markup/html/AjaxFallbackLink.java (working copy) @@ -21,6 +21,7 @@ import wicket.MarkupContainer; import wicket.ajax.AjaxEventBehavior; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.ajax.IAjaxCallDecorator; import wicket.ajax.calldecorator.CancelEventIfNoAjaxDecorator; import wicket.markup.html.link.Link; @@ -69,7 +70,7 @@ { super(parent, id, model); - add(new AjaxEventBehavior("onclick") + add(new AjaxEventBehavior(ClientEvent.CLICK) { private static final long serialVersionUID = 1L; Index: src/java/wicket/ajax/markup/html/AjaxLink.java =================================================================== --- src/java/wicket/ajax/markup/html/AjaxLink.java (revision 6237) +++ src/java/wicket/ajax/markup/html/AjaxLink.java (working copy) @@ -20,6 +20,7 @@ import wicket.MarkupContainer; import wicket.ajax.AjaxEventBehavior; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.ajax.IAjaxCallDecorator; import wicket.markup.html.WebMarkupContainer; import wicket.model.IModel; @@ -65,7 +66,7 @@ { super(parent, id, model); - add(new AjaxEventBehavior("href") + add(new AjaxEventBehavior(ClientEvent.HREF) { private static final long serialVersionUID = 1L; Index: src/java/wicket/ajax/markup/html/form/AjaxCheckBox.java =================================================================== --- src/java/wicket/ajax/markup/html/form/AjaxCheckBox.java (revision 6237) +++ src/java/wicket/ajax/markup/html/form/AjaxCheckBox.java (working copy) @@ -20,6 +20,7 @@ import wicket.MarkupContainer; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.ajax.form.AjaxFormComponentUpdatingBehavior; import wicket.markup.html.form.CheckBox; import wicket.model.IModel; @@ -63,7 +64,7 @@ setOutputMarkupId(true); - add(new AjaxFormComponentUpdatingBehavior("onclick") + add(new AjaxFormComponentUpdatingBehavior(ClientEvent.CLICK) { private static final long serialVersionUID = 1L; Index: src/java/wicket/ajax/markup/html/form/AjaxSubmitButton.java =================================================================== --- src/java/wicket/ajax/markup/html/form/AjaxSubmitButton.java (revision 6237) +++ src/java/wicket/ajax/markup/html/form/AjaxSubmitButton.java (working copy) @@ -20,6 +20,7 @@ import wicket.MarkupContainer; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.ajax.IAjaxCallDecorator; import wicket.ajax.form.AjaxFormSubmitBehavior; import wicket.markup.ComponentTag; @@ -54,7 +55,7 @@ { super(parent, id); - add(new AjaxFormSubmitBehavior(form, "onclick") + add(new AjaxFormSubmitBehavior(form, ClientEvent.CLICK) { private static final long serialVersionUID = 1L; Index: src/java/wicket/ajax/markup/html/form/AjaxSubmitLink.java =================================================================== --- src/java/wicket/ajax/markup/html/form/AjaxSubmitLink.java (revision 6237) +++ src/java/wicket/ajax/markup/html/form/AjaxSubmitLink.java (working copy) @@ -20,6 +20,7 @@ import wicket.MarkupContainer; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.ajax.IAjaxCallDecorator; import wicket.ajax.form.AjaxFormSubmitBehavior; import wicket.markup.ComponentTag; @@ -53,7 +54,7 @@ { super(parent, id); - add(new AjaxFormSubmitBehavior(form, "onclick") + add(new AjaxFormSubmitBehavior(form, ClientEvent.CLICK) { private static final long serialVersionUID = 1L; Index: src/java/wicket/ajax/markup/html/navigation/paging/AjaxPagingNavigationBehavior.java =================================================================== --- src/java/wicket/ajax/markup/html/navigation/paging/AjaxPagingNavigationBehavior.java (revision 6237) +++ src/java/wicket/ajax/markup/html/navigation/paging/AjaxPagingNavigationBehavior.java (working copy) @@ -22,6 +22,7 @@ import wicket.MarkupContainer; import wicket.ajax.AjaxEventBehavior; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.ajax.IAjaxCallDecorator; import wicket.ajax.calldecorator.CancelEventIfNoAjaxDecorator; import wicket.ajax.markup.html.IAjaxLink; @@ -61,7 +62,7 @@ * @param event * the javascript event to bind to (e.g. onclick) */ - public AjaxPagingNavigationBehavior(IAjaxLink owner, IPageable pageable, String event) + public AjaxPagingNavigationBehavior(IAjaxLink owner, IPageable pageable, ClientEvent event) { super(event); this.owner = owner; Index: src/java/wicket/ajax/markup/html/navigation/paging/AjaxPagingNavigationIncrementLink.java =================================================================== --- src/java/wicket/ajax/markup/html/navigation/paging/AjaxPagingNavigationIncrementLink.java (revision 6237) +++ src/java/wicket/ajax/markup/html/navigation/paging/AjaxPagingNavigationIncrementLink.java (working copy) @@ -20,6 +20,7 @@ import wicket.MarkupContainer; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.ajax.markup.html.IAjaxLink; import wicket.markup.html.navigation.paging.IPageable; import wicket.markup.html.navigation.paging.PagingNavigationIncrementLink; @@ -69,7 +70,7 @@ final IPageable pageable, final int increment) { super(parent, id, pageable, increment); - add(new AjaxPagingNavigationBehavior(this, pageable, "onclick")); + add(new AjaxPagingNavigationBehavior(this, pageable, ClientEvent.CLICK)); setOutputMarkupId(true); } Index: src/java/wicket/ajax/markup/html/navigation/paging/AjaxPagingNavigationLink.java =================================================================== --- src/java/wicket/ajax/markup/html/navigation/paging/AjaxPagingNavigationLink.java (revision 6237) +++ src/java/wicket/ajax/markup/html/navigation/paging/AjaxPagingNavigationLink.java (working copy) @@ -20,6 +20,7 @@ import wicket.MarkupContainer; import wicket.ajax.AjaxRequestTarget; +import wicket.ajax.ClientEvent; import wicket.ajax.markup.html.IAjaxLink; import wicket.markup.html.navigation.paging.IPageable; import wicket.markup.html.navigation.paging.PagingNavigationLink; @@ -53,7 +54,7 @@ final IPageable pageable, final int pageNumber) { super(parent, id, pageable, pageNumber); - add(new AjaxPagingNavigationBehavior(this, pageable, "onclick")); + add(new AjaxPagingNavigationBehavior(this, pageable, ClientEvent.CLICK)); setOutputMarkupId(true); } Index: src/test/wicket/ajax/AjaxEventBehaviorTest.java =================================================================== --- src/test/wicket/ajax/AjaxEventBehaviorTest.java (revision 0) +++ src/test/wicket/ajax/AjaxEventBehaviorTest.java (revision 0) @@ -0,0 +1,98 @@ +/* + * $Id: org.eclipse.jdt.ui.prefs 5004 2006-03-17 20:47:08 -0800 (Fri, 17 Mar + * 2006) eelco12 $ $Revision: 5004 $ $Date: 2006-03-17 20:47:08 -0800 (Fri, 17 + * Mar 2006) $ + * + * ============================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package wicket.ajax; + +import wicket.WicketTestCase; +import wicket.markup.html.basic.Label; + +/** + * + * + * @author Frank Bille + */ +public class AjaxEventBehaviorTest extends WicketTestCase +{ + private boolean eventExecuted; + + public AjaxEventBehaviorTest() + { + super("Test of AjaxEventBehavior"); + } + + + @Override + protected void setUp() throws Exception + { + eventExecuted = false; + + super.setUp(); + } + + + /** + * Test constructor with valid input + */ + public void testConstructorWithValidInput() + { + AjaxEventBehavior ajaxEventBehavior = new AjaxEventBehavior(ClientEvent.DBLCLICK) + { + private static final long serialVersionUID = 1L; + + @Override + protected void onEvent(AjaxRequestTarget target) + { + eventExecuted = true; + } + }; + + MockPageWithPlaceholder page = new MockPageWithPlaceholder(); + Label label = new Label(page, "component"); + label.add(ajaxEventBehavior); + + ajaxEventBehavior.onRequest(); + + assertTrue(eventExecuted); + } + + /** + * Test constructor with invalid input + */ + public void testConstructorWithInvalidInput() + { + try + { + new AjaxEventBehavior(null) + { + private static final long serialVersionUID = 1L; + + @Override + protected void onEvent(AjaxRequestTarget target) + { + eventExecuted = true; + } + }; + + fail("When null is given as input to the constructor, a IllegalArgumentException should be thrown."); + } + catch (IllegalArgumentException e) + { + // expected + } + } +} Index: src/test/wicket/ajax/MockPageWithPlaceholder.html =================================================================== --- src/test/wicket/ajax/MockPageWithPlaceholder.html (revision 0) +++ src/test/wicket/ajax/MockPageWithPlaceholder.html (revision 0) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Insert title here</title> +</head> +<body> +<div wicket:id="component"></div> +</body> +</html> \ No newline at end of file Index: src/test/wicket/ajax/MockPageWithPlaceholder.java =================================================================== --- src/test/wicket/ajax/MockPageWithPlaceholder.java (revision 0) +++ src/test/wicket/ajax/MockPageWithPlaceholder.java (revision 0) @@ -0,0 +1,27 @@ +/* + * $Id: org.eclipse.jdt.ui.prefs 5004 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) eelco12 $ + * $Revision: 5004 $ + * $Date: 2006-03-17 20:47:08 -0800 (Fri, 17 Mar 2006) $ + * + * ============================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package wicket.ajax; + +import wicket.markup.html.WebPage; + +public class MockPageWithPlaceholder extends WebPage +{ + private static final long serialVersionUID = 1L; + +} Index: src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html =================================================================== --- src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html (revision 6237) +++ src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html (working copy) @@ -7,7 +7,7 @@ <script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-drag.js"></script> <script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script> </head><body> - <span wicket:id="ajaxLabel" id="ajaxLabel">UpdateMe</span> - <a href="javascript:var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });" wicket:id="ajaxLink" id="ajaxLink">Update</a> + <span id="ajaxLabel" wicket:id="ajaxLabel">UpdateMe</span> + <a href="javascript:var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });" id="ajaxLink" wicket:id="ajaxLink">Update</a> </body> </html> Index: src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java =================================================================== --- src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java (revision 6237) +++ src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java (working copy) @@ -56,7 +56,7 @@ executeTest(AjaxLinkWithBorderPage.class, "AjaxLinkWithBorderPageExpectedResult.html"); Page page = application.getLastRenderedPage(); - Component ajaxLink = page.get("ajaxLink"); + Component ajaxLink = page.get("border:ajaxLink"); AbstractAjaxBehavior behavior = (AbstractAjaxBehavior)ajaxLink.getBehaviors().get(0); executedBehavior(AjaxPage2.class, behavior, "AjaxLinkWithBorderPage-1ExpectedResult.html"); @@ -71,7 +71,7 @@ executeTest(AjaxPage2.class, "AjaxPage2_ExpectedResult.html"); Page page = application.getLastRenderedPage(); - Component ajaxLink = page.get("ajaxLink"); + Component ajaxLink = page.get("pageLayout:ajaxLink"); AbstractAjaxBehavior behavior = (AbstractAjaxBehavior)ajaxLink.getBehaviors().get(0); executedBehavior(AjaxPage2.class, behavior, "AjaxPage2-1_ExpectedResult.html"); Index: src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPage-1ExpectedResult.html =================================================================== --- src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPage-1ExpectedResult.html (revision 6237) +++ src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPage-1ExpectedResult.html (working copy) @@ -1 +1 @@ -<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="ajaxLabel" ><![CDATA[<span wicket:id="ajaxLabel" id="ajaxLabel">Updated!</span>]]></component></ajax-response> \ No newline at end of file +<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="border_ajaxLabel" ><![CDATA[<span id="border_ajaxLabel" wicket:id="ajaxLabel">Updated!</span>]]></component></ajax-response> \ No newline at end of file Index: src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPage.java =================================================================== --- src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPage.java (revision 6237) +++ src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPage.java (working copy) @@ -38,11 +38,12 @@ */ public AjaxLinkWithBorderPage() { - new AjaxTestBorder(this, "border").setTransparentResolver(true); + AjaxTestBorder ajaxTestBorder = new AjaxTestBorder(this, "border"); + ajaxTestBorder.setTransparentResolver(true); - final Label label = new Label(this, "ajaxLabel", new PropertyModel(this, "labelText")); + final Label label = new Label(ajaxTestBorder, "ajaxLabel", new PropertyModel(this, "labelText")); label.setOutputMarkupId(true); - new AjaxLink(this, "ajaxLink") + new AjaxLink(ajaxTestBorder, "ajaxLink") { private static final long serialVersionUID = 1L; Index: src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html =================================================================== --- src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html (revision 6237) +++ src/test/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html (working copy) @@ -10,8 +10,8 @@ <span wicket:id="border"><wicket:border> Border <wicket:body> - <span wicket:id="ajaxLabel" id="ajaxLabel">UpdateMe</span> - <a href="javascript:var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });" wicket:id="ajaxLink" id="ajaxLink">Update</a> + <span id="border_ajaxLabel" wicket:id="ajaxLabel">UpdateMe</span> + <a href="javascript:var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:border:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });" id="border_ajaxLink" wicket:id="ajaxLink">Update</a> </wicket:body> Border </wicket:border></span> Index: src/test/wicket/ajax/markup/html/ajaxLink/AjaxPage2-1_ExpectedResult.html =================================================================== --- src/test/wicket/ajax/markup/html/ajaxLink/AjaxPage2-1_ExpectedResult.html (revision 6237) +++ src/test/wicket/ajax/markup/html/ajaxLink/AjaxPage2-1_ExpectedResult.html (working copy) @@ -1 +1 @@ -<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="ajaxLabel" ><![CDATA[<span wicket:id="ajaxLabel" id="ajaxLabel">BBBBBBB</span>]]></component></ajax-response> \ No newline at end of file +<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="ajaxLabel" ><![CDATA[<span id="pageLayout_ajaxLabel" wicket:id="ajaxLabel">BBBBBBB</span>]]></component></ajax-response> \ No newline at end of file Index: src/test/wicket/ajax/markup/html/ajaxLink/AjaxPage2.java =================================================================== --- src/test/wicket/ajax/markup/html/ajaxLink/AjaxPage2.java (revision 6237) +++ src/test/wicket/ajax/markup/html/ajaxLink/AjaxPage2.java (working copy) @@ -43,10 +43,10 @@ myBorder = new BoxBorder(this, "pageLayout"); myBorder.setTransparentResolver(true); - ajaxLabel = new Label(this, "ajaxLabel", "AAAAAAA"); + ajaxLabel = new Label(myBorder, "ajaxLabel", "AAAAAAA"); ajaxLabel.setOutputMarkupId(true); - new AjaxLink(this, "ajaxLink") + new AjaxLink(myBorder, "ajaxLink") { private static final long serialVersionUID = 1L; Index: src/test/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html =================================================================== --- src/test/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html (revision 6237) +++ src/test/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html (working copy) @@ -15,8 +15,8 @@ <tr> <td width = "100%"> <wicket:body> - <span wicket:id="ajaxLabel" id="ajaxLabel">AAAAAAA</span> - <a href="javascript:var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });" wicket:id="ajaxLink" id="ajaxLink">Update</a> + <span id="pageLayout_ajaxLabel" wicket:id="ajaxLabel">AAAAAAA</span> + <a href="javascript:var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:pageLayout:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });" id="pageLayout_ajaxLink" wicket:id="ajaxLink">Update</a> </wicket:body> </td> </tr> Index: src/test/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html =================================================================== --- src/test/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html (revision 6237) +++ src/test/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html (working copy) @@ -1 +1 @@ -<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="testPanel_baseSpan_linja1" ><![CDATA[<span wicket:id="linja1" id="testPanel_baseSpan_linja1">1</span>]]></component><evaluate><![CDATA[setTimeout(function() { var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:testPanel:baseSpan:linja1:-1:IUnversionedBehaviorListener&wicket:behaviorId=0', function() { }, function() { }); }, 2000);]]></evaluate></ajax-response> \ No newline at end of file +<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="testPanel_baseSpan_linja1" ><![CDATA[<span id="testPanel_baseSpan_linja1" wicket:id="linja1">1</span>]]></component><evaluate><![CDATA[setTimeout(function() { var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:testPanel:baseSpan:linja1:-1:IUnversionedBehaviorListener&wicket:behaviorId=0', function() { }, function() { }); }, 2000);]]></evaluate></ajax-response> \ No newline at end of file Index: src/test/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html =================================================================== --- src/test/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html (revision 6237) +++ src/test/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html (working copy) @@ -13,7 +13,7 @@ <span wicket:id="testPanel"><wicket:panel> <span wicket:id="baseSpan"> <wicket:child><wicket:extend> - this counter should update every 2 seconds: <span wicket:id="linja1" id="testPanel_baseSpan_linja1">0</span> + this counter should update every 2 seconds: <span id="testPanel_baseSpan_linja1" wicket:id="linja1">0</span> </wicket:extend></wicket:child> </span> </wicket:panel></span>
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Wicket-develop mailing list Wicket-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-develop