javax.faces.component.behavior
Class BehaviorBase

java.lang.Object
  extended by javax.faces.component.behavior.BehaviorBase
All Implemented Interfaces:
Behavior, PartialStateHolder, StateHolder
Direct Known Subclasses:
ClientBehaviorBase

public class BehaviorBase
extends java.lang.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.

Since:
2.0

Constructor Summary
BehaviorBase()
           
 
Method Summary
protected  void addBehaviorListener(BehaviorListener listener)
          

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

 void broadcast(BehaviorEvent event)
          

Default implementation of Behavior#broadcast.

 void clearInitialState()
          

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

 boolean initialStateMarked()
          

Implementation of PartialStateHolder.initialStateMarked().

 boolean isTransient()
          

Implementation of StateHolder.isTransient().

 void markInitialState()
          

Implementation of PartialStateHolder.markInitialState().

protected  void removeBehaviorListener(BehaviorListener listener)
          

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

 void restoreState(FacesContext context, java.lang.Object state)
          

Implementation of StateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object).

 java.lang.Object saveState(FacesContext context)
          

Implementation of StateHolder.saveState(javax.faces.context.FacesContext).

 void setTransient(boolean transientFlag)
          

Implementation of StateHolder.setTransient(boolean).

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BehaviorBase

public BehaviorBase()
Method Detail

broadcast

public void broadcast(BehaviorEvent event)
               throws AbortProcessingException

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).

Specified by:
broadcast in interface Behavior
Parameters:
event - The BehaviorEvent to be broadcast
Throws:
AbortProcessingException - Signal the JavaServer Faces implementation that no further processing on the current event should be performed
java.lang.IllegalArgumentException - if the implementation class of this BehaviorEvent is not supported by this component
java.lang.NullPointerException - if event is null
Since:
2.0

isTransient

public boolean isTransient()

Implementation of StateHolder.isTransient().

Specified by:
isTransient in interface StateHolder

setTransient

public void setTransient(boolean transientFlag)

Implementation of StateHolder.setTransient(boolean).

Specified by:
setTransient in interface StateHolder
Parameters:
transientFlag - boolean pass true if this Object will participate in state saving or restoring, otherwise pass false.

saveState

public java.lang.Object saveState(FacesContext context)

Implementation of StateHolder.saveState(javax.faces.context.FacesContext).

Specified by:
saveState in interface StateHolder

restoreState

public void restoreState(FacesContext context,
                         java.lang.Object state)

Implementation of StateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object).

Specified by:
restoreState in interface StateHolder

markInitialState

public void markInitialState()

Implementation of PartialStateHolder.markInitialState().

Specified by:
markInitialState in interface PartialStateHolder

initialStateMarked

public boolean initialStateMarked()

Implementation of PartialStateHolder.initialStateMarked().

Specified by:
initialStateMarked in interface PartialStateHolder

clearInitialState

public void clearInitialState()

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

Specified by:
clearInitialState in interface PartialStateHolder

addBehaviorListener

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 - The BehaviorListener to be registered
Throws:
java.lang.NullPointerException - if listener is null
Since:
2.0

removeBehaviorListener

protected void removeBehaviorListener(BehaviorListener listener)

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

Parameters:
listener - The BehaviorListener to be deregistered
Throws:
java.lang.NullPointerException - if listener is null
Since:
2.0


Submit a bug or feature

Copyright © 2009, 2010, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 4-June-2010 04:34