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 <mgrigo...@apache.org> wrote: > > On May 6, 2015 3:10 PM, "Martijn Dashorst" <martijn.dasho...@gmail.com> > wrote: > > > > On Wed, May 6, 2015 at 1:35 PM, Martin Grigorov <mgrigo...@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.dasho...@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 >