Re: wicket-dnd and link multiple items at once

2018-03-14 Thread Sven Meier
Hi,

well that's an 'interesting' use case you have there.

No, I'm afraid that would require some mayor tweaks in wicket-dnd's JavaScript.

Have fun
Sven

Am 14. März 2018 07:08:50 MEZ schrieb Dirk Forchel :
>Hi Sven,
>Thank you fror your answer. I think you have misunderstood the "use
>case" we
>want to achieve.
>We don't want to select several items and transfer them at once but
>rather
>select only one item (only one drag source) and drop that item (link
>operation) to different drop targets. I think if the user releases the
>mouse
>button on the first drop target, the selection will be lost. However,
>this
>should only happen once the user releases the control key. I hope I
>could
>express myself more clearly.
>Many thanks
>
>--
>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: wicket-dnd and link multiple items at once

2018-03-13 Thread Dirk Forchel
Hi Sven,
Thank you fror your answer. I think you have misunderstood the "use case" we
want to achieve.
We don't want to select several items and transfer them at once but rather
select only one item (only one drag source) and drop that item (link
operation) to different drop targets. I think if the user releases the mouse
button on the first drop target, the selection will be lost. However, this
should only happen once the user releases the control key. I hope I could
express myself more clearly.
Many thanks

--
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: wicket-dnd and link multiple items at once

2018-03-12 Thread Sven Meier
Hi Dirk,

wicket-dev doesn't know anything about selection.

You could do that by yourself, keeping track of clicked items while a control 
key is held.

When the actual dragNdrop operation is performed, your DragSource can put all 
selected items into the Transfer and the DropTarget can retrieve the 
transferred items.

This is a rough idea only as I haven't tried this actually.

Have fun
Sven



Am 12. März 2018 13:18:12 MEZ schrieb Dirk Forchel :
>Hello,
>I've a question regarding the Wicket drag'n'drop library. We're using
>this
>library successfully in order to link items with other items (the only
>operation allowed is a LINK operation) between to different panels (or
>container). It works quite well and I'm a bit curious about the way how
>to
>support multiple "link" operations at once. Instead of clicking on an
>item
>on the left container and dragging this item to the right container and
>releasing the mouse button, I'd like to hold an extra button to support
>"multiple" item copy operations.
>I could imagine that pressing the "ALT"-key and holding this key could
>start
>a link operation from the left container to the right as long as the
>"ALT"
>key gets pressed. Releasing the this key would stop the whole copy
>operation.
>I'm not sure whether this would be possible with the current release
>(wicket-dnd 0.7.3). For any hint I would be very grateful.
>
>--
>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


wicket-dnd and link multiple items at once

2018-03-12 Thread Dirk Forchel
Hello,
I've a question regarding the Wicket drag'n'drop library. We're using this
library successfully in order to link items with other items (the only
operation allowed is a LINK operation) between to different panels (or
container). It works quite well and I'm a bit curious about the way how to
support multiple "link" operations at once. Instead of clicking on an item
on the left container and dragging this item to the right container and
releasing the mouse button, I'd like to hold an extra button to support
"multiple" item copy operations.
I could imagine that pressing the "ALT"-key and holding this key could start
a link operation from the left container to the right as long as the "ALT"
key gets pressed. Releasing the this key would stop the whole copy
operation.
I'm not sure whether this would be possible with the current release
(wicket-dnd 0.7.3). For any hint I would be very grateful.

--
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: Disabling a link based on the authorization state of the page it links to.

2017-12-07 Thread Martin Nielsen
Brilliant. Thank you:)

On Thu, Dec 7, 2017 at 10:31 AM, Andrea Del Bene 
wrote:

> Hi,
>
> you can do it using your IAuthorizationStrategy:
>
> IAuthorizationStrategy as =
> Application.get().getSecuritySettings().getAuthorizationStrategy();
> as.isInstantiationAuthorized(Page.class);
>
>
>
> On Thu, Dec 7, 2017 at 10:08 AM, Martin Nielsen  wrote:
>
> > Hello everyone.
> >
> > I have been looking through this guide:
> > https://ci.apache.org/projects/wicket/guide/6.x/guide/security.html
> > I am currently trying to implement the AnnotationsRoleAuthorizationSt
> rategy
> > but
> > I have a followup question.
> >
> > I would like to create a navbar with Links which disable themselves if
> the
> > page they link to is not allowed for the logged in user. I am guessing i
> > need to create a subclass of Link for this case.
> > So what i need is some way to ask Wicket if a page is allowed based on
> its
> > class alone.
> > Is there a method along the lines of isAllowed(Class)
> > somewhere?
> >
> > Or does anyone have a different idea of accomplishing this?
> >
> >
> > Thank you
> >
> > -Martin
> >
>


Re: Disabling a link based on the authorization state of the page it links to.

2017-12-07 Thread Andrea Del Bene
Hi,

you can do it using your IAuthorizationStrategy:

IAuthorizationStrategy as =
Application.get().getSecuritySettings().getAuthorizationStrategy();
as.isInstantiationAuthorized(Page.class);



On Thu, Dec 7, 2017 at 10:08 AM, Martin Nielsen  wrote:

> Hello everyone.
>
> I have been looking through this guide:
> https://ci.apache.org/projects/wicket/guide/6.x/guide/security.html
> I am currently trying to implement the AnnotationsRoleAuthorizationStrategy
> but
> I have a followup question.
>
> I would like to create a navbar with Links which disable themselves if the
> page they link to is not allowed for the logged in user. I am guessing i
> need to create a subclass of Link for this case.
> So what i need is some way to ask Wicket if a page is allowed based on its
> class alone.
> Is there a method along the lines of isAllowed(Class)
> somewhere?
>
> Or does anyone have a different idea of accomplishing this?
>
>
> Thank you
>
> -Martin
>


Disabling a link based on the authorization state of the page it links to.

2017-12-07 Thread Martin Nielsen
Hello everyone.

I have been looking through this guide:
https://ci.apache.org/projects/wicket/guide/6.x/guide/security.html
I am currently trying to implement the AnnotationsRoleAuthorizationStrategy but
I have a followup question.

I would like to create a navbar with Links which disable themselves if the
page they link to is not allowed for the logged in user. I am guessing i
need to create a subclass of Link for this case.
So what i need is some way to ask Wicket if a page is allowed based on its
class alone.
Is there a method along the lines of isAllowed(Class)
somewhere?

Or does anyone have a different idea of accomplishing this?


Thank you

-Martin


Re: How to get generate html link for page with parameters

2017-08-21 Thread Martin Grigorov
Hi,

What you need is just : RequestCycle.get().urlFor(SomePage.class,
somePageParameters)
Otherwise also take a look at
http://examples8x.wicket.apache.org/mailtemplate/ example. It shows how to
render a Page, a Component and how to use TextTemplate.

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

On Mon, Aug 21, 2017 at 8:17 PM, fromgate  wrote:

> Hello!
>
> I need to create text (in fact it will be a confirmation email) that will
> contain a link to specific page object with provided parameters
> (confirmation code).
>
> Is there a way to render a BookmarkablePageLink object and get a String
> that
> will contain this link?
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/How-to-get-generate-html-link-for-page-
> with-parameters-tp4678570.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
>
>


How to get generate html link for page with parameters

2017-08-21 Thread fromgate
Hello!

I need to create text (in fact it will be a confirmation email) that will
contain a link to specific page object with provided parameters
(confirmation code).

Is there a way to render a BookmarkablePageLink object and get a String that
will contain this link?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-get-generate-html-link-for-page-with-parameters-tp4678570.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: POST request on textfield when expecting GET on link in AjaxPagingNavigator

2017-04-10 Thread Martin Grigorov
You can override it use only "inputchange" event for this TextField.
See
https://github.com/apache/wicket/blob/5f4affeb62bbd4ec6286394e0572ec20633c939f/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java#L79

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

On Mon, Apr 10, 2017 at 9:08 AM, ssamarin  wrote:

> We've got .add(new OnChangeAjaxBehavior() on TextField.
>
> Is there any way to fix this?
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/POST-request-on-textfield-when-expecting-GET-on-link-in-
> AjaxPagingNavigator-tp4677619p4677638.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: POST request on textfield when expecting GET on link in AjaxPagingNavigator

2017-04-10 Thread ssamarin
We've got .add(new OnChangeAjaxBehavior() on TextField. 

Is there any way to fix this?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/POST-request-on-textfield-when-expecting-GET-on-link-in-AjaxPagingNavigator-tp4677619p4677638.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: POST request on textfield when expecting GET on link in AjaxPagingNavigator

2017-04-07 Thread Martin Grigorov
Hi,

On Apr 7, 2017 4:52 PM, "ssamarin"  wrote:

Hello,

We've got TextField and AjaxPagingNavigator. After user enters something in
text field, list view is filtered, navigator is updated. After that, if
clicking on ">>" in navigator, POST request for text field is issued and
nothing happens. After clicking second time on ">>" - GET request is issued
for navigator and everything works as expected.

Any ideas why POST request for text field is issued first time?


It sounds like you have an AjaxFormComponentUpdatingBehavior ("blur") on
the TextField.
When you click the >> it loses focus and POSTs the content.


Regards, Stepan.

--
View this message in context: http://apache-wicket.1842946.
n4.nabble.com/POST-request-on-textfield-when-expecting-GET-on-link-in-
AjaxPagingNavigator-tp4677619.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


POST request on textfield when expecting GET on link in AjaxPagingNavigator

2017-04-07 Thread ssamarin
Hello,

We've got TextField and AjaxPagingNavigator. After user enters something in
text field, list view is filtered, navigator is updated. After that, if
clicking on ">>" in navigator, POST request for text field is issued and
nothing happens. After clicking second time on ">>" - GET request is issued
for navigator and everything works as expected.

Any ideas why POST request for text field is issued first time?

Regards, Stepan.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/POST-request-on-textfield-when-expecting-GET-on-link-in-AjaxPagingNavigator-tp4677619.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



WG: Re: Infinite Redirect Loop when using a Link

2017-03-29 Thread rene . hartwig
Hi,

I found the cause. This is happening because of the redirect I am making 
with the 'ConstraintSecurityHandler' together with the same name for the 
session cookie in both applications.
When using a separate session name for both applications everything is 
working fine.



Mit freundlichen Grüßen / Best regards,
René Hartwig
Team Leader Software Development

Mail:   rene.hart...@cryptshare.com
Phone:  +49 761 38913 0
Fax:+49 761 38913 115
Web:www.cryptshare.com
Befine Solutions AG - The Cryptshare company
Werthmannstr. 15
79098 Freiburg
Germany
__

Are your attachments too large or confidential for common e-mail?
Get to know Cryptshare! 
__

Interested in news and updates or you just like Cryptshare? Follow us!
Newsletter  |  Linkedin  l  XING  l  Twitter  l  Youtube l  Facebook  |  
RSS  l  Google+ 
__
Register Court Freiburg HRB 6144, Board of Management: Mark Forrest, 
Dominik Lehr, Chairman of the Supervisor Board: Thilo Braun
- Forwarded by René Hartwig/befine/DE on 29.03.2017 13:51 -

From:   Martin Grigorov 
To: "users@wicket.apache.org" 
Date:   28.03.2017 13:57
Subject:Re: Infinite Redirect Loop when using a Link



Hi,

Put a breakpoint in WebPageRenderer#respond() or/and #redirectTo() and see
what is the current url and what is the target url.
Do you use HttpsMapper? If YES then play with
org.apache.wicket.protocol.https.HttpsConfig#setPreferStateful(boolean) 
and
see whether it helps.

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

On Tue, Mar 28, 2017 at 1:50 PM,  wrote:

> Hi,
>
> I am using Wicket 7.6.0 with two Web Applications:
>
> Admin Interface on HTTPS  Port 8080 using a SignInPanel
> User Interface on HTTP Port 80
>
> Now I have a very strange behavior - here is how I can reproduce it:
> Delete all browser cookies
> Visit the Admin Interface
> Visit the User Interface (Using the same browser tab)
>
> --> An infinite redirect loop happens. The source of this problem is a
> Link on the page returning 'false' for #getStatelessHint().
>
> This is everything I have found out so far. Unfortunately I have not 
been
> able to reproduce this behavior in a quickstart project. Do you have an
> idea what might be causing this?
> I found this issue related to a recent redirect-issue, but I do not 
think
> that it has something to do with my problem, especially because it 
should
> be fixed in this Wicket version already.
>
>
>
> Mit freundlichen Grüßen / Best regards,
> René Hartwig
> Team Leader Software Development
>
> Mail:   rene.hart...@cryptshare.com
> Phone:  +49 761 38913 0
> Fax:+49 761 38913 115
> Web:www.cryptshare.com
> Befine Solutions AG - The Cryptshare company
> Werthmannstr. 15
> 79098 Freiburg
> Germany
> 
> __
>
> Are your attachments too large or confidential for common e-mail?
> Get to know Cryptshare!
> 
> __
>
> Interested in news and updates or you just like Cryptshare? Follow us!
> Newsletter  |  Linkedin  l  XING  l  Twitter  l  Youtube l  Facebook  |
> RSS  l  Google+
> 
> __
> Register Court Freiburg HRB 6144, Board of Management: Mark Forrest,
> Dominik Lehr, Chairman of the Supervisor Board: Thilo Braun


Re: Infinite Redirect Loop when using a Link

2017-03-28 Thread rene . hartwig
Hi,

