public class BehaviorBase extends Object implements Behavior, PartialStateHolder
BehaviorBase is a
convenience base class that provides a default implementation of the
Behavior
contract. It also provides behavior listener registration
and state saving support.
Constructor and Description |
---|
BehaviorBase() |
Modifier and Type | Method and Description |
---|---|
protected void |
addBehaviorListener(BehaviorListener listener)
Add the specified |
void |
broadcast(BehaviorEvent event)
Default implementation of
|
void |
clearInitialState()
Clears the initial state flag, causing the behavior to revert from partial to full state saving. |
boolean |
initialStateMarked()
Implementation of
|
boolean |
isTransient()
Implementation of
|
void |
markInitialState()
Implementation of
|
protected void |
removeBehaviorListener(BehaviorListener listener)
Remove the specified
|
void |
restoreState(FacesContext context,
Object state)
Implementation of
|
Object |
saveState(FacesContext context)
Implementation of
|
void |
setTransient(boolean transientFlag)
Implementation of
|
public void broadcast(BehaviorEvent event) throws AbortProcessingException
Default implementation of
Behavior.broadcast(javax.faces.event.BehaviorEvent)
. Delivers the specified
BehaviorEvent
to all registered BehaviorListener
event listeners who have expressed an interest in events of
this type. Listeners are called in the order in which they were
registered (added).
broadcast
in interface Behavior
event
- The BehaviorEvent
to be broadcastAbortProcessingException
- Signal the Jakarta Server Faces
implementation that no further processing on the current event
should be performedIllegalArgumentException
- if the implementation class
of this BehaviorEvent
is not supported by this componentNullPointerException
- if event
is
null
public boolean isTransient()
Implementation of
StateHolder.isTransient()
.
isTransient
in interface StateHolder
true
if transient, false
otherwise.public void setTransient(boolean transientFlag)
Implementation of
StateHolder.setTransient(boolean)
.
setTransient
in interface StateHolder
transientFlag
- boolean pass true
if this
Object will not
participate in state saving or restoring, otherwise pass
false
.public Object saveState(FacesContext context)
Implementation of
StateHolder.saveState(javax.faces.context.FacesContext)
.
saveState
in interface StateHolder
context
- the Faces context.public void restoreState(FacesContext context, Object state)
Implementation of
StateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object)
.
restoreState
in interface StateHolder
context
- the Faces context.state
- the state.public void markInitialState()
Implementation of
PartialStateHolder.markInitialState()
.
markInitialState
in interface PartialStateHolder
public boolean initialStateMarked()
Implementation of
PartialStateHolder.initialStateMarked()
.
initialStateMarked
in interface PartialStateHolder
true
if the initial state is marked, false
otherwise.public void clearInitialState()
Clears the initial state flag, causing the behavior to revert from partial to full state saving.
clearInitialState
in interface PartialStateHolder
protected void addBehaviorListener(BehaviorListener listener)
Add the specified BehaviorListener
to the set of listeners registered to receive event notifications
from this Behavior
.
It is expected that Behavior
classes acting as event sources
will have corresponding typesafe APIs for registering listeners of the
required type, and the implementation of those registration methods
will delegate to this method. For example:
public class AjaxBehaviorEvent extends BehaviorEvent { ... } public interface AjaxBehaviorListener extends BehaviorListener { public void processAjaxBehavior(FooEvent event); } public class AjaxBehavior extends ClientBehaviorBase { ... public void addAjaxBehaviorListener(AjaxBehaviorListener listener) { addBehaviorListener(listener); } public void removeAjaxBehaviorListener(AjaxBehaviorListener listener) { removeBehaviorListener(listener); } ... }
listener
- The BehaviorListener
to be registeredNullPointerException
- if listener
is null
protected void removeBehaviorListener(BehaviorListener listener)
Remove the specified
BehaviorListener
from the set of listeners
registered to receive event notifications from this
Behavior
.
listener
- The BehaviorListener
to be deregisteredNullPointerException
- if listener
is null
Copyright © 2019 Eclipse Foundation.
Use is subject to license terms.