Re: Wicket jQuery js loaded twice when modal window opened

2014-10-30 Thread Martin Grigorov
@Maxim,

It seems you didn't read the message till the end. It says that it uses
JQuery UI Dialog.

@Prasad: Wicket filters out any JS or CSS resource at the client side if it
is already loaded. I.e. The server may contribute script
src=.../jquery.js but while processing the Ajax response
(ajax-response XML element) wicket-ajax-jquery.js will take the value of
the src attribute and check whether there is another script element in
the document with the same url. If there is then the contribution is
ignored.
Please check whether the urls are same.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 30, 2014 at 5:09 AM, Maxim Solodovnik solomax...@gmail.com
wrote:

 I believe this is because you are using ModalWindow with page, Maybe you
 better use it with panel?
 Or use dialog from wicket-jqueryui:
 http://www.7thweb.net/wicket-jquery-ui/dialog/MessageDialogPage ?

 On 30 October 2014 06:08, prasad.bhandagi prasad.bhand...@marsh.com
 wrote:

  I have a Wicket v6 page with couple of AjaxButtons. When the AjaxButton
 is
  clicked, am opening a modal window using jQuery ui Dialog passing the URL
  of
  a second page. The second wicket page also has a AjaxButton. When wicket
  fetches the second page using Ajax to be rendered in the modal window, it
  loads jQuery js again.
 
  I think this causes issues and it gives me error subsequently
  jQuery(...).dialog is not a function.
 
  Is there a way I can tell Wicket to NOT to load the jQuery js when
  rendering
  the page in the modal window? Wicket Ajax components automatically add
  jQuery reference always. Am looking for a way to remove the jQuery
  reference
  before the page is rendered.
 
  Note: I am not using the Wicket extension for Modal Window. Am using
 jQuery
  UI Dialog directly to open modal window. But I think the problem of
 jQuery
  getting loaded again will occur when Modal Window used also.
 
  --
  View this message in context:
 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-jQuery-js-loaded-twice-when-modal-window-opened-tp4668156.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
 
 


 --
 WBR
 Maxim aka solomax



Re: Wicket jQuery js loaded twice when modal window opened

2014-10-30 Thread Maxim Solodovnik
My bad, sorry

On 30 October 2014 13:15, Martin Grigorov mgrigo...@apache.org wrote:

 @Maxim,

 It seems you didn't read the message till the end. It says that it uses
 JQuery UI Dialog.

 @Prasad: Wicket filters out any JS or CSS resource at the client side if it
 is already loaded. I.e. The server may contribute script
 src=.../jquery.js but while processing the Ajax response
 (ajax-response XML element) wicket-ajax-jquery.js will take the value of
 the src attribute and check whether there is another script element in
 the document with the same url. If there is then the contribution is
 ignored.
 Please check whether the urls are same.

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Thu, Oct 30, 2014 at 5:09 AM, Maxim Solodovnik solomax...@gmail.com
 wrote:

  I believe this is because you are using ModalWindow with page, Maybe you
  better use it with panel?
  Or use dialog from wicket-jqueryui:
  http://www.7thweb.net/wicket-jquery-ui/dialog/MessageDialogPage ?
 
  On 30 October 2014 06:08, prasad.bhandagi prasad.bhand...@marsh.com
  wrote:
 
   I have a Wicket v6 page with couple of AjaxButtons. When the AjaxButton
  is
   clicked, am opening a modal window using jQuery ui Dialog passing the
 URL
   of
   a second page. The second wicket page also has a AjaxButton. When
 wicket
   fetches the second page using Ajax to be rendered in the modal window,
 it
   loads jQuery js again.
  
   I think this causes issues and it gives me error subsequently
   jQuery(...).dialog is not a function.
  
   Is there a way I can tell Wicket to NOT to load the jQuery js when
   rendering
   the page in the modal window? Wicket Ajax components automatically add
   jQuery reference always. Am looking for a way to remove the jQuery
   reference
   before the page is rendered.
  
   Note: I am not using the Wicket extension for Modal Window. Am using
  jQuery
   UI Dialog directly to open modal window. But I think the problem of
  jQuery
   getting loaded again will occur when Modal Window used also.
  
   --
   View this message in context:
  
 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-jQuery-js-loaded-twice-when-modal-window-opened-tp4668156.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
  
  
 
 
  --
  WBR
  Maxim aka solomax
 




