Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    *
    * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
    *
    * The contents of this file are subject to the terms of either the GNU
    * General Public License Version 2 only ("GPL") or the Common Development
    * and Distribution License("CDDL") (collectively, the "License").  You
    * may not use this file except in compliance with the License.  You can
   * obtain a copy of the License at
   * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
   * or packager/legal/LICENSE.txt.  See the License for the specific
   * language governing permissions and limitations under the License.
   *
   * When distributing the software, include this License Header Notice in each
   * file and include the License file at packager/legal/LICENSE.txt.
   *
   * GPL Classpath Exception:
   * Oracle designates this particular file as subject to the "Classpath"
   * exception as provided by Oracle in the GPL Version 2 section of the License
   * file that accompanied this code.
   *
   * Modifications:
   * If applicable, add the following below the License Header, with the fields
   * enclosed by brackets [] replaced by your own identifying information:
   * "Portions Copyright [year] [name of copyright owner]"
   *
   * Contributor(s):
   * If you wish your version of this file to be governed by only the CDDL or
   * only the GPL Version 2, indicate your decision by adding "[Contributor]
   * elects to include this software in this distribution under the [CDDL or GPL
   * Version 2] license."  If you don't indicate a single choice of license, a
   * recipient has the option to distribute your version of this file under
   * either the CDDL, the GPL Version 2 or to extend the choice of license to
   * its licensees as provided above.  However, if you add GPL Version 2 code
   * and therefore, elected the GPL Version 2 license, then the option applies
   * only if the new code is made subject to such option by the copyright
   * holder.
   */
  
  package javax.faces.component;
  
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  import java.util.Set;

UIComponentBase is a convenience base class that implements the default concrete behavior of all methods defined by UIComponent.

By default, this class defines getRendersChildren() to find the renderer for this component and call its getRendersChildren() method. The default implementation on the Renderer returns false. As of version 1.2 of the JavaServer Faces Specification, component authors are encouraged to return true from this method and rely on the implementation of encodeChildren(javax.faces.context.FacesContext) in this class and in the Renderer (javax.faces.render.Renderer.encodeChildren(javax.faces.context.FacesContext,javax.faces.component.UIComponent)). Subclasses that wish to manage the rendering of their children should override this method to return true instead.

  
 public abstract class UIComponentBase extends UIComponent {
 
 
     // -------------------------------------------------------------- Attributes
 
     private static Logger LOGGER = Logger.getLogger("javax.faces.component",
             "javax.faces.LogStrings");
 
     private static final String ADDED = UIComponentBase.class.getName() + ".ADDED";


    

Each entry is an map of PropertyDescriptors describing the properties of a concrete UIComponent implementation, keyed by the corresponding java.lang.Class.

IMPLEMENTATION NOTE - This is implemented as a WeakHashMap so that, even if this class is embedded in a container's class loader that is a parent to webapp class loaders, references to the classes will eventually expire.

 
     @SuppressWarnings({"CollectionWithoutInitialCapacity"})
     private static Map<Class<?>, Map<StringPropertyDescriptor>>
             descriptors =
             new WeakHashMap<Class<?>, Map<StringPropertyDescriptor>>();

    
Reference to the map of PropertyDescriptors for this class in the descriptors Map.
 
     private Map<StringPropertyDescriptorpdMap = null;
 
     private Map<Class<? extends SystemEvent>, List<SystemEventListener>> listenersByEventClass;

    

An EMPTY_OBJECT_ARRAY argument list to be passed to reflection methods.

 
     private static final Object EMPTY_OBJECT_ARRAY[] = new Object[0];
 
     public UIComponentBase() {
     }
 
     private void populateDescriptorsMapIfNecessary() {
         Class<?> clazz = this.getClass();
         synchronized() {
              = .get(clazz);
         }
         if (null != ) {
             return;
         }
 
         // load the property descriptors for this class.
         PropertyDescriptor pd[] = getPropertyDescriptors();
         if (pd != null) {
              = new HashMap<StringPropertyDescriptor>(pd.length, 1.0f);
             for (PropertyDescriptor aPd : pd) {
                 .put(aPd.getName(), aPd);
             }
             if (.isLoggable(.)) {
                 .log(."fine.component.populating_descriptor_map",
                         new Object[]{clazz,
                                 Thread.currentThread().getName()});
             }
 
             // Check again
             Map<StringPropertyDescriptorreCheckMap = null;
             synchronized() {
                 reCheckMap = .get(clazz);
             }
             if (null != reCheckMap) {
                 return;
             }
             synchronized() {
                 .put(clazz);
             }
         }
 
 
     }


    

Return an array of PropertyDescriptors for this UIComponent's implementation class. If no descriptors can be identified, a zero-length array will be returned.

Throws:
javax.faces.FacesException if an introspection exception occurs
 
         PropertyDescriptor[] pd;
         try {
             pd = Introspector.getBeanInfo(this.getClass()).
                     getPropertyDescriptors();
         } catch (IntrospectionException e) {
             throw new FacesException(e);
         }
         return (pd);
     }


    

