Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1)
E10684-05


oracle.adf.view.rich.activedata
Class ActiveComponentContext

java.lang.Object
  extended by oracle.adf.view.rich.activedata.ActiveComponentContext


public final class ActiveComponentContext
extends java.lang.Object

Called by Renderers that want to support active data on their attributes. The current instance is retrieved by calling the factory method ActiveComponentContext.getActiveComponentContext().

A Renderer that wishes to support active data on its attributes should:

  1. Call pushActiveComponent with its component before retrieving any attributes.
  2. Before fetching each component attribute for which active data will be supported, call startActiveAttribute and then call endActiveAttribute after the value has been retrieved.
  3. Call popActiveComponent after all of the active attributes have been retrieved.

If any of the potentially active attributes were bound to ActiveDataModels, popActiveComponent will register an ActiveDataEncoder for the component.


Method Summary
 void endActiveAttribute(java.lang.String attributeName)
          Removes the association of active data with the attributeName component attribute.
static ActiveComponentContext getActiveComponentContext()
          Returns an instance of the ActiveComponentContext for use by a component that wants to support active data on its attributes.
 boolean hasActiveData()
          Returns true if the currently pushed active component currently has associated active data.
 void popActiveComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Stops associating active data with this component, registering an appropriate ActiveDataEncoder with any ActiveDataModels providing active data for the active attributes.
 void pushActiveComponent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Begins associating active data with the specifiec component, creating a new association context in the process
 void startActiveAttribute(java.lang.String attributeName)
           Sets the name of the component attribute that any EL references to ActiveDataModels should be associated with until the corresponding cleatActiveAttribute is called.
 void startSupressingActiveComponents()
          Called by Renderers that perform their own active component management to disable the generation of the mapping between components and ActiveDataModels on the current component and its children.
 void stopSupressingActiveComponents()
          Called by Renderers that perform their own active component management to disable the generation of the mapping between components and ActiveDataModels.

 

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

 

Method Detail

getActiveComponentContext

public static ActiveComponentContext getActiveComponentContext()
Returns an instance of the ActiveComponentContext for use by a component that wants to support active data on its attributes.
Returns:
the ActiveComponentContext instance

startSupressingActiveComponents

public void startSupressingActiveComponents()
Called by Renderers that perform their own active component management to disable the generation of the mapping between components and ActiveDataModels on the current component and its children. Calls to startSupressingActiveComponents may be nested.
Throws:
java.lang.IllegalStateException - if there are no current active components on the stack
See Also:
stopSupressingActiveComponents()

stopSupressingActiveComponents

public void stopSupressingActiveComponents()
Called by Renderers that perform their own active component management to disable the generation of the mapping between components and ActiveDataModels.
Throws:
java.lang.IllegalStateException - if active data mapping collection isn't currently suppressed
See Also:
startSupressingActiveComponents()

pushActiveComponent

public void pushActiveComponent(javax.faces.context.FacesContext context,
                                javax.faces.component.UIComponent component)
Begins associating active data with the specifiec component, creating a new association context in the process

In order to avoid mismatched pushActiveComponent/popActiveComponent pairs if an exception occurs when fetching the attribute value, try/ finally should be used:

 protected void encodeAll(
 FacesContext        context,
 RenderingContext    rc,
 UIComponent         component,
 ClientComponent     client,
 FacesBean           bean
 ) throws IOException
 {
   ActiveComponentContext activeContext = ActiveComponentContext.getActiveComponentContext();
 
   activeContext.pushActiveComponent(component);
 
   try
   { 
     super.encodeAll(context, rc, component, client, bean);
   }
   finally
   {
     activeContext.popActiveComponent(context, component);
   }
 }
 
Parameters:
component - UIComponent to begin associating active data with
Throws:
java.lang.NullPointerException - if context or component are null.
See Also:
popActiveComponent(javax.faces.context.FacesContext, javax.faces.component.UIComponent)

startActiveAttribute

public void startActiveAttribute(java.lang.String attributeName)

Sets the name of the component attribute that any EL references to ActiveDataModels should be associated with until the corresponding cleatActiveAttribute is called.

In order to avoid mismatched setActiveAttribute/clearActiveAttribute pairs if an exception occurs when fetching the attribute value, try/ finally should be used:

 ActiveComponentContext activeContext = ActiveComponentContext.getActiveComponentContext();
 
 // support active data for the source attribute
 activeContext.startActiveAttribute("source");
 
 String srcURI;
 
 try
 {
   srcURI = super.getSource(bean);
 }
 finally
 {
   // done with the source attribtue
   activeContext.endActiveAttribute("source");
 }     
 

Any attribute that supports active data should have an optimized client-side setter

Parameters:
attributeName - Name of component attribute to associate active data with.
Throws:
java.lang.IllegalStateException - if pushActiveComponent hasn't been called or there is already an attribute active on this component.
java.lang.IllegalArgumentException - if attributeName is null attribute is currently started.
See Also:
endActiveAttribute(java.lang.String), pushActiveComponent(javax.faces.context.FacesContext, javax.faces.component.UIComponent)

endActiveAttribute

public void endActiveAttribute(java.lang.String attributeName)
Removes the association of active data with the attributeName component attribute.
Parameters:
attributeName - Name of component attribute to stop associating active data with
Throws:
java.lang.IllegalStateException - if the cleared attribute doesn't match the currently set attribute.
java.lang.NullPointerException - if attributeName is null.
See Also:
startActiveAttribute(java.lang.String)

hasActiveData

public boolean hasActiveData()
Returns true if the currently pushed active component currently has associated active data.

popActiveComponent

public void popActiveComponent(javax.faces.context.FacesContext context,
                               javax.faces.component.UIComponent component)
Stops associating active data with this component, registering an appropriate ActiveDataEncoder with any ActiveDataModels providing active data for the active attributes.
Parameters:
context - Current FacesContext
component - UIComponent to stop associating active data with
Throws:
java.lang.IllegalStateException - if the cleared attribute doesn't match the currently set attribute.
java.lang.NullPointerException - if attributeName or attributeEncoder are null.
See Also:
pushActiveComponent(javax.faces.context.FacesContext, javax.faces.component.UIComponent)

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 1 (11.1.1)
E10684-05


Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.