-- 
WBR
Maxim aka solomax


Multipart form doesn't work with AjaxSubmitLink (1.5.8 - 6.17 upgrade)

2014-10-30 Thread tomask79
Hi guys,

we're migrating to wicket 6.17 and I'm stuck at problem that AjaxSubmitLinks
are not working inside form, which is marked as multipart form, yes we have
there some upload fields. Method onSubmit of AjaxSubmitLinks never gets
called...:-(...I see NO ERRORS in the javascript console...Anyway AjaxLinks
in the same place are working fineBack to problem:

*HTML of AjaxSubmitLink*



*Java*



*Link inside DOM:*



*Registered event in the new Wicket 6.0 style:*

Wicket.Ajax.ajax({f:form10e,mp:true,u:./application-form?3-3.IBehaviorListener.0-content-form-panesContainer-2-paneContent-panesContainer-0-paneContent-personsContainer-relatedPersons-2-removeid=_AxmgvNX1d4A3Jiqlimy25exWY9xmL1UtabId=a4UHLIwD5zvFwqfJ5Pw4,e:click,c:remove11d,sc:panesContainer:2:paneContent:panesContainer:0:paneContent:personsContainer:relatedPersons:2:remove,m:POST,i:veil});;


I was debugging wicket-ajax-jquery.js and jquery's ajax never get's called
in this case, because of the line:



Repeated clicking at the mentioned AjaxSubmitLink ends then in message:
*Channel '0' is busy - scheduling the callback to be executed when the
previous request finish.* in the AJAX DEBUG CONSOLE.


Guys, any help would be highly appreciated...Maybe I should refactor
mentioned form in some way, but migration guide doesn't provide info
concerning AjaxSubmitLink...

Thank you very much in advance for any help

regards

Tomas







--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Multipart-form-doesn-t-work-with-AjaxSubmitLink-1-5-8-6-17-upgrade-tp4668161.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: Multipart form doesn't work with AjaxSubmitLink (1.5.8 - 6.17 upgrade)

2014-10-30 Thread Martin Grigorov
Hi,

Can you reproduce the problem in a quckstart ?
If YES then please attach it to JIRA and we will take a look.
You should go inside submitMultipartForm() with the debugger. When the form
is multipart Wicket needs to use an iframe to make the submit.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 30, 2014 at 10:42 AM, tomask79 tomas.klou...@embedit.cz wrote:

 Hi guys,

 we're migrating to wicket 6.17 and I'm stuck at problem that
 AjaxSubmitLinks
 are not working inside form, which is marked as multipart form, yes we have
 there some upload fields. Method onSubmit of AjaxSubmitLinks never gets
 called...:-(...I see NO ERRORS in the javascript console...Anyway AjaxLinks
 in the same place are working fineBack to problem:

 *HTML of AjaxSubmitLink*



 *Java*



 *Link inside DOM:*



 *Registered event in the new Wicket 6.0 style:*


 Wicket.Ajax.ajax({f:form10e,mp:true,u:./application-form?3-3.IBehaviorListener.0-content-form-panesContainer-2-paneContent-panesContainer-0-paneContent-personsContainer-relatedPersons-2-removeid=_AxmgvNX1d4A3Jiqlimy25exWY9xmL1UtabId=a4UHLIwD5zvFwqfJ5Pw4,e:click,c:remove11d,sc:panesContainer:2:paneContent:panesContainer:0:paneContent:personsContainer:relatedPersons:2:remove,m:POST,i:veil});;


 I was debugging wicket-ajax-jquery.js and jquery's ajax never get's called
 in this case, because of the line:



 Repeated clicking at the mentioned AjaxSubmitLink ends then in message:
 *Channel '0' is busy - scheduling the callback to be executed when the
 previous request finish.* in the AJAX DEBUG CONSOLE.


 Guys, any help would be highly appreciated...Maybe I should refactor
 mentioned form in some way, but migration guide doesn't provide info
 concerning AjaxSubmitLink...

 Thank you very much in advance for any help

 regards

 Tomas







 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Multipart-form-doesn-t-work-with-AjaxSubmitLink-1-5-8-6-17-upgrade-tp4668161.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: Multipart form doesn't work with AjaxSubmitLink (1.5.8 - 6.17 upgrade)

2014-10-30 Thread tomask79
Okay Martin, thanks for quick reply.

I will try to simulate it as you said and let you know.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Multipart-form-doesn-t-work-with-AjaxSubmitLink-1-5-8-6-17-upgrade-tp4668161p4668163.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: Multipart form doesn't work with AjaxSubmitLink (1.5.8 - 6.17 upgrade)

2014-10-30 Thread tomask79
Hi Martin again,

false alarm, I apologize.

As you mentioned, I debugged the wicket-ajax-jquery.js's submitMultipartForm
function and found out that wicket was ending at the bold line:

*wicket-ajax-jquery.js:*
.
.
if (form.onsubmit  !form.getAttribute(submittingAttribute)) {
form.setAttribute(submittingAttribute, submittingAttribute);
var retValue = true;
try {
retValue = form.onsubmit();
} finally {
form.removeAttribute(submittingAttribute);
}
if (!retValue) {
*return; = Here was wicket returning with form unsubmitted*
}
}
.

All because my colleague* have rewritten the form's onsubmit attribute* with
his code..:-)
Which disposed the code provided by wicket.

Martin I apologize again, it's just that upgrade to 6.0 is a little
exhausting, because you changed a lot of things..:)

