Implementing behaviors in a component library is currently not as easy as implementing components.
1) There is no abstract behavior base available
2) No common way to handle state saving like the StateHelper
3) No common way to attach a behavior to a component
4) No common, portable and easy way to attach a behavior to a composite
It would be a great goal to create a abstract base for behaviors, which fixes the common problems.
In PrimeFaces, i developed it via:
AbstractBehavior; base class which handles the attributes and state saving - similar to getStateHelper and PropertyKeys
Implementing behaviors in a component library is currently not as easy as implementing components.
1) There is no abstract behavior base available 2) No common way to handle state saving like the StateHelper 3) No common way to attach a behavior to a component 4) No common, portable and easy way to attach a behavior to a composite
It would be a great goal to create a abstract base for behaviors, which fixes the common problems. In PrimeFaces, i developed it via:
https://github.com/primefaces/primefaces/blob/6_0/src/main/java/org/primefaces/behavior/base/AbstractBehavior.java
https://github.com/primefaces/primefaces/blob/6_0/src/main/java/org/primefaces/behavior/base/AbstractBehaviorHandler.java
Example implemtation of p:ajax: https://github.com/primefaces/primefaces/blob/6_0/src/main/java/org/primefaces/behavior/ajax/AjaxBehavior.java https://github.com/primefaces/primefaces/blob/6_0/src/main/java/org/primefaces/behavior/ajax/AjaxBehaviorHandler.java
Affected Versions
[2.2]