Java Reference
In-Depth Information
Whether you decide to have your component extend UIComponentBase or a standard
component, you might also want your component to implement one or more of these be-
havioral interfaces defined in the javax.faces.component package:
ActionSource :
Indicates
that
the
component
can
fire
a
javax.faces.event.ActionEvent .
ActionSource2 : Extends ActionSource and allows component properties
referencing methods that handle action events to use method expressions as
defined by the unified EL.
EditableValueHolder : Extends ValueHolder and specifies additional
features for editable components, such as validation and emitting value-change
events.
NamingContainer : Mandates that each component rooted at this component
have a unique ID.
StateHolder : Denotes that a component has state that must be saved between
requests.
ValueHolder : Indicates that the component maintains a local value as well as
the option of accessing data in the model tier.
If your component extends UIComponentBase , it automatically implements only
StateHolder . Because all components directly or indirectly extend UIComponen-
tBase , they all implement StateHolder . Any component that implements
StateHolder also implements the StateHelper interface, which extends
StateHolder and defines a Map -like contract that makes it easy for components to
save and restore a partial view state.
If your component extends one of the other standard components, it might also implement
other behavioral interfaces in addition to StateHolder . If your component extends
UICommand , it automatically implements ActionSource2 . If your component ex-
tends UIOutput or one of the component classes that extend UIOutput , it automatic-
ally implements ValueHolder . If your component extends UIInput , it automatically
implements EditableValueHolder and ValueHolder . See the JavaServer Faces
API documentation to find out what the other component classes implement.
You can also make your component explicitly implement a behavioral interface that it
doesn't already by virtue of extending a particular standard component. For example, if
you have a component that extends UIInput and you want it to fire action events, you
must make it explicitly implement ActionSource2 because a UIInput component
doesn't automatically implement this interface.
Search WWH ::




Custom Search