regards

Tomas.



}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Multipart-form-doesn-t-work-with-AjaxSubmitLink-1-5-8-6-17-upgrade-tp4668161p4668164.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: Multipart form doesn't work with AjaxSubmitLink (1.5.8 - 6.17 upgrade)

2014-10-30 Thread Martin Grigorov
Hi,


On Thu, Oct 30, 2014 at 11:52 AM, tomask79 tomas.klou...@embedit.cz wrote:

 Hi Martin again,

 false alarm, I apologize.


No worries!
The important thing is that it works !



 As you mentioned, I debugged the wicket-ajax-jquery.js's
 submitMultipartForm
 function and found out that wicket was ending at the bold line:

 *wicket-ajax-jquery.js:*
 .
 .
 if (form.onsubmit  !form.getAttribute(submittingAttribute)) {
 form.setAttribute(submittingAttribute, submittingAttribute);
 var retValue = true;
 try {
 retValue = form.onsubmit();
 } finally {
 form.removeAttribute(submittingAttribute);
 }
 if (!retValue) {
 *return; = Here was wicket returning with form
 unsubmitted*


This particular piece of code is in use in 1.5.x as well.


 }
 }
 .

 All because my colleague* have rewritten the form's onsubmit attribute*
 with
 his code..:-)


I recommend you when you migrate to new version to not make improvements in
your code. Just mark them for later, when the upgrade is finished.
Otherwise it is hard to find whether the new version of the library is
broken or your changes broke it.


 Which disposed the code provided by wicket.

 Martin I apologize again, it's just that upgrade to 6.0 is a little
 exhausting, because you changed a lot of things..:)


Migrating to 7.x should be much easier! There are no big refactorings and
the migration guide
https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+7.0 is
very detailed.



 regards

 Tomas.



 }

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Multipart-form-doesn-t-work-with-AjaxSubmitLink-1-5-8-6-17-upgrade-tp4668161p4668164.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: Wicket jQuery js loaded twice when modal window opened

2014-10-30 Thread prasad.bhandagi
@Martin

When the first page is loaded, below is the url:
http://localhost:7001/ahc/prol/wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-1.10.1-ver-1372037384000.js

When the second page is loaded in modal window, below is the url:
http://localhost:7001/ahc/prol/wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-1.10.1-ver-1372037384000.js?_=1414675886491

