Yes.
I'd write it the other way around though.
I.e. the member variable will be 'preventDefault' as now:

public boolean isPreventDefault() {
    return preventDefault;
}

@Deprecated
public boolean isAllowDefault() {
    return !preventDefault;
}

Martin Grigorov
Wicket Training and Consulting


On Fri, Jan 31, 2014 at 5:10 PM, Martijn Dashorst <
[email protected]> wrote:

> Is my assessment that the semantics of isPreventDefault() and
> isAllowDefault() can be explained as:
>
> public boolean isPreventDefault() {
>     return !isAllowDefault();
> }
>
> ?
>
> Martijn
>
>
> On Fri, Jan 31, 2014 at 4:32 PM, Martin Grigorov <[email protected]
> >wrote:
>
> > +1 to keep the old API deprecated for one release if possible (as in this
> > case)
> >
> > recently I thought that it'd be better to keep MountMapper and Co.
> > deprecated in 7.x. Wicket doesn't use them but some app may ...
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> >
> >
> > On Fri, Jan 31, 2014 at 4:26 PM, Martijn Dashorst <
> > [email protected]> wrote:
> >
> > > It looks like this is not very aptly named according to the JavaDoc...
> > >
> > > According to the JavaDoc AjaxAttributes#isPreventDefault() should:
> > >
> > >     return true if the default event handler should be invoked, false
> > > otherwise.
> > >
> > > However, the name "prevent default" implies the other way around!
> > >
> > > So instead of removing isAllowDefault/setAllowDefault in Wicket 7,
> should
> > > we rather @deprecate it, and negate the behaviour in
> > > isPreventDefault/setPreventDefault?
> > >
> > > Martijn
> > >
> > >
> > > @@ -291,16 +291,16 @@ public final class AjaxRequestAttributes
> > >         /**
> > >          * Only applies for event behaviors. Returns whether the
> behavior
> > > should allow the default event
> > >          * handler to be invoked. For example if the behavior is
> attached
> > > to a link and
> > > -        * {@link #isAllowDefault()} returns <code>false</code> (which
> is
> > > default value), the link's URL
> > > +        * {@link #isPreventDefault()} returns <code>false</code>
> (which
> > is
> > > default value), the link's URL
> > >          * will not be followed. If the Ajax behavior is attached to a
> > > checkbox or a radio button then
> > >          * the default behavior should be allowed to actually check the
> > box
> > > or radio button, i.e. this
> > >          * method should return <code>true</code>.
> > >          *
> > >          * @return {@code true} if the default event handler should be
> > > invoked, {@code false} otherwise.
> > >          */
> > > -       public boolean isAllowDefault()
> > > +       public boolean isPreventDefault()
> > >         {
> > > -               return allowDefault;
> > > +               return preventDefault;
> > >         }
> > >
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>

Reply via email to