Top Description Fields Constructors Methods
javax.faces.component.behavior

public Class BehaviorBase

extends Object
implements Behavior, PartialStateHolder
Class Inheritance
All Implemented Interfaces
javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.component.behavior.Behavior
Known Direct Subclasses
javax.faces.component.behavior.ClientBehaviorBase
Imports
java.util.ArrayList, .List, javax.faces.component.PartialStateHolder, .UIComponentBase, javax.faces.context.FacesContext, javax.faces.event.AbortProcessingException, .BehaviorEvent, .BehaviorListener

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.

Since
2.0

Field Summary

Modifier and TypeField and Description
private boolean
private List<BehaviorListener>
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
addBehaviorListener(BehaviorListener
The BehaviorListener to be registered
listener
)

Add the specified BehaviorListener to the set of listeners registered to receive event notifications from this Behavior.

public void
broadcast(BehaviorEvent
The BehaviorEvent to be broadcast
event
)

Implements javax.faces.component.behavior.Behavior.broadcast.

Default implementation of Behavior#broadcast.

public void
clearInitialState()

Implements javax.faces.component.PartialStateHolder.clearInitialState.

Clears the initial state flag, causing the behavior to revert from partial to full state saving.

public boolean
public boolean
public void
protected void
removeBehaviorListener(BehaviorListener
The BehaviorListener to be deregistered
listener
)

Remove the specified BehaviorListener from the set of listeners registered to receive event notifications from this Behavior.

public void
public Object
public void
setTransient(boolean
boolean pass true if this Object will not participate in state saving or restoring, otherwise pass false.
transientFlag
)

Implements javax.faces.component.StateHolder.setTransient.

Implementation of javax.faces.component.StateHolder#setTransient.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

initialStateback to summary
private boolean initialState
listenersback to summary
private List<BehaviorListener> listeners

Our javax.faces.event.BehaviorListeners. This data structure is lazily instantiated as necessary.

transientFlagback to summary
private boolean transientFlag

Constructor Detail

BehaviorBaseback to summary
public BehaviorBase()

Method Detail

addBehaviorListenerback to summary
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);
  }
  ...
}
Parameters
listener:BehaviorListener

The BehaviorListener to be registered

Exceptions
NullPointerException:
if listener is null
Since
2.0
broadcastback to summary
public void broadcast(BehaviorEvent event) throws AbortProcessingException

Implements javax.faces.component.behavior.Behavior.broadcast.

Default implementation of Behavior#broadcast. 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).

Parameters
event:BehaviorEvent

The BehaviorEvent to be broadcast

Annotations
@Override
Exceptions
AbortProcessingException:
Signal the JavaServer Faces implementation that no further processing on the current event should be performed
IllegalArgumentException:
if the implementation class of this BehaviorEvent is not supported by this component
NullPointerException:
if event is null
Since
2.0
clearInitialStateback to summary
public void clearInitialState()

Implements javax.faces.component.PartialStateHolder.clearInitialState.

Clears the initial state flag, causing the behavior to revert from partial to full state saving.

Annotations
@Override
initialStateMarkedback to summary
public boolean initialStateMarked()

Implements javax.faces.component.PartialStateHolder.initialStateMarked.

Implementation of javax.faces.component.PartialStateHolder#initialStateMarked.

Returns:boolean

Doc from javax.faces.component.PartialStateHolder.initialStateMarked.

true if the initial state is marked, false otherwise.

Annotations
@Override
isTransientback to summary
public boolean isTransient()

Implements javax.faces.component.StateHolder.isTransient.

Implementation of javax.faces.component.StateHolder#isTransient.

Returns:boolean

Doc from javax.faces.component.StateHolder.isTransient.

true if transient, false otherwise.

Annotations
@Override
markInitialStateback to summary
public void markInitialState()

Implements javax.faces.component.PartialStateHolder.markInitialState.

Implementation of javax.faces.component.PartialStateHolder#markInitialState.

Annotations
@Override
removeBehaviorListenerback to summary
protected void removeBehaviorListener(BehaviorListener listener)

Remove the specified BehaviorListener from the set of listeners registered to receive event notifications from this Behavior.

Parameters
listener:BehaviorListener

The BehaviorListener to be deregistered

Exceptions
NullPointerException:
if listener is null
Since
2.0
restoreStateback to summary
public void restoreState(FacesContext context, Object state)

Implements javax.faces.component.StateHolder.restoreState.

Implementation of javax.faces.component.StateHolder#restoreState.

Parameters
context:FacesContext

Doc from javax.faces.component.StateHolder.restoreState.

the Faces context.

state:Object

Doc from javax.faces.component.StateHolder.restoreState.

the state.

Annotations
@SuppressWarnings:unchecked
@Override
saveStateback to summary
public Object saveState(FacesContext context)

Implements javax.faces.component.StateHolder.saveState.

Implementation of javax.faces.component.StateHolder#saveState.

Parameters
context:FacesContext

Doc from javax.faces.component.StateHolder.saveState.

the Faces context.

Returns:Object

Doc from javax.faces.component.StateHolder.saveState.

the saved state.

Annotations
@Override
setTransientback to summary
public void setTransient(boolean transientFlag)

Implements javax.faces.component.StateHolder.setTransient.

Implementation of javax.faces.component.StateHolder#setTransient.

Parameters
transientFlag:boolean

Doc from javax.faces.component.StateHolder.setTransient.

boolean pass true if this Object will not participate in state saving or restoring, otherwise pass false.

Annotations
@Override