[richfaces-issues] [JBoss JIRA] (RF-13550) Refactor bridge-base so that it will allow bridges to extend widgets

Brian Leathem (JIRA) issues at jboss.org
Mon Feb 17 00:51:47 EST 2014


    [ https://issues.jboss.org/browse/RF-13550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12945068#comment-12945068 ] 

Brian Leathem commented on RF-13550:
------------------------------------

I spent some time playing with this in various scenarios and I've concluded it's not a good idea.  We end up losing what is currently a good encapsulation of concerns and end up polluting our widget object with bridge functionality.  I much prefer keeping these ideas separate.

Going back to the original problem of providing legacy functions without polluting the widget, this /can/ instead be done by "monkey patching" the widget prototype in the bridge js file.  However this presents it's own concerns in terms of properly documenting the widget capabilities.

Instead we should just make take a clean start with the js API for 5.0 and do things correctly.  The RF 4 js API was not well standardized across components and was poorly documented.  I don't believe we will break many applications with any naming changed in the RF 5 js API.
                
> Refactor bridge-base so that it will allow bridges to extend widgets
> --------------------------------------------------------------------
>
>                 Key: RF-13550
>                 URL: https://issues.jboss.org/browse/RF-13550
>             Project: RichFaces
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>          Components: component
>    Affects Versions: 5.0.0.Alpha3
>            Reporter: Lukáš Fryč
>
> This will allow bridges to extend widget API and make it more natural for JSF users, e.g.:
> Editor is now:
> {code}
> $.widget('rf.editorBridge', $.rf.bridgeBase,
> {code}
> but we want:
> {code}
> $.widget('rf.editorBridge', $.rich.editor,
> {code}
> On multiple inheritance in jQuery Widget Factory:
> https://forum.jquery.com/topic/how-to-extend-a-widget-factory-widget-with-multiple-base-widgets
> The way of extending API should be designed in that way that user calls e.g.:
> {code}
> #{r:component('editor')}.setValue();
> {code}
> but editor has (or rather should have) only a method which is named in jQuery Widget Factory style:
> {code}
> data('editor').value() / data('editor').value(newValue)
> editor('value') / editor('value', newValue)
> {code}
> So, we want bridge to add the setValue/getValue API:
> {code}
> $.extend(widget), { setValue: ..., getValue: ...};
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the richfaces-issues mailing list