You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Serban Balamaci (Created) (JIRA)" <ji...@apache.org> on 2012/03/20 22:23:42 UTC

[jira] [Created] (WICKET-4463) Maybe there are several Ajax event behaviors on the same type assigned to this component

Maybe there are several Ajax event behaviors on the same type assigned to this component
----------------------------------------------------------------------------------------

                 Key: WICKET-4463
                 URL: https://issues.apache.org/jira/browse/WICKET-4463
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5.5
            Reporter: Serban Balamaci
            Priority: Minor


I don't know if this is actually an issue, just wanted to know let you know what the recent http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html change impacted.
We are now seeing:
WARN  (org.apache.wicket.ajax.AjaxEventBehavior:120)    - org.apache.wicket.ajax.markup.html.AjaxLink$1 {event='onclick'} assigned to [ [Component id = delete]] is overriding the previous value of the inline attribute. Maybe there are several Ajax event behaviors on the same type assigned to this component.

Because we have an AjaxLink with added ConfirmBehavior that does not "replace" but "enhances" by appending to a behaviour:

ConfirmBehavior extends Behavior {
     @Override
     public void onComponentTag(Component component, ComponentTag tag) {
         StringBuilder handler = new StringBuilder(128);
         handler.append("if (!confirm('");
         handler.append(message.getObject());
         handler.append("')) {return false;} ");

         String script = tag.getAttributes().getString("onclick");
         if (script != null) {
             handler.append(script);
         }

         tag.put("onclick", handler.toString());
     }
}

we can/should probably change it to an AjaxCallDecorator, just wanted to let others know what the change http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html might affect.

Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (WICKET-4463) Maybe there are several Ajax event behaviors on the same type assigned to this component

Posted by "Martin Grigorov (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4463.
-------------------------------------

    Resolution: Not A Problem

Yes, it looks TinyMceAjaxSubmitModifier has the same problem.
Someone has to improve it...
                
> Maybe there are several Ajax event behaviors on the same type assigned to this component
> ----------------------------------------------------------------------------------------
>
>                 Key: WICKET-4463
>                 URL: https://issues.apache.org/jira/browse/WICKET-4463
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.5
>            Reporter: Serban Balamaci
>            Priority: Minor
>
> I don't know if this is actually an issue, just wanted to know let you know what the recent http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html change impacted.
> We are now seeing:
> WARN  (org.apache.wicket.ajax.AjaxEventBehavior:120)    - org.apache.wicket.ajax.markup.html.AjaxLink$1 {event='onclick'} assigned to [ [Component id = delete]] is overriding the previous value of the inline attribute. Maybe there are several Ajax event behaviors on the same type assigned to this component.
> Because we have an AjaxLink with added ConfirmBehavior that does not "replace" but "enhances" by appending to a behaviour:
> ConfirmBehavior extends Behavior {
>      @Override
>      public void onComponentTag(Component component, ComponentTag tag) {
>          StringBuilder handler = new StringBuilder(128);
>          handler.append("if (!confirm('");
>          handler.append(message.getObject());
>          handler.append("')) {return false;} ");
>          String script = tag.getAttributes().getString("onclick");
>          if (script != null) {
>              handler.append(script);
>          }
>          tag.put("onclick", handler.toString());
>      }
> }
> we can/should probably change it to an AjaxCallDecorator, just wanted to let others know what the change http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html might affect.
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4463) Maybe there are several Ajax event behaviors on the same type assigned to this component

Posted by "Martin Grigorov (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13236481#comment-13236481 ] 

Martin Grigorov commented on WICKET-4463:
-----------------------------------------

Hi Serban,

I think you actually benefit from this warning.
I guess your code looks like:
AjaxLink l = new AjaxLink() {...};
l.add(new ConfirmBehavior());
parent.add(link);

If this is the case then ConfirmBehavior is added before AjaxEventBehavior because the latter is added in AjaxLink#onInitialize(). So tag.getAttributes().getString("onclick");  should always return "null" for you, no ?

AjaxEventBehavior#onComponentTag() logs this warning only if there is some value already for the event it manipulates. Because it completely ignores the old value and replaces with the result of org.apache.wicket.ajax.AjaxEventBehavior#getEventHandler().
                
> Maybe there are several Ajax event behaviors on the same type assigned to this component
> ----------------------------------------------------------------------------------------
>
>                 Key: WICKET-4463
>                 URL: https://issues.apache.org/jira/browse/WICKET-4463
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.5
>            Reporter: Serban Balamaci
>            Priority: Minor
>
> I don't know if this is actually an issue, just wanted to know let you know what the recent http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html change impacted.
> We are now seeing:
> WARN  (org.apache.wicket.ajax.AjaxEventBehavior:120)    - org.apache.wicket.ajax.markup.html.AjaxLink$1 {event='onclick'} assigned to [ [Component id = delete]] is overriding the previous value of the inline attribute. Maybe there are several Ajax event behaviors on the same type assigned to this component.
> Because we have an AjaxLink with added ConfirmBehavior that does not "replace" but "enhances" by appending to a behaviour:
> ConfirmBehavior extends Behavior {
>      @Override
>      public void onComponentTag(Component component, ComponentTag tag) {
>          StringBuilder handler = new StringBuilder(128);
>          handler.append("if (!confirm('");
>          handler.append(message.getObject());
>          handler.append("')) {return false;} ");
>          String script = tag.getAttributes().getString("onclick");
>          if (script != null) {
>              handler.append(script);
>          }
>          tag.put("onclick", handler.toString());
>      }
> }
> we can/should probably change it to an AjaxCallDecorator, just wanted to let others know what the change http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html might affect.
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4463) Maybe there are several Ajax event behaviors on the same type assigned to this component

Posted by "Serban Balamaci (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13237281#comment-13237281 ] 

Serban Balamaci commented on WICKET-4463:
-----------------------------------------

Hello Martin,
You are right! I've thought that it was not doing the confirmation because of the change in 1.5.5 I mentioned instead it helped me improve the code by using the decorator so it's a good thing it is now in place. Thanks.

Hmm, but then again would stuff like TinyMceAjaxSubmitModifier which is based on an AttributeModifier for "onclick" would probably be in the same situation?...
                
> Maybe there are several Ajax event behaviors on the same type assigned to this component
> ----------------------------------------------------------------------------------------
>
>                 Key: WICKET-4463
>                 URL: https://issues.apache.org/jira/browse/WICKET-4463
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.5
>            Reporter: Serban Balamaci
>            Priority: Minor
>
> I don't know if this is actually an issue, just wanted to know let you know what the recent http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html change impacted.
> We are now seeing:
> WARN  (org.apache.wicket.ajax.AjaxEventBehavior:120)    - org.apache.wicket.ajax.markup.html.AjaxLink$1 {event='onclick'} assigned to [ [Component id = delete]] is overriding the previous value of the inline attribute. Maybe there are several Ajax event behaviors on the same type assigned to this component.
> Because we have an AjaxLink with added ConfirmBehavior that does not "replace" but "enhances" by appending to a behaviour:
> ConfirmBehavior extends Behavior {
>      @Override
>      public void onComponentTag(Component component, ComponentTag tag) {
>          StringBuilder handler = new StringBuilder(128);
>          handler.append("if (!confirm('");
>          handler.append(message.getObject());
>          handler.append("')) {return false;} ");
>          String script = tag.getAttributes().getString("onclick");
>          if (script != null) {
>              handler.append(script);
>          }
>          tag.put("onclick", handler.toString());
>      }
> }
> we can/should probably change it to an AjaxCallDecorator, just wanted to let others know what the change http://apache-wicket.1842946.n4.nabble.com/Log-a-warning-when-there-are-several-ajax-event-behaviors-on-the-same-event-td4413925.html might affect.
> Thanks.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira