You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by kn...@apache.org on 2007/10/04 22:14:51 UTC
svn commit: r581999 - in
/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket:
RequestCycle.java ajax/AbstractDefaultAjaxBehavior.java
ajax/AjaxRequestTarget.java util/tester/BaseWicketTester.java
Author: knopp
Date: Thu Oct 4 13:14:50 2007
New Revision: 581999
URL: http://svn.apache.org/viewvc?rev=581999&view=rev
Log:
WICKET-1042
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java?rev=581999&r1=581998&r2=581999&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java Thu Oct 4 13:14:50 2007
@@ -257,8 +257,8 @@
/**
* Boolean if the next to be encoded url is targetting a new window (ModalWindow, popup, tab).
- * This temporary flag is specifically needed for portlet-support as then such a page needs a special target (Resource) url.
- * After each urlFor call, this flag is reset to false.
+ * This temporary flag is specifically needed for portlet-support as then such a page needs a
+ * special target (Resource) url. After each urlFor call, this flag is reset to false.
*/
private transient boolean urlForNewWindowEncoding;
@@ -625,6 +625,29 @@
}
/**
+ * Atempts to return name of current page map
+ *
+ * @return
+ */
+ private String getCurrentPageMap()
+ {
+ IRequestTarget target = RequestCycle.get().getRequestTarget();
+ if (target instanceof IPageRequestTarget)
+ {
+ Page page = ((IPageRequestTarget)target).getPage();
+ return page != null ? page.getPageMapName() : null;
+ }
+ else if (target instanceof IBookmarkablePageRequestTarget)
+ {
+ return ((IBookmarkablePageRequestTarget)target).getPageMapName();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
* Convenience method that sets page class as the response. This will generate a redirect to the
* page with a bookmarkable url
*
@@ -646,7 +669,25 @@
*/
public final void setResponsePage(final Class pageClass, final PageParameters pageParameters)
{
- IRequestTarget target = new BookmarkablePageRequestTarget(pageClass, pageParameters);
+ setResponsePage(pageClass, pageParameters, getCurrentPageMap());
+ }
+
+ /**
+ * Sets the page class with optionally the page parameters and page map name as the render
+ * target of this request.
+ *
+ * @param pageClass
+ * The page class to render as a response
+ * @param pageParameters
+ * The page parameters that gets appended to the bookmarkable url,
+ * @param pageMapName
+ * The pagemap in which the response page should be created
+ */
+ public final void setResponsePage(final Class pageClass, final PageParameters pageParameters,
+ final String pageMapName)
+ {
+ IRequestTarget target = new BookmarkablePageRequestTarget(pageMapName, pageClass,
+ pageParameters);
setRequestTarget(target);
}
@@ -672,25 +713,27 @@
}
/**
- * @return true if the next to be encoded url is targetting a new window (ModalWindow, popup, tab).
+ * @return true if the next to be encoded url is targetting a new window (ModalWindow, popup,
+ * tab).
*/
public final boolean isUrlForNewWindowEncoding()
{
return urlForNewWindowEncoding;
}
-
+
/**
* Indicate if the next to be encoded url is targetting a new window (ModalWindow, popup, tab).
- * This temporary flag is specifically needed for portlet-support as then such a page needs a special target (Resource) url.
- * After each urlFor call, this flag is reset to false.
+ * This temporary flag is specifically needed for portlet-support as then such a page needs a
+ * special target (Resource) url. After each urlFor call, this flag is reset to false.
*/
public final void setUrlForNewWindowEncoding()
{
urlForNewWindowEncoding = true;
}
-
+
/**
- * Returns an encoded URL that references the given request target and clears the urlForNewWindowEncoding flag.
+ * Returns an encoded URL that references the given request target and clears the
+ * urlForNewWindowEncoding flag.
*
* @param requestTarget
* the request target to reference
@@ -702,7 +745,7 @@
urlForNewWindowEncoding = false;
return url;
}
-
+
/**
* Returns a bookmarkable URL that references a given page class using a given set of page
* parameters. Since the URL which is returned contains all information necessary to instantiate
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java?rev=581999&r1=581998&r2=581999&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AbstractDefaultAjaxBehavior.java Thu Oct 4 13:14:50 2007
@@ -277,7 +277,7 @@
*/
public final void onRequest()
{
- AjaxRequestTarget target = new AjaxRequestTarget();
+ AjaxRequestTarget target = new AjaxRequestTarget(getComponent().getPage());
RequestCycle.get().setRequestTarget(target);
respond(target);
}
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java?rev=581999&r1=581998&r2=581999&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java Thu Oct 4 13:14:50 2007
@@ -29,7 +29,6 @@
import org.apache.wicket.Application;
import org.apache.wicket.Component;
-import org.apache.wicket.IRequestTarget;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.Page;
import org.apache.wicket.RequestCycle;
@@ -44,6 +43,7 @@
import org.apache.wicket.markup.parser.filter.HtmlHeaderSectionHandler;
import org.apache.wicket.markup.repeater.AbstractRepeater;
import org.apache.wicket.protocol.http.WebResponse;
+import org.apache.wicket.request.target.component.IPageRequestTarget;
import org.apache.wicket.util.string.AppendingStringBuffer;
import org.apache.wicket.util.string.Strings;
import org.slf4j.Logger;
@@ -78,7 +78,7 @@
* @author Igor Vaynberg (ivaynberg)
* @author Eelco Hillenius
*/
-public class AjaxRequestTarget implements IRequestTarget
+public class AjaxRequestTarget implements IPageRequestTarget
{
/**
* An {@link AjaxRequestTarget} listener that can be used to respond to various target-related
@@ -248,11 +248,21 @@
/** a list of listeners */
private List listeners = null;
+ private final Page page;
+
+ public Page getPage()
+ {
+ return page;
+ }
+
/**
* Constructor
+ *
+ * @param page
*/
- public AjaxRequestTarget()
+ public AjaxRequestTarget(Page page)
{
+ this.page = page;
Response response = RequestCycle.get().getResponse();
encodingBodyResponse = new AjaxResponse(response);
encodingHeaderResponse = new AjaxResponse(response);
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java?rev=581999&r1=581998&r2=581999&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java Thu Oct 4 13:14:50 2007
@@ -67,12 +67,12 @@
/**
- * A helper to ease unit testing of Wicket applications without the need for a
- * servlet container. See javadoc of WicketTester for example usage. This class
- * can be used as is, but JUnit users should use derived class WicketTester.
- *
+ * A helper to ease unit testing of Wicket applications without the need for a servlet container.
+ * See javadoc of WicketTester for example usage. This class can be used as is, but JUnit users
+ * should use derived class WicketTester.
+ *
* @see WicketTester
- *
+ *
* @author Ingram Chen
* @author Juergen Donnerstag
* @author Frank Bille
@@ -92,7 +92,7 @@
/**
* Construct.
- *
+ *
* @param page
*/
private TestPageSource(Page page)
@@ -120,7 +120,7 @@
{
// Do nothing.
}
-
+
protected ISessionStore newSessionStore()
{
// Don't use a filestore, or we spawn lots of threads, which makes things slow.
@@ -129,8 +129,8 @@
}
/**
- * Create WicketTester and automatically create a WebApplication, but the
- * tester will have no home page.
+ * Create WicketTester and automatically create a WebApplication, but the tester will have no
+ * home page.
*/
public BaseWicketTester()
{
@@ -139,7 +139,7 @@
/**
* Create WicketTester and automatically create a WebApplication.
- *
+ *
* @param homePage
*/
public BaseWicketTester(final Class homePage)
@@ -158,19 +158,19 @@
{
// Do nothing.
}
-
+
protected ISessionStore newSessionStore()
{
// Don't use a filestore, or we spawn lots of threads, which makes things slow.
return new HttpSessionStore(this);
}
-
+
}, null);
}
/**
* Create WicketTester
- *
+ *
* @param application
* The wicket tester object
*/
@@ -181,15 +181,15 @@
/**
* Create WicketTester to help unit testing
- *
+ *
* @param application
* The wicket tester object
* @param path
- * The absolute path on disk to the web application contents
- * (e.g. war root) - may be null
- *
+ * The absolute path on disk to the web application contents (e.g. war root) - may be
+ * null
+ *
* @see org.apache.wicket.protocol.http.MockWebApplication#MockWebApplication(
- org.apache.wicket.protocol.http.WebApplication, String)
+ * org.apache.wicket.protocol.http.WebApplication, String)
*/
public BaseWicketTester(final WebApplication application, final String path)
{
@@ -197,10 +197,10 @@
}
/**
- * Render a page defined in <code>TestPageSource</code>. This is usually
- * used when a page does not have default constructor. For example, a
- * <code>ViewBook</code> page requires a <code>Book</code> instance:
- *
+ * Render a page defined in <code>TestPageSource</code>. This is usually used when a page
+ * does not have default constructor. For example, a <code>ViewBook</code> page requires a
+ * <code>Book</code> instance:
+ *
* <pre>
* tester.startPage(new TestPageSource()
* {
@@ -211,7 +211,7 @@
* }
* });
* </pre>
- *
+ *
* @param testPageSource
* a page factory that creating test page instance
* @return Page rendered page
@@ -227,9 +227,9 @@
}
/**
- * Builds and processes a request suitable for invoking a listener. The
- * component must implement any of the known *Listener interfaces.
- *
+ * Builds and processes a request suitable for invoking a listener. The component must implement
+ * any of the known *Listener interfaces.
+ *
* @param component
* the listener to invoke
*/
@@ -242,7 +242,7 @@
/**
* Builds and processes a request suitable for executing an ajax behavior.
- *
+ *
* @param behavior
* the ajax behavior to execute
*/
@@ -259,7 +259,7 @@
/**
* Render the page
- *
+ *
* @param page
* @return The page rendered
*/
@@ -270,7 +270,7 @@
/**
* Render a page from its default constructor.
- *
+ *
* @param pageClass
* a test page class with default constructor
* @return Page Rendered Page
@@ -283,9 +283,8 @@
/**
* create a {@link FormTester} for the form at path, and fill all child
- * {@link org.apache.wicket.markup.html.form.FormComponent}s with blank
- * String initially.
- *
+ * {@link org.apache.wicket.markup.html.form.FormComponent}s with blank String initially.
+ *
* @param path
* path to {@link Form} component
* @return FormTester A FormTester instance for testing form
@@ -298,13 +297,13 @@
/**
* create a {@link FormTester} for the form at path.
- *
+ *
* @param path
* path to {@link Form} component
* @param fillBlankString
* specify whether fill all child
- * {@link org.apache.wicket.markup.html.form.FormComponent}s
- * with blankString initially.
+ * {@link org.apache.wicket.markup.html.form.FormComponent}s with blankString
+ * initially.
* @return FormTester A FormTester instance for testing form
* @see FormTester
*/
@@ -315,9 +314,9 @@
}
/**
- * Render a panel defined in <code>TestPanelSource</code>. The usage is
- * similar with {@link #startPage(ITestPageSource)}. Please note that
- * testing panel must use supplied <code>panelId<code> as component id.
+ * Render a panel defined in <code>TestPanelSource</code>. The usage is similar with
+ * {@link #startPage(ITestPageSource)}. Please note that testing panel must use supplied
+ * <code>panelId<code> as component id.
*
* <pre>
* tester.startPanel(new TestPanelSource()
@@ -349,10 +348,9 @@
/**
* Render a panel from <code>Panel(String id)</code> constructor.
- *
+ *
* @param panelClass
- * a test panel class with <code>Panel(String id)</code>
- * constructor
+ * a test panel class with <code>Panel(String id)</code> constructor
* @return Panel rendered panel
*/
public final Panel startPanel(final Class panelClass)
@@ -400,33 +398,32 @@
}).get(DummyPanelPage.TEST_PANEL_ID);
}
- /**
- * A helper method for starting a component for a test without attaching it to a Page.
- *
- * Components which are somehow dependent on the page structure can not be currently tested
- * with this method.
- *
- * Example:
- *
- * UserDataView view = new UserDataView("view", new ListDataProvider(userList));
- * tester.startComponent(view);
- * assertEquals(4, view.size());
- *
- * @param component
- */
- public void startComponent(Component component)
- {
- component.attach();
- if (component instanceof FormComponent)
- {
- ((FormComponent) component).processInput();
- }
- component.beforeRender();
- }
+ /**
+ * A helper method for starting a component for a test without attaching it to a Page.
+ *
+ * Components which are somehow dependent on the page structure can not be currently tested with
+ * this method.
+ *
+ * Example:
+ *
+ * UserDataView view = new UserDataView("view", new ListDataProvider(userList));
+ * tester.startComponent(view); assertEquals(4, view.size());
+ *
+ * @param component
+ */
+ public void startComponent(Component component)
+ {
+ component.attach();
+ if (component instanceof FormComponent)
+ {
+ ((FormComponent)component).processInput();
+ }
+ component.beforeRender();
+ }
/**
* Throw "standard" WicketRuntimeException
- *
+ *
* @param e
* @return RuntimeException
*/
@@ -436,10 +433,10 @@
}
/**
- * Gets the component with the given path from last rendered page. This
- * method fails in case the component couldn't be found, and it will return
- * null if the component was found, but is not visible.
- *
+ * Gets the component with the given path from last rendered page. This method fails in case the
+ * component couldn't be found, and it will return null if the component was found, but is not
+ * visible.
+ *
* @param path
* Path to component
* @return The component at the path
@@ -450,8 +447,8 @@
final Component component = getLastRenderedPage().get(path);
if (component == null)
{
- fail("path: '" + path + "' does not exist for page: "
- + Classes.simpleName(getLastRenderedPage().getClass()));
+ fail("path: '" + path + "' does not exist for page: " +
+ Classes.simpleName(getLastRenderedPage().getClass()));
return component;
}
if (component.isVisibleInHierarchy())
@@ -463,7 +460,7 @@
/**
* assert the text of <code>Label</code> component.
- *
+ *
* @param path
* path to <code>Label</code> component
* @param expectedLabelText
@@ -478,7 +475,7 @@
/**
* assert <code>PageLink</code> link to page class.
- *
+ *
* @param path
* path to <code>PageLink</code> component
* @param expectedPageClass
@@ -511,7 +508,7 @@
/**
* assert component class
- *
+ *
* @param path
* path to component
* @param expectedComponentClass
@@ -521,14 +518,14 @@
public Result isComponent(String path, Class expectedComponentClass)
{
Component component = getComponentFromLastRenderedPage(path);
- return isTrue("component '" + Classes.simpleName(component.getClass()) + "' is not type:"
- + Classes.simpleName(expectedComponentClass), expectedComponentClass
+ return isTrue("component '" + Classes.simpleName(component.getClass()) + "' is not type:" +
+ Classes.simpleName(expectedComponentClass), expectedComponentClass
.isAssignableFrom(component.getClass()));
}
/**
* assert component visible.
- *
+ *
* @param path
* path to component
* @return
@@ -538,8 +535,8 @@
Component component = getLastRenderedPage().get(path);
if (component == null)
{
- fail("path: '" + path + "' does no exist for page: "
- + Classes.simpleName(getLastRenderedPage().getClass()));
+ fail("path: '" + path + "' does no exist for page: " +
+ Classes.simpleName(getLastRenderedPage().getClass()));
}
return isTrue("component '" + path + "' is not visible", component.isVisible());
@@ -547,7 +544,7 @@
/**
* assert component invisible.
- *
+ *
* @param path
* path to component
* @return
@@ -559,7 +556,7 @@
/**
* assert the content of last rendered page contains(matches) regex pattern.
- *
+ *
* @param pattern
* reqex pattern to match
* @return
@@ -572,7 +569,7 @@
/**
* assert the model of {@link ListView} use expectedList
- *
+ *
* @param path
* path to {@link ListView} component
* @param expectedList
@@ -588,7 +585,7 @@
* Click the {@link Link} in the last rendered Page.
* <p>
* Simulate that AJAX is enabled.
- *
+ *
* @see WicketTester#clickLink(String, boolean)
* @param path
* Click the <code>Link</code> in the last rendered Page.
@@ -601,33 +598,28 @@
/**
* Click the {@link Link} in the last rendered Page.
* <p>
- * This method also works for {@link AjaxLink}, {@link AjaxFallbackLink}
- * and {@link AjaxSubmitLink}.
+ * This method also works for {@link AjaxLink}, {@link AjaxFallbackLink} and
+ * {@link AjaxSubmitLink}.
* <p>
- * On AjaxLinks and AjaxFallbackLinks the onClick method is invoked with a
- * valid AjaxRequestTarget. In that way you can test the flow of your
- * application when using AJAX.
+ * On AjaxLinks and AjaxFallbackLinks the onClick method is invoked with a valid
+ * AjaxRequestTarget. In that way you can test the flow of your application when using AJAX.
* <p>
- * When clicking an AjaxSubmitLink the form, which the AjaxSubmitLink is
- * attached to is first submitted, and then the onSubmit method on
- * AjaxSubmitLink is invoked. If you have changed some values in the form
- * during your test, these will also be submitted. This should not be used
- * as a replacement for the {@link FormTester} to test your forms. It should
- * be used to test that the code in your onSubmit method in AjaxSubmitLink
- * actually works.
+ * When clicking an AjaxSubmitLink the form, which the AjaxSubmitLink is attached to is first
+ * submitted, and then the onSubmit method on AjaxSubmitLink is invoked. If you have changed
+ * some values in the form during your test, these will also be submitted. This should not be
+ * used as a replacement for the {@link FormTester} to test your forms. It should be used to
+ * test that the code in your onSubmit method in AjaxSubmitLink actually works.
* <p>
- * This method is also able to simulate that AJAX (javascript) is disabled
- * on the client. This is done by setting the isAjax parameter to false. If
- * you have an AjaxFallbackLink you can then check that it doesn't fail when
- * invoked as a normal link.
- *
+ * This method is also able to simulate that AJAX (javascript) is disabled on the client. This
+ * is done by setting the isAjax parameter to false. If you have an AjaxFallbackLink you can
+ * then check that it doesn't fail when invoked as a normal link.
+ *
* @param path
* path to <code>Link</code> component
* @param isAjax
- * Whether to simulate that AJAX (javascript) is enabled or not.
- * If it's false then AjaxLink and AjaxSubmitLink will fail,
- * since it wouldn't work in real life. AjaxFallbackLink will be
- * invoked with null as the AjaxRequestTarget parameter.
+ * Whether to simulate that AJAX (javascript) is enabled or not. If it's false then
+ * AjaxLink and AjaxSubmitLink will fail, since it wouldn't work in real life.
+ * AjaxFallbackLink will be invoked with null as the AjaxRequestTarget parameter.
*/
public void clickLink(String path, boolean isAjax)
{
@@ -640,15 +632,15 @@
// If it's not ajax we fail
if (isAjax == false)
{
- fail("Link " + path + "is an AjaxLink and will "
- + "not be invoked when AJAX (javascript) is disabled.");
+ fail("Link " + path + "is an AjaxLink and will " +
+ "not be invoked when AJAX (javascript) is disabled.");
}
AjaxLink link = (AjaxLink)linkComponent;
setupRequestAndResponse();
RequestCycle requestCycle = createRequestCycle();
- AjaxRequestTarget target = new AjaxRequestTarget();
+ AjaxRequestTarget target = new AjaxRequestTarget(link.getPage());
requestCycle.setRequestTarget(target);
link.onClick(target);
@@ -665,7 +657,7 @@
setupRequestAndResponse();
RequestCycle requestCycle = createRequestCycle();
- AjaxRequestTarget target = new AjaxRequestTarget();
+ AjaxRequestTarget target = new AjaxRequestTarget(link.getPage());
requestCycle.setRequestTarget(target);
link.onClick(target);
@@ -680,8 +672,8 @@
// If it's not ajax we fail
if (isAjax == false)
{
- fail("Link " + path + "is an AjaxSubmitLink and "
- + "will not be invoked when AJAX (javascript) is disabled.");
+ fail("Link " + path + "is an AjaxSubmitLink and " +
+ "will not be invoked when AJAX (javascript) is disabled.");
}
AjaxSubmitLink link = (AjaxSubmitLink)linkComponent;
@@ -720,8 +712,8 @@
AbstractLink link = (AbstractLink)linkComponent;
/*
- * If the link is a bookmarkable link, then we need to transfer the
- * parameters to the next request.
+ * If the link is a bookmarkable link, then we need to transfer the parameters to the
+ * next request.
*/
if (link instanceof BookmarkablePageLink)
{
@@ -753,7 +745,7 @@
/**
* submit the <code>Form</code> in the last rendered Page.
- *
+ *
* @param path
* path to <code>Form</code> component
*/
@@ -764,10 +756,9 @@
}
/**
- * Sets a parameter for the component with the given path to be used with
- * the next request. NOTE: this method only works when a page was rendered
- * first.
- *
+ * Sets a parameter for the component with the given path to be used with the next request.
+ * NOTE: this method only works when a page was rendered first.
+ *
* @param componentPath
* path of the component
* @param value
@@ -800,10 +791,9 @@
/**
* assert last rendered Page class
- *
- * FIXME explain why the code is so complicated to compare two classes, or
- * simplify
- *
+ *
+ * FIXME explain why the code is so complicated to compare two classes, or simplify
+ *
* @param expectedRenderedPageClass
* expected class of last renered page
* @return
@@ -826,10 +816,10 @@
/**
* assert last rendered Page against an expected HTML document
* <p>
- * Use <code>-Dwicket.replace.expected.results=true</code> to
- * automatically replace the expected output file.
+ * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the
+ * expected output file.
* </p>
- *
+ *
* @param pageClass
* Used to load the file (relative to clazz package)
* @param filename
@@ -845,7 +835,7 @@
/**
* assert last rendered Page against an expected HTML document as a String
- *
+ *
* @param expectedDocument
* Expected output
* @return
@@ -860,31 +850,31 @@
/**
* assert no error feedback messages
- *
+ *
* @return
*/
public Result hasNoErrorMessage()
{
List messages = getMessages(FeedbackMessage.ERROR);
- return isTrue("expect no error message, but contains\n"
- + WicketTesterHelper.asLined(messages), messages.isEmpty());
+ return isTrue("expect no error message, but contains\n" +
+ WicketTesterHelper.asLined(messages), messages.isEmpty());
}
/**
* assert no info feedback messages
- *
+ *
* @return
*/
public Result hasNoInfoMessage()
{
List messages = getMessages(FeedbackMessage.INFO);
- return isTrue("expect no info message, but contains\n"
- + WicketTesterHelper.asLined(messages), messages.isEmpty());
+ return isTrue("expect no info message, but contains\n" +
+ WicketTesterHelper.asLined(messages), messages.isEmpty());
}
/**
* get feedback messages
- *
+ *
* @param level
* level of feedback message, ex.
* <code>FeedbackMessage.DEBUG or FeedbackMessage.INFO.. etc</code>
@@ -930,10 +920,9 @@
/**
* Dump the component trees to log.
- *
+ *
* @param filter
- * Show only the components, which path contains the
- * filterstring.
+ * Show only the components, which path contains the filterstring.
*/
public void debugComponentTrees(String filter)
{
@@ -951,13 +940,13 @@
/**
* Test that a component has been added to a AjaxRequestTarget, using
- * {@link AjaxRequestTarget#addComponent(Component)}. This method actually
- * tests that a component is on the AJAX response sent back to the client.
+ * {@link AjaxRequestTarget#addComponent(Component)}. This method actually tests that a
+ * component is on the AJAX response sent back to the client.
* <p>
- * PLEASE NOTE! This method doesn't actually insert the component in the
- * client DOM tree, using javascript. But it shouldn't be needed because you
- * have to trust that the Wicket Ajax Javascript just works.
- *
+ * PLEASE NOTE! This method doesn't actually insert the component in the client DOM tree, using
+ * javascript. But it shouldn't be needed because you have to trust that the Wicket Ajax
+ * Javascript just works.
+ *
* @param component
* The component to test whether it's on the response.
* @return
@@ -993,23 +982,22 @@
}
// Look for that the component is on the response, using the markup id
- boolean isComponentInAjaxResponse = ajaxResponse.matches("(?s).*<component id=\"" + markupId
- + "\" ?>.*");
+ boolean isComponentInAjaxResponse = ajaxResponse.matches("(?s).*<component id=\"" +
+ markupId + "\" ?>.*");
failMessage = "Component wasn't found in the AJAX response";
return isTrue(failMessage, isComponentInAjaxResponse);
}
/**
* Simulate that an AJAX event has been fired.
- *
+ *
* @see #executeAjaxEvent(Component, String)
- *
+ *
* @since 1.2.3
* @param componentPath
* The component path.
* @param event
- * The event which we simulate is fired. If the event is null,
- * the test will fail.
+ * The event which we simulate is fired. If the event is null, the test will fail.
*/
public void executeAjaxEvent(String componentPath, String event)
{
@@ -1018,9 +1006,8 @@
}
/**
- * Simulate that an AJAX event has been fired. You add an AJAX event to a
- * component by using:
- *
+ * Simulate that an AJAX event has been fired. You add an AJAX event to a component by using:
+ *
* <pre>
* ...
* component.add(new AjaxEventBehavior("ondblclick") {
@@ -1028,30 +1015,29 @@
* });
* ...
* </pre>
- *
- * You can then test that the code inside onEvent actually does what it's
- * supposed to, using the WicketTester:
- *
+ *
+ * You can then test that the code inside onEvent actually does what it's supposed to, using the
+ * WicketTester:
+ *
* <pre>
* ...
* tester.executeAjaxEvent(component, "ondblclick");
* // Test that the code inside onEvent is correct.
* ...
* </pre>
- *
- * This also works with AjaxFormSubmitBehavior, where it will "submit" the
- * form before executing the command.
+ *
+ * This also works with AjaxFormSubmitBehavior, where it will "submit" the form before executing
+ * the command.
* <p>
- * PLEASE NOTE! This method doesn't actually insert the component in the
- * client DOM tree, using javascript.
- *
- *
+ * PLEASE NOTE! This method doesn't actually insert the component in the client DOM tree, using
+ * javascript.
+ *
+ *
* @param component
- * The component which has the AjaxEventBehavior we wan't to
- * test. If the component is null, the test will fail.
+ * The component which has the AjaxEventBehavior we wan't to test. If the component
+ * is null, the test will fail.
* @param event
- * The event which we simulate is fired. If the event is null,
- * the test will fail.
+ * The event which we simulate is fired. If the event is null, the test will fail.
*/
public void executeAjaxEvent(Component component, String event)
{
@@ -1083,11 +1069,12 @@
// If there haven't been found any event behaviors on the component
// which maches the parameters we fail.
- failMessage = "No AjaxEventBehavior found on component: " + component.getId()
- + " which matches the event: " + event.toString();
+ failMessage = "No AjaxEventBehavior found on component: " + component.getId() +
+ " which matches the event: " + event.toString();
notNull(failMessage, ajaxEventBehavior);
- // initialize the request only if needed to allow the user to pass request parameters, see WICKET-254
+ // initialize the request only if needed to allow the user to pass request parameters, see
+ // WICKET-254
WebRequestCycle requestCycle;
if (RequestCycle.get() == null)
{
@@ -1112,9 +1099,9 @@
}
/**
- * Get a TagTester based on a wicket:id. If more components exists with the
- * same wicket:id in the markup only the first one is returned.
- *
+ * Get a TagTester based on a wicket:id. If more components exists with the same wicket:id in
+ * the markup only the first one is returned.
+ *
* @param wicketId
* The wicket:id to search for.
* @return The TagTester for the tag which has the given wicket:id.
@@ -1126,9 +1113,9 @@
}
/**
- * Get a TagTester based on an dom id. If more components exists with the
- * same id in the markup only the first one is returned.
- *
+ * Get a TagTester based on an dom id. If more components exists with the same id in the markup
+ * only the first one is returned.
+ *
* @param id
* The dom id to search for.
* @return The TagTester for the tag which has the given dom id.
@@ -1139,9 +1126,8 @@
}
/**
- * Helper method for all the places where an AjaxCall should submit an
- * associated form.
- *
+ * Helper method for all the places where an AjaxCall should submit an associated form.
+ *
* @param behavior
* The AjaxFormSubmitBehavior with the form to "submit"
*/
@@ -1168,13 +1154,14 @@
{
public void onFormComponent(FormComponent formComponent)
{
- if (!(formComponent instanceof Button) && !(formComponent instanceof RadioGroup)
- && !(formComponent instanceof CheckGroup))
+ if (!(formComponent instanceof Button) && !(formComponent instanceof RadioGroup) &&
+ !(formComponent instanceof CheckGroup))
{
String name = formComponent.getInputName();
String value = formComponent.getValue();
- // Set request parameter with the field value, but do not modify an existing request parameter explicitly set using FormTester.setValue()
+ // Set request parameter with the field value, but do not modify an existing
+ // request parameter explicitly set using FormTester.setValue()
if (getServletRequest().getParameterMap().get(name) == null)
{
getServletRequest().setParameter(name, value);
@@ -1185,7 +1172,7 @@
}
/**
- *
+ *
* @return
*/
public String getContentTypeFromResponseHeader()
@@ -1200,7 +1187,7 @@
}
/**
- *
+ *
* @return
*/
public int getContentLengthFromResponseHeader()
@@ -1215,7 +1202,7 @@
}
/**
- *
+ *
* @return
*/
public String getLastModifiedFromResponseHeader()
@@ -1225,7 +1212,7 @@
}
/**
- *
+ *
* @return
*/
public String getContentDispositionFromResponseHeader()