Re: Need an event later than 'done'

2020-01-23 Thread Sven Meier

Cool, thanks for the update!

Sven

On 23.01.20 20:19, Entropy wrote:

Okay, nevermind.  I solved that by using a MutationObserver in javascript to
look for the thing Wicket makes visible or not and invoke my javascript as
needed.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
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: Need an event later than 'done'

2020-01-23 Thread Entropy
Okay, nevermind.  I solved that by using a MutationObserver in javascript to
look for the thing Wicket makes visible or not and invoke my javascript as
needed.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Need an event later than 'done'

2020-01-23 Thread Entropy
I just tried that and in terms of timing, it's perfect!  However, my
front-end guys put together a multi-piece veil that blocks input, displays
our spinny, but also does some accessibility stuff and focus stuff that they
consider important.  I'm going to go talk to them and see if they can live
with just a show/hide, but I have a strong hunch they'll balk.

Is there a way I can invoke a piece of javascript to show/hide respectively,
instead of giving an id to show/hide?  Maybe something I can override? 

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Need an event later than 'done'

2020-01-22 Thread Sven Meier

Hi,

sorry, I thought you know that detail:

If a behavior or any of the components in the hierarchy implements 
IAjaxIndicatorAware, it can specify the id of a markup to be shown 
during Ajax processing:


https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/IAjaxIndicatorAware.java

This id is stored in the JavaScript attributes as attr.i - if you set it 
from Java (by implementing the interface) or by setting directly from 
JavaScript (e.g. in before), Wicket will show the veil and keep it shown 
when a redirect happens.


Hope this helps
Sven


On 22.01.20 21:25, Entropy wrote:

Sven,

I'm afraid I don't know what you mean.  Our real jQuery expert quit abruptly
and hasn't been replaced yet, so I'm sorry if this is a jQuery thing, but
your last two paragraphs don't make sense to me.  What is attrs.i?  It's not
on the object from what I see in the F12 tools.  There's alot of one and two
letter vars, but not i.  I assume by AJAX_CALL_BEFORE you mean subscribe to
/ajax/call/before, which I can do.  Are you suggesting that I can launch the
veil there?  I am currently launching it in beforeSend.  But how would it
automatically remove it?  Removing it at the right time is of course the
issue.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
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: Need an event later than 'done'

2020-01-22 Thread Entropy
Sven,

I'm afraid I don't know what you mean.  Our real jQuery expert quit abruptly
and hasn't been replaced yet, so I'm sorry if this is a jQuery thing, but
your last two paragraphs don't make sense to me.  What is attrs.i?  It's not
on the object from what I see in the F12 tools.  There's alot of one and two
letter vars, but not i.  I assume by AJAX_CALL_BEFORE you mean subscribe to
/ajax/call/before, which I can do.  Are you suggesting that I can launch the
veil there?  I am currently launching it in beforeSend.  But how would it
automatically remove it?  Removing it at the right time is of course the
issue.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Need an event later than 'done'

2020-01-22 Thread Sven Meier

You're right, the Ajax response isn't available in the done callback.
Regretfully I can't remember how I solved the same issue in one of my 
last projects.


But have you thought about utilizing the default Ajax indicator?

You could set attrs.i in AJAX_CALL_BEFORE and let Wicket show that 
markup. Then it will automatically remove it at the right moment (or not 
in case of a redirect).


Have fun
Sven


On 22.01.20 15:37, Entropy wrote:

That sounds great.  But as I look through the jqEvent and attributes objects
I don't see what element is the response headers.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
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: Need an event later than 'done'

2020-01-22 Thread Entropy
And I should add that the third parameter, which the docs imply is the jqXHR
object, which is where I would expect the response to be, is null in these
callbacks.  i tried subscribing to the /ajax/call/success handler as well
and it was null there.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Need an event later than 'done'

2020-01-22 Thread Entropy
That sounds great.  But as I look through the jqEvent and attributes objects
I don't see what element is the response headers.  

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Need an event later than 'done'

2020-01-22 Thread Martin Grigorov
On Tue, Jan 21, 2020 at 11:59 PM Entropy  wrote:

> That seems promising.  If you could look how you did it in your other
> project
> that would be great.  I suppose if I could get access to the response XML I
> could look for the redirect in that.  I'm not sure where it is though or
> even if it's provided to this event.
>

You can use the Ajax (jQuery) response and check whether it has "Location"
header


>
> --
> Sent from:
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Need an event later than 'done'

2020-01-21 Thread Ernesto Reinaldo Barreiro
Hi,

I know this is not bulletproof but I always add a timeOut to hiding the
veil, usually 300, 400 milliseconds, so that there is some margin for AJAX
request to finish. Also some AJAX requests are so fast that veil + almost
not visible. spinner is

On Tue, Jan 21, 2020 at 11:59 PM Entropy  wrote:

> That seems promising.  If you could look how you did it in your other
> project
> that would be great.  I suppose if I could get access to the response XML I
> could look for the redirect in that.  I'm not sure where it is though or
> even if it's provided to this event.
>
> --
> Sent from:
> http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-- 
Regards - Ernesto Reinaldo Barreiro


Re: Need an event later than 'done'

2020-01-21 Thread Entropy
That seems promising.  If you could look how you did it in your other project
that would be great.  I suppose if I could get access to the response XML I
could look for the redirect in that.  I'm not sure where it is though or
even if it's provided to this event.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Need an event later than 'done'

2020-01-21 Thread Sven Meier

Hi Entropy,

the trick is do keep the veil up whenever a redirect happens as the 
result of an Ajax request.


Similar to what wicket-ajax-jquery.js is doing with it's Ajax indicator:

                        if (attrs.i && context.isRedirecting !== true) {
                            Wicket.DOM.hideIncrementally(attrs.i);
                        }

I have to look up how I solved that in one of my projects - regretfully 
Ajax listeners do not have access to that "isRedirecting" flag.


Hope this helps
Sven


On 21.01.20 21:19, Entropy wrote:

In our app we display a veil after any button click that goes to the server
to prevent users double-submitting.  Which they do.  Alot.  Double-submits
cause a variety of mischief for us ranging from StaleObjectExceptions in
hibernate to wicket exceptions about buttons not being enabled and others.

So we add the veil, and then (for ajax) close it thusly:

Wicket.Event.subscribe('/ajax/call/done',
function(jqEvent, attributes, jqXHR, errorThrown, textStatus) {
//  console.log("done");
if(attributes) {
if(attributes.event) {

if(isVeiled(attributes.event.currentTarget)) {
closeVeil();
}
}
}   
}
);

The problem is that this /ajax/call/done doesn't seem to fire when the
request is REALLY done, but rather a bit BEFORE it's done.  We're getting
the same behavior, especially when an ajax event transitions from one page
to the next.  The veil unloads, and there's a pause just before the redirect
kicks in during which the user assumes the same page is being seen and their
click was ignored...so they click again.

Is there a better/later event during which i can unload the veil?  A
/ajax/call/really_done?

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
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