You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2007/03/30 05:31:47 UTC

svn commit: r523920 - /incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java

Author: ehillenius
Date: Thu Mar 29 20:31:46 2007
New Revision: 523920

URL: http://svn.apache.org/viewvc?view=rev&rev=523920
Log:
header contributions test on isBehaviorAccepted

Modified:
    incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java

Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java?view=diff&rev=523920&r1=523919&r2=523920
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java Thu Mar 29 20:31:46 2007
@@ -1812,7 +1812,7 @@
 				while (iter.hasNext())
 				{
 					IBehavior behavior = (IBehavior)iter.next();
-					if (behavior instanceof IHeaderContributor && behavior.isEnabled(this))
+					if (behavior instanceof IHeaderContributor && isBehaviorAccepted(behavior))
 					{
 						((IHeaderContributor)behavior).renderHead(container.getHeaderResponse());
 					}



Re: svn commit: r523920 - /incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java

Posted by Eelco Hillenius <ee...@gmail.com>.
On 3/30/07, Igor Vaynberg <ig...@gmail.com> wrote:
> well, however you fix it, imho the way it is now is broken.

No that's reversing it. It was truly broken, as it wasn't called at
all (in fact I committed the check on isEnabled just a couple of days
ago). Your concern is that it still not may work at all times (if
people forget to call super) which is quite a different thing.

I'm also hoping that whoever wrote the original method chimes in here.

Eelco

Re: svn commit: r523920 - /incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java

Posted by Igor Vaynberg <ig...@gmail.com>.
well, however you fix it, imho the way it is now is broken.

-igor


On 3/30/07, Eelco Hillenius <ee...@gmail.com> wrote:
>
> It seemed a bit odd to me to punish our users with multiple calls
> because of something we didn't design well in the first place. Typical
> case of where we should have provided an empty template method. It
> would have my preference to fix that rather than doing the isEnabled
> call twice.
>
> Eelco
>
>
> On 3/29/07, Igor Vaynberg <ig...@gmail.com> wrote:
> > i think you should leave the isenabled check. isbehavioraccepted does
> it,
> > sure. but as users override it, will they remember to call super? its
> not in
> > javadoc and is not enforced. and if they do not call super they can
> override
> > what is behavior's choice not the components.
> >
> > -igor
> >
> >
> > On 3/29/07, ehillenius@apache.org <eh...@apache.org> wrote:
> > >
> > > Author: ehillenius
> > > Date: Thu Mar 29 20:31:46 2007
> > > New Revision: 523920
> > >
> > > URL: http://svn.apache.org/viewvc?view=rev&rev=523920
> > > Log:
> > > header contributions test on isBehaviorAccepted
> > >
> > > Modified:
> > >     incubator/wicket/branches/wicket-1.x/jdk-1.4
> > > /wicket/src/main/java/wicket/Component.java
> > >
> > > Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4
> > > /wicket/src/main/java/wicket/Component.java
> > > URL:
> > >
> http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java?view=diff&rev=523920&r1=523919&r2=523920
> > >
> > >
> ==============================================================================
> > > --- incubator/wicket/branches/wicket-1.x/jdk-1.4
> /wicket/src/main/java/wicket/Component.java
> > > (original)
> > > +++ incubator/wicket/branches/wicket-1.x/jdk-1.4
> /wicket/src/main/java/wicket/Component.java
> > > Thu Mar 29 20:31:46 2007
> > > @@ -1812,7 +1812,7 @@
> > >                                 while (iter.hasNext())
> > >                                 {
> > >                                         IBehavior behavior =
> > > (IBehavior)iter.next();
> > > -                                       if (behavior instanceof
> > > IHeaderContributor && behavior.isEnabled(this))
> > > +                                       if (behavior instanceof
> > > IHeaderContributor && isBehaviorAccepted(behavior))
> > >                                         {
> > >
> > >
> ((IHeaderContributor)behavior).renderHead(
> > > container.getHeaderResponse());
> > >                                         }
> > >
> > >
> > >
> >
>

Re: svn commit: r523920 - /incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java

Posted by Eelco Hillenius <ee...@gmail.com>.
It seemed a bit odd to me to punish our users with multiple calls
because of something we didn't design well in the first place. Typical
case of where we should have provided an empty template method. It
would have my preference to fix that rather than doing the isEnabled
call twice.

Eelco


On 3/29/07, Igor Vaynberg <ig...@gmail.com> wrote:
> i think you should leave the isenabled check. isbehavioraccepted does it,
> sure. but as users override it, will they remember to call super? its not in
> javadoc and is not enforced. and if they do not call super they can override
> what is behavior's choice not the components.
>
> -igor
>
>
> On 3/29/07, ehillenius@apache.org <eh...@apache.org> wrote:
> >
> > Author: ehillenius
> > Date: Thu Mar 29 20:31:46 2007
> > New Revision: 523920
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=523920
> > Log:
> > header contributions test on isBehaviorAccepted
> >
> > Modified:
> >     incubator/wicket/branches/wicket-1.x/jdk-1.4
> > /wicket/src/main/java/wicket/Component.java
> >
> > Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4
> > /wicket/src/main/java/wicket/Component.java
> > URL:
> > http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java?view=diff&rev=523920&r1=523919&r2=523920
> >
> > ==============================================================================
> > --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java
> > (original)
> > +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java
> > Thu Mar 29 20:31:46 2007
> > @@ -1812,7 +1812,7 @@
> >                                 while (iter.hasNext())
> >                                 {
> >                                         IBehavior behavior =
> > (IBehavior)iter.next();
> > -                                       if (behavior instanceof
> > IHeaderContributor && behavior.isEnabled(this))
> > +                                       if (behavior instanceof
> > IHeaderContributor && isBehaviorAccepted(behavior))
> >                                         {
> >
> >                                                 ((IHeaderContributor)behavior).renderHead(
> > container.getHeaderResponse());
> >                                         }
> >
> >
> >
>

Re: svn commit: r523920 - /incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java

Posted by Igor Vaynberg <ig...@gmail.com>.
i think you should leave the isenabled check. isbehavioraccepted does it,
sure. but as users override it, will they remember to call super? its not in
javadoc and is not enforced. and if they do not call super they can override
what is behavior's choice not the components.

-igor


On 3/29/07, ehillenius@apache.org <eh...@apache.org> wrote:
>
> Author: ehillenius
> Date: Thu Mar 29 20:31:46 2007
> New Revision: 523920
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=523920
> Log:
> header contributions test on isBehaviorAccepted
>
> Modified:
>     incubator/wicket/branches/wicket-1.x/jdk-1.4
> /wicket/src/main/java/wicket/Component.java
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4
> /wicket/src/main/java/wicket/Component.java
> URL:
> http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java?view=diff&rev=523920&r1=523919&r2=523920
>
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java
> (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Component.java
> Thu Mar 29 20:31:46 2007
> @@ -1812,7 +1812,7 @@
>                                 while (iter.hasNext())
>                                 {
>                                         IBehavior behavior =
> (IBehavior)iter.next();
> -                                       if (behavior instanceof
> IHeaderContributor && behavior.isEnabled(this))
> +                                       if (behavior instanceof
> IHeaderContributor && isBehaviorAccepted(behavior))
>                                         {
>
>                                                 ((IHeaderContributor)behavior).renderHead(
> container.getHeaderResponse());
>                                         }
>
>
>