You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martijn Dashorst <ma...@gmail.com> on 2015/05/06 11:03:37 UTC

Add IFallback marker interface to AjaxFallback* components

The WicketTester has a click method that doesn't detect all AJAX
capable links (e.g. the Ajax links in the AjaxPagingNavigator are not
testable).

When trying to fix this by adding support for IAjaxLink, I noticed
that we also don't support AjaxFallbackButton, and probably a lot more
components.

Should we introduce a marker interface for fallback components?

(or should we wait until Optional support arrives with Java 8 in Wicket 8)

Martijn

Re: Add IFallback marker interface to AjaxFallback* components

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I've tried to rework AjaxFeedback** components to use java.util.Optional in
Wicket 8 but I've hit a wall related to this discussion:

Currently AjaxFallbackLink implements IAjaxLink, so it has
#onClick(AjaxRequestTarget).
First thought: OK, let's introduce
IAjaxFallbackLink#onClick(Optional<AjaxRequestTarget>)!
But then AjaxFallbackButton does not implement IAjaxLink and provides
#onSubmit(ART, Form), so IAFL doesn't help here.

For now I think the easiest solution is to add yet another if/else in
BaseWicketTester for those classes, and not rely on interfaces.
Other suggestions?

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

On Wed, May 6, 2015 at 2:44 PM, Martin Grigorov <mg...@apache.org>
wrote:

>
> On May 6, 2015 3:10 PM, "Martijn Dashorst" <ma...@gmail.com>
> wrote:
> >
> > On Wed, May 6, 2015 at 1:35 PM, Martin Grigorov <mg...@apache.org>
> wrote:
> > > +1 to introduce IFallback
> > >
> > > I don't understand how Optional could help for this use case
> >
> > Change the onClick signature (perhaps only for Ajax fallback components):
> >
> > public void onClick(Optional<AjaxRequestTarget> target) {
> > }
> >
> > This expresses clearly that target is optional, and hence that a
> > fallback scenario is possible.
>
> Yeah, but how this could be exploited in WicketTester?
>
> >
> > Martijn
> >
> > >
> > > On Wed, May 6, 2015 at 12:03 PM, Martijn Dashorst <
> > > martijn.dashorst@gmail.com> wrote:
> > >
> > >> The WicketTester has a click method that doesn't detect all AJAX
> > >> capable links (e.g. the Ajax links in the AjaxPagingNavigator are not
> > >> testable).
> > >>
> > >> When trying to fix this by adding support for IAjaxLink, I noticed
> > >> that we also don't support AjaxFallbackButton, and probably a lot more
> > >> components.
> > >>
> > >> Should we introduce a marker interface for fallback components?
> > >>
> > >> (or should we wait until Optional support arrives with Java 8 in
> Wicket 8)
> > >>
> > >> Martijn
> > >>
> >
> >
> >
> > --
> > Become a Wicket expert, learn from the best: http://wicketinaction.com
>

Re: Add IFallback marker interface to AjaxFallback* components

Posted by Martin Grigorov <mg...@apache.org>.
On May 6, 2015 3:10 PM, "Martijn Dashorst" <ma...@gmail.com>
wrote:
>
> On Wed, May 6, 2015 at 1:35 PM, Martin Grigorov <mg...@apache.org>
wrote:
> > +1 to introduce IFallback
> >
> > I don't understand how Optional could help for this use case
>
> Change the onClick signature (perhaps only for Ajax fallback components):
>
> public void onClick(Optional<AjaxRequestTarget> target) {
> }
>
> This expresses clearly that target is optional, and hence that a
> fallback scenario is possible.

Yeah, but how this could be exploited in WicketTester?

>
> Martijn
>
> >
> > On Wed, May 6, 2015 at 12:03 PM, Martijn Dashorst <
> > martijn.dashorst@gmail.com> wrote:
> >
> >> The WicketTester has a click method that doesn't detect all AJAX
> >> capable links (e.g. the Ajax links in the AjaxPagingNavigator are not
> >> testable).
> >>
> >> When trying to fix this by adding support for IAjaxLink, I noticed
> >> that we also don't support AjaxFallbackButton, and probably a lot more
> >> components.
> >>
> >> Should we introduce a marker interface for fallback components?
> >>
> >> (or should we wait until Optional support arrives with Java 8 in
Wicket 8)
> >>
> >> Martijn
> >>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com

Re: Add IFallback marker interface to AjaxFallback* components

Posted by Martijn Dashorst <ma...@gmail.com>.
On Wed, May 6, 2015 at 1:35 PM, Martin Grigorov <mg...@apache.org> wrote:
> +1 to introduce IFallback
>
> I don't understand how Optional could help for this use case

Change the onClick signature (perhaps only for Ajax fallback components):

public void onClick(Optional<AjaxRequestTarget> target) {
}

This expresses clearly that target is optional, and hence that a
fallback scenario is possible.

Martijn

>
> On Wed, May 6, 2015 at 12:03 PM, Martijn Dashorst <
> martijn.dashorst@gmail.com> wrote:
>
>> The WicketTester has a click method that doesn't detect all AJAX
>> capable links (e.g. the Ajax links in the AjaxPagingNavigator are not
>> testable).
>>
>> When trying to fix this by adding support for IAjaxLink, I noticed
>> that we also don't support AjaxFallbackButton, and probably a lot more
>> components.
>>
>> Should we introduce a marker interface for fallback components?
>>
>> (or should we wait until Optional support arrives with Java 8 in Wicket 8)
>>
>> Martijn
>>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

Re: Add IFallback marker interface to AjaxFallback* components

Posted by Martin Grigorov <mg...@apache.org>.
+1 to introduce IFallback

I don't understand how Optional could help for this use case

On Wed, May 6, 2015 at 12:03 PM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> The WicketTester has a click method that doesn't detect all AJAX
> capable links (e.g. the Ajax links in the AjaxPagingNavigator are not
> testable).
>
> When trying to fix this by adding support for IAjaxLink, I noticed
> that we also don't support AjaxFallbackButton, and probably a lot more
> components.
>
> Should we introduce a marker interface for fallback components?
>
> (or should we wait until Optional support arrives with Java 8 in Wicket 8)
>
> Martijn
>

Re: Add IFallback marker interface to AjaxFallback* components

Posted by Tobias Soloschenko <to...@googlemail.com>.
I would prefer the interface because Wicket 6 / 7 users should also see that components are not supported.

kind regards

Tobias

> Am 06.05.2015 um 11:03 schrieb Martijn Dashorst <ma...@gmail.com>:
> 
> The WicketTester has a click method that doesn't detect all AJAX
> capable links (e.g. the Ajax links in the AjaxPagingNavigator are not
> testable).
> 
> When trying to fix this by adding support for IAjaxLink, I noticed
> that we also don't support AjaxFallbackButton, and probably a lot more
> components.
> 
> Should we introduce a marker interface for fallback components?
> 
> (or should we wait until Optional support arrives with Java 8 in Wicket 8)
> 
> Martijn