|
Hi,
What do you think about this additional code in AjaxEventBehavior#onComponentTag() (Wicket 1.5) : @@ -108,6 +112,20 @@ public abstract class AjaxEventBehavior extends AbstractDefaultAjaxBehavior Component myComponent = getComponent(); if (myComponent.isEnabledInHierarchy()) { + if (LOG.isWarnEnabled() && myComponent.getApplication().usesDevelopmentConfig()) + { + String attribute = tag.getAttribute(event); + if (Strings.isEmpty(attribute) == false) + { + LOG.warn("{} assigned to {} is overriding the previous value of the inline attribute. " + + "Maybe there are several Ajax event behaviors on the same type assigned to this component." + new Object[] { + this, myComponent + } + ); + } + } The problem it tries to solve is that you can add several AEBs on the same event type to a component and silently the last one wins. This warning should tell the developer that something bad may happen -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com |
|
looks good to me
-igor On Thu, Feb 23, 2012 at 6:01 AM, Martin Grigorov <[hidden email]> wrote: > Hi, > > What do you think about this additional code in > AjaxEventBehavior#onComponentTag() (Wicket 1.5) : > > @@ -108,6 +112,20 @@ public abstract class AjaxEventBehavior extends > AbstractDefaultAjaxBehavior > Component myComponent = getComponent(); > if (myComponent.isEnabledInHierarchy()) > { > + if (LOG.isWarnEnabled() && > myComponent.getApplication().usesDevelopmentConfig()) > + { > + String attribute = tag.getAttribute(event); > + if (Strings.isEmpty(attribute) == false) > + { > + LOG.warn("{} assigned to {} is > overriding the previous value of the inline attribute. " + > + "Maybe there are > several Ajax event behaviors on the same type assigned to this > component." > + new Object[] { > + this, myComponent > + } > + ); > + } > + } > > > The problem it tries to solve is that you can add several AEBs on the > same event type to a component and silently the last one wins. > This warning should tell the developer that something bad may happen > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com |
| Powered by Nabble | Edit this page |
