I agree with Martin here (thanks for the great writeup, Andy). It&#39;s weird to have all these &quot;Behavior&quot; features that just focus on dealing with a script. Andy, your proposal seems like the simplest way to handle this for now. However, if we assume that a behavior has a single purpose, couldn&#39;t we just rename &quot;getScript&quot; to &quot;getContent&quot; or something?<br clear="all">
---<br>Kito D. Mann -- Author, JavaServer Faces in Action<br><a href="http://twitter.com/kito99">http://twitter.com/kito99</a>  <a href="http://twitter.com/jsfcentral">http://twitter.com/jsfcentral</a><br><a href="http://www.virtua.com">http://www.virtua.com</a> - JSF/Java EE consulting, training, and mentoring<br>
<a href="http://www.JSFCentral.com">http://www.JSFCentral.com</a> - JavaServer Faces FAQ, news, and info<br>+1 203-404-4848 x3<br><br><br><br>
<br><br><div class="gmail_quote">On Wed, Mar 11, 2009 at 11:06 AM, Martin Marinschek <span dir="ltr">&lt;<a href="mailto:mmarinschek@apache.org">mmarinschek@apache.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Andy,<br>
<br>
ok, I see. Well, I just wanted to make sure that we don&#39;t pollute the<br>
namespace: again, behavior seems to generic a name to me to have a<br>
method providing a script. Should we have a behavior interface, an<br>
extending script-behavior interface, and then we can make behavior<br>
(the base-interface) more powerful in 2.1?<br>
<div><div></div><div class="h5"><br>
<br>
regards,<br>
<br>
Martin<br>
<br>
On 3/10/09, Andy Schwartz &lt;<a href="mailto:andy.schwartz@oracle.com">andy.schwartz@oracle.com</a>&gt; wrote:<br>
&gt; Hey Martin -<br>
&gt;<br>
&gt; Thanks for reading through my long email and for the comments!<br>
&gt;<br>
&gt; We ended up with the getScript() and decode() methods out of necessity -<br>
&gt; these were the minimal APIs that we needed to encapsulate our<br>
&gt; Ajax-related functionality into a Behavior object.  As currently<br>
&gt; designed, our Behavior solution is definitely focused on creating and<br>
&gt; attaching scripts to components - thus we ended up with getScript() as<br>
&gt; the centerpiece of the Behavior contract.<br>
&gt;<br>
&gt; I find your idea of Behaviors as component aspects very interesting, and<br>
&gt; can see how this would add another degree of flexibility.  However, I am<br>
&gt; a little uncomfortable expanding the scope at this point in the 2.0<br>
&gt; release.   For 2.1, I do think it would be worth considering whether we<br>
&gt; can address this, perhaps by adding a new &quot;PhaseBehavior&quot; interface.<br>
&gt; The idea is that this would identify Behaviors that want to be notified<br>
&gt; before/after each phase, similar to a PhaseListener, but at the<br>
&gt; component instance-level rather than at the view-level.<br>
&gt;<br>
&gt; Do you feel that this is something that we can evaluate for 2.1?  Or do<br>
&gt; you feel that it is critical to address this in 2.0?<br>
&gt;<br>
&gt; Andy<br>
&gt;<br>
&gt; Martin Marinschek wrote On 3/10/2009 3:02 PM ET:<br>
&gt;&gt; Hi Andy,<br>
&gt;&gt;<br>
&gt;&gt; I think this all reads very well - however, I was wondering why you<br>
&gt;&gt; stopped at providing decode and renderScript (especially the<br>
&gt;&gt; get-script method feels a little awkward in something which sounds as<br>
&gt;&gt; generic as a behaviour class).<br>
&gt;&gt;<br>
&gt;&gt; For me, this whole behavior thing sounds like a component aspect:<br>
&gt;&gt; something which is called before/after/around component lifecycle<br>
&gt;&gt; methods are executed... at least before/after/around decode and<br>
&gt;&gt; before/after/around rendering.<br>
&gt;&gt;<br>
&gt;&gt; regards,<br>
&gt;&gt;<br>
&gt;&gt; Martin<br>
&gt;&gt;<br>
&gt;&gt; On 3/10/09, Andy Schwartz &lt;<a href="mailto:andy.schwartz@oracle.com">andy.schwartz@oracle.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; Gang -<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I wanted to send one last email on the new Behavior API to help folks<br>
&gt;&gt;&gt; who were not able to keep up with the progress on this API as it<br>
&gt;&gt;&gt; evolved.  Much of this information has been covered in previous emails,<br>
&gt;&gt;&gt; but some of the API details are new, so please read on if you are<br>
&gt;&gt;&gt; interested.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * Core APIs<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Just to remind everyone why we started down this path...  As of the<br>
&gt;&gt;&gt; public review draft, we had a single non-generic &quot;behavior&quot; - the<br>
&gt;&gt;&gt; AjaxBeahvior - which could only be attached to EditableValueHolders and<br>
&gt;&gt;&gt; ActionSource components, and even then, only for valueChange/action<br>
&gt;&gt;&gt; events.  So, two obvious limitations that we decided to address:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 1. We wanted to allow other types of &quot;behaviors&quot; to be provided - not<br>
&gt;&gt;&gt; limit the solution to AjaxBehavior.<br>
&gt;&gt;&gt; 2. We wanted to allow components other than<br>
&gt;&gt;&gt; EditableValueHolders/ActionSources to host &quot;behaviors&quot;.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; In order to address #1, we introduced the generic<br>
&gt;&gt;&gt; javax.faces.component.behavior.Behavior class.  The class provides the<br>
&gt;&gt;&gt; base contract for all behavior implementations.  Note that early on we<br>
&gt;&gt;&gt; decided that a &quot;behavior&quot; was something distinct from a &quot;component&quot;.<br>
&gt;&gt;&gt; Behaviors, like converters/validators, are objects that are attached to<br>
&gt;&gt;&gt; existing components in order to enhance the component with functionality<br>
&gt;&gt;&gt; that is not provided by the component itself.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The main responsibility of a Behavior implementation is to cough up a<br>
&gt;&gt;&gt; script - ie. a bit of JavaScript code that can be attached to one of the<br>
&gt;&gt;&gt; component&#39;s client-side event handlers (eg. attach to &quot;onclick&quot;).  This<br>
&gt;&gt;&gt; responsibility is implemented via the Behavior.getScript() method.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; In order to address #2, we introduced the<br>
&gt;&gt;&gt; javax.faces.component.behavior.BehaviorHolder interface.  Components<br>
&gt;&gt;&gt; that want to allow behaviors to be attached implement this interface.<br>
&gt;&gt;&gt; This allows the component to communicate the valid attach points<br>
&gt;&gt;&gt; (getEventNames()) and the default attach point (getDefaultEventName()),<br>
&gt;&gt;&gt; provides a mechanism for registering behaviors (addBehavior()), and also<br>
&gt;&gt;&gt; provides access to any registered behaviors (getBehaviors()).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; While UIComponentBase does not implement the BehaviorHolder interface<br>
&gt;&gt;&gt; itself, it provides default implementations of the BehaviorHolder<br>
&gt;&gt;&gt; methods in order to make it easier for subclasses to implement<br>
&gt;&gt;&gt; BehaviorHolder.  The minimal requirement for a UIComponentBase subclass<br>
&gt;&gt;&gt; to implement BehaviorHolder is to provide an implementation of<br>
&gt;&gt;&gt; getEventNames() that returns a non-empty set of the event names<br>
&gt;&gt;&gt; supported by the component.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; These two contracts, Behavior and BehaviorHolder, form the foundation of<br>
&gt;&gt;&gt; our new component behavior solution.  Hopefully the above should be<br>
&gt;&gt;&gt; familiar since it has been discussed the number of times on the EG list<br>
&gt;&gt;&gt; and was also covered in Appendix C of the recent spec drafts.   The<br>
&gt;&gt;&gt; actual set of APIs that we need has grown over the last few months, so I<br>
&gt;&gt;&gt; wanted to also discuss some of the more recent additions...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * BehaviorRenderer<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Once we got the core Behavior/BehaviorHolder contract in place, we<br>
&gt;&gt;&gt; (Roger, Ted, Alex and I) quickly realized that additional flexibility<br>
&gt;&gt;&gt; was needed.  In particular, we felt that the scripts that are produced<br>
&gt;&gt;&gt; by Behaivor implementations may need to vary based on the RenderKit.  In<br>
&gt;&gt;&gt; order to support RenderKit-specific Behavior script generation, we<br>
&gt;&gt;&gt; followed the existing UIComonent/Renderer pattern and introduced a<br>
&gt;&gt;&gt; BehaviorRenderer API.  BehaviorRenderers are similar in spirit to<br>
&gt;&gt;&gt; component Renderers, but provide a contract that is geared towards<br>
&gt;&gt;&gt; Behaviors.  So, while component Renderers are designed for HTML content<br>
&gt;&gt;&gt; generation and write directly to the ResponseWriter, BehaviorRenderers<br>
&gt;&gt;&gt; simply cough up a script - ie. the main API on BehaviorRenderer is<br>
&gt;&gt;&gt; getScript() (mirrors Behavior.getScript()).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Of course, as with component Renderers, BehaviorRenderers are entirely<br>
&gt;&gt;&gt; optional.  A Behavior implementation does not need to use a<br>
&gt;&gt;&gt; BehaviorRenderer at all - it can simply override Behavior.getScript()<br>
&gt;&gt;&gt; and produce the script locally.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * Behavior Event Handling<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The next enhancement that we tackled was the ability for Behaviors to<br>
&gt;&gt;&gt; participate in decoding.  This was necessary in order to support a very<br>
&gt;&gt;&gt; important use case: the ability for Behavior implementations to deliver<br>
&gt;&gt;&gt; events to registered listeners.  The main case that we had in mind was<br>
&gt;&gt;&gt; AjaxBehavior, ie. we wanted to make it possible to do this:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;   &lt;h:commandButton&gt;<br>
&gt;&gt;&gt;       &lt;f:ajax event=&quot;mouseover&quot;<br>
&gt;&gt;&gt; listener=&quot;#{bean.doSomethingInResponseToMouseOver}&quot;/&gt;<br>
&gt;&gt;&gt;   &lt;/h:commandButton&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; In order to support this we added the following APIs:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; - Behavior.decode()<br>
&gt;&gt;&gt; - BehaviorRenderer.decode()<br>
&gt;&gt;&gt; - Behavior.broadcast()<br>
&gt;&gt;&gt; - BehaviorEvent (extends FacesEvent)<br>
&gt;&gt;&gt; - BehaviorListener (extends FacesListener)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; We also specified the mechanism/conditions under which BehaviorHolder<br>
&gt;&gt;&gt; components must give attached Behaviors the opportunity to decode.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * BehaviorBase<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Around this time we also introduced a BehaviorBase base class that<br>
&gt;&gt;&gt; provides base functionality for Behavior implementations (such as<br>
&gt;&gt;&gt; listener registration, event broadcast support, BehaviorRenderer<br>
&gt;&gt;&gt; delegation wiring).  BehaviorBase is to Behavior what UIComponentBase is<br>
&gt;&gt;&gt; to UIComponent.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * Behavior.Parameter<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; As we started integrating the new behavior contract with our existing<br>
&gt;&gt;&gt; renderers, we realized that Behavior/BehaviorRenderer getScript()<br>
&gt;&gt;&gt; implementations may need access to various pieces of information to help<br>
&gt;&gt;&gt; them generate the correct scripts.  For example, in the h:commandButton<br>
&gt;&gt;&gt; case, the component may have f:params attached.  These f:param<br>
&gt;&gt;&gt; names/values must be included in the request, whether the request is a<br>
&gt;&gt;&gt; full page postback provided by the component, or an Ajax postback<br>
&gt;&gt;&gt; provided by the AjaxBehavior.  In order to support this case, we added a<br>
&gt;&gt;&gt; trivial static inner Parameter class to Behavior.  This allows<br>
&gt;&gt;&gt; components/renderers to pass (resolved) parameter name/values into<br>
&gt;&gt;&gt; Behavior.getScript().<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * BehaviorContext<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; At this point we realized that there is danger in adding more arguments<br>
&gt;&gt;&gt; to the Behavior.BehaviorRenderer.getScript() methods.  The problem is<br>
&gt;&gt;&gt; that we may not be able to foresee all of the possible information that<br>
&gt;&gt;&gt; getScript() implementations may need access to.  Rather than risk having<br>
&gt;&gt;&gt; to later define new overrides of getScript(), we decided to introduce a<br>
&gt;&gt;&gt; BehaviorContext class.  The BehaviorContext is used to pass information<br>
&gt;&gt;&gt; (FacesContext, component, parameters, source id) into<br>
&gt;&gt;&gt; Behavior.getScript().  If we find that we need to pass additional<br>
&gt;&gt;&gt; information into getScript() in a later release, we can do so by adding<br>
&gt;&gt;&gt; new methods to the BehaviorContext.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; BehaviorContext is defined as an abstract class, but provides access to<br>
&gt;&gt;&gt; a implementation via the BehaviorContext.createBehaviorContext() factory<br>
&gt;&gt;&gt; method.  Note that we explicitly avoid going through the FactoryFinder<br>
&gt;&gt;&gt; mechanism here since this is a trivial data transfer object - and one<br>
&gt;&gt;&gt; which may need to be instantiated many times during a typical request -<br>
&gt;&gt;&gt; so we want to keep the overhead low.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I keep going back and forth as to whether Behavior.decode() should also<br>
&gt;&gt;&gt; take a BehaviorContext.  Currently it just takes a FacesContext and the<br>
&gt;&gt;&gt; UIComponent.  I am tempted to pass in the BehaviorContext instead,<br>
&gt;&gt;&gt; though certain information on the BehaviorContext (like the parameters)<br>
&gt;&gt;&gt; are clearly specific to script generation.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * BehaviorHint<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Another issue that arose while integrating Behavior support into<br>
&gt;&gt;&gt; h:commandButton is that the component renderer may itself need to vary<br>
&gt;&gt;&gt; its content depending on whether or not it has a Behavior attached, and<br>
&gt;&gt;&gt; in particular depending on whether that Behavior provides a script that<br>
&gt;&gt;&gt; performs a postback.  The issue here is that certain renderers - eg.<br>
&gt;&gt;&gt; commandButton/Link renderers - may generate their own postback scripts<br>
&gt;&gt;&gt; (in Mojarra these renderers generate calls to mojarra.jsfcljs()).<br>
&gt;&gt;&gt; However, when an AjaxBehavior is attached, it provides its own postback<br>
&gt;&gt;&gt; script that should replace/suppress the postback script that the<br>
&gt;&gt;&gt; component renderer normally produces.  Since not all Behavior<br>
&gt;&gt;&gt; implementations actually perform postbacks (AjaxBehavior does, but most<br>
&gt;&gt;&gt; won&#39;t), the component renderer needs some way to determine whether or<br>
&gt;&gt;&gt; not an attached Behavior is going to perform a postback.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; In order to solve this problem, we added a new enum, BehaviorHint, and a<br>
&gt;&gt;&gt; new method to Behavior: Behavior.getHints().  getHints() returns a<br>
&gt;&gt;&gt; Set&lt;BehaviorHint&gt; (implemented under the covers as an EnumSet of course)<br>
&gt;&gt;&gt; that provides information about the Behavior that the consuming<br>
&gt;&gt;&gt; component/renderer may be interested in.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; At the moment, the BehaviorHint enum only defines a single value -<br>
&gt;&gt;&gt; BehaviorHint.SUBMITTING.  However, we chose to use an enum rather than a<br>
&gt;&gt;&gt; boolean (ie. rather than a Behavior.isSubmitting() method) to allow for<br>
&gt;&gt;&gt; additional hints in the future.  If people feel that it is too awkward<br>
&gt;&gt;&gt; to have a single-valued enum in our API, please let me know.  We can<br>
&gt;&gt;&gt; consider reverting to a boolean method, though an enum is more future<br>
&gt;&gt;&gt; proof.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * Behavior configuration<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; In order to provide complete support for configuring Behavior and<br>
&gt;&gt;&gt; BehaviorRenderer implementations, we had to touch a number of places,<br>
&gt;&gt;&gt; including:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; - javax.faces.application.Application now supports methods for adding<br>
&gt;&gt;&gt; and creating Behavior instances<br>
&gt;&gt;&gt; - faces-config.xml now supports &lt;behavior&gt; and &lt;behavior-renderer&gt;<br>
&gt;&gt;&gt; elements<br>
&gt;&gt;&gt; - We have added annotations for identifying Behavior and<br>
&gt;&gt;&gt; BehaviorRenderer implementations so that faces-config entries are not<br>
&gt;&gt;&gt; required<br>
&gt;&gt;&gt; - The Facelets taglib file now supports &lt;behavior&gt; tags.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; In all cases we followed the precedents already set by<br>
&gt;&gt;&gt; converter/validator.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * Standard HTML component BehaviorHolders<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Finally, once we had agreement our generic Behavior solution, we also<br>
&gt;&gt;&gt; decided that it was silly not to enhance the standard HTML component set<br>
&gt;&gt;&gt; to take advantage of this.  Most of the standard HTML components now<br>
&gt;&gt;&gt; implement BehaviorHolder and thus allow Behaviors to be attached.  The<br>
&gt;&gt;&gt; attach points for the standard HTML components correspond to the<br>
&gt;&gt;&gt; standard &quot;on&lt;Event&gt;&quot; attributes.  So, whereas before it was only<br>
&gt;&gt;&gt; possible to attach behaviors to EditableValueHolder/ActionSource<br>
&gt;&gt;&gt; components, it is now possible to attach Behaviors to other standard<br>
&gt;&gt;&gt; components, eg. &lt;h:panelGroup&gt;:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;   &lt;h:panelGroup&gt;<br>
&gt;&gt;&gt;       &lt;f:ajax event=&quot;mouseover&quot; listener=&quot;#{bean.foo}&quot;/&gt;<br>
&gt;&gt;&gt;   &lt;/h:panelGroup&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; This gives us significantly more flexibility - and a much more powerful<br>
&gt;&gt;&gt; solution than we had outlined in our original plans.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; One quick note on event names... The event names/attach points do not<br>
&gt;&gt;&gt; include the &quot;on&quot; prefix that is used in the component attribute names.<br>
&gt;&gt;&gt; So:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;       &lt;f:ajax event=&quot;mouseover&quot;/&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Not:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;       &lt;f:ajax event=&quot;onMouseover&quot;/&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The standard ActionSource components still support a logical &quot;action&quot;<br>
&gt;&gt;&gt; event/attach point.  And the standard EditableValueHolder components<br>
&gt;&gt;&gt; still support a logical &quot;valueChange&quot; event/attach point.  This allows<br>
&gt;&gt;&gt; page authors to attach Behaviors to these components without having to<br>
&gt;&gt;&gt; be aware of the unerlying DOM event that triggers the action/value<br>
&gt;&gt;&gt; change.  Also note that the &quot;action&quot; and &quot;valueChange&quot; events are<br>
&gt;&gt;&gt; defined as default events for these components, which makes it possible<br>
&gt;&gt;&gt; to do omit the event attribute, eg:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;    &lt;!-- Fires Ajax requests in response to actions --&gt;<br>
&gt;&gt;&gt;    &lt;h:commandButton&gt;<br>
&gt;&gt;&gt;       &lt;f:ajax/&gt;<br>
&gt;&gt;&gt;   &lt;/h:commandButton&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;   &lt;!-- Fires Ajax requests in response to value changes --&gt;<br>
&gt;&gt;&gt;   &lt;h:inputText&gt;<br>
&gt;&gt;&gt;       &lt;f:ajax/&gt;<br>
&gt;&gt;&gt;   &lt;/h:inputText&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; BTW, Jeffrey Stephenson (JSR-276) and I have been having some offline<br>
&gt;&gt;&gt; discussions on the possibility of getting event name/default event name<br>
&gt;&gt;&gt; metadata in place.  This would clearly help the development tool<br>
&gt;&gt;&gt; experience.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; * Limitations<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; While I think that the Behavior API is a great addition to JSF, there<br>
&gt;&gt;&gt; are a few limitations that we have not been able to address for 2.0.<br>
&gt;&gt;&gt; These include:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 1. Custom renderer wiring<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Implementing the BehaviorHolder contract is trivial.  However, actually<br>
&gt;&gt;&gt; rendering the Behavior scripts - possibly multiple scripts which may<br>
&gt;&gt;&gt; need to be chained with other component/renderer-defined scripts - can<br>
&gt;&gt;&gt; be tedious.  To help simplify this, we have introduced a new utility<br>
&gt;&gt;&gt; method into our JavaScript API: jsf.util.chain().  This method takes an<br>
&gt;&gt;&gt; arbitrary number of script arguments and executes each one until it<br>
&gt;&gt;&gt; finds one that returns false, at which point it short-circuits  While<br>
&gt;&gt;&gt; this simplifies things somewhat, it is still nontrivial for a Renderer<br>
&gt;&gt;&gt; author to produce the proper call to jsf.util.chain().<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; If we had more time, I would recommend trying to get some utility<br>
&gt;&gt;&gt; methods into the JSF API so that we can make it easier for custom<br>
&gt;&gt;&gt; Renderer authors to produce the properly chained scripts.  However,<br>
&gt;&gt;&gt; given how little have time we have left, I do not think that we have<br>
&gt;&gt;&gt; time to get this right.  My current plan is to try to provide some open<br>
&gt;&gt;&gt; source utilities to help Renderer authors solve this problem.  Once<br>
&gt;&gt;&gt; we&#39;ve worked out the right APIs in open source, I am hoping that we can<br>
&gt;&gt;&gt; incorporate these back into the 2.1 spec.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 2. Behavior attribute-property transparency<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I have been thinking that, like components, Behaviors should expose an<br>
&gt;&gt;&gt; attribute map that provides attribute-property transparency.  That way,<br>
&gt;&gt;&gt; BehaviorRenderers do not have to worry about the actual Behavior type -<br>
&gt;&gt;&gt; they can simply grab attributes out of the attribute map.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I briefly considered implementing this functionality, but after a quick<br>
&gt;&gt;&gt; look at UIComponentBase.AttributeMap I got scared away.  I think the<br>
&gt;&gt;&gt; right solution is to:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; - Break UIComponentBase.AttributeMap out into its own top-level public<br>
&gt;&gt;&gt; class.<br>
&gt;&gt;&gt; - Introduce an AttributeHolder contract<br>
&gt;&gt;&gt; - Have UIComponentBase and BehaviorBase implement AttributeHolder and<br>
&gt;&gt;&gt; use AttributeMap to hold their attributes.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; However, for obvious reasons I decided not to push this for 2.0.<br>
&gt;&gt;&gt; Perhaps we can think about this for 2.1.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Since we do not have a Behavior.getAttributes() API, at the moment,<br>
&gt;&gt;&gt; BehaviorRenderer implementations are forced to cast to the actual<br>
&gt;&gt;&gt; Behaivor type (eg. AjaxBehaviorRenderer casts the Behavior to<br>
&gt;&gt;&gt; AjaxBehavior).  I am not happy about this, but willing to live with it<br>
&gt;&gt;&gt; for now.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 3. Behavior resources<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Behavior implementations clearly are going to want to pull in JavaScript<br>
&gt;&gt;&gt; libraries so that these do not need to be pulled in explicitly by the<br>
&gt;&gt;&gt; application developer.  However, at the moment we do not have a<br>
&gt;&gt;&gt; solution/recommendation for this.  (Well, there might be some solution -<br>
&gt;&gt;&gt; just haven&#39;t identified what it is yet.)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; This is another one that will need to wait for 2.1.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I think that&#39;s it!  If you have any questions/comments on this new API,<br>
&gt;&gt;&gt; please follow up here.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I am hoping to do some blogging on all of this if I can ever find the<br>
&gt;&gt;&gt; time. :-)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Andy<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
</div></div><div><div></div><div class="h5">--<br>
<br>
<a href="http://www.irian.at" target="_blank">http://www.irian.at</a><br>
<br>
Your JSF powerhouse -<br>
JSF Consulting, Development and<br>
Courses in English and German<br>
<br>
Professional Support for Apache MyFaces<br>
</div></div></blockquote></div><br>