Wicket for some reason is appending a query parameter the second time. Hence
it is loading jQuery again when the modal window is opened.
If the url was the same, Wicket client side filters would have not loaded
jQuery again as you said.
Any idea on why the _ query parameter is being appended the second time
and if it can be avoided?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-jQuery-js-loaded-twice-when-modal-window-opened-tp4668156p4668168.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: Wicket jQuery js loaded twice when modal window opened

2014-10-30 Thread Martin Grigorov
Hi,

The anti cache parameter is added by jQuery itself when $.ajax({cache:
false, ...}) - http://api.jquery.com/jquery.ajax/

ack-grep '_=' wicket-core/src/main/java/
wicket-core/src/main/java/org/apache/wicket/resource/jquery/jquery-1.11.1.js
8551: rts = /([?])_=[^]*/,
9105: cacheURL.replace( rts, $1_= + nonce++ ) :
9108: cacheURL + ( rquery.test( cacheURL ) ?  : ? ) + _= + nonce++;

wicket-ajax sets cache to false to avoid cached Ajax responses:
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L671

Can you reproduce this with a plain (i.e. no third party libs) Wicket
quickstart ?
If YES then please create a ticket and attach the quickstart.
Thanks!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 30, 2014 at 3:35 PM, prasad.bhandagi prasad.bhand...@marsh.com
wrote:

 @Martin

 When the first page is loaded, below is the url:

 http://localhost:7001/ahc/prol/wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-1.10.1-ver-1372037384000.js

 When the second page is loaded in modal window, below is the url:

 http://localhost:7001/ahc/prol/wicket/resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-1.10.1-ver-1372037384000.js?_=1414675886491

 Wicket for some reason is appending a query parameter the second time.
 Hence
 it is loading jQuery again when the modal window is opened.
 If the url was the same, Wicket client side filters would have not loaded
 jQuery again as you said.
 Any idea on why the _ query parameter is being appended the second time
 and if it can be avoided?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-jQuery-js-loaded-twice-when-modal-window-opened-tp4668156p4668168.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




simple confirmation on button/link

2014-10-30 Thread Garret Wilson

All,

I've created a simple confirmation link based on Sven Meier's 
ConfirmationLink code https://cwiki.apache.org/confluence/x/X4U on 
Confluence. For the most part it works, but...


...but if I'm on an upload form, then an an Ajax link won't work because 
I need to actually submit the multipart information.


The theory behind Sven's code should work the same with or without an 
Ajax link. Wicket's AjaxLink simply provides an easy way to inject the 
confirmation JavaScript without having to wire the event handling 
manually. You'll see on the same page listed above other examples that 
do this wiring manually, and do it in a way that is decidedly not 
correct (replacing the onclick attribute) according to today's modern 
JavaScript best practices (and frankly hasn't been correct for almost a 
decade).


There is some discussion of this sort on that page, with a bit of 
back-and-forth about wanting a general, reusable solution, but in the 
end only giving an example of something in that fashion and with 
another contributor noting that their solution isn't working and I need 
to figure out why. And now we're at Wicket 7 and even the incomplete 
examples on this page don't work anymore because the underlying classes 
have been removed.


(On that page the idea of Ed Eustace is also mentioned, namely to use 
Component.replaceWith() to have an embedded confirmation panel that 
appears when needed. But it's as usually a completely do-it-yourself 
project.)


So, friends, does the latest version of Wicket have an easy way to make 
a confirmation dialog? If not, does it have an easy way for me to inject 
JavaScript using best-practice DOM event binding?


Garret


Modify items in quickview?

2014-10-30 Thread Boris Goldowsky
How would you set things up to have the best of both worlds with a QuickView?   
I need to have
(a) a button like an AjaxItemsNavigator that adds additional elements to the 
QuickView without repainting the entire view, AND
(b) some AJAX operations that change the entire content of the QuickView – for 
example, they can change the data provider.

If I use the ReuseAllStrategy I can’t determine how to accomplish (b).  Other 
item reuse strategies don’t seem to allow (a).  Does a custom item reuse 
strategy with a “reset” method make sense or is there a better way?

Boris



How to partially update listview on scroll.

2014-10-30 Thread David Vdd
Hello,

