http://stackoverflow.com/questions/23886278/disable-middle-mouse-click

You can register a global Wicket Ajax 'precondition' that stops the Ajax
request when the conditions are satisfied.

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

On Thu, Mar 26, 2015 at 11:07 AM, Patrick Davids <
[email protected]> wrote:

> Hi Martin,
> I missed something.
>
> We have a kind of own LinkComponent class here and someone in our team
> implemented an AjaxFallbackLink in the upper class hierarhcy, so currently
> we have a AjaxFallbackLink case here.
> I didnt know that.
>
> Thats the reason why I have a null AjaxRequestTarget.
> Sorry, for giving a wrong hint here...
>
> I removed the AjaxFallbackLink.
>
> Now, the browser opens a new tab, with just having "javascript:;" as url.
> (This also avoids the NPE issue mentioned in my previous mail.)
>
> So, my question is reducing now to (and is not really wicket related
> anymore):
> What the best practise to prevent a middle mouse click?
>
> best regards
> Patrick
>
> Am 25.03.2015 um 18:25 schrieb Martin Grigorov:
>
>  Hi,
>>
>> I don't use a mouse (and I have no one around) so I cannot test the use
>> case.
>> I cannot see how
>> org.apache.wicket.ajax.markup.html.form.AjaxButton#onSubmit(
>> org.apache.wicket.ajax.AjaxRequestTarget,
>> org.apache.wicket.markup.html.form.Form<?>)
>> or org.apache.wicket.ajax.markup.html.AjaxLink#onClick(org.
>> apache.wicket.ajax.AjaxRequestTarget)
>> would deliver null as a target.
>> The target is created
>> at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#onRequest(). Put a
>> breakpoint there is see what happens.
>>
>> Martin Grigorov
>> Freelancer, available for hire!
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Wed, Mar 25, 2015 at 3:33 PM, Patrick Davids <
>> [email protected]> wrote:
>>
>>  Hi all,
>>> I have a problem here, I would like to ask you for feedback.
>>>
>>> I am not sure, if its more a jquery/js / wicket issue, so thanx in
>>> advance
>>> for any brainstorming and hints.
>>>
>>> Browsers often features the middle mouse button to open a link or button
>>> in a new tab.
>>> This is quite browser-specific, so I'm looking for the most independent
>>> solution.
>>>
>>> Clicking the middle mouse on a ajaxified Link or Button, the browser
>>> opens
>>> a new tab and starts a usual request cycle.
>>>
>>> This leads into wicket call e.g.
>>> onClick(AjaxRequestTarget target)
>>> but then the target parameter is null.
>>> (I cannot use AjaxFallbackLinks in my case)
>>>
>>> I'm able to handle this NPEs by implementing null-checks on every ajax
>>> link.
>>> Hmm... not the perfect solution.
>>>
>>> So, I could try to prevent middle mouse clicks by a global javascript on
>>> all pages.
>>> I've seen several scripts, and here also it seems to be very
>>> browser-specific (mousewheel, or not... event.which seem to differ and
>>> so...).
>>> Also, not my favorite solution, yet.
>>>
>>> Then I thought about wicket solution. Is there any possible way?
>>> I know about a IComponentOnConfigureListener, which can be used to have
>>> to
>>> implement an application-wide onConfigure() for any component in page
>>> hierarchy.
>>> Is there something siilar e.g. IComponentOnAjaxRequestListener?
>>> So I could implement some code there, checking for null and stop any
>>> further code-calls on ajaxified wicket components, to avoid running into
>>> NPEs in later code?
>>>
>>> All these are my thoughts for now.
>>>
>>> Thanx a lot for feedback...
>>>
>>> kind regards
>>> Patrick
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to