The Map containing our attributes, keyed by attribute name.

 
     private AttributesMap attributes = null;
 
 
     public Map<StringObjectgetAttributes() {
 
         if ( == null) {
              = new AttributesMap(this);
         }
         return ();
 
     }
 
 
     // ---------------------------------------------------------------- Bindings
 

    
 
     public ValueBinding getValueBinding(String name) {
 
         if (name == null) {
             throw new NullPointerException();
         }
         ValueBinding result = null;
         ValueExpression ve;
 
         if (null != (ve = getValueExpression(name))) {
             // if the ValueExpression is an instance of our private
             // wrapper class.
             if (ve.getClass().equals(ValueExpressionValueBindingAdapter.class)) {
                 result = ((ValueExpressionValueBindingAdapterve).getWrapped();
             } else {
                 // otherwise, this is a real ValueExpression.  Wrap it
                 // in a ValueBinding.
                 result = new ValueBindingValueExpressionAdapter(ve);
             }
         }
         return result;
     }


    
 
     public void setValueBinding(String nameValueBinding binding) {
         if (name == null) {
             throw new NullPointerException();
         }
         if (binding != null) {
             ValueExpressionValueBindingAdapter adapter =
                     new ValueExpressionValueBindingAdapter(binding);
             setValueExpression(nameadapter);
         } else {
             setValueExpression(namenull);
         }
 
     }
 
 
     // -------------------------------------------------------------- Properties
 

    

The assigned client identifier for this component.

 
     private String clientId = null;


    
 
     public String getClientId(FacesContext context) {
 
         if (context == null) {
             throw new NullPointerException();
         }
 
         // if the clientId is not yet set
         if (this. == null) {
             UIComponent namingContainerAncestor =
                     this.getNamingContainerAncestor();
             UIComponent parent = namingContainerAncestor;
             String parentId = null;
 
             // give the parent the opportunity to first
             // grab a unique clientId
             if (parent != null) {
                 parentId = parent.getContainerClientId(context);
             }
 
             // now resolve our own client id
             this. = getId();
             if (this. == null) {
                 String generatedId;
                 if (null != namingContainerAncestor &&
                     namingContainerAncestor instanceof UniqueIdVendor) {
                     generatedId = ((UniqueIdVendor)namingContainerAncestor).createUniqueId(contextnull);
                 }
                 else {
                     generatedId = context.getViewRoot().createUniqueId();
                 }
                 setId(generatedId);
                 this. = getId();
             }
             if (parentId != null) {
                 StringBuilder idBuilder =
                         new StringBuilder(parentId.length()
                                 + 1
                                 + this..length());
                 this. = idBuilder.append(parentId)
                         .append(UINamingContainer.getSeparatorChar(context))
                         .append(this.).toString();
             }
 
             // allow the renderer to convert the clientId
             Renderer renderer = this.getRenderer(context);
             if (renderer != null) {
                 this. = renderer.convertClientId(contextthis.);
             }
         }
         return this.;
     }

    

The component identifier for this component.

 
     private String id = null;
 
 
     public String getId() {
 
         return ();
 
     }
 
 	UIComponent namingContainer = this.getParent();
         while (namingContainer != null) {
             if (namingContainer instanceof NamingContainer) {
                 return namingContainer;
             }
             namingContainer = namingContainer.getParent();
         }
         return null;
     }


    
 
     public void setId(String id) {
 
         // if the current ID is not null, and the passed
         // argument is the same, no need to validate it
         // as it has already been validated.
         if (this. == null || !(this..equals(id))) {
             validateId(id);
             this. = id;
         }
 
         this. = null// Erase any cached value
 
     }


    