I'm trying to make a component that listens to scroll events and loads data
when needed. When the scrollbar reached the bottom or the top.

The component should have 2 possible usecases :one that keeps all the
previous data and one that only show x rows and reloads them both ways(up
and down).

I've already looked at other libraries like  wicket-quickview library
https://github.com/vineetsemwal/quickview/tree/master/wicket-quickview  ,
but this library adds many functionalities I don't need, and if there are
changes that break this library I would not be able to fix it since I don't
understand all the inner workings.

I was able to use the ajax scroll event implementation in combination with a
listview that add's items. The problem I'm having is that I can only update
the complete listview by adding its parent component. 

In the library they solve this by appending the items using js.(this was
based on  repainting-only-newly-created-repeater-items-via-ajax
http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/
 
)

I was wondering if there was a way to partially update a listview(or similar
component)? Can I extend the listview to prepend and append items with the
js/ajax) Which component should I be using?

I don't have much experience with extending existing wicket components so
I'm not really sure what I should overwrite.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-partially-update-listview-on-scroll-tp4668171.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



Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
Wicket 6.17.0

I have a RadioChoice (in a Form) that has an attached
AjaxFormComponentUpdatingBehavior.

The onUpdate() method of the Behavior fires an event for other components
on the page to update (change visibility depending on user selection in
radio choice).

Im trying to unit test it using:

formTester.selectRadioChoice( propertyType, 2 );

and then I'm trying to trigger the behavior to fire so that I can
check that the various components are visible/invisible:

Component component = baseTester.getComponentFromLastRenderedPage(
form:propertyType );
for ( Behavior b : component.getBehaviors() )
{
   if ( b instanceof AjaxFormComponentUpdatingBehavior )
   {
  baseTester.executeBehavior( (AbstractAjaxBehavior) b );
   }
}

However, I'm running in to this when the behavior is executed:

org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
Behavior rejected interface invocation.

Is it possible to unit test this specific behavior, and am I going
about this the right way?

I've verified that the application works as expected in a browser.


Re: simple confirmation on button/link

2014-10-30 Thread Andrea Del Bene

On 30/10/14 17:57, Garret Wilson wrote:

All,

I've created a simple confirmation link based on Sven Meier's 
ConfirmationLink code https://cwiki.apache.org/confluence/x/X4U on 
Confluence. For the most part it works, but...


...but if I'm on an upload form, then an an Ajax link won't work 
because I need to actually submit the multipart information.




Hi,

not sure I've got your problem. Are you submitting a form using a Ajax link?


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



Re: Modify items in quickview?

2014-10-30 Thread Paul Bors
Are you talking about this QuickView?
https://github.com/vineetsemwal/quickview



On Thu, Oct 30, 2014 at 1:16 PM, Boris Goldowsky bgoldow...@cast.org
wrote:

 How would you set things up to have the best of both worlds with a
 QuickView?   I need to have
 (a) a button like an AjaxItemsNavigator that adds additional elements to
 the QuickView without repainting the entire view, AND
 (b) some AJAX operations that change the entire content of the QuickView –
 for example, they can change the data provider.

 If I use the ReuseAllStrategy I can’t determine how to accomplish (b).
 Other item reuse strategies don’t seem to allow (a).  Does a custom item
 reuse strategy with a “reset” method make sense or is there a better way?

 Boris




Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Andrea Del Bene

On 30/10/14 21:08, Nick Pratt wrote:

Wicket 6.17.0

I have a RadioChoice (in a Form) that has an attached
AjaxFormComponentUpdatingBehavior.

The onUpdate() method of the Behavior fires an event for other components
on the page to update (change visibility depending on user selection in
radio choice).

Im trying to unit test it using:

formTester.selectRadioChoice( propertyType, 2 );

I guess that's a typo :) or are you using a custom formTester?


and then I'm trying to trigger the behavior to fire so that I can
check that the various components are visible/invisible:

Component component = baseTester.getComponentFromLastRenderedPage(
form:propertyType );
for ( Behavior b : component.getBehaviors() )
{
if ( b instanceof AjaxFormComponentUpdatingBehavior )
{
   baseTester.executeBehavior( (AbstractAjaxBehavior) b );
}
}

