Re: Remember Wicket.Ajax.ajax bindings after altering DOM with javascript.

2014-06-02 Thread Martin Grigorov
This is how we work here! ;)
Have fun!

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 2, 2014 at 2:01 PM, denethon  wrote:

> Using clone(true, true) solved it! Thank you for your fast response :-)
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Remember-Wicket-Ajax-ajax-bindings-after-altering-DOM-with-javascript-tp4666091p4666095.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Remember Wicket.Ajax.ajax bindings after altering DOM with javascript.

2014-06-02 Thread denethon
Using clone(true, true) solved it! Thank you for your fast response :-)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Remember-Wicket-Ajax-ajax-bindings-after-altering-DOM-with-javascript-tp4666091p4666095.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: TDD - End to End acceptance test - how to set form field values

2014-06-02 Thread Martin Grigorov
Hi,


On Mon, Jun 2, 2014 at 1:33 PM, lucast  wrote:

> Dear Forum,
>
> I'm trying to (retro) fit TDD into my Wicket project (Wicket Spring
> Hibernate) after reading "growing object-oriented software guided by tests"
> by Steve Freeman and Nat Pryce.
>
> One of the first thing the book suggest is to write an acceptance test for
> each feature.
>
> The simple feature I want to test is a user login.
>
> Here are my steps to take:
> 1 create organisation
> 2 create user
>2.a set username
>2.b set password
>2.c set email
>2.d set organisation
> 3 start application
> 4 render login page
> 5 populate username and password fields
> 6 assert successful login
>
> I am following the example from  Wicket's Wiki Spring Unit Testing the
> Proxy
> Approach
> <
> https://cwiki.apache.org/confluence/display/WICKET/Spring#Spring-UnitTestingtheProxyApproach
> >
> .
>
> So far, I can render the login page and assert the form components.
>
> How do I set the form username and password before calling
> WicketTester.submitForm()?
>

FormTester formTester = tester.newFormTester("formId");
formTester.setValue("relative:path:to:textFieldId", "John");
formTester.setValue("relative:path:to:passwordId", "secret")
formTester.submit()


>
> Thanks in advance,
> Lucas
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/TDD-End-to-End-acceptance-test-how-to-set-form-field-values-tp4666093.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


TDD - End to End acceptance test - how to set form field values

2014-06-02 Thread lucast
Dear Forum,

I'm trying to (retro) fit TDD into my Wicket project (Wicket Spring
Hibernate) after reading "growing object-oriented software guided by tests"
by Steve Freeman and Nat Pryce.

One of the first thing the book suggest is to write an acceptance test for
each feature.

The simple feature I want to test is a user login.

Here are my steps to take:
1 create organisation
2 create user
   2.a set username
   2.b set password
   2.c set email
   2.d set organisation
3 start application
4 render login page
5 populate username and password fields
6 assert successful login

I am following the example from  Wicket's Wiki Spring Unit Testing the Proxy
Approach

 
. 

So far, I can render the login page and assert the form components.

How do I set the form username and password before calling
WicketTester.submitForm()?

Thanks in advance,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/TDD-End-to-End-acceptance-test-how-to-set-form-field-values-tp4666093.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Remember Wicket.Ajax.ajax bindings after altering DOM with javascript.

2014-06-02 Thread Martin Grigorov
Hi,

How do you "move" the HTML element with id "ajaxLinkID" ?
I think you can use jQuery#clone(true, true) to preserve the event bindings
of the original HTML element.

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 2, 2014 at 1:06 PM, denethon  wrote:

> Hi
>
> I'm in the process of updating a wicket application from wicket 1.5 to
> wicket 6, and have come across a challenge regarding third party javascript
> code altering the DOM after markup has been sent to the client.
>
> Basically there are several  elements in the markup who are
> distributed evenly across a number of  when the user
> resize the browser window. The steps are as follows:
>
> 1. Fetch all section elements HTML and put them inside an array (as a
> string).
> 2. Calculate number of columns based on the size of surrounding div.
> 3. Create the desired number of columns
> 4. Distribute the sections elements (or html really) evenly across the
> columns.
>
> This is done every time the user alters the size of the browser window,
> possibly causing the DOM to change if the number of columns increases or
> decreases.
>
> By doing this, the elements being moved around seems to loose its wicket
> Wicket.Ajax.ajax-bindings like the one below.
>
>
> Wicket.Ajax.ajax({"u":"./org.package.SomePage?16-1.IBehaviorListener.0-listItemsDiv-listItemRepeater-1-
> somePanel-someAjaxLink","e":"click","c":"ajaxlinkID"});;
>
> Is there any way to make wicket stick the ajax behavior to the section
> elements, so that when moving the sections around across the columns the
> ajax-bindings wont be broken?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Remember-Wicket-Ajax-ajax-bindings-after-altering-DOM-with-javascript-tp4666091.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Remember Wicket.Ajax.ajax bindings after altering DOM with javascript.

2014-06-02 Thread denethon
Hi

I'm in the process of updating a wicket application from wicket 1.5 to
wicket 6, and have come across a challenge regarding third party javascript
code altering the DOM after markup has been sent to the client.

Basically there are several  elements in the markup who are
distributed evenly across a number of  when the user
resize the browser window. The steps are as follows:

1. Fetch all section elements HTML and put them inside an array (as a
string).
2. Calculate number of columns based on the size of surrounding div.
3. Create the desired number of columns
4. Distribute the sections elements (or html really) evenly across the
columns.

This is done every time the user alters the size of the browser window,
possibly causing the DOM to change if the number of columns increases or
decreases.

By doing this, the elements being moved around seems to loose its wicket
Wicket.Ajax.ajax-bindings like the one below.

Wicket.Ajax.ajax({"u":"./org.package.SomePage?16-1.IBehaviorListener.0-listItemsDiv-listItemRepeater-1-
somePanel-someAjaxLink","e":"click","c":"ajaxlinkID"});;

Is there any way to make wicket stick the ajax behavior to the section
elements, so that when moving the sections around across the columns the
ajax-bindings wont be broken?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Remember-Wicket-Ajax-ajax-bindings-after-altering-DOM-with-javascript-tp4666091.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Opening a Modal window on page load in Wicket 6

2014-06-02 Thread Martin Grigorov
Hi,

Wicket sources are publicly available. Use them! It will save you a lot of
time! ;-)

Here  is the related code:
Page page = createPage();
 if (page == null)
{
throw new WicketRuntimeException("Error creating page for modal dialog.");
 }

So it seems your page creator is null.

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 2, 2014 at 6:35 AM, chathuraka.waas 
wrote:

> hi,
>
> my bad the method is there. but now i'm getting a exception when creating
> the modal window and from the stack trace its hard to figure out whats the
> issue.
>
> here is my code.
>
> on page load.
>
> emailWarningModalWindow = new
> EmailWarningModalWindow(("emailwarningModal"));
> add(emailWarningModalWindow);
>
> public class EmailWarningModalWindow extends ModalWindow implements
> IHeaderContributor {
>
> public EmailWarningModalWindow(String id) {
> super(id);
> }
>
> @Override
> public void renderHead(IHeaderResponse response) {
>
>
> response.render(JavaScriptHeaderItem.forScript(getWindowOpenJavaScript(),null));
> }
>
> @Override
> protected boolean makeContentVisible() {
> return true;
> }
> }
>
> and her's the exception i'm getting,
>
> org.apache.wicket.WicketRuntimeException: Error creating page for modal
> dialog.
> at
>
> org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.getWindowOpenJavaScript(ModalWindow.java:1082)
> at
>
> com.fanminder.merchant.app.programs.EmailWarningModalWindow.renderHead(EmailWarningModalWindow.java:26)
> at org.apache.wicket.Component.renderHead(Component.java:4446)
> at org.apache.wicket.Component.renderHead(Component.java:2704)
> at
>
> org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy$1.component(ChildFirstHeaderRenderStrategy.java:85)
> at
>
> org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:96)
> at
>
> org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:87)
> at
>
> org.apache.wicket.markup.renderStrategy.DeepChildFirstVisitor.visit(DeepChildFirstVisitor.java:51)
> at
>
> org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderChildHeaders(ChildFirstHeaderRenderStrategy.java:78)
> at
>
> org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderHeader(ChildFirstHeaderRenderStrategy.java:57)
> at
>
> org.apache.wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:170)
> at
>
> org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
> at
> org.apache.wicket.Component.internalRenderComponent(Component.java:2551)
> at
> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1494)
> at org.apache.wicket.Component.internalRender(Component.java:2381)
> at org.apache.wicket.Component.render(Component.java:2309)
> at
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1390)
> at
> org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1555)
> at org.apache.wicket.Page.onRender(Page.java:887)
> at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:142)
> at org.apache.wicket.Component.internalRender(Component.java:2381)
> at org.apache.wicket.Component.render(Component.java:2309)
> at org.apache.wicket.Page.renderPage(Page.java:1024)
> at
>
> org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:121)
> at
>
> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:274)
> at
>
> org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
> at
>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
> at
>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> at
>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:97)
> at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> at
>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> at
>
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.doFi