it is always toggling between  and ?0:


I am not using an HttpsMapper, however I am making an automated redirect 
on the Admin Interface from HTTP Port 9090 to HTTPS Port 8080 using a 
Jetty 'ConstraintSecurityHandler'. When not making this redirect, the 
problem does not happen.


Mit freundlichen Grüßen / Best regards,
René Hartwig
Team Leader Software Development

Mail:   rene.hart...@cryptshare.com
Phone:  +49 761 38913 0
Fax:+49 761 38913 115
Web:www.cryptshare.com
Befine Solutions AG - The Cryptshare company
Werthmannstr. 15
79098 Freiburg
Germany
__

Are your attachments too large or confidential for common e-mail?
Get to know Cryptshare! 
__

Interested in news and updates or you just like Cryptshare? Follow us!
Newsletter  |  Linkedin  l  XING  l  Twitter  l  Youtube l  Facebook  |  
RSS  l  Google+ 
__
Register Court Freiburg HRB 6144, Board of Management: Mark Forrest, 
Dominik Lehr, Chairman of the Supervisor Board: Thilo Braun



From:   Martin Grigorov 
To: "users@wicket.apache.org" 
Date:   28.03.2017 13:57
Subject:Re: Infinite Redirect Loop when using a Link



Hi,

Put a breakpoint in WebPageRenderer#respond() or/and #redirectTo() and see
what is the current url and what is the target url.
Do you use HttpsMapper? If YES then play with
org.apache.wicket.protocol.https.HttpsConfig#setPreferStateful(boolean) 
and
see whether it helps.

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

On Tue, Mar 28, 2017 at 1:50 PM,  wrote:

> Hi,
>
> I am using Wicket 7.6.0 with two Web Applications:
>
> Admin Interface on HTTPS  Port 8080 using a SignInPanel
> User Interface on HTTP Port 80
>
> Now I have a very strange behavior - here is how I can reproduce it:
> Delete all browser cookies
> Visit the Admin Interface
> Visit the User Interface (Using the same browser tab)
>
> --> An infinite redirect loop happens. The source of this problem is a
> Link on the page returning 'false' for #getStatelessHint().
>
> This is everything I have found out so far. Unfortunately I have not 
been
> able to reproduce this behavior in a quickstart project. Do you have an
> idea what might be causing this?
> I found this issue related to a recent redirect-issue, but I do not 
think
> that it has something to do with my problem, especially because it 
should
> be fixed in this Wicket version already.
>
>
>
> Mit freundlichen Grüßen / Best regards,
> René Hartwig
> Team Leader Software Development
>
> Mail:   rene.hart...@cryptshare.com
> Phone:  +49 761 38913 0
> Fax:+49 761 38913 115
> Web:www.cryptshare.com
> Befine Solutions AG - The Cryptshare company
> Werthmannstr. 15
> 79098 Freiburg
> Germany
> 
> __
>
> Are your attachments too large or confidential for common e-mail?
> Get to know Cryptshare!
> 
> __
>
> Interested in news and updates or you just like Cryptshare? Follow us!
> Newsletter  |  Linkedin  l  XING  l  Twitter  l  Youtube l  Facebook  |
> RSS  l  Google+
> 
> __
> Register Court Freiburg HRB 6144, Board of Management: Mark Forrest,
> Dominik Lehr, Chairman of the Supervisor Board: Thilo Braun



Re: Infinite Redirect Loop when using a Link

2017-03-28 Thread Martin Grigorov
Hi,

Put a breakpoint in WebPageRenderer#respond() or/and #redirectTo() and see
what is the current url and what is the target url.
Do you use HttpsMapper? If YES then play with
org.apache.wicket.protocol.https.HttpsConfig#setPreferStateful(boolean) and
see whether it helps.

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

On Tue, Mar 28, 2017 at 1:50 PM,  wrote:

> Hi,
>
> I am using Wicket 7.6.0 with two Web Applications:
>
> Admin Interface on HTTPS  Port 8080 using a SignInPanel
> User Interface on HTTP Port 80
>
> Now I have a very strange behavior - here is how I can reproduce it:
> Delete all browser cookies
> Visit the Admin Interface
> Visit the User Interface (Using the same browser tab)
>
> --> An infinite redirect loop happens. The source of this problem is a
> Link on the page returning 'false' for #getStatelessHint().
>
> This is everything I have found out so far. Unfortunately I have not been
> able to reproduce this behavior in a quickstart project. Do you have an
> idea what might be causing this?
> I found this issue related to a recent redirect-issue, but I do not think
> that it has something to do with my problem, especially because it should
> be fixed in this Wicket version already.
>
>
>
> Mit freundlichen Grüßen / Best regards,
> René Hartwig
> Team Leader Software Development
>
> Mail:   rene.hart...@cryptshare.com
> Phone:  +49 761 38913 0
> Fax:+49 761 38913 115
> Web:www.cryptshare.com
> Befine Solutions AG - The Cryptshare company
> Werthmannstr. 15
> 79098 Freiburg
> Germany
> 
> __
>
> Are your attachments too large or confidential for common e-mail?
> Get to know Cryptshare!
> 
> __
>
> Interested in news and updates or you just like Cryptshare? Follow us!
> Newsletter  |  Linkedin  l  XING  l  Twitter  l  Youtube l  Facebook  |
> RSS  l  Google+
> 
> __
> Register Court Freiburg HRB 6144, Board of Management: Mark Forrest,
> Dominik Lehr, Chairman of the Supervisor Board: Thilo Braun


Infinite Redirect Loop when using a Link

2017-03-28 Thread rene . hartwig
Hi,

I am using Wicket 7.6.0 with two Web Applications:

Admin Interface on HTTPS  Port 8080 using a SignInPanel
User Interface on HTTP Port 80

Now I have a very strange behavior - here is how I can reproduce it:
Delete all browser cookies
Visit the Admin Interface
Visit the User Interface (Using the same browser tab)

--> An infinite redirect loop happens. The source of this problem is a 
Link on the page returning 'false' for #getStatelessHint().

This is everything I have found out so far. Unfortunately I have not been 
able to reproduce this behavior in a quickstart project. Do you have an 
idea what might be causing this?
I found this issue related to a recent redirect-issue, but I do not think 
that it has something to do with my problem, especially because it should 
be fixed in this Wicket version already.



Mit freundlichen Grüßen / Best regards,
René Hartwig
Team Leader Software Development

Mail:   rene.hart...@cryptshare.com
Phone:  +49 761 38913 0
Fax:+49 761 38913 115
Web:www.cryptshare.com
Befine Solutions AG - The Cryptshare company
Werthmannstr. 15
79098 Freiburg
Germany
__

Are your attachments too large or confidential for common e-mail?
Get to know Cryptshare! 
__

Interested in news and updates or you just like Cryptshare? Follow us!
Newsletter  |  Linkedin  l  XING  l  Twitter  l  Youtube l  Facebook  |  
RSS  l  Google+ 
__
Register Court Freiburg HRB 6144, Board of Management: Mark Forrest, 
Dominik Lehr, Chairman of the Supervisor Board: Thilo Braun

Re: CsrfPreventionRequestCycleListener Link 400

2016-11-14 Thread Francois Meillet
Thanks a lot you very detailed information.

François


> Le 14 nov. 2016 à 09:25, Emond Papegaaij  a écrit 
> :
> 
> Hi François,
> 
> Since 8.0.0-M2 (and 7.5.0) the CsrfPreventionRequestCycleListener will block 
> requests without an Origin and Referer header. The reason for this is that is 
> possible for an attacker to prevent a browser from sending a referer header 
> (for example with rel="noreferrer"). When you open a link in a new tab, your 
> browser probably does not send these headers and Wicket blocks the action-
> request.
> 
> You can configure this behavior in CsrfPreventionRequestCycleListener with 
> setNoOriginAction. As said, the default is 'ABORT'. If you set it to 
> 'SUPPRESS', Wicket will render the page, but not execute Link.onClick. This 
> will open the new tab with the page containing the link. If you set it to 
> 'ALLOW', Wicket will allow the request, but this may undermine the protection 
> offered by CsrfPreventionRequestCycleListener.
> 
> If your link simply points to a different page, I'd recommend to use a 
> BookmarkablePageLink. A request to simply render a page will never be blocked 
> by CsrfPreventionRequestCycleListener, so a BookmarkablePageLink will always 
> work. Naturaly for this to work, your target page needs to be bookmarkable.
> 
> You can also subclass CsrfPreventionRequestCycleListener and override 
> 'protected boolean isChecked(IRequestHandler handler)' to whitelist specific 
> requests. Perhaps you can tag safe links and skip checking those. This 
> solution offers you the most flexibility, but requires more work and you need 
> to be very precise in what requests to allow.
> 
> Best regards,
> Emond
> 
> 
> On zondag 13 november 2016 18:33:52 CET Francois Meillet wrote:
>> Hi,
>> 
>> When I use a CsrfPreventionRequestCycleListener, clicking a Link<> while
>> holding the command key does not open link in new tab. (Wicket 8.0.0-M2 /
>> OSX)
>> 
>> I get this error :
>> 
>> HTTP ERROR 400
>> Problem accessing /. Reason: Origin does not correspond to request
>> 
>> 
>> Clicking a BookmarkablePageLink is ok.
>> 
>> 
>> François
>> 
>> 
>> -
>> 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
> 


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



Re: CsrfPreventionRequestCycleListener Link 400

2016-11-14 Thread Emond Papegaaij
Hi François,

Since 8.0.0-M2 (and 7.5.0) the CsrfPreventionRequestCycleListener will block 
requests without an Origin and Referer header. The reason for this is that is 
possible for an attacker to prevent a browser from sending a referer header 
(for example with rel="noreferrer"). When you open a link in a new tab, your 
browser probably does not send these headers and Wicket blocks the action-
request.

You can configure this behavior in CsrfPreventionRequestCycleListener with 
setNoOriginAction. As said, the default is 'ABORT'. If you set it to 
'SUPPRESS', Wicket will render the page, but not execute Link.onClick. This 
will open the new tab with the page containing the link. If you set it to 
'ALLOW', Wicket will allow the request, but this may undermine the protection 
offered by CsrfPreventionRequestCycleListener.

If your link simply points to a different page, I'd recommend to use a 
BookmarkablePageLink. A request to simply render a page will never be blocked 
by CsrfPreventionRequestCycleListener, so a BookmarkablePageLink will always 
work. Naturaly for this to work, your target page needs to be bookmarkable.

You can also subclass CsrfPreventionRequestCycleListener and override 
'protected boolean isChecked(IRequestHandler handler)' to whitelist specific 
requests. Perhaps you can tag safe links and skip checking those. This 
solution offers you the most flexibility, but requires more work and you need 
to be very precise in what requests to allow.

Best regards,
Emond


On zondag 13 november 2016 18:33:52 CET Francois Meillet wrote:
> Hi,
> 
> When I use a CsrfPreventionRequestCycleListener, clicking a Link<> while
> holding the command key does not open link in new tab. (Wicket 8.0.0-M2 /
> OSX)
> 
> I get this error :
> 
> HTTP ERROR 400
> Problem accessing /. Reason: Origin does not correspond to request
> 
> 
> Clicking a BookmarkablePageLink is ok.
> 
> 
> François
> 
> 
> -
> 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



CsrfPreventionRequestCycleListener Link 400

2016-11-13 Thread Francois Meillet
Hi,

When I use a CsrfPreventionRequestCycleListener, clicking a Link<> while 
holding the command key does not open link in new tab.
(Wicket 8.0.0-M2 / OSX)

I get this error : 

HTTP ERROR 400
Problem accessing /. Reason: Origin does not correspond to request


Clicking a BookmarkablePageLink is ok.


François


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



Re: how to call modal window on link

2016-10-31 Thread Martin Grigorov
Check for JavaScript errors.

"it's not working" doesn't tell us much to be able to help you

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

On Mon, Oct 31, 2016 at 3:11 PM, Pratibha 
wrote:

> I tried that its not working, not sure what i am missing.
>
> @Override
> public void onClick() {
> confirmModal.add(new OpenWindowOnLoadBehavior());
> }
>
> public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
>   @Override
>   protected void respond(AjaxRequestTarget target) {
>   ModalWindow window = (ModalWindow) getComponent();
>   window.show(target);
>   }
>   @Override
>   public void renderHead(final Component component, IHeaderResponse
> response) {
> super.renderHead(component, response);
> response.render(OnEventHeaderItem.forScript("'" +
> component.getMarkupId()+
> "'","click", getCallbackScript()));
>   }
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675977.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: how to call modal window on link

2016-10-31 Thread Pratibha
I tried that its not working, not sure what i am missing.

@Override
public void onClick() {
confirmModal.add(new OpenWindowOnLoadBehavior());
}   

public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
  @Override
  protected void respond(AjaxRequestTarget target) {
  ModalWindow window = (ModalWindow) getComponent();
  window.show(target);
  }
  @Override
  public void renderHead(final Component component, IHeaderResponse
response) {
super.renderHead(component, response);
response.render(OnEventHeaderItem.forScript("'" +  component.getMarkupId()+
"'","click", getCallbackScript()));
  }
  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675977.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: how to call modal window on link

2016-10-31 Thread Martin Grigorov
click

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

On Mon, Oct 31, 2016 at 3:00 PM, Pratibha 
wrote:

> please advise which event i should use on link click then?
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675974.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: how to call modal window on link

