[ 
http://issues.apache.org/jira/browse/MYFACES-111?page=comments#action_60055 ]
     
Heath Borders-Wing commented on MYFACES-111:
--------------------------------------------

You are correct, both of those are exposed.  However, if someone wants to build 
a custom CommandButton and wants it to extend the 'ext' HtmlCommandButton to 
have some javascript automatically embedded in the 'onclick' attribute after 
whatever is passed in the jsp, this facilitates it.

For example, right now, HtmlCommandButton and HtmlCommandLink are rendered with 
javascript to properly setup which ActionEvent should be fired.  
HtmlCommandButton clears the HtmlForm's hiddenCommandLinkField, so that only 
the HtmlCommandButton's action is fired (by the browser putting the clientId on 
the request), and the HtmlCommandLink uses javascript to add its clientId to 
the HtmlForm's hiddenCommandLinkField.

This javascript is appeneded to whatever the user provides and both of those 
are rendered to the HTML onclick attribute.

If I want additional javascript to be appended/prepended, this refactoring 
allows me to.

If you're curious, I was to write out some client-side code that ignores 
user-clicks after a commandButton or commandLink has been clicked.

This could be userful for other things though, maybe you want to update the 
statusbar to saying loading... after a commandButton has been clicked.  Now, 
you can just update the StringBuffer that commandButton generates, rather than 
having to rewrite the whole renderer.

> Exposed/refactored renderClearFormOnClick for subclass chaining in 
> HtmlButtonRendererBase
> -----------------------------------------------------------------------------------------
>
>          Key: MYFACES-111
>          URL: http://issues.apache.org/jira/browse/MYFACES-111
>      Project: MyFaces
>         Type: Improvement
>     Versions: 1.0.8 beta
>  Environment: WSAD 5.1.2, IE6
>     Reporter: Heath Borders-Wing
>     Priority: Minor
>  Attachments: HtmlButtonRendererBase.java, HtmlButtonRendererBaseDiff.java
>
> The current HtmlButtonRendererBase does not allow for easy additions to the 
> rendered onclick attribute.  This refactoring makes this possible.
> Now, the renderClearFormOnClick() is defined as:
> protected StringBuffer buildOnClick(UIComponent uiComponent, FacesContext 
> facesContext, ResponseWriter writer);
> This way, subclasses may call the superclass implementation and add any 
> additional javascript before onclick is rendered.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to