However, I'm running in to this when the behavior is executed:

org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:
Behavior rejected interface invocation.

Is it possible to unit test this specific behavior, and am I going
about this the right way?

I've verified that the application works as expected in a browser.
BTW, multiple-choice component should use 
AjaxFormChoiceComponentUpdatingBehavior instead of 
AjaxFormComponentUpdatingBehavior.



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



Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Paul Bors
Since you want to test a AjaxFormComponentUpdatingBehav
ior and not a standard form component (non-ajax) you don't use
formTester.selectRadioChoice( propertyType, 2 ) you have to create the
AjaxTarget and etc.

See Testing AJAX behaviors section at:
http://wicket.apache.org/guide/guide/testing.html

On Thu, Oct 30, 2014 at 4:27 PM, Andrea Del Bene an.delb...@gmail.com
wrote:

 On 30/10/14 21:08, Nick Pratt wrote:

 Wicket 6.17.0

 I have a RadioChoice (in a Form) that has an attached
 AjaxFormComponentUpdatingBehavior.

 The onUpdate() method of the Behavior fires an event for other components
 on the page to update (change visibility depending on user selection in
 radio choice).

 Im trying to unit test it using:

 formTester.selectRadioChoice( propertyType, 2 );

 I guess that's a typo :) or are you using a custom formTester?


 and then I'm trying to trigger the behavior to fire so that I can
 check that the various components are visible/invisible:

 Component component = baseTester.getComponentFromLastRenderedPage(
 form:propertyType );
 for ( Behavior b : component.getBehaviors() )
 {
 if ( b instanceof AjaxFormComponentUpdatingBehavior )
 {
baseTester.executeBehavior( (AbstractAjaxBehavior) b );
 }
 }

 However, I'm running in to this when the behavior is executed:

 org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedEx
 ception:
 Behavior rejected interface invocation.

 Is it possible to unit test this specific behavior, and am I going
 about this the right way?

 I've verified that the application works as expected in a browser.

 BTW, multiple-choice component should use 
 AjaxFormChoiceComponentUpdatingBehavior
 instead of AjaxFormComponentUpdatingBehavior.


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




Re: Modify items in quickview?

2014-10-30 Thread Boris Goldowsky
Yes, that one.

For now, I am just replacing the QuickView with a newly-instantiated one,
which does work around the problem.

Boris


On 10/30/14, 4:26 PM, Paul Bors p...@bors.ws wrote:

Are you talking about this QuickView?
https://github.com/vineetsemwal/quickview



On Thu, Oct 30, 2014 at 1:16 PM, Boris Goldowsky bgoldow...@cast.org
wrote:

 How would you set things up to have the best of both worlds with a
 QuickView?   I need to have
 (a) a button like an AjaxItemsNavigator that adds additional elements to
 the QuickView without repainting the entire view, AND
 (b) some AJAX operations that change the entire content of the
QuickView ­
 for example, they can change the data provider.

 If I use the ReuseAllStrategy I can¹t determine how to accomplish (b).
 Other item reuse strategies don¹t seem to allow (a).  Does a custom item
 reuse strategy with a ³reset² method make sense or is there a better
way?

 Boris




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



Re: Integrating Wicket with an Angular app

2014-10-30 Thread BenjaminV
Hi guys

Is this thread still alive? I have reasons to consider using wicket and
angular together and I was wondering how you got on?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Integrating-Wicket-with-an-Angular-app-tp4656794p4668180.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: simple confirmation on button/link

2014-10-30 Thread Garret Wilson

Andrea, thanks for jolting my brain; I was a little sleepy this morning.

I was using a subclass of AjaxLink that added confirmation JavaScript as 
I outlined below. My original HTML was:


button wicket:id=foo type=submit

The root of the problem is that Wicket kept turning that into:

button wicket:id=foo type=button id=foo7

Thus even though I got a confirmation dialog, the FileUpload was never 
being populated because the form was never being submitted.


It turns out that apparently I have to use a subclass of AjaxSubmitLink 
rather than AjaxLink if I want the form to actually be submitted, even 
though I specified type=submit in the HTML. So my immediate problem is 
solved.


On a higher level, though, it means that I now have to go create a 
ConfirmationAjaxSubmitLink along with my ConfirmationAjaxLink. I would 
have thought/hoped that things like submission and confirmation were 
something that could be injected to various components using behaviors 
rather that subclassing all over the place.


But for now the program is working. Thanks again, Andrea, for asking the 
right question that made me investigate further in the right spot.


Garret

On 10/30/2014 1:14 PM, Andrea Del Bene wrote:

On 30/10/14 17:57, Garret Wilson wrote:

All,

I've created a simple confirmation link based on Sven Meier's 
ConfirmationLink code https://cwiki.apache.org/confluence/x/X4U on 
Confluence. For the most part it works, but...


...but if I'm on an upload form, then an an Ajax link won't work 
because I need to actually submit the multipart information.




Hi,

not sure I've got your problem. Are you submitting a form using a Ajax 
link?



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




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



Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
That was a typo - apologies.  I'm using a
AjaxFormChoiceComponentUpdatingBehavior

As for the tester, its the EnhancedFormTester - its a thin wrapper that
invokes: formTester.select( path, index ); (where formTester is the Wicket
FormTester)

On Thu, Oct 30, 2014 at 4:27 PM, Andrea Del Bene an.delb...@gmail.com
wrote:

 On 30/10/14 21:08, Nick Pratt wrote:

 Wicket 6.17.0

 I have a RadioChoice (in a Form) that has an attached
 AjaxFormComponentUpdatingBehavior.

 The onUpdate() method of the Behavior fires an event for other components
 on the page to update (change visibility depending on user selection in
 radio choice).

 Im trying to unit test it using:

 formTester.selectRadioChoice( propertyType, 2 );

 I guess that's a typo :) or are you using a custom formTester?


 and then I'm trying to trigger the behavior to fire so that I can
 check that the various components are visible/invisible:

 Component component = baseTester.getComponentFromLastRenderedPage(
 form:propertyType );
 for ( Behavior b : component.getBehaviors() )
 {
 if ( b instanceof AjaxFormComponentUpdatingBehavior )
 {
baseTester.executeBehavior( (AbstractAjaxBehavior) b );
 }
 }

 However, I'm running in to this when the behavior is executed:

 org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedEx
 ception:
 Behavior rejected interface invocation.

 Is it possible to unit test this specific behavior, and am I going
 about this the right way?

 I've verified that the application works as expected in a browser.

 BTW, multiple-choice component should use 
 AjaxFormChoiceComponentUpdatingBehavior
 instead of AjaxFormComponentUpdatingBehavior.


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




Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
Thanks Paul

 I read that before posting, and tried a couple of things.  Is there
anything specific in that section other than:

tester.executeAjaxEvent(label, click);

If this is what is needed, how do I simulate a click on a specific
item from a RadioChoice? Do I set the value using the normal
formTester methods and then fire a generic click event?


On Thu, Oct 30, 2014 at 4:31 PM, Paul Bors p...@bors.ws wrote:

 Since you want to test a AjaxFormComponentUpdatingBehav
 ior and not a standard form component (non-ajax) you don't use
 formTester.selectRadioChoice( propertyType, 2 ) you have to create the
 AjaxTarget and etc.

 See Testing AJAX behaviors section at:
 http://wicket.apache.org/guide/guide/testing.html

 On Thu, Oct 30, 2014 at 4:27 PM, Andrea Del Bene an.delb...@gmail.com
 wrote:

  On 30/10/14 21:08, Nick Pratt wrote:
 
  Wicket 6.17.0
 
  I have a RadioChoice (in a Form) that has an attached
  AjaxFormComponentUpdatingBehavior.
 
  The onUpdate() method of the Behavior fires an event for other
 components
  on the page to update (change visibility depending on user selection in
  radio choice).
 
  Im trying to unit test it using:
 
  formTester.selectRadioChoice( propertyType, 2 );
 
  I guess that's a typo :) or are you using a custom formTester?
 
 
  and then I'm trying to trigger the behavior to fire so that I can
  check that the various components are visible/invisible:
 
  Component component = baseTester.getComponentFromLastRenderedPage(
  form:propertyType );
  for ( Behavior b : component.getBehaviors() )
  {
  if ( b instanceof AjaxFormComponentUpdatingBehavior )
  {
 baseTester.executeBehavior( (AbstractAjaxBehavior) b );
  }
  }
 
  However, I'm running in to this when the behavior is executed:
 
  org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedEx
  ception:
  Behavior rejected interface invocation.
 
  Is it possible to unit test this specific behavior, and am I going
  about this the right way?
 
  I've verified that the application works as expected in a browser.
 
  BTW, multiple-choice component should use
 AjaxFormChoiceComponentUpdatingBehavior
  instead of AjaxFormComponentUpdatingBehavior.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
I reproduced this in a simple quickstart using this unit test:

@Test
public void testAjaxEventFired() throws Exception
{
   HomePage homePage = new HomePage( new PageParameters() );
   tester.startPage( homePage );

   FormTester formTester = tester.newFormTester( form );
   formTester.select( radioChoice, 2 );

   Component component = tester.getComponentFromLastRenderedPage(
form:radioChoice );
   List? extends Behavior behaviors = component.getBehaviors();
   for( Behavior behavior : behaviors )
   {
  if( behavior instanceof AjaxFormChoiceComponentUpdatingBehavior )
  {
 AjaxFormChoiceComponentUpdatingBehavior afccub =
(AjaxFormChoiceComponentUpdatingBehavior) behavior;
 tester.executeBehavior( afccub );
  }
   }

   assertEquals( true, homePage.eventFired );
   assertEquals( C, homePage.chosen );
}


This is working as expected.  HomePage has a RadioChoice with a
ListString of choices, A,B,C,D,E.


There must be something in our application that's causing the
invocation to be rejected which Ill dig in to.


On Thu, Oct 30, 2014 at 4:27 PM, Andrea Del Bene an.delb...@gmail.com
wrote:

 On 30/10/14 21:08, Nick Pratt wrote:

 Wicket 6.17.0

 I have a RadioChoice (in a Form) that has an attached
 AjaxFormComponentUpdatingBehavior.

 The onUpdate() method of the Behavior fires an event for other components
 on the page to update (change visibility depending on user selection in
 radio choice).

 Im trying to unit test it using:

 formTester.selectRadioChoice( propertyType, 2 );

 I guess that's a typo :) or are you using a custom formTester?


 and then I'm trying to trigger the behavior to fire so that I can
 check that the various components are visible/invisible:

 Component component = baseTester.getComponentFromLastRenderedPage(
 form:propertyType );
 for ( Behavior b : component.getBehaviors() )
 {
 if ( b instanceof AjaxFormComponentUpdatingBehavior )
 {
baseTester.executeBehavior( (AbstractAjaxBehavior) b );
 }
 }

 However, I'm running in to this when the behavior is executed:

 org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedEx
 ception:
 Behavior rejected interface invocation.

 Is it possible to unit test this specific behavior, and am I going
 about this the right way?

 I've verified that the application works as expected in a browser.

 BTW, multiple-choice component should use 
 AjaxFormChoiceComponentUpdatingBehavior
 instead of AjaxFormComponentUpdatingBehavior.


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




Re: Integrating Wicket with an Angular app

2014-10-30 Thread Warren Bell
I have an Angular app with a Wicket back end. I am using Wicket rest 
annotations located at https://github.com/bitstorm/Wicket-rest-annotations . 
Seems to be working pretty good.

Warren

On Oct 30, 2014, at 2:04 PM, BenjaminV 
bvellac...@yahoo.commailto:bvellac...@yahoo.com wrote:

Hi guys

Is this thread still alive? I have reasons to consider using wicket and
angular together and I was wondering how you got on?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Integrating-Wicket-with-an-Angular-app-tp4656794p4668180.html
Sent from the Users forum mailing list archive at Nabble.comhttp://Nabble.com.

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