2016-10-31 Thread Pratibha
please advise which event i should use on link click then?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675974.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: how to call modal window on link

2016-10-31 Thread Martin Grigorov
On Mon, Oct 31, 2016 at 2:35 PM, Pratibha 
wrote:

> That seems to be working  ok but when i close modalwindow it again Loads
> page
>
> is it possible to use
> response.render(OnEventHeaderItem.forScript(getCallbackScript().toString()
> ));
>

OnLoadHeaderItem just does: window.onload
So yes, you could use OnEventHeaderItem.forScript() with any better event.


>
> instead of OnloadHeaderItem
>
> Thank you
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675966.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: how to call modal window on link

2016-10-31 Thread Martin Grigorov
"onclick" is not a valid JS event name

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

On Mon, Oct 31, 2016 at 2:51 PM, Pratibha 
wrote:

> Thank you i tried this,it does not seem to be doing anything i want to call
> modal window on link click. am i missing something?
>
> response.render(OnEventHeaderItem.forScript("'" +
> component.getMarkupId()+
> "'", "onclick", getCallbackScript()));
>
> Please advise.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675972.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: how to call modal window on link

2016-10-31 Thread Pratibha
Thank you i tried this,it does not seem to be doing anything i want to call
modal window on link click. am i missing something?

response.render(OnEventHeaderItem.forScript("'" +  component.getMarkupId()+
"'", "onclick", getCallbackScript()));

Please advise.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675972.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: how to call modal window on link

2016-10-31 Thread Pratibha
That seems to be working  ok but when i close modalwindow it again Loads page

is it possible to use
response.render(OnEventHeaderItem.forScript(getCallbackScript().toString())); 

instead of OnloadHeaderItem

Thank you

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675966.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: how to call modal window on link

2016-10-27 Thread Ernesto Reinaldo Barreiro
checked that you don't target="_blank" on that link.

On Thu, Oct 27, 2016 at 2:40 PM, Pratibha 
wrote:

> Thank you that seems to be working but when i click on link it  first opens
> the same page in new tab and after that i can see modalWindow.
>
> So basically i end up with 2 same pages in 2 tabs one with modalwindow.
>
> confirmModal.add(new OpenWindowOnLoadBehavior());
> confirmModal.setContent(new
> ComplaintModal(confirmModal.getContentId(),confirmModal,_form));
>
> I need modalwindow to be opened in same page on button click.
>
> Thank you so much...
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675913.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro


Re: how to call modal window on link

2016-10-27 Thread Pratibha
Thank you that seems to be working but when i click on link it  first opens
the same page in new tab and after that i can see modalWindow.

So basically i end up with 2 same pages in 2 tabs one with modalwindow.

confirmModal.add(new OpenWindowOnLoadBehavior());
confirmModal.setContent(new
ComplaintModal(confirmModal.getContentId(),confirmModal,_form));

I need modalwindow to be opened in same page on button click.

Thank you so much...


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675913.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: how to call modal window on link

2016-10-27 Thread Martin Grigorov
response.render(OnLoadHeaderItem.forScript(getCallbackScript().toString());

Should be something like this.

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

On Thu, Oct 27, 2016 at 2:08 PM, Pratibha 
wrote:

> I am trying to call modal window but this is not working my code is
>
> @Override
> public void onClick() {
>
> confirmModal.add(new
> OpenWindowOnLoadBehavior());
>   confirmModal.setPageCreator(new
> ModalWindow.PageCreator() {
> @Override
> public Page createPage() {
> return new RedirectPage("http://www.google.com";);
> }
> });
> }
>
> public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
>   @Override
>   protected void respond(AjaxRequestTarget target) {
>   ModalWindow window = (ModalWindow) getComponent();
>   window.show(target);
>   }
>   @Override
>   public void renderHead(final Component component, IHeaderResponse
> response) {
>
>   *response.renderOnLoadJavascript(getCallbackScript().toString());*
>   }
>
> Please help me with this.
>
> Thanks
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675907.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: how to call modal window on link

2016-10-27 Thread Pratibha
I am trying to call modal window but this is not working my code is

@Override
public void onClick() {

confirmModal.add(new 
OpenWindowOnLoadBehavior());
  confirmModal.setPageCreator(new 
ModalWindow.PageCreator() {
@Override
public Page createPage() {
return new RedirectPage("http://www.google.com";);
}
});
}

public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
  @Override
  protected void respond(AjaxRequestTarget target) {
  ModalWindow window = (ModalWindow) getComponent();
  window.show(target);
  }
  @Override
  public void renderHead(final Component component, IHeaderResponse
response) {
  
  *response.renderOnLoadJavascript(getCallbackScript().toString());*
  }

Please help me with this.

Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675907.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: how to call modal window on link

2016-10-27 Thread Pratibha
Compile error..The method renderOnLoadJavascript(String) is undefined for the
type IHeaderResponse

public class OpenWindowOnLoadBehavior extends AbstractDefaultAjaxBehavior {
  @Override
  protected void respond(AjaxRequestTarget target) {
  ModalWindow window = (ModalWindow) getComponent();
  window.show(target);
  }
  @Override
  public void renderHead(final Component component, IHeaderResponse
response) {
   
  //*response.renderOnLoadJavascript(getCallbackScript().toString());*
  }

}

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675906.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: how to call modal window on link

2016-10-27 Thread Martin Grigorov
On Thu, Oct 27, 2016 at 1:41 PM, Pratibha 
wrote:

> Hi thank you for your help  but the below lines in OpenWindowOnLoadBehavior
> seems to be creating issue
>

What kind of issue ?


>
>   @Override
> public void renderHead(IHeaderResponse response) {
> response.renderOnLoadJavascript(getCallbackScript().toString());
> }
>
> I followed code in
> http://stackoverflow.com/questions/4765790/how-to-open-
> modaldialog-on-pageload.
>
> I cant get it working :(. Please advise.
>
> Thank you.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675903.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: how to call modal window on link

2016-10-27 Thread Pratibha
Hi thank you for your help  but the below lines in OpenWindowOnLoadBehavior 
seems to be creating issue

  @Override
public void renderHead(IHeaderResponse response) {
response.renderOnLoadJavascript(getCallbackScript().toString());
}

I followed code in
http://stackoverflow.com/questions/4765790/how-to-open-modaldialog-on-pageload.

I cant get it working :(. Please advise.

Thank you.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882p4675903.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: how to call modal window on link

2016-10-26 Thread Ernesto Reinaldo Barreiro
http://stackoverflow.com/questions/4765790/how-to-open-modaldialog-on-pageload

and

https://cwiki.apache.org/confluence/display/WICKET/Modal+Windows

Hope it still works as it did a few years ago!


On Wed, Oct 26, 2016 at 3:15 PM, Pratibha 
wrote:

> Hi,
>
> is it possible to call modal window on simple link without Ajax Request?
> public void onClick() {
> }
>
> Thanks
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/how-to-call-modal-window-on-link-tp4675882.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro


how to call modal window on link

2016-10-26 Thread Pratibha
Hi,

is it possible to call modal window on simple link without Ajax Request?
public void onClick() {
}

Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-call-modal-window-on-link-tp4675882.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: Bookmarkable link doesn't become a https link

2016-10-15 Thread Lars Törner
Hi Martin and thanks for your answer!

I think that what you say is that the documentation I found is correct.
  "It is extremely important that when setting the rootRequestMapper it
is done AFTER you have added any bookmarkable links otherwise they will not
be switched over to Secure mode".

I also understand why it's implemented like this. What I don't understand
is why it's now working in our code when we're mounting the bookmarkable
page after setting the requestmapper. I guess we have to take a deeper look
into it.

Once again, thank you for your effort!

Lars


lördag 15 oktober 2016 skrev Martin Grigorov :

> Hi Lars,
>
>
> mountPage("page2", Page2.class);
> setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
> HttpsConfig(8080, 8443)));
> mountPage("page3", Page3.class);
>
> Now if I am at Page1 (http://localhost:8080/page1) and there I have
> add(new BookmarkablePageLink("page2", Page2.class));
> then the generated url is https://localhost:8443/page2 because the
> HttpsMapper wraps the old root mapper that knows about Page2.
>
> HttpsMapper doesn't
> implement org.apache.wicket.request.mapper.ICompoundRequestMapper so when
> mountPage(page3) is called Wicket creates a
> new org.apache.wicket.request.mapper.CompoundRequestMapper that adds the
> current root mapper (HttpsMapper) at position 1 and a MountedMapper for
> Page3 at position 2. So requests to Page3 are not handled by HttpsMapper
> and the generated urls are HTTP, not HTTPS.
>
> HttpsMapper intentionally doesn't implement ICompoundRequestMapper exactly
> for this reason - to make it possible to configure pages which should never
> be secured.
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Oct 14, 2016 at 2:48 PM, Lars Törner  > wrote:
>
> > Hi,
> >
> > we had a problem where a bookmarkable link didn't become a https link.
> >
> > I found this:
> > https://cwiki.apache.org/confluence/display/WICKET/How+
> > to+switch+to+SSL+mode
> >
> > Which, with a warning,  states:
> >
> >  "It is extemtely important that when setting the rootRequestMapper it is
> > done AFTER you have added any bookmarkable links otherwise they will not
> be
> > switched over to Secure mode."
> >
> > I found that we in our Application.init() did the opposite, i.e. set the
> > rootRequestMapper before the page mounting. Problem solved, I thought.
> >
> > Instead the problem was that the page wasn't mounted at all, and the only
> > thing that worked was to mount the page and keep the order we had, which,
> > according to the link and the warning above is bound to fail.
> >
> > Please, can anyone tell me what I'm missing here?
> >
> > Wicket version: 6.22.
> >
> > Cheers
> > Lars
> >
>


Re: Bookmarkable link doesn't become a https link

2016-10-15 Thread Martin Grigorov
Hi Lars,


mountPage("page2", Page2.class);
setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
HttpsConfig(8080, 8443)));
mountPage("page3", Page3.class);

Now if I am at Page1 (http://localhost:8080/page1) and there I have
add(new BookmarkablePageLink("page2", Page2.class));
then the generated url is https://localhost:8443/page2 because the
HttpsMapper wraps the old root mapper that knows about Page2.

HttpsMapper doesn't
implement org.apache.wicket.request.mapper.ICompoundRequestMapper so when
mountPage(page3) is called Wicket creates a
new org.apache.wicket.request.mapper.CompoundRequestMapper that adds the
current root mapper (HttpsMapper) at position 1 and a MountedMapper for
Page3 at position 2. So requests to Page3 are not handled by HttpsMapper
and the generated urls are HTTP, not HTTPS.

HttpsMapper intentionally doesn't implement ICompoundRequestMapper exactly
for this reason - to make it possible to configure pages which should never
be secured.


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

On Fri, Oct 14, 2016 at 2:48 PM, Lars Törner  wrote:

> Hi,
>
> we had a problem where a bookmarkable link didn't become a https link.
>
> I found this:
> https://cwiki.apache.org/confluence/display/WICKET/How+
> to+switch+to+SSL+mode
>
> Which, with a warning,  states:
>
>  "It is extemtely important that when setting the rootRequestMapper it is
> done AFTER you have added any bookmarkable links otherwise they will not be
> switched over to Secure mode."
>
> I found that we in our Application.init() did the opposite, i.e. set the
> rootRequestMapper before the page mounting. Problem solved, I thought.
>
> Instead the problem was that the page wasn't mounted at all, and the only
> thing that worked was to mount the page and keep the order we had, which,
> according to the link and the warning above is bound to fail.
>
> Please, can anyone tell me what I'm missing here?
>
> Wicket version: 6.22.
>
> Cheers
> Lars
>


Bookmarkable link doesn't become a https link

2016-10-14 Thread Lars Törner
Hi,

we had a problem where a bookmarkable link didn't become a https link.

I found this:
https://cwiki.apache.org/confluence/display/WICKET/How+to+switch+to+SSL+mode

Which, with a warning,  states:

 "It is extemtely important that when setting the rootRequestMapper it is
done AFTER you have added any bookmarkable links otherwise they will not be
switched over to Secure mode."

I found that we in our Application.init() did the opposite, i.e. set the
rootRequestMapper before the page mounting. Problem solved, I thought.

Instead the problem was that the page wasn't mounted at all, and the only
thing that worked was to mount the page and keep the order we had, which,
according to the link and the warning above is bound to fail.

Please, can anyone tell me what I'm missing here?

Wicket version: 6.22.

Cheers
Lars


Re: Link - open modal on left click, new tab/window on right-click/context

2016-08-05 Thread Martin Grigorov
Hi,

Please show us what you have done so we can tell you what is still missing.
Google for "JavaScript preventDefault" and "JavaScript left middle right
click" to find out more about how those work.

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

On Wed, Jul 27, 2016 at 10:36 PM, sorinev  wrote:

> Changing the href worked. But it opens the page on both a left click and a
> right click -> new tab. This may be related to the second part having no
> effect (stopping the propagation), which may in turn be related to the
> third
> part. Since I don't really know javascript, I'm not sure what needs to go
> there.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Link-open-modal-on-left-click-new-tab-window-
> on-right-click-context-tp4675216p4675227.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: Link - open modal on left click, new tab/window on right-click/context

2016-07-27 Thread sorinev
Changing the href worked. But it opens the page on both a left click and a
right click -> new tab. This may be related to the second part having no
effect (stopping the propagation), which may in turn be related to the third
part. Since I don't really know javascript, I'm not sure what needs to go
there. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Link-open-modal-on-left-click-new-tab-window-on-right-click-context-tp4675216p4675227.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: Link - open modal on left click, new tab/window on right-click/context

2016-07-27 Thread Martin Grigorov
Hi,

You can override onComponentTag() of this AjaxLink and do tag.put("href",
redirectUrl);
In addition you need to stop the propagation of the JS event: override
#updateAjaxAttributes() and do attributes.setEventPropagation(STOP)
One more thing you may need here is a precondition that checks whether it
is a left or right click. For this you can use:
attributes.getAjaxCallListeners().add(new
AjaxCallListener().onPrecondition("someJavaScriptThatUses attrs.event to do
the extra checks"))

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

On Tue, Jul 26, 2016 at 7:51 PM, sorinev  wrote:

> I have an AjaxLink on my page.
>
>
>
> and the modal side of it is:
>
>
>
> And this works just fine. When I click the link, a wicket modal window
> opens
> with the content of that modal being loaded from an external url.
>
> However, a request has been made to change the functionality slightly. When
> left clicking, the behavior should remain as is, but when right clicking on
> the link and choosing open in a new tab or window, it should open a new
> tab/window with that external url instead of popping up the modal. I've
> googled around and haven't found a way to do this.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Link-open-modal-on-left-click-new-tab-window-on-right-click-context-tp4675216.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
>
>


Link - open modal on left click, new tab/window on right-click/context

2016-07-26 Thread sorinev
I have an AjaxLink on my page. 



and the modal side of it is:



And this works just fine. When I click the link, a wicket modal window opens
with the content of that modal being loaded from an external url.

However, a request has been made to change the functionality slightly. When
left clicking, the behavior should remain as is, but when right clicking on
the link and choosing open in a new tab or window, it should open a new
tab/window with that external url instead of popping up the modal. I've
googled around and haven't found a way to do this.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Link-open-modal-on-left-click-new-tab-window-on-right-click-context-tp4675216.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: How can I modify onclick attribute of Link (wicket7) ?

2015-09-04 Thread xesj
Thank You. This is perfect solution:

add(
  new Link("linkWithConfirm") {
@Override
public void onClick() {
  setResponsePage(Abc.class);
}
@Override
protected void onComponentTag(ComponentTag tag) {
  // parent makes attributes
  super.onComponentTag(tag);
  // modify onclick attribute
  String parentOnclick = tag.getAttribute("onclick");
  String newOnclick = "if (!confirm('Sure ?')) return false; " +
parentOnclick;
  tag.put("onclick", newOnclick);
}
  }
  .setPopupSettings(new PopupSettings())
);


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-can-I-modify-onclick-attribute-of-Link-wicket7-tp4671900p4671902.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: How can I modify onclick attribute of Link (wicket7) ?

2015-09-04 Thread Martin Grigorov
Hi,

See org.apache.wicket.markup.html.link.Link#onComponentTag().
You override the popup settings with your alert.

You may need to
override org.apache.wicket.markup.html.link.Link#onComponentTag() to be
able to preserve the popup settings.

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

On Fri, Sep 4, 2015 at 10:42 AM, xesj  wrote:

> Hi !
>
> When a Link doesn't open popup window, I can write onclick in html code:
>...
>
> But 'popup' Link rewrites onclick attribute.
> I tried to modify this javascript, but this example isn't working:
>
>   add(
>   new Link("linkWithConfirm") {
> @Override
> public void onClick() {
>   setResponsePage(Abc.class);
> }
> @Override
> protected CharSequence getOnClickScript(CharSequence url) {
>   return "alert('run!!!'); " + super.getOnClickScript(url);
> }
>   }
>   .setPopupSettings(new PopupSettings())
> );
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-can-I-modify-onclick-attribute-of-Link-wicket7-tp4671900.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
>
>


How can I modify onclick attribute of Link (wicket7) ?

2015-09-04 Thread xesj
Hi !

When a Link doesn't open popup window, I can write onclick in html code:
   ... 

But 'popup' Link rewrites onclick attribute.
I tried to modify this javascript, but this example isn't working:

  add(
  new Link("linkWithConfirm") {
@Override
public void onClick() {
  setResponsePage(Abc.class);
}
@Override
protected CharSequence getOnClickScript(CharSequence url) {
  return "alert('run!!!'); " + super.getOnClickScript(url);
}
  }
  .setPopupSettings(new PopupSettings())
);

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-can-I-modify-onclick-attribute-of-Link-wicket7-tp4671900.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: Link not working after upgrade from 6.8.0 to 6.20.0

2015-08-20 Thread Martin Grigorov
Yes. This was a bug fix.
You need to account for both.

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

On Thu, Aug 20, 2015 at 1:10 PM, Tom Eicher  wrote:

> Hello,
>
> okay, I have located the reason for for 6.8.0++ incompatibility.
>
> In a MountedMapper for unversioned pages, for 6.8.0 the method
>
> @Override
> public Url mapHandler(IRequestHandler requestHandler) {
>  if (requestHandler instanceof ListenerInterfaceRequestHandler) {
>  return null;
>  }
>  else {
>  return super.mapHandler(requestHandler);
>      }
> }
>
> would work but loose the link hrefs for >6.8.0,
> here we additionally need
>
> if (requestHandler instanceof ListenerInterfaceRequestHandler ||
>  requestHandler instanceof BookmarkableListenerInterfaceRequestHandler)
>
> Quickstart attached.
>
> Any thoughts?
>
> Cheers, Tom.
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>


Re: Link not working after upgrade from 6.8.0 to 6.20.0

2015-08-13 Thread Martin Grigorov
Hi,

Do you use WicketStuff-Portlet ? I see some "Portal"s in the paths.
Try to upgrade version by version and see at which one exactly it starts to
fail.
If there are no portlets involved then please create a quickstart app and
attach it to JIRA so we can debug it. Thanks!

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

On Thu, Aug 13, 2015 at 6:39 PM, Tom Eicher  wrote:

> Hello,
>
> I was thinking, I'd just upgrade to 6.latest before
> planning the big move to Wicket 7, but I experience
> some very strange behaviour:
>
> All throughout my app. I am using Links like this:
>
> Link l = new Link("NavBarAppLink") {
> @Override
> public void onClick() {
> setResponsePage(page);
> }
> };
> l.setBody(Model.of(someText));
> return l;
>
> In Wicket 6.8.0 this produced like:
>
>  href="../page?4-1.ILinkListener-PortalBody-PortalNavBar-NavBarItems-2-NavBarItem-NavBarAppItem-NavBarItems-0-NavBarItem-NavBarAppItem-NavBarAppLink"
> wicketpath="PortalBody_PortalNavBar_NavBarItems_2_NavBarItem_NavBarAppItem_NavBarItems_0_NavBarItem_NavBarAppItem_NavBarAppLink">TheApp
>
> and the click works.
>
> In Wicket 6.20.0 this just produces
>
>  wicketpath="PortalBody_PortalNavBar_NavBarItems_1_NavBarItem_NavBarAppItem_NavBarAppLink">TheApp
>
> Where "Home" ist the mount path of the current page, not the intended
> target. So basically all links just go to themselves.
>
> I have no idea what could be causing this.
> Just changing the wicket project libraries makes the app work again.
>
> -rw-r--r--  1 teicher  staff35284 30 Jul 16:31 wicket-cdi-6.20.0.jar
> -rw-r--r--  1 teicher  staff35496 30 Jul 17:20 wicket-cdi-6.8.0.jar
> -rw-r--r--  1 teicher  staff  2115670 30 Jul 16:31 wicket-core-6.20.0.jar
> -rw-r--r--  1 teicher  staff  1910550 30 Jul 17:20 wicket-core-6.8.0.jar
> -rw-r--r--  1 teicher  staff   113012 30 Jul 16:31
> wicket-devutils-6.20.0.jar
> -rw-r--r--  1 teicher  staff   113231 30 Jul 17:20
> wicket-devutils-6.8.0.jar
> -rw-r--r--  1 teicher  staff  1381884 30 Jul 16:31
> wicket-extensions-6.20.0.jar
> -rw-r--r--  1 teicher  staff  1371703 30 Jul 17:20
> wicket-extensions-6.8.0.jar
> -rw-r--r--  1 teicher  staff86597 30 Jul 16:32
> wicket-request-6.20.0.jar
> -rw-r--r--  1 teicher  staff86496 30 Jul 17:20 wicket-request-6.8.0.jar
> -rw-r--r--  1 teicher  staff   426848 30 Jul 16:32 wicket-util-6.20.0.jar
> -rw-r--r--  1 teicher  staff   415481 30 Jul 17:20 wicket-util-6.8.0.jar
>
> Any hints appreciated.
>
> Thanks, Tom.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Link not working after upgrade from 6.8.0 to 6.20.0

2015-08-13 Thread Tom Eicher

Hello,

I was thinking, I'd just upgrade to 6.latest before
planning the big move to Wicket 7, but I experience
some very strange behaviour:

All throughout my app. I am using Links like this:

Link l = new Link("NavBarAppLink") {
@Override
public void onClick() {
setResponsePage(page);
}
};
l.setBody(Model.of(someText));
return l;

In Wicket 6.8.0 this produced like:

href="../page?4-1.ILinkListener-PortalBody-PortalNavBar-NavBarItems-2-NavBarItem-NavBarAppItem-NavBarItems-0-NavBarItem-NavBarAppItem-NavBarAppLink" 
wicketpath="PortalBody_PortalNavBar_NavBarItems_2_NavBarItem_NavBarAppItem_NavBarItems_0_NavBarItem_NavBarAppItem_NavBarAppLink">TheApp


and the click works.

In Wicket 6.20.0 this just produces

wicketpath="PortalBody_PortalNavBar_NavBarItems_1_NavBarItem_NavBarAppItem_NavBarAppLink">TheApp


Where "Home" ist the mount path of the current page, not the intended
target. So basically all links just go to themselves.

I have no idea what could be causing this.
Just changing the wicket project libraries makes the app work again.

-rw-r--r--  1 teicher  staff35284 30 Jul 16:31 wicket-cdi-6.20.0.jar
-rw-r--r--  1 teicher  staff35496 30 Jul 17:20 wicket-cdi-6.8.0.jar
-rw-r--r--  1 teicher  staff  2115670 30 Jul 16:31 wicket-core-6.20.0.jar
-rw-r--r--  1 teicher  staff  1910550 30 Jul 17:20 wicket-core-6.8.0.jar
-rw-r--r--  1 teicher  staff   113012 30 Jul 16:31 
wicket-devutils-6.20.0.jar

-rw-r--r--  1 teicher  staff   113231 30 Jul 17:20 wicket-devutils-6.8.0.jar
-rw-r--r--  1 teicher  staff  1381884 30 Jul 16:31 
wicket-extensions-6.20.0.jar
-rw-r--r--  1 teicher  staff  1371703 30 Jul 17:20 
wicket-extensions-6.8.0.jar

-rw-r--r--  1 teicher  staff86597 30 Jul 16:32 wicket-request-6.20.0.jar
-rw-r--r--  1 teicher  staff86496 30 Jul 17:20 wicket-request-6.8.0.jar
-rw-r--r--  1 teicher  staff   426848 30 Jul 16:32 wicket-util-6.20.0.jar
-rw-r--r--  1 teicher  staff   415481 30 Jul 17:20 wicket-util-6.8.0.jar

Any hints appreciated.

Thanks, Tom.


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



Re: How to link an anchor to another element id, all within a repeater (DataView)?

2015-07-09 Thread Martin Grigorov
Hi,

You will have to make both of them Wicket components.
>From there on it is easy.

Martin Grigorov
Freelancer. Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Jul 9, 2015 at 10:55 PM, Christopher Merrill <
ch...@webperformance.com> wrote:

> I have this bit of HTML:
>
>  class="action">Start
> 
>  
>   class="close">X
>  Confirm controller start
>  Are you sure you want to do this?
>   href="#">Start it!
>  
> 
>
>
> The "Start" link in the first line references, by ID, the following DIV to
> open a modal dialog (simulated in CSS) to confirm the user's action. Within
> that dialog is a confirm link. This all works great.
>
> When I put this into a repeater (DataView), I think I will end up with
> multiple elements with the same ID...which implies that references by ID
> will not work as expected. The ID in the anchor and the div need to be
> dynamic and match up.
>
> What is the Wicket way to do this?
>
> TIA!
> Chris
>


How to link an anchor to another element id, all within a repeater (DataView)?

2015-07-09 Thread Christopher Merrill
I have this bit of HTML:

Start

 
 X
 Confirm controller start
 Are you sure you want to do this?
 Start it!
 



The "Start" link in the first line references, by ID, the following DIV to
open a modal dialog (simulated in CSS) to confirm the user's action. Within
that dialog is a confirm link. This all works great.

When I put this into a repeater (DataView), I think I will end up with
multiple elements with the same ID...which implies that references by ID
will not work as expected. The ID in the anchor and the div need to be
dynamic and match up.

What is the Wicket way to do this?

TIA!
Chris


Re: Add a link to MessageDialog

2015-06-09 Thread Sebastien
Hi,

You need to extend MessageDialog, provide a complete markup file
(copied/inspired from MessageDialog.html), and supply the "link1" markup (A
tag) in it...

Hope this helps,
Sebastien



On Tue, Jun 9, 2015 at 5:53 PM, smoothe19 
wrote:

> I am trying to add a clickable link to my message dialog
>
>
>   //TrainingDialog associated with save button
> trainingDialog = new MessageDialog("trainingdialog", "Warning",
> "",
> DialogButtons.OK, DialogIcon.WARN) {
> public void onClose(AjaxRequestTarget target, DialogButton
> button) {
> if (button != null && button.match(LBL_OK)) {
>
> //note: predefined button text are:
> //LBL_OK, LBL_CANCEL, LBL_YES, LBL_NO, LBL_CLOSE,
> LBL_SUBMIT
> }
> }
> };
>
> add(trainingDialog);
>
>
>
> //Method displays dialog
>  public void initiateTrainingMode() {
>
>try {
>   //Training mode logic
>   if (trainingmode()){
>
>  final String com = trainingEvalService.getMessage();
>  final AjaxLink  link1 = new AjaxLink("link1") {
> private static final long serialVersionUID = 1L;
>
> @Override
> public void onClick(AjaxRequestTarget target) {
>
> }
> };
>  AjaxEventBehavior event = new AjaxEventBehavior("onload") {
> @Override
> protected void onEvent(final AjaxRequestTarget target) {
> // Display popup
>if (com.length() > 0){
>   trainingDialog.setModelObject(com);
>  * trainingDialog.add(link1);*
>   trainingDialog.open(target);
>   trainingEvalService.setMessage("");
>
>}
>
> }
> };
> add(event);
>
>   }
>
>}
>catch (NullPointerException e){
>   LOG.debug("NullPointer was caught " + e.getMessage());
>}
> }
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Add-a-link-to-MessageDialog-tp4671115.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
>
>


Add a link to MessageDialog

2015-06-09 Thread smoothe19
I am trying to add a clickable link to my message dialog


  //TrainingDialog associated with save button
trainingDialog = new MessageDialog("trainingdialog", "Warning",
"",
DialogButtons.OK, DialogIcon.WARN) {
public void onClose(AjaxRequestTarget target, DialogButton
button) {
if (button != null && button.match(LBL_OK)) {   


//note: predefined button text are:
//LBL_OK, LBL_CANCEL, LBL_YES, LBL_NO, LBL_CLOSE,
LBL_SUBMIT
}
}
};  
 
add(trainingDialog);



//Method displays dialog
 public void initiateTrainingMode() {
   
   try {  
  //Training mode logic
  if (trainingmode()){
 
 final String com = trainingEvalService.getMessage();  
 final AjaxLink  link1 = new AjaxLink("link1") {
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {

}
};
 AjaxEventBehavior event = new AjaxEventBehavior("onload") {
   
@Override
protected void onEvent(final AjaxRequestTarget target) {

// Display popup 
   if (com.length() > 0){
  trainingDialog.setModelObject(com); 
 * trainingDialog.add(link1);*
  trainingDialog.open(target); 
  trainingEvalService.setMessage("");
 
   }  
   
}
};
add(event);   
   
  }

   }
   catch (NullPointerException e){
  LOG.debug("NullPointer was caught " + e.getMessage());
   }
}


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Add-a-link-to-MessageDialog-tp4671115.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: link with confirm dialog

2015-05-31 Thread Chris
Thanks for your answer,

Chris


> Am 31.05.2015 um 22:48 schrieb Martin Grigorov :
> 
> Hi,
> 
> 'confirm' is a JavaScript method.
> It is executed *before* the Ajax call that would lead to execution of
> AjaxFallbackLink's onClick().
> If 'confirm' returns false then the Ajax call won't be made at all.
> 
> To accomplish what you need you have to introduce a step in the middle.
> When the user clicks on the Ajax link you have to open a dialog/modal
> window with your question and buttons OK/Cancel. If OK is clicked then go
> to page Page, otherwise do nothing.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Sat, May 30, 2015 at 8:44 PM, Chris  wrote:
> 
>> Hi all,
>> 
>> how can I change the code so that the confirm-dialog is called when the
>> #onClick method is executed and not at constructor-time?
>> I would like to change the dialog text based on some runtime variable.
>> 
>> Thanks, Chris
>> 
>> 
>> 
>> Link link = new AjaxFallbackLink("link") {
>> 
>>@Override
>>public void onClick(AjaxRequestTarget target) {
>>setResponsePage(new Page());
>>}
>> 
>>@Override
>>protected void updateAjaxAttributes(AjaxRequestAttributes
>> attributes) {
>>super.updateAjaxAttributes(attributes);
>>AjaxCallListener ajaxCallListener = new
>> AjaxCallListener();
>>ajaxCallListener.onPrecondition("return
>> confirm('...');");
>> 
>> attributes.getAjaxCallListeners().add(ajaxCallListener);
>>}
>>}
>>};
>> -
>> 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: link with confirm dialog

2015-05-31 Thread Martin Grigorov
Hi,

'confirm' is a JavaScript method.
It is executed *before* the Ajax call that would lead to execution of
AjaxFallbackLink's onClick().
If 'confirm' returns false then the Ajax call won't be made at all.

To accomplish what you need you have to introduce a step in the middle.
When the user clicks on the Ajax link you have to open a dialog/modal
window with your question and buttons OK/Cancel. If OK is clicked then go
to page Page, otherwise do nothing.

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

On Sat, May 30, 2015 at 8:44 PM, Chris  wrote:

> Hi all,
>
> how can I change the code so that the confirm-dialog is called when the
> #onClick method is executed and not at constructor-time?
> I would like to change the dialog text based on some runtime variable.
>
> Thanks, Chris
>
>
>
>  Link link = new AjaxFallbackLink("link") {
>
> @Override
> public void onClick(AjaxRequestTarget target) {
> setResponsePage(new Page());
> }
>
> @Override
> protected void updateAjaxAttributes(AjaxRequestAttributes
> attributes) {
> super.updateAjaxAttributes(attributes);
> AjaxCallListener ajaxCallListener = new
> AjaxCallListener();
> ajaxCallListener.onPrecondition("return
> confirm('...');");
>
> attributes.getAjaxCallListeners().add(ajaxCallListener);
> }
> }
> };
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


link with confirm dialog

2015-05-30 Thread Chris
Hi all,

how can I change the code so that the confirm-dialog is called when the 
#onClick method is executed and not at constructor-time?
I would like to change the dialog text based on some runtime variable.

Thanks, Chris



 Link link = new AjaxFallbackLink("link") {

@Override
public void onClick(AjaxRequestTarget target) {
setResponsePage(new Page());
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes 
attributes) {
super.updateAjaxAttributes(attributes);
AjaxCallListener ajaxCallListener = new 
AjaxCallListener();
ajaxCallListener.onPrecondition("return confirm('...');");
attributes.getAjaxCallListeners().add(ajaxCallListener);
}
}
};
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Link generated href

2015-05-27 Thread CodeMonkey
Hi Martin,


It worked, thank you very much. :)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Link-generated-href-tp4670915p4670962.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: Link generated href

2015-05-26 Thread CodeMonkey
Hi Martin, 


Ok thank you, let me look at this.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Link-generated-href-tp4670915p4670918.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: Link generated href

2015-05-26 Thread Martin Grigorov
Hi,

You can use XPath or CSS selector to find the link by id/class/attribute.
See http://stackoverflow.com/a/26604982/497381

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

On Tue, May 26, 2015 at 1:24 PM, CodeMonkey 
wrote:

> Hello guys,
>
>
> I'm new to Wicket, and actually i'm doing some JMeter tests for my
> application, I have a page with a DataView (HTML table) that has a filter
> button to filter data and a "Link" button, this Link has his generated href
> like the following :
>
> =>
>
> href="page?5-1.ILinkListener-assignpu_list_panel-filterForm-dataview-1-assign"
>
> The problem is everytime i click on the filter button, the generated href
> changes and becomes for example :
>
> href="page?5-1.ILinkListener-assignpu_list_panel-filterForm-dataview-*3*-assign"
>
> And next time i click again becomes :
>
> href="page?5-1.ILinkListener-assignpu_list_panel-filterForm-dataview-*6*-assign"
>
> That makes it difficule for me to test with JMeter since i almost can't
> guess the given id each time especialy with many threads...
>
>
> I welcome any suggestions, thanks in advance.
>
>
> Regards
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Link-generated-href-tp4670915.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
>
>


Link generated href

2015-05-26 Thread CodeMonkey
Hello guys,


I'm new to Wicket, and actually i'm doing some JMeter tests for my
application, I have a page with a DataView (HTML table) that has a filter
button to filter data and a "Link" button, this Link has his generated href
like the following : 

=>
href="page?5-1.ILinkListener-assignpu_list_panel-filterForm-dataview-1-assign" 

The problem is everytime i click on the filter button, the generated href
changes and becomes for example :
href="page?5-1.ILinkListener-assignpu_list_panel-filterForm-dataview-*3*-assign"

And next time i click again becomes :
href="page?5-1.ILinkListener-assignpu_list_panel-filterForm-dataview-*6*-assign"

That makes it difficule for me to test with JMeter since i almost can't
guess the given id each time especialy with many threads... 


I welcome any suggestions, thanks in advance.


Regards

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Link-generated-href-tp4670915.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: Resource link open in new window

2015-05-03 Thread Chris
Hi Martin,

do you mean using the popupsettings or directly some window.open js underneath?

With following code a completely new page would open, I would prefer open a new 
tab.
PopupSettings popupSettings = new PopupSettings();
popupSettings.setTarget("_blank");
resourceLink.setPopupSettings(popupSettings);
Thanks, Chris

> Am 03.05.2015 um 21:47 schrieb Martin Grigorov :
> 
> You should use window.open() instead.
> See org.apache.wicket.markup.html.link.Link#setPopupSettings
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Sun, May 3, 2015 at 10:44 PM, Chris  wrote:
> 
>> Hi Martin,
>> 
>> thanks - if the click is on a DIV element instead of a link, how can I add
>> to the response a JS that the response should be opened in a new window?
>> 
>> Chris
>> 
>>> Am 03.05.2015 um 21:15 schrieb Martin Grigorov :
>>> 
>>> Hi,
>>> 
>>> Add target="_blank" in the HTML.
>>> In Java make sure you use ContentDisposition=INLINE.
>>> 
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>> 
>>> On Sun, May 3, 2015 at 2:42 PM, Chris  wrote:
>>> 
>>>> Hi all,
>>>> 
>>>> How is it possible to add a tag target=_blank to a resource link
>> serving a
>>>> pdf so that a click on this resource link opens a new browser window?
>>>> Following code does not work:l ink.add(new AttributeAppender("onclick",
>>>> new Model("alert('This is my JS script');"), ";"));
>>>> 
>>>> Thanks Chris
>>>> -
>>>> 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: Resource link open in new window

2015-05-03 Thread Martin Grigorov
You should use window.open() instead.
See org.apache.wicket.markup.html.link.Link#setPopupSettings

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

On Sun, May 3, 2015 at 10:44 PM, Chris  wrote:

> Hi Martin,
>
> thanks - if the click is on a DIV element instead of a link, how can I add
> to the response a JS that the response should be opened in a new window?
>
> Chris
>
> > Am 03.05.2015 um 21:15 schrieb Martin Grigorov :
> >
> > Hi,
> >
> > Add target="_blank" in the HTML.
> > In Java make sure you use ContentDisposition=INLINE.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Sun, May 3, 2015 at 2:42 PM, Chris  wrote:
> >
> >> Hi all,
> >>
> >> How is it possible to add a tag target=_blank to a resource link
> serving a
> >> pdf so that a click on this resource link opens a new browser window?
> >> Following code does not work:l ink.add(new AttributeAppender("onclick",
> >> new Model("alert('This is my JS script');"), ";"));
> >>
> >> Thanks Chris
> >> -
> >> 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: Resource link open in new window

2015-05-03 Thread Chris
Hi Martin,

thanks - if the click is on a DIV element instead of a link, how can I add to 
the response a JS that the response should be opened in a new window? 

Chris

> Am 03.05.2015 um 21:15 schrieb Martin Grigorov :
> 
> Hi,
> 
> Add target="_blank" in the HTML.
> In Java make sure you use ContentDisposition=INLINE.
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Sun, May 3, 2015 at 2:42 PM, Chris  wrote:
> 
>> Hi all,
>> 
>> How is it possible to add a tag target=_blank to a resource link serving a
>> pdf so that a click on this resource link opens a new browser window?
>> Following code does not work:l ink.add(new AttributeAppender("onclick",
>> new Model("alert('This is my JS script');"), ";"));
>> 
>> Thanks Chris
>> -
>> 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: Resource link open in new window

2015-05-03 Thread Martin Grigorov
Hi,

Add target="_blank" in the HTML.
In Java make sure you use ContentDisposition=INLINE.

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

On Sun, May 3, 2015 at 2:42 PM, Chris  wrote:

> Hi all,
>
> How is it possible to add a tag target=_blank to a resource link serving a
> pdf so that a click on this resource link opens a new browser window?
> Following code does not work:l ink.add(new AttributeAppender("onclick",
> new Model("alert('This is my JS script');"), ";"));
>
> Thanks Chris
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Resource link open in new window

2015-05-03 Thread Chris
Hi all,

How is it possible to add a tag target=_blank to a resource link serving a pdf 
so that a click on this resource link opens a new browser window?
Following code does not work:l ink.add(new AttributeAppender("onclick", new 
Model("alert('This is my JS script');"), ";"));

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



Re: How to display download link with file name in wicket

2015-04-14 Thread Martin Grigorov
confirming!
On Apr 14, 2015 6:04 AM, "kspat"  wrote:

> Hi,
>
> Thanks for the response. As I have not given separate wickets ids for each
> column will the approach of adding Panel to CellItem and creating one more
> wicket id in Panel with a  link  . Please confirm this.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-display-download-link-with-file-name-in-wicket-tp4670270p4670290.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: How to display download link with file name in wicket

2015-04-14 Thread kspat
Hi,

Thanks for the response. As I have not given separate wickets ids for each
column will the approach of adding Panel to CellItem and creating one more
wicket id in Panel with a  link  . Please confirm this.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-display-download-link-with-file-name-in-wicket-tp4670270p4670290.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: How to display download link with file name in wicket

2015-04-13 Thread Martin Grigorov
Hi,

You have to add a Panel to the CellItem.
The panel should contain a link ()
On Apr 14, 2015 12:47 AM, "kspat"  wrote:

> Hi Martin,
>
> I tried the approach suggested by you and its working as expected. The file
> name is displayed in the filed, and when clicked the file download pop up
> is
> displayed.
>
> However the file name is displayed as a link, but as a plain text. Is there
> any way out to make sure it is displayed as a link ?
>
> Regards,
> Karthik S Patawardhan
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-display-download-link-with-file-name-in-wicket-tp4670270p4670281.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: How to display download link with file name in wicket

2015-04-13 Thread kspat
Hi Martin,

I tried the approach suggested by you and its working as expected. The file
name is displayed in the filed, and when clicked the file download pop up is
displayed.

However the file name is displayed as a link, but as a plain text. Is there
any way out to make sure it is displayed as a link ?

Regards,
Karthik S Patawardhan

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-display-download-link-with-file-name-in-wicket-tp4670270p4670281.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: How to display download link with file name in wicket

2015-04-13 Thread kspat
Hello Martin,

Your understanding on the Issue 1 is correct. I want to show the file name
as a label for the link ? And this link should lead me to file download when
clicked. 

I will try the approach given by you. Thanks a ton for the swift response.
Really appreciate it.!

Best Regards,
Karthik S Patawardhan

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-display-download-link-with-file-name-in-wicket-tp4670270p4670278.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: How to display download link with file name in wicket

2015-04-13 Thread Martin Grigorov
Hi,

On Mon, Apr 13, 2015 at 3:34 PM, kspat  wrote:

> Hi,
>
> I have 2 issues for which I need guidance from you.
>
> Issue 1:::
>
> In my application I am trying to write a page where I am having one html
> file with one wicket panel with id mapped to a table.
> And in the java file I am creating columns with AbstractColumns. Then I am
> populating the DataTable with id (which is specified in the html page),
> columns (created using AbstractColumns), dataprovider (this feeds the row
> data to the table), and rows per page.
>
> Coming to the columns, except one column all other are Label. And do not
> see
> any problem.
>
> But when I want to have a DownloadLink for a file present on the server I
> am
> facing issue. I want to have the fileName as the DownloadLink which is not
> happening. (Just to remind I am not using separate wicket ids for each
> field). I am passing id, File (file object present on the server) and
> fileName (this is the name displayed on the popup when the link is
> clicked).
> This results in the Id being displayed in the place of link field and when
> this is clicked I am able to download the file.
>
> I need help on how do I get the fileName as download link instead of id.
>

This is not very clear to me.
Do you want to show the file name as a label for the link ?
If YES then do:

String fileName = myClass.getFile();
cellItem.add(new DownloadLink(id, new File(fileDirectory, csvFile),
fileName).setBody(Model.of(fileName)));


> new AbstractColumn(new MessageModel(COLUMN_NAME)) {
> @Override
> public void populateItem(Item cellItem, String id, IModel rowModel) {
> final MyClass myClass = (MyClass) rowModel.getObject();
> final File fileDirectory = new File(filePath);
> cellItem.add(new DownloadLink(id, new File(fileDirectory, csvFile),
> myClass.getFile()));
> }
> }
>
> Issue 2 :::
> I tried on more approach. For the download link I declared a Label with id
> and href for the link. We are able to get the link but when clicked it is
> appending the ip of the server which I do not want. I could not find any
> way
> to remove that IP. Following is the code snippet used in side the column:
>
> cellItem.add(new Label(componentId, " +
> filePath + "', '_blank'); target=\"_blank\"
> href=\"" + filePath + "\" > " + fileName + "
> ").setEscapeModelStrings(false));
>

I think my answer for #1 should help you.
Please give more details and examples if I'm not answering your question.


>
> Thanks
> Karthik S Patawardhan
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-display-download-link-with-file-name-in-wicket-tp4670270.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
>
>


How to display download link with file name in wicket

2015-04-13 Thread kspat
Hi,

I have 2 issues for which I need guidance from you.

Issue 1:::

In my application I am trying to write a page where I am having one html
file with one wicket panel with id mapped to a table.
And in the java file I am creating columns with AbstractColumns. Then I am
populating the DataTable with id (which is specified in the html page),
columns (created using AbstractColumns), dataprovider (this feeds the row
data to the table), and rows per page.

Coming to the columns, except one column all other are Label. And do not see
any problem.

But when I want to have a DownloadLink for a file present on the server I am
facing issue. I want to have the fileName as the DownloadLink which is not
happening. (Just to remind I am not using separate wicket ids for each
field). I am passing id, File (file object present on the server) and
fileName (this is the name displayed on the popup when the link is clicked).
This results in the Id being displayed in the place of link field and when
this is clicked I am able to download the file.

I need help on how do I get the fileName as download link instead of id.

new AbstractColumn(new MessageModel(COLUMN_NAME)) {
@Override
public void populateItem(Item cellItem, String id, IModel rowModel) {
final MyClass myClass = (MyClass) rowModel.getObject();
final File fileDirectory = new File(filePath);
cellItem.add(new DownloadLink(id, new File(fileDirectory, csvFile),
myClass.getFile()));
}
}

Issue 2 :::
I tried on more approach. For the download link I declared a Label with id
and href for the link. We are able to get the link but when clicked it is
appending the ip of the server which I do not want. I could not find any way
to remove that IP. Following is the code snippet used in side the column:

cellItem.add(new Label(componentId, " " + fileName + "
").setEscapeModelStrings(false));

Thanks
Karthik S Patawardhan

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-display-download-link-with-file-name-in-wicket-tp4670270.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: create link to pdf created on the fly

2015-04-07 Thread Chris
Hi Martin,

thanks a lot, that worked!

Chris


> Am 07.04.2015 um 08:52 schrieb Martin Grigorov :
> 
> Hi,
> 
> Check ResourceLink component.
> 
> Martin Grigorov
> Freelancer, available for hire!
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Tue, Apr 7, 2015 at 2:10 AM, Chris  wrote:
> 
>> Hi all,
>> 
>> I would like to create a download link to a PDF which is generated on the
>> fly.
>> 
>> How can I transform the ByteArrayResource into an IResource Stream?
>> 
>> Thanks, Chris
>> 
>> Link pdfLink = new Link("linkPdf") {
>>@Override
>>public void onClick() {
>>final OutputStream pdfOutputStream = generatePdf();
>> 
>>final ByteArrayResource byteArrayResource = new
>> ByteArrayResource("application/pdf", ((ByteArrayOutputStream)
>> pdfOutputStream).toByteArray());
>>IResourceStream resourceStream = byteArrayResource...;
>>getRequestCycle().scheduleRequestHandlerAfterCurrent(new
>> ResourceStreamRequestHandler(resourceStream, "PDF_Download"));
>>}
>> };
>> -
>> 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: create link to pdf created on the fly

2015-04-06 Thread Martin Grigorov
Hi,

Check ResourceLink component.

Martin Grigorov
Freelancer, available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Apr 7, 2015 at 2:10 AM, Chris  wrote:

> Hi all,
>
> I would like to create a download link to a PDF which is generated on the
> fly.
>
> How can I transform the ByteArrayResource into an IResource Stream?
>
> Thanks, Chris
>
>  Link pdfLink = new Link("linkPdf") {
> @Override
> public void onClick() {
> final OutputStream pdfOutputStream = generatePdf();
>
> final ByteArrayResource byteArrayResource = new
> ByteArrayResource("application/pdf", ((ByteArrayOutputStream)
> pdfOutputStream).toByteArray());
> IResourceStream resourceStream = byteArrayResource...;
> getRequestCycle().scheduleRequestHandlerAfterCurrent(new
> ResourceStreamRequestHandler(resourceStream, "PDF_Download"));
> }
> };
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: create link to pdf created on the fly

2015-04-06 Thread Christoph Läubrich
Is there any reason why you can't use a static mounted resource (with 
some page parameter if neccessary)?
This has several advantages e.g. leveraging browser caching, no need for 
statefull link etc...


Am 07.04.2015 01:10, schrieb Chris:

Hi all,

I would like to create a download link to a PDF which is generated on the fly.

How can I transform the ByteArrayResource into an IResource Stream?

Thanks, Chris

  Link pdfLink = new Link("linkPdf") {
 @Override
 public void onClick() {
 final OutputStream pdfOutputStream = generatePdf();

 final ByteArrayResource byteArrayResource = new 
ByteArrayResource("application/pdf", ((ByteArrayOutputStream) 
pdfOutputStream).toByteArray());
 IResourceStream resourceStream = byteArrayResource...;
 getRequestCycle().scheduleRequestHandlerAfterCurrent(new 
ResourceStreamRequestHandler(resourceStream, "PDF_Download"));
 }
};
-
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



create link to pdf created on the fly

2015-04-06 Thread Chris
Hi all,

I would like to create a download link to a PDF which is generated on the fly.

How can I transform the ByteArrayResource into an IResource Stream?

Thanks, Chris

 Link pdfLink = new Link("linkPdf") {
@Override
public void onClick() {
final OutputStream pdfOutputStream = generatePdf();

final ByteArrayResource byteArrayResource = new 
ByteArrayResource("application/pdf", ((ByteArrayOutputStream) 
pdfOutputStream).toByteArray());
IResourceStream resourceStream = byteArrayResource...;
getRequestCycle().scheduleRequestHandlerAfterCurrent(new 
ResourceStreamRequestHandler(resourceStream, "PDF_Download"));
}
};
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Javascript link to Wicket Page

2015-04-05 Thread Chris
Thank you, Sebastian!


> Am 05.04.2015 um 13:23 schrieb Sebastien :
> 
> Hi Chris,
> 
> You can get the url of the page you want to point to using
> RequestCycle.get().urlFor(pageClass, pageParameterOrNullIfNone)
> 
> Best regards,
> Sebastien.


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



Re: Javascript link to Wicket Page

2015-04-05 Thread Sebastien
Hi Chris,

You can get the url of the page you want to point to using
RequestCycle.get().urlFor(pageClass, pageParameterOrNullIfNone)

Best regards,
Sebastien.


Javascript link to Wicket Page

2015-04-04 Thread Chris
Hi all,

I have a Javascript, that shows a footer with text & link on the bottom of a 
Web page for some seconds.
Currently, it is loaded via 
response.render(OnDomReadyHeaderItem.forScript(...));

How can I call a Wicket Webpage from the link of the footer?

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



Re: Wicket 6.13 link onclick behavior not working with ajax onclick row select

2015-01-13 Thread avchavan
Thanks.
Worked for me :)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-13-link-onclick-behavior-not-working-with-ajax-onclick-row-select-tp4668995p4669001.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 6.13 link onclick behavior not working with ajax onclick row select

2015-01-12 Thread Martin Grigorov
Hi,

The 'click' event propagates from the  (the link) to the  (the row).
This is normal behavior in JavaScript.
You need to add something like: ...

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

On Tue, Jan 13, 2015 at 7:45 AM, avchavan 
wrote:

> Hi,
> I have recently upgraded to Wicket 6.13 from Wicket 1.5.11 After the
> upgrade
> i am facing an issue with onclick behavior of a link.
>
> We have a clickable row which contains few columns (one of which is a link
> to new page). now, if we click on the link then we are taken to new page
> and
> we click on the row (apart from the link) the row get selected (using Ajax
> call).
>
> This was working fine with Wicket 1.5.11, i am facing issues with Wicket
> 6.13
>
> Link class:
>
> public class MyLink extends Link {
>
> private static final long serialVersionUID = 5808539933400105591L;
> private MyRow myRow;
>
> public MyLink(String id, MyRow myRow) {
> super(id);
> this.myRow = myRow;
> }
>
> /** {@inheritDoc} */
> @Override
> public void onClick() {
> //sets the response page where this needs to be redirected.
> this.setResponsePage(new ResponseReadPage(this.myRow));
> }
> }
>
> Populate method:
>
> @Override
> protected void populateItem(final ListItem item) {
> final MyRow myRow = (MyRow) item.getModelObject();
> item.add(new Label("naam", myRow.getName()));
> item.add(new Label("id", myRow.getCode()));
>
> MyLink myLink = new MyLink("myLink", myRow);
> item.add(myLink);
> final MyRow selectedRow = this.session.getSelectedRow();
>
> if (selectedRow != null
> && selectedRow.equals(myRow)) {
> this.session.selectedRow(myRow);
> item.add(new AttributeModifier("class", "activeRow"));
> this.selecteditem = item;
>
> //some business logic
> }
>
> item.add(new AjaxEventBehavior("onclick") {
> /** {@inheritDoc} */
> @SuppressWarnings({ "unchecked", "rawtypes" })
> @Override
> protected void onEvent(final AjaxRequestTarget target) {
> final WebMarkupContainer container = (WebMarkupContainer)
> MyListView.this.getParent()
> .getParent().get("myContainer");
>
> MyListView.this.session.setSelectedRow(myRow);
>
> if (MyListView.this.currentActiveItem != null) {
> MyListView.this.previousActiveItem =
> MyListView.this.currentActiveItem;
> MyListView.this.previousActiveItem.add(new
> AttributeModifier("class", ""));
> }
> item.add(new AttributeModifier("class", "activeRow"));
> MyListView.this.currentActiveItem = item;
> if (MyListView.this.previousActiveItem != null) {
> target.add(MyListView.this.previousActiveItem);
> }
>
> if (MyListView.this.selecteditem != null
> && !MyView.this.selecteditem.equals(item)) {
> MyListView.this.selecteditem.add(new
> AttributeModifier("class", ""));
> target.add(MyListView.this.selecteditem);
> }
> target.add(item);
> target.add(container);
> }
>     });
> }
>
> When i try to click on the LINK instead of onClick method of the link, the
> onclick event of AjaxBehavior of row gets called.
> When i right click on the link and open it in another tab the call to
> onClick method of link happens successfully as expected.
> Can anyone point me in the correct direction to get this sorted?
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-6-13-link-onclick-behavior-not-working-with-ajax-onclick-row-select-tp4668995.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
>
>


Wicket 6.13 link onclick behavior not working with ajax onclick row select

2015-01-12 Thread avchavan
Hi,
I have recently upgraded to Wicket 6.13 from Wicket 1.5.11 After the upgrade
i am facing an issue with onclick behavior of a link.

We have a clickable row which contains few columns (one of which is a link
to new page). now, if we click on the link then we are taken to new page and
we click on the row (apart from the link) the row get selected (using Ajax
call).

This was working fine with Wicket 1.5.11, i am facing issues with Wicket
6.13

Link class:

public class MyLink extends Link {

private static final long serialVersionUID = 5808539933400105591L;
private MyRow myRow;

public MyLink(String id, MyRow myRow) {
super(id);
this.myRow = myRow;
}

/** {@inheritDoc} */
@Override
public void onClick() {
//sets the response page where this needs to be redirected.
this.setResponsePage(new ResponseReadPage(this.myRow));
}
}

Populate method:

@Override
protected void populateItem(final ListItem item) {
final MyRow myRow = (MyRow) item.getModelObject();
item.add(new Label("naam", myRow.getName()));
item.add(new Label("id", myRow.getCode()));

MyLink myLink = new MyLink("myLink", myRow);
item.add(myLink);
final MyRow selectedRow = this.session.getSelectedRow();

if (selectedRow != null
&& selectedRow.equals(myRow)) {
this.session.selectedRow(myRow);
item.add(new AttributeModifier("class", "activeRow"));
this.selecteditem = item;

//some business logic
}

item.add(new AjaxEventBehavior("onclick") {
/** {@inheritDoc} */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void onEvent(final AjaxRequestTarget target) {
final WebMarkupContainer container = (WebMarkupContainer)
MyListView.this.getParent()
.getParent().get("myContainer");

MyListView.this.session.setSelectedRow(myRow);

if (MyListView.this.currentActiveItem != null) {
MyListView.this.previousActiveItem =
MyListView.this.currentActiveItem;
MyListView.this.previousActiveItem.add(new
AttributeModifier("class", ""));
}
item.add(new AttributeModifier("class", "activeRow"));
MyListView.this.currentActiveItem = item;
if (MyListView.this.previousActiveItem != null) {
target.add(MyListView.this.previousActiveItem);
}

if (MyListView.this.selecteditem != null
&& !MyView.this.selecteditem.equals(item)) {
MyListView.this.selecteditem.add(new
AttributeModifier("class", ""));
target.add(MyListView.this.selecteditem);
    }
target.add(item);
target.add(container);
    }
    });
}

When i try to click on the LINK instead of onClick method of the link, the
onclick event of AjaxBehavior of row gets called. 
When i right click on the link and open it in another tab the call to
onClick method of link happens successfully as expected.
Can anyone point me in the correct direction to get this sorted?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-13-link-onclick-behavior-not-working-with-ajax-onclick-row-select-tp4668995.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: AJAX-Behavior that decides activation of a link

2015-01-11 Thread Martin Grigorov
Hi,

On Thu, Jan 8, 2015 at 10:45 PM, Joachim Schrod  wrote:

> On 01/08/15 08:15, Ernesto Reinaldo Barreiro wrote:
> > Hi,
> >
> > I would  use server side activation. Implemented as in
> >
> > 1- You can create your own events, e.g. [1]. One that is a wrapper of
> AJAX
> > request target (e.g. AtivateLinksEvent).
> > 2- Your  links will listen for AtivateLinksEvents and decide if they
> should
> > be enabled or not (and add themselves to ART on AtivateLinksEvent).
> >
> >
> > References:
> >
> > 1-
> >
> https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TaskLaunchedEvent.java
>
> I don't grasp your intent completely. I get that I can define my
> own event classes server-side. I don't get how that helps me client
> side.
>
> My problem is: How do I communicate to client-side within an event
> handler that attrs.event.preventDefault() shall be called for
> exactly that event handler or not. Wicket provides a static
> pre-made decision via AjaxRequestAttributes; I want a dynamic one.
>

Ajax is asynchronous.
event.preventDefault() is processed long before the request is processed by
the server. Even longer that the processing of the response at the client.

You can use synchronous Ajax call to accomplish this but this is not
recommended. It will freeze the browser tab until the response is processed.


>
> I looked at the code you cited, and the enable/disable decision is
> done server-side, right? But how does introduction of a new event
> type help with my problem client-side? Adding the links to ART on
> some event won't change anything, as this won't influence the
> _original DOM event_ (attrs.event) that controls if default action
> is taken or not. I also can't see how that new Wicket event type
> would give me access to that DOM event I want to influence.
>
> Sorry, but I don't get it. Maybe your Wicket usage is way above my
> head?
>
> Or, do you mean that the server shall decide, according to previous
> user actions, that the link is enabled from now on and then shall
> change the link in an ART? Also disabling it back, as needed?
> That's hard to do, some parameter for the enable/disable decision
> are external availability of resources that are checked at the
> moment of link activation. (The actual link almost always works.
> The behavior shall implement proper error checking and reporting in
> case of unavailable resources or other errors that are beyond the
> user's realm.)
>
> Thanks for your answer, and for digging out that link,
>
> Joachim
>
> > On Thu, Jan 8, 2015 at 2:15 AM, Joachim Schrod  wrote:
> >
> >> Hi,
> >>
> >> I have a class of links where some of them sometimes shall not
> >> trigger. The decision is made server-side according to current state.
> >>
> >> At first sight, the realization seems to be not that straight forward:
> >>  -- I add an AJAX behavior to these link that allows default action
> >> and computes if the link action shall be prevented.
> >>  -- The AJAX behavior has an AJAX call listener (complete handler)
> >> that may call attrs.event.preventDefault() if the link shall
> >> not be triggered.
> >>  -- The decision if the link shall not be triggered is
> >> communicated by the AJAX request to the complete handler via
> >> an HiddenField that is updated in the AJAX request. Delivery
> >> of the decision via JSON is difficult, as we also want to
> >> update other DOM elements with the response (feedback why the
> >> link was not triggered).
> >>
> >> Do I miss something? Is there a completely different approach that
> >> I could take?
> >>
> >> Or: Is there a better way to communicate the decision if the link
> >> shall be triggered to the call listener? Introducing a hidden field
> >> for that purpose seems to be awkward, for me.
> >>
> >> I would be thankful for any comments or recommendations.
> >>
> >> Joachim
> >>
> >> --
> >> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> >> Joachim Schrod, Roedermark, Germany
> >> Email: jsch...@acm.org
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
> >
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Joachim Schrod, Roedermark, Germany
> Email: jsch...@acm.org
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: AJAX-Behavior that decides activation of a link

2015-01-09 Thread Ernesto Reinaldo Barreiro
Hi,

Apologies, I might have not understood your requirements correctly.

Comments inline.


> I don't grasp your intent completely. I get that I can define my
> own event classes server-side. I don't get how that helps me client
> side.
>

You can do want at server side to trigger something or not at client side.
E.g. you can create:

1- A client side map var bottonStates={} ---> ["buttonID"]=true/false;
2- On your event your event you get your ART and
art.appendJavaString("bottonStates['"+getMarkupId()+"']="+true/false.
3- Create a type of link that checks this map before firing.

The same trick can be used for other types of  info you want to pass to
client side.

No need for hidden fields.

My problem is: How do I communicate to client-side within an event
> handler that attrs.event.preventDefault() shall be called for
> exactly that event handler or not. Wicket provides a static
> pre-made decision via AjaxRequestAttributes; I want a dynamic one.
>

See comment above.

Just roll your own version of a link. E.g.

1- A JS prototype for your links.
2- These links check state map (at client side) to execute or not... and
also if there is some message to be displayed.


> I looked at the code you cited, and the enable/disable decision is
> done server-side, right? But how does introduction of a new event
> type help with my problem client-side? Adding the links to ART on
> some event won't change anything, as this won't influence the
> _original DOM event_ (attrs.event) that controls if default action
> is taken or not. I also can't see how that new Wicket event type
> would give me access to that DOM event I want to influence.
>

What I meant is that for any pertinent ART you can generate a new type of
event that tells all your links "Hey guys, do you have a different sate to
report? and give the opportunity to them to do so."


> Sorry, but I don't get it. Maybe your Wicket usage is way above my
> head?
>

 I do not think so... :-(


> Or, do you mean that the server shall decide, according to previous
> user actions, that the link is enabled from now on and then shall
> change the link in an ART? Also disabling it back, as needed?
>

Yep... Or let it fail gracefully... Server side instead of performing the
desired action just answers back. Hey guy, that's not allowed right now.


> That's hard to do, some parameter for the enable/disable decision
> are external availability of resources that are checked at the
> moment of link activation. (The actual link almost always works.
> The behavior shall implement proper error checking and reporting in
> case of unavailable resources or other errors that are beyond the
> user's realm.)
>

Then you might want them to fail gracefully... E.g using something like.

http://www.erichynds.com/examples/jquery-notify/

By the way, I have a private implementation of this (wicket 6.x
compatible), that I might share with the community. E.g. via wicket-stuff.

-- 
Regards - Ernesto Reinaldo Barreiro


Re: AJAX-Behavior that decides activation of a link

2015-01-08 Thread Joachim Schrod
On 01/08/15 08:15, Ernesto Reinaldo Barreiro wrote:
> Hi,
> 
> I would  use server side activation. Implemented as in
> 
> 1- You can create your own events, e.g. [1]. One that is a wrapper of AJAX
> request target (e.g. AtivateLinksEvent).
> 2- Your  links will listen for AtivateLinksEvents and decide if they should
> be enabled or not (and add themselves to ART on AtivateLinksEvent).
> 
> 
> References:
> 
> 1-
> https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TaskLaunchedEvent.java

I don't grasp your intent completely. I get that I can define my
own event classes server-side. I don't get how that helps me client
side.

My problem is: How do I communicate to client-side within an event
handler that attrs.event.preventDefault() shall be called for
exactly that event handler or not. Wicket provides a static
pre-made decision via AjaxRequestAttributes; I want a dynamic one.

I looked at the code you cited, and the enable/disable decision is
done server-side, right? But how does introduction of a new event
type help with my problem client-side? Adding the links to ART on
some event won't change anything, as this won't influence the
_original DOM event_ (attrs.event) that controls if default action
is taken or not. I also can't see how that new Wicket event type
would give me access to that DOM event I want to influence.

Sorry, but I don't get it. Maybe your Wicket usage is way above my
head?

Or, do you mean that the server shall decide, according to previous
user actions, that the link is enabled from now on and then shall
change the link in an ART? Also disabling it back, as needed?
That's hard to do, some parameter for the enable/disable decision
are external availability of resources that are checked at the
moment of link activation. (The actual link almost always works.
The behavior shall implement proper error checking and reporting in
case of unavailable resources or other errors that are beyond the
user's realm.)

Thanks for your answer, and for digging out that link,

Joachim

> On Thu, Jan 8, 2015 at 2:15 AM, Joachim Schrod  wrote:
> 
>> Hi,
>>
>> I have a class of links where some of them sometimes shall not
>> trigger. The decision is made server-side according to current state.
>>
>> At first sight, the realization seems to be not that straight forward:
>>  -- I add an AJAX behavior to these link that allows default action
>> and computes if the link action shall be prevented.
>>  -- The AJAX behavior has an AJAX call listener (complete handler)
>> that may call attrs.event.preventDefault() if the link shall
>> not be triggered.
>>  -- The decision if the link shall not be triggered is
>> communicated by the AJAX request to the complete handler via
>> an HiddenField that is updated in the AJAX request. Delivery
>> of the decision via JSON is difficult, as we also want to
>> update other DOM elements with the response (feedback why the
>> link was not triggered).
>>
>> Do I miss something? Is there a completely different approach that
>> I could take?
>>
>> Or: Is there a better way to communicate the decision if the link
>> shall be triggered to the call listener? Introducing a hidden field
>> for that purpose seems to be awkward, for me.
>>
>> I would be thankful for any comments or recommendations.
>>
>> Joachim
>>
>> --
>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>> Joachim Schrod, Roedermark, Germany
>> Email: jsch...@acm.org
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> 
> 

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org


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



Re: AJAX-Behavior that decides activation of a link

2015-01-08 Thread Joachim Schrod
On 01/08/15 15:50, Boris Goldowsky wrote:
> If I¹m understanding you correctly, wouldn¹t it be sufficient to code this
> as 
> a simple AjaxLink, which responds with a regular AJAX
> update when the link is disabled, or uses setResponsePage when it¹s
> enabled? 

The link in question delivers a PDF document, and has
target="_blank" to do that in a new tab. In fact, there are several
of these links, and only some of that have the controlling
behavior. Thus prevention of the default action is essential, to
prevent opening a new tab.

I also had a solution that used window.open() in JS -- but that
code wasn't any prettier. I think what I'm looking for is a way to
add some client data to an ART target that I can access
client-side, e.g., in an AJAX call listener.

Thanks for your comments,
Joachim

> On 1/7/15, 9:15 PM, "Joachim Schrod"  wrote:
> 
>>Hi,
>>
>>I have a class of links where some of them sometimes shall not
>>trigger. The decision is made server-side according to current state.
>>
>>At first sight, the realization seems to be not that straight forward:
>> -- I add an AJAX behavior to these link that allows default action
>>and computes if the link action shall be prevented.
>> -- The AJAX behavior has an AJAX call listener (complete handler)
>>that may call attrs.event.preventDefault() if the link shall
>>not be triggered.
>> -- The decision if the link shall not be triggered is
>>communicated by the AJAX request to the complete handler via
>>an HiddenField that is updated in the AJAX request. Delivery
>>of the decision via JSON is difficult, as we also want to
>>update other DOM elements with the response (feedback why the
>>link was not triggered).
>>
>>Do I miss something? Is there a completely different approach that
>>I could take?
>>
>>Or: Is there a better way to communicate the decision if the link
>>shall be triggered to the call listener? Introducing a hidden field
>>for that purpose seems to be awkward, for me.
>>
>>I would be thankful for any comments or recommendations.
>>
>>  Joachim
>>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org


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



Re: AJAX-Behavior that decides activation of a link

2015-01-08 Thread Boris Goldowsky
If I¹m understanding you correctly, wouldn¹t it be sufficient to code this
as 
a simple AjaxLink, which responds with a regular AJAX
update when the link is disabled, or uses setResponsePage when it¹s
enabled? 

Boris

On 1/7/15, 9:15 PM, "Joachim Schrod"  wrote:

>Hi,
>
>I have a class of links where some of them sometimes shall not
>trigger. The decision is made server-side according to current state.
>
>At first sight, the realization seems to be not that straight forward:
> -- I add an AJAX behavior to these link that allows default action
>and computes if the link action shall be prevented.
> -- The AJAX behavior has an AJAX call listener (complete handler)
>that may call attrs.event.preventDefault() if the link shall
>not be triggered.
> -- The decision if the link shall not be triggered is
>communicated by the AJAX request to the complete handler via
>an HiddenField that is updated in the AJAX request. Delivery
>of the decision via JSON is difficult, as we also want to
>update other DOM elements with the response (feedback why the
>link was not triggered).
>
>Do I miss something? Is there a completely different approach that
>I could take?
>
>Or: Is there a better way to communicate the decision if the link
>shall be triggered to the call listener? Introducing a hidden field
>for that purpose seems to be awkward, for me.
>
>I would be thankful for any comments or recommendations.
>
>   Joachim
>
>-- 
>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>Joachim Schrod, Roedermark, Germany
>Email: jsch...@acm.org
>
>
>-
>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: AJAX-Behavior that decides activation of a link

2015-01-07 Thread Ernesto Reinaldo Barreiro
Hi,

I would  use server side activation. Implemented as in

1- You can create your own events, e.g. [1]. One that is a wrapper of AJAX
request target (e.g. AtivateLinksEvent).
2- Your  links will listen for AtivateLinksEvents and decide if they should
be enabled or not (and add themselves to ART on AtivateLinksEvent).


References:

1-
https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TaskLaunchedEvent.java

On Thu, Jan 8, 2015 at 2:15 AM, Joachim Schrod  wrote:

> Hi,
>
> I have a class of links where some of them sometimes shall not
> trigger. The decision is made server-side according to current state.
>
> At first sight, the realization seems to be not that straight forward:
>  -- I add an AJAX behavior to these link that allows default action
> and computes if the link action shall be prevented.
>  -- The AJAX behavior has an AJAX call listener (complete handler)
> that may call attrs.event.preventDefault() if the link shall
> not be triggered.
>  -- The decision if the link shall not be triggered is
> communicated by the AJAX request to the complete handler via
> an HiddenField that is updated in the AJAX request. Delivery
> of the decision via JSON is difficult, as we also want to
> update other DOM elements with the response (feedback why the
> link was not triggered).
>
> Do I miss something? Is there a completely different approach that
> I could take?
>
> Or: Is there a better way to communicate the decision if the link
> shall be triggered to the call listener? Introducing a hidden field
> for that purpose seems to be awkward, for me.
>
> I would be thankful for any comments or recommendations.
>
> Joachim
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Joachim Schrod, Roedermark, Germany
> Email: jsch...@acm.org
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro


AJAX-Behavior that decides activation of a link

2015-01-07 Thread Joachim Schrod
Hi,

I have a class of links where some of them sometimes shall not
trigger. The decision is made server-side according to current state.

At first sight, the realization seems to be not that straight forward:
 -- I add an AJAX behavior to these link that allows default action
and computes if the link action shall be prevented.
 -- The AJAX behavior has an AJAX call listener (complete handler)
that may call attrs.event.preventDefault() if the link shall
not be triggered.
 -- The decision if the link shall not be triggered is
communicated by the AJAX request to the complete handler via
an HiddenField that is updated in the AJAX request. Delivery
of the decision via JSON is difficult, as we also want to
update other DOM elements with the response (feedback why the
link was not triggered).

Do I miss something? Is there a completely different approach that
I could take?

Or: Is there a better way to communicate the decision if the link
shall be triggered to the call listener? Introducing a hidden field
for that purpose seems to be awkward, for me.

I would be thankful for any comments or recommendations.

Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org


-
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-31 Thread Andrea Del Bene
Probably there was a misunderstanding :). I saw Garret Wilson searching 
for a behavior to inject "submission" and "confirmation" into various 
components. I just pointed out that actually we have a special behavior 
for AJAX (AbstractDefaultAjaxBehavior) that can be used to factorize 
custom Ajax request attributes and apply them when needed instead of 
repeating code in various subclasses. Of course with this solution you 
have to manually add you custom behavior and is not powerful as an Ajax 
listener as you suggested.

Unless you use a more powerful language than Java that provides something
like Scala's Trait I don't see how you could implement your solution
without re-implementing the standard Ajax links.

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

On Fri, Oct 31, 2014 at 5:33 PM, Andrea Del Bene 
wrote:




-
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-31 Thread Martin Grigorov
Unless you use a more powerful language than Java that provides something
like Scala's Trait I don't see how you could implement your solution
without re-implementing the standard Ajax links.

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

On Fri, Oct 31, 2014 at 5:33 PM, Andrea Del Bene 
wrote:

> You are suggesting something like we see in GlobalUpdateAjaxAttributesTest,
> right? What I was thinking of was a less powerful solution suited to
> decorate standard AJAX links only in few cases you might need confirmation.
>
>  You have to refresh your knowledge about the related code.
>>
>> Or I should ...
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Fri, Oct 31, 2014 at 3:54 PM, Andrea Del Bene 
>> wrote:
>>
>>  You have to add it explicitly with the usual way. This is more desirable
>>> if you don't want to apply it to every Ajax behavior as you suggested.
>>>
>>>  @Andrea: how would you share this behavior between ConfirmingAjaxLink
 and
 ConfirmingAjaxSubmitLink ?

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

 On Fri, Oct 31, 2014 at 2:56 PM, Andrea Del Bene 
 wrote:

   you can also use behavior AbstractDefaultAjaxBehavior which has

> updateAjaxAttributes(AjaxRequestAttributes attributes), so you can
> share
> confirmation code among different components.
>
>Hi,
>
>
>  -
>>> 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: simple confirmation on button/link

2014-10-31 Thread Andrea Del Bene
You are suggesting something like we see in 
GlobalUpdateAjaxAttributesTest, right? What I was thinking of was a less 
powerful solution suited to decorate standard AJAX links only in few 
cases you might need confirmation.

You have to refresh your knowledge about the related code.

Or I should ...

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

On Fri, Oct 31, 2014 at 3:54 PM, Andrea Del Bene 
wrote:


You have to add it explicitly with the usual way. This is more desirable
if you don't want to apply it to every Ajax behavior as you suggested.


@Andrea: how would you share this behavior between ConfirmingAjaxLink and
ConfirmingAjaxSubmitLink ?

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

On Fri, Oct 31, 2014 at 2:56 PM, Andrea Del Bene 
wrote:

  you can also use behavior AbstractDefaultAjaxBehavior which has

updateAjaxAttributes(AjaxRequestAttributes attributes), so you can share
confirmation code among different components.

   Hi,



-
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: simple confirmation on button/link

2014-10-31 Thread Martin Grigorov
You have to refresh your knowledge about the related code.

Or I should ...

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

On Fri, Oct 31, 2014 at 3:54 PM, Andrea Del Bene 
wrote:

> You have to add it explicitly with the usual way. This is more desirable
> if you don't want to apply it to every Ajax behavior as you suggested.
>
>> @Andrea: how would you share this behavior between ConfirmingAjaxLink and
>> ConfirmingAjaxSubmitLink ?
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Fri, Oct 31, 2014 at 2:56 PM, Andrea Del Bene 
>> wrote:
>>
>>  you can also use behavior AbstractDefaultAjaxBehavior which has
>>> updateAjaxAttributes(AjaxRequestAttributes attributes), so you can share
>>> confirmation code among different components.
>>>
>>>   Hi,
>>>
>>>
>
> -
> 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-31 Thread Andrea Del Bene
You have to add it explicitly with the usual way. This is more desirable 
if you don't want to apply it to every Ajax behavior as you suggested.

@Andrea: how would you share this behavior between ConfirmingAjaxLink and
ConfirmingAjaxSubmitLink ?

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

On Fri, Oct 31, 2014 at 2:56 PM, Andrea Del Bene 
wrote:


you can also use behavior AbstractDefaultAjaxBehavior which has
updateAjaxAttributes(AjaxRequestAttributes attributes), so you can share
confirmation code among different components.

  Hi,




-
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-31 Thread Martin Grigorov
@Andrea: how would you share this behavior between ConfirmingAjaxLink and
ConfirmingAjaxSubmitLink ?

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

On Fri, Oct 31, 2014 at 2:56 PM, Andrea Del Bene 
wrote:

> you can also use behavior AbstractDefaultAjaxBehavior which has
> updateAjaxAttributes(AjaxRequestAttributes attributes), so you can share
> confirmation code among different components.
>
>  Hi,
>>
>> On Thu, Oct 30, 2014 at 11:57 PM, Garret Wilson 
>> wrote:
>>
>>  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:
>>>
>>>  
>>>
>>> The root of the problem is that Wicket kept turning that into:
>>>
>>>  
>>>
>>> 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.
>>>
>>>  There is a way to provide a global #updateAjaxAttributes() that is
>> called
>> for each and every Ajax
>> behavior: org.apache.wicket.ajax.AjaxRequestTarget.IListener#
>> updateAjaxAttributes
>>
>> With
>> https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commit;h=d1caec5e
>> I've improved it so there is no need to cast it
>> to AbstractDefaultAjaxBehavior in the application code. You can use
>> AbstractDefaultAjaxBehavior#getComponent() to check whether you should
>> contribute to the ajax attributes or nor.
>>
>>
>>
>
> -
> 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-31 Thread Andrea Del Bene
you can also use behavior AbstractDefaultAjaxBehavior which has 
updateAjaxAttributes(AjaxRequestAttributes attributes), so you can share 
confirmation code among different components.

Hi,

On Thu, Oct 30, 2014 at 11:57 PM, Garret Wilson 
wrote:


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:

 

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

 

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.


There is a way to provide a global #updateAjaxAttributes() that is called
for each and every Ajax
behavior: 
org.apache.wicket.ajax.AjaxRequestTarget.IListener#updateAjaxAttributes

With
https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commit;h=d1caec5e
I've improved it so there is no need to cast it
to AbstractDefaultAjaxBehavior in the application code. You can use
AbstractDefaultAjaxBehavior#getComponent() to check whether you should
contribute to the ajax attributes or nor.





-
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-31 Thread Martin Grigorov
Hi,

On Thu, Oct 30, 2014 at 11:57 PM, Garret Wilson 
wrote:

> 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:
>
> 
>
> The root of the problem is that Wicket kept turning that into:
>
> 
>
> 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.
>

There is a way to provide a global #updateAjaxAttributes() that is called
for each and every Ajax
behavior: 
org.apache.wicket.ajax.AjaxRequestTarget.IListener#updateAjaxAttributes

With
https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commit;h=d1caec5e
I've improved it so there is no need to cast it
to AbstractDefaultAjaxBehavior in the application code. You can use
AbstractDefaultAjaxBehavior#getComponent() to check whether you should
contribute to the ajax attributes or nor.


>
> 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: 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:




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



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: 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



  1   2   3   4   5   6   7   8   9   10   >