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 2014/01/31 16:26:18 UTC

WICKET-5197: s/AllowDefault/PreventDefault/

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;
        }

Re: WICKET-5197: s/AllowDefault/PreventDefault/

Posted by Martijn Dashorst <ma...@gmail.com>.
thx


On Sun, Feb 2, 2014 at 10:24 AM, Martin Grigorov <mg...@apache.org>wrote:

> Done.
>
> Martin Grigorov
> Wicket Training and Consulting
>
>
> On Fri, Jan 31, 2014 at 5:14 PM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
>
> > 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 <
> > martijn.dashorst@gmail.com> 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 <mgrigorov@apache.org
> >> >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 <
> >> > martijn.dashorst@gmail.com> 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
> >>
> >
> >
>



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

Re: WICKET-5197: s/AllowDefault/PreventDefault/

Posted by Martin Grigorov <mg...@apache.org>.
Done.

Martin Grigorov
Wicket Training and Consulting


On Fri, Jan 31, 2014 at 5:14 PM, Martin Grigorov <mg...@apache.org>wrote:

> 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 <
> martijn.dashorst@gmail.com> 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 <mgrigorov@apache.org
>> >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 <
>> > martijn.dashorst@gmail.com> 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
>>
>
>

Re: WICKET-5197: s/AllowDefault/PreventDefault/

Posted by Martin Grigorov <mg...@apache.org>.
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 <
martijn.dashorst@gmail.com> 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 <mgrigorov@apache.org
> >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 <
> > martijn.dashorst@gmail.com> 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
>

Re: WICKET-5197: s/AllowDefault/PreventDefault/

Posted by Martijn Dashorst <ma...@gmail.com>.
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 <mg...@apache.org>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 <
> martijn.dashorst@gmail.com> 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

Re: WICKET-5197: s/AllowDefault/PreventDefault/

Posted by Martin Grigorov <mg...@apache.org>.
+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 <
martijn.dashorst@gmail.com> 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;
>         }
>