The parent component for this component.

 
     private UIComponent parent = null;
 
 
     public UIComponent getParent() {
         return (this.);
     }
 
     public void setParent(UIComponent parent) {
         
         if (parent == null) {
             if (this. != null) {
                 doPreRemoveProcessing(FacesContext.getCurrentInstance(), this);
                 this. = parent;
             }
              = null;            
         } else {
             this. = parent;
             if (this.getAttributes().get() == null) {
                 // add an attribute to this component here to indiciate that
                 // it's being processed.  If we don't do this, and the component
                 // is re-parented, the events could fire again in certain cases
                 // and cause a stack overflow.
                 this.getAttributes().put(.);
                 doPostAddProcessing(FacesContext.getCurrentInstance(), this);
                 // remove the attribute once we've returned from the event
                 // processing.
                 this.getAttributes().remove();                
             }
         }
     }
 
     public boolean isRendered() {
         
 	return Boolean.valueOf(getStateHelper().eval(..).toString());        
     }
 
 
     public void setRendered(boolean rendered) {
         getStateHelper().put(.rendered);
     }
 
 
     public String getRendererType() {
 
         return (StringgetStateHelper().eval(.);
         
     }
 
 
     public void setRendererType(String rendererType) {
 
         getStateHelper().put(.rendererType);
 
     }
 
 
     public boolean getRendersChildren() {
         boolean result = false;
 
         Renderer renderer;
         if (getRendererType() != null) {
             if (null !=
                     (renderer = getRenderer(getFacesContext()))) {
                 result = renderer.getRendersChildren();
             }
         }
         return result;
 
     }
 
     // ------------------------------------------------- Tree Management Methods
 
 
     /*
      * <p>The <code>List</code> containing our child components.</p>
      */
     private List<UIComponentchildren = null;
 
 
     public List<UIComponentgetChildren() {
 
         if ( == null) {
              = new ChildrenList(this);
         }
         return ();
 
     }
 
 
     // Do not allocate the children List to answer this question
     public int getChildCount() {
 
         if ( != null) {
             return (.size());
         } else {
             return (0);
         }
 
     }


    

If the specified UIComponent has a non-null parent, remove it as a child or facet (as appropriate) of that parent. As a result, the parent property will always be null when this method returns.

Parameters:
component UIComponent to have any parent erased
 
     private static void eraseParent(UIComponent component) {
 
         UIComponent parent = component.getParent();
         if (parent == null) {
             return;
         }
         if (parent.getChildCount() > 0) {
             List children = parent.getChildren();
             int index = children.indexOf(component);
             if (index >= 0) {
                 children.remove(index);
                 return;
             }
         }
         if (parent.getFacetCount() > 0) {
             Map facets = parent.getFacets();
             Iterator entries = facets.entrySet().iterator();
             while (entries.hasNext()) {
                 Map.Entry entry = (Map.Entryentries.next();
                 //noinspection ObjectEquality
                 if (entry.getValue() == component) {
                     entries.remove();
                     return;
                 }
             }
         }
 
         // Throw an exception for the "cannot happen" case
         throw new IllegalStateException("Parent was not null, " +
                 "but this component not related");
 
     }

    

Throw IllegalArgumentException if the specified component identifier is non-null and not syntactically valid.

Parameters:
id The component identifier to test
 
     private static void validateId(String id) {
 
         if (id == null) {
             return;
         }
         int n = id.length();
         if (n < 1) {
             throw new IllegalArgumentException("Empty id attribute is not allowed");
         }
         for (int i = 0; i < ni++) {
             char c = id.charAt(i);
             if (i == 0) {
                 if (!Character.isLetter(c) && (c != '_')) {
                     throw new IllegalArgumentException(id);
                 }
             } else {
                 if (!Character.isLetter(c) &&
                         !Character.isDigit(c) &&
                         (c != '-') && (c != '_')) {
                     throw new IllegalArgumentException(id);
                 }
             }
         }
 
     }


    
 
     public UIComponent findComponent(String expr) {
         if (expr == null) {
             throw new NullPointerException();
         }
 
         FacesContext ctx = FacesContext.getCurrentInstance();
         final char sepChar = UINamingContainer.getSeparatorChar(ctx);
         final String SEPARATOR_STRING = String.valueOf(sepChar);
 
         if (expr.length() == 0) {
             // if an empty value is provided, fail fast.
             throw new IllegalArgumentException("\"\"");
         }
 
         // Identify the base component from which we will perform our search
         UIComponent base = this;
         if (expr.charAt(0) == sepChar) {
             // Absolute searches start at the root of the tree
             while (base.getParent() != null) {
                 base = base.getParent();
             }
             // Treat remainder of the expression as relative
             expr = expr.substring(1);
         } else if (!(base instanceof NamingContainer)) {
             // Relative expressions start at the closest NamingContainer or root
             while (base.getParent() != null) {
                 if (base instanceof NamingContainer) {
                     break;
                 }
                 base = base.getParent();
             }
         }
 
         // Evaluate the search expression (now guaranteed to be relative)
         UIComponent result = null;
         String[] segments = expr.split(SEPARATOR_STRING);
         for (int i = 0, length = (segments.length - 1);
              i < segments.length;
              i++, length--) {
             result = findComponent(basesegments[i], (i == 0));
             // the first element of the expression may match base.id
             // (vs. a child if of base)
             if (i == 0 && result == null &&
                     segments[i].equals(base.getId())) {
                 result = base;
             }
             if (result != null && (!(result instanceof NamingContainer)) && length > 0) {
                 throw new IllegalArgumentException(segments[i]);
             }
             if (result == null) {
                 break;
             }
             base = result;
         }
 
         // Return the final result of our search
         return (result);
 
     }


    

Return the UIComponent (if any) with the specified id, searching recursively starting at the specified base, and examining the base component itself, followed by examining all the base component's facets and children (unless the base component is a NamingContainer, in which case the recursive scan is skipped.

Parameters:
base Base UIComponent from which to search
id Component identifier to be matched
 
     private static UIComponent findComponent(UIComponent base,
                                              String id,
                                              boolean checkId) {
         if (checkId && id.equals(base.getId())) {
             return base;
         }
         // Search through our facets and children
         UIComponent result = null;
         for (Iterator i = base.getFacetsAndChildren(); i.hasNext();) {
             UIComponent kid = (UIComponenti.next();
             if (!(kid instanceof NamingContainer)) {
                 if (checkId && id.equals(kid.getId())) {
                     result = kid;
                     break;
                 }
                 result = findComponent(kididtrue);
                 if (result != null) {
                     break;
                 }
             } else if (id.equals(kid.getId())) {
                 result = kid;
                 break;
             }
         }
         return (result);
 
     }

    
 
     public boolean invokeOnComponent(FacesContext contextString clientId,
                                      ContextCallback callback)
             throws FacesException {
         return super.invokeOnComponent(contextclientIdcallback);
     }
 
 
     // ------------------------------------------------ Facet Management Methods
 
 
     /*
      * <p>The <code>Map</code> containing our related facet components.</p>
      */
     private Map<StringUIComponentfacets = null;
 
 
     public Map<StringUIComponentgetFacets() {
 
         if ( == null) {
              = new FacetsMap(this);
         }
         return ();
 
     }
 
     // Do not allocate the children List to answer this question
     public int getFacetCount() {
 
         if ( != null) {
             return (.size());
         } else {
             return (0);
         }
 
     }
 
 
     // Do not allocate the facets Map to answer this question
     public UIComponent getFacet(String name) {
 
         if ( != null) {
             return (.get(name));
         } else {
             return (null);
         }
 
     }
 
 
 
         Iterator<UIComponentresult;
         int childCount = this.getChildCount(),
                 facetCount = this.getFacetCount();
         // If there are neither facets nor children
         if (0 == childCount && 0 == facetCount) {
             result = ;
         }
         // If there are only facets and no children
         else if (0 == childCount) {
             Collection<UIComponentunmodifiable =
                     Collections.unmodifiableCollection(getFacets().values());
             result = unmodifiable.iterator();
         }
         // If there are only children and no facets
         else if (0 == facetCount) {
             List<UIComponentunmodifiable =
                     Collections.unmodifiableList(getChildren());
             result = unmodifiable.iterator();
         }
         // If there are both children and facets
         else {
             result = new FacetsAndChildrenIterator(this);
         }
         return result;
     }
 
 
     // -------------------------------------------- Lifecycle Processing Methods
 
    
 
     public void broadcast(FacesEvent event)
         throws AbortProcessingException {
 
         if (event == null) {
             throw new NullPointerException();
         }
         if (event instanceof BehaviorEvent) {
             BehaviorEvent behaviorEvent = (BehaviorEventevent;
             Behavior behavior = behaviorEvent.getBehavior();
             behavior.broadcast(behaviorEvent);
         }
 
         if ( == null) {
             return;
         }
 
         for (FacesListener listener : .asArray(FacesListener.class)) {
             if (event.isAppropriateListener(listener)) {
                 event.processListener(listener);
             }
         }
     }


    
 
     public void decode(FacesContext context) {
 
         if (context == null) {
             throw new NullPointerException();
         }
         String rendererType = getRendererType();
         if (rendererType != null) {
             Renderer renderer = this.getRenderer(context);
             if (renderer != null) {
                 renderer.decode(contextthis);
             } else {
                 if (.isLoggable(.)) {
                     .fine("Can't get Renderer for type " + rendererType);
                 }
             }
         }
     }


    
 
     public void encodeBegin(FacesContext contextthrows IOException {
 
         if (context == null) {
             throw new NullPointerException();
         }
 
         pushComponentToEL(contextnull);
 
         if (!isRendered()) {
             return;
         }
 
         context.getApplication().publishEvent(context,
                                               PreRenderComponentEvent.class,
                                               this);
 
         String rendererType = getRendererType();
         if (rendererType != null) {
             Renderer renderer = this.getRenderer(context);
             if (renderer != null) {
                 renderer.encodeBegin(contextthis);
             } else {
                 if (.isLoggable(.)) {
                     .fine("Can't get Renderer for type " + rendererType);
                 }
             }
         }
 
     }

    
 
     public void encodeChildren(FacesContext contextthrows IOException {
 
         if (context == null) {
             throw new NullPointerException();
         }
         if (!isRendered()) {
             return;
         }
         String rendererType = getRendererType();
         if (rendererType != null) {
             Renderer renderer = this.getRenderer(context);
             if (renderer != null) {
                 renderer.encodeChildren(contextthis);
             }
             // We've already logged for this component
         } else {
             if (getChildCount() > 0) {
                 for (UIComponent child : getChildren()) {
                     child.encodeAll(context);
                 }
             }
         }
     }


    
 
     public void encodeEnd(FacesContext contextthrows IOException {
 
         if (context == null) {
             throw new NullPointerException();
         }
         if (!isRendered()) {
             popComponentFromEL(context);
             return;
         }
         String rendererType = getRendererType();
         if (rendererType != null) {
             Renderer renderer = this.getRenderer(context);
             if (renderer != null) {
                 renderer.encodeEnd(contextthis);
             } else {
                 // We've already logged for this component
             }
         }
         popComponentFromEL(context);
 
     }
 
     // -------------------------------------------------- Event Listener Methods
 

Add the specified javax.faces.event.FacesListener to the set of listeners registered to receive event notifications from this UIComponent. It is expected that UIComponent 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 FooEvent extends FacesEvent {
   ...
   protected boolean isAppropriateListener(FacesListener listener) {
     return (listener instanceof FooListener);
   }
   protected void processListener(FacesListener listener) {
     ((FooListener) listener).processFoo(this);
   }
   ...
 }
 

public interface FooListener extends FacesListener { public void processFoo(FooEvent event); }

public class FooComponent extends UIComponentBase { ... public void addFooListener(FooListener listener) { addFacesListener(listener); } public void removeFooListener(FooListener listener) { removeFacesListener(listener); } ... }

Parameters:
listener The javax.faces.event.FacesListener to be registered
Throws:
java.lang.NullPointerException if listener is null
 
     protected void addFacesListener(FacesListener listener) {
 
         if (listener == null) {
             throw new NullPointerException();
         }
 
         if ( == null) {
              = new AttachedObjectListHolder<FacesListener>();
         }
 
         .add(listener);
 
     }


    
 
     protected FacesListener[] getFacesListeners(Class clazz) {
 
         if (clazz == null) {
             throw new NullPointerException();
         }
         if (!FacesListener.class.isAssignableFrom(clazz)) {
             throw new IllegalArgumentException();
         }
 
         if (this. == null) {
             return (FacesListener[]) Array.newInstance(clazz, 0);
         }
         FacesListener[] listeners = this..asArray(FacesListener.class);
         if (listeners.length == 0) {
             return (FacesListener[]) Array.newInstance(clazz, 0);
         }
 
         List<FacesListenerresults = new ArrayList<FacesListener>(listeners.length);
         for (FacesListener listener : listeners) {
             if (((Class<?>) clazz).isAssignableFrom(listener.getClass())) {
                 results.add(listener);
             }
         }
 
         return (results.toArray
                 ((FacesListener[]) Array.newInstance(clazz,
                         results.size())));
 
     }


    

Remove the specified javax.faces.event.FacesListener from the set of listeners registered to receive event notifications from this UIComponent.

Parameters:
listener The javax.faces.event.FacesListener to be deregistered
Throws:
java.lang.NullPointerException if listener is null
 
     protected void removeFacesListener(FacesListener listener) {
 
         if (listener == null) {
             throw new NullPointerException();
         }
 
         if ( != null) {
             .remove(listener);
         }
 
     }

    
    public void queueEvent(FacesEvent event) {
        if (event == null) {
            throw new NullPointerException();
        }
        UIComponent parent = getParent();
        if (parent == null) {
            throw new IllegalStateException();
        } else {
            parent.queueEvent(event);
        }
    }

    

Install the listener instance referenced by argument componentListener as a listener for events of type eventClass originating from this specific instance of UIComponent. The default implementation creates an inner javax.faces.event.SystemEventListener instance that wraps argument componentListener as the listener argument. This inner class must call through to the argument componentListener in its implementation of javax.faces.event.SystemEventListener.processEvent(javax.faces.event.SystemEvent) and its implementation of javax.faces.event.SystemEventListener.isListenerForSource(java.lang.Object) must return true if the instance class of this UIComponent is assignable from the argument to isListenerForSource.

Parameters:
eventClass the Class of event for which listener must be fired.
componentListener the implementation of javax.faces.event.ComponentSystemEventListener whose javax.faces.event.ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent) method must be called when events of type facesEventClass are fired.
Throws:
NullPointerException if any of the arguments are null.
Since:
2.1
    public void subscribeToEvent(Class<? extends SystemEventeventClass,
                                 ComponentSystemEventListener componentListener) {
        if (eventClass == null) {
            throw new NullPointerException();
        }
        if (componentListener == null) {
            throw new NullPointerException();
        }
        if (initialStateMarked()) {
             = false;
        }
        if (null == ) {
             = new HashMap<Class<? extends SystemEvent>,
                                                List<SystemEventListener>>(3, 1.0f);
        }
        SystemEventListener facesLifecycleListener =
              new ComponentSystemEventListenerAdapter(componentListenerthis);
        List<SystemEventListenerlistenersForEventClass =
              .get(eventClass);
        if (listenersForEventClass == null) {
            listenersForEventClass = new ArrayList<SystemEventListener>(3);
            .put(eventClasslistenersForEventClass);
        }
        if (!listenersForEventClass.contains(facesLifecycleListener)) {
            listenersForEventClass.add(facesLifecycleListener);
        }
    }

    

Remove the listener instance referenced by argument componentListener as a listener for events of type eventClass originating from this specific instance of UIComponent. When doing the comparison to determine if an existing listener is equal to the argument componentListener (and thus must be removed), the equals() method on the existing listener must be invoked, passing the argument componentListener, rather than the other way around.

Parameters:
eventClass the Class of event for which listener must be removed.
componentListener the implementation of javax.faces.event.ComponentSystemEventListener whose javax.faces.event.ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent) method must no longer be called when events of type eventClass are fired.
Throws:
NullPointerException if any of the arguments are null.
Since:
2.1
    public void unsubscribeFromEvent(Class<? extends SystemEventeventClass,
                                     ComponentSystemEventListener componentListener) {
        if (eventClass == null) {
            throw new NullPointerException();
        }
        if (componentListener == null) {
            throw new NullPointerException();
        }
        List<SystemEventListenerlisteners =
              getListenersForEventClass(eventClass);
        if (listeners != null && !listeners.isEmpty()) {
            for (Iterator<SystemEventListeneri = listeners.iterator(); i.hasNext();) {
                SystemEventListener item = i.next();
                ComponentSystemEventListenerAdapter csla =
                      (ComponentSystemEventListenerAdapteritem;
                ComponentSystemEventListener l = csla.getWrapped();
                if (l.equals(componentListener)) {
                    i.remove();
                    break;
                }
            }
        }
    }

    

Return the SystemEventListener instances registered on this UIComponent instance that are interested in events of type eventClass.

Parameters:
eventClass the Class of event for which the listeners must be returned.
Throws:
java.lang.NullPointerException if argument eventClass is null.
Since:
2.1
    public List<SystemEventListenergetListenersForEventClass(Class<? extends SystemEventeventClass) {
        if (eventClass == null) {
            throw new NullPointerException();
        }
        List<SystemEventListenerresult = null;
        if ( != null) {
            result = .get(eventClass);
        }
        return result;
    }
    // ------------------------------------------------ Lifecycle Phase Handlers


    
    public void processDecodes(FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }
        // Skip processing if our rendered flag is false
        if (!isRendered()) {
            return;
        }
        pushComponentToEL(contextnull);
        // Process all facets and children of this component
        Iterator kids = getFacetsAndChildren();
        while (kids.hasNext()) {
            UIComponent kid = (UIComponentkids.next();
            kid.processDecodes(context);
        }
        // Process this component itself
        try {
            decode(context);
        } catch (RuntimeException e) {
            context.renderResponse();
            throw e;
        } finally {
            popComponentFromEL(context);
        }
    }


    
    public void processValidators(FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }
        // Skip processing if our rendered flag is false
        if (!isRendered()) {
            return;
        }
        pushComponentToEL(contextnull);
        Application app = context.getApplication();
        app.publishEvent(contextPreValidateEvent.classthis);
        // Process all the facets and children of this component
        Iterator kids = getFacetsAndChildren();
        while (kids.hasNext()) {
            UIComponent kid = (UIComponentkids.next();
            kid.processValidators(context);
        }
        app.publishEvent(contextPostValidateEvent.classthis);
        popComponentFromEL(context);
    }


    
    public void processUpdates(FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }
        // Skip processing if our rendered flag is false
        if (!isRendered()) {
            return;
        }
        pushComponentToEL(contextnull);
        // Process all facets and children of this component
        Iterator kids = getFacetsAndChildren();
        while (kids.hasNext()) {
            UIComponent kid = (UIComponentkids.next();
            kid.processUpdates(context);
        }
        popComponentFromEL(context);
        
    }
    private static final int MY_STATE = 0;
    private static final int CHILD_STATE = 1;

    
    public Object processSaveState(FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }
        if (this.isTransient()) {
            return null;
        }
        Object[] stateStruct = new Object[2];
        Object[] childState = ;
        pushComponentToEL(contextnull);
        try {
            // Process this component itself
            stateStruct[] = saveState(context);
            // determine if we have any children to store
            int count = this.getChildCount() + this.getFacetCount();
            if (count > 0) {
                // this arraylist will store state
                List<ObjectstateList = new ArrayList<Object>(count);
                // if we have children, add them to the stateList
                if (this.getChildCount() > 0) {
                    Iterator kids = getChildren().iterator();
                    UIComponent kid;
                    while (kids.hasNext()) {
                        kid = (UIComponentkids.next();
                        if (!kid.isTransient()) {
                            stateList.add(kid.processSaveState(context));
                        }
                    }
                }
                // if we have facets, add them to the stateList
                if (this.getFacetCount() > 0) {
                    Iterator myFacets = getFacets().entrySet().iterator();
                    UIComponent facet;
                    Object facetState;
                    Object[] facetSaveState;
                    Map.Entry entry;
                    while (myFacets.hasNext()) {
                        entry = (Map.EntrymyFacets.next();
                        facet = (UIComponententry.getValue();
                        if (!facet.isTransient()) {
                            facetState = facet.processSaveState(context);
                            facetSaveState = new Object[2];
                            facetSaveState[0] = entry.getKey();
                            facetSaveState[1] = facetState;
                            stateList.add(facetSaveState);
                        }
                    }
                }
                // finally, capture the stateList and replace the original,
                // EMPTY_OBJECT_ARRAY Object array
                childState = stateList.toArray();
            }
        } finally {
            popComponentFromEL(context);
        }
        stateStruct[] = childState;
        return stateStruct;
    }

    
    public void processRestoreState(FacesContext context,
                                    Object state) {
        if (context == null) {
            throw new NullPointerException();
        }
        Object[] stateStruct = (Object[]) state;
        Object[] childState = (Object[]) stateStruct[];
        // Process this component itself
        restoreState(contextstateStruct[]);
        int i = 0;
        // Process all the children of this component
        if (this.getChildCount() > 0) {
            for (UIComponent kid : getChildren()) {
                if (kid.isTransient()) {