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-2010 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.HashSet;
  import java.util.List;
  import java.util.Locale;
  import java.util.Map;
  
  import java.util.Set;

UIComponent is the base class for all user interface components in JavaServer Faces. The set of UIComponent instances associated with a particular request and response are organized into a component tree under a UIViewRoot that represents the entire content of the request or response.

For the convenience of component developers, UIComponentBase provides the default behavior that is specified for a UIComponent, and is the base class for all of the concrete UIComponent "base" implementations. Component writers are encouraged to subclass UIComponentBase, instead of directly implementing this abstract class, to reduce the impact of any future changes to the method signatures.

If the javax.faces.event.ListenerFor annotation is attached to the class definition of a Component, that class must also implement javax.faces.event.ComponentSystemEventListener.

 
 
         ComponentSystemEventListener {
 
     private static Logger LOGGER = Logger.getLogger("javax.faces.component",
             "javax.faces.LogStrings");

    

The ServletContext init parameter consulted by the UIComponent to tell whether or not the CURRENT_COMPONENT and CURRENT_COMPOSITE_COMPONENT attribute keys should be honored as specified.

If this parameter is not specified, or is set to false, the contract specified by the CURRENT_COMPONENT and CURRENT_COMPOSITE_COMPONENT method is not honored. If this parameter is set to true, the contract is honored.

 
     public static final String HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME =
             "javax.faces.HONOR_CURRENT_COMPONENT_ATTRIBUTES";
    
    

The key to which the UIComponent currently being processed will be associated with within the javax.faces.context.FacesContext attributes map.

 
     public static final String CURRENT_COMPONENT = "javax.faces.component.CURRENT_COMPONENT";

    

The key to which the composite UIComponent currently being processed will be associated with within the javax.faces.context.FacesContext attributes map.

 
     public static final String CURRENT_COMPOSITE_COMPONENT = "javax.faces.component.CURRENT_COMPOSITE_COMPONENT";

    

The value of this constant is used as the key in the component attribute map, the value for which is a java.beans.BeanInfo implementation describing the composite component. This BeanInfo is known as the composite component BeanInfo.

Since:
2.0
 
     public static final String BEANINFO_KEY = "javax.faces.component.BEANINFO_KEY";


    

The value of this constant is used as the key in the composite component BeanDescriptor for the Map<PropertyDescriptor> that contains meta-information for the declared facets for this composite component. This map must contain an entry under the key COMPOSITE_FACET_NAME, even if no facets were explicitly declared. See COMPOSITE_FACET_NAME.

Since:
2.0
 
     public static final String FACETS_KEY = "javax.faces.component.FACETS_KEY";
    
    

The value of this constant is used as the key in the component attributes Map for the javax.faces.view.Location in the view at which this component instance resides.

Since:
2.0
 
     public static final String VIEW_LOCATION_KEY = "javax.faces.component.VIEW_LOCATION_KEY";
    
    

The value of this constant is used as the key in the composite component BeanDescriptor for a ValueExpression that evaluates to the component-type of the composite component root UIComponent for this composite component, if one was declared by the composite component author.

Since:
2.0
 
     public static final String COMPOSITE_COMPONENT_TYPE_KEY = "javax.faces.component.COMPOSITE_COMPONENT_TYPE";
    
    

The value of this constant is used as the key in the Map returned as described in FACETS_KEY for the PropertyDescriptor describing the composite component facet. The value of this constant is also used as the key in the Map returned from getFacets(). In this case, it refers to the actual facet that is the UIPanel that is the parent of the all of the components in the <composite:implementation> section of the composite component VDL file.

Since:
2.0
 
     public static final String COMPOSITE_FACET_NAME = "javax.faces.component.COMPOSITE_FACET_NAME";

    

This constant enables one to quickly discover the names of the declared composite component attributes that have been given default values by the composite component author. The information is exposed as a Collection<String> returned from the getValue() method on the composite component BeanDescriptor, when this constant is passed as the argument.

Since:
2.1
 
     public static final String ATTRS_WITH_DECLARED_DEFAULT_VALUES =
             "javax.faces.component.ATTR_NAMES_WITH_DEFAULT_VALUES";
 
     enum PropertyKeysPrivate {
         attributesThatAreSet
     }

    
Properties that are tracked by state saving.
 
     enum PropertyKeys {
         rendered,
         attributes,
         bindings,
         rendererType,
         systemEventListeners,
         behaviors
     }

    
List of attributes that have been set on the component (this may be from setValueExpression, the attributes map, or setters from the concrete HTML components. This allows for faster rendering of attributes as this list is authoratative on what has been set.
 
 
 
     // -------------------------------------------------------------- Attributes
 

    

Return a mutable Map representing the attributes (and properties, see below) associated wth this UIComponent, keyed by attribute name (which must be a String). The returned implementation must support all of the standard and optional Map methods, plus support the following additional requirements:

  • The Map implementation must implement the java.io.Serializable interface.
  • Any attempt to add a null key or value must throw a NullPointerException.
  • Any attempt to add a key that is not a String must throw a ClassCastException.
  • If the attribute name specified as a key matches a property of this UIComponent's implementation class, the following methods will have special behavior:
    • containsKey - Return false.
    • get() - If the property is readable, call the getter method and return the returned value (wrapping primitive values in their corresponding wrapper classes); otherwise throw IllegalArgumentException.
    • put() - If the property is writeable, call the setter method to set the corresponding value (unwrapping primitive values in their corresponding wrapper classes). If the property is not writeable, or an attempt is made to set a property of primitive type to null, throw IllegalArgumentException.
    • remove - Throw IllegalArgumentException.
 
     public abstract Map<StringObjectgetAttributes();
     
     
     // ---------------------------------------------------------------- Bindings
 

    

Call through to getValueExpression(java.lang.String) and examine the result. If the result is an instance of the wrapper class mandated in setValueBinding(java.lang.String,javax.faces.el.ValueBinding), extract the ValueBinding instance and return it. Otherwise, wrap the result in an implementation of ValueBinding, and return it.

Deprecated:
This has been replaced by getValueExpression(java.lang.String).
Parameters:
name Name of the attribute or property for which to retrieve a javax.faces.el.ValueBinding
Throws:
java.lang.NullPointerException if name is null
 
     public abstract ValueBinding getValueBinding(String name);


    

Wrap the argument binding in an implementation of javax.el.ValueExpression and call through to setValueExpression(java.lang.String,javax.el.ValueExpression).

Deprecated:
This has been replaced by setValueExpression(java.lang.String,javax.el.ValueExpression).
Parameters:
name Name of the attribute or property for which to set a javax.faces.el.ValueBinding
binding The javax.faces.el.ValueBinding to set, or null to remove any currently set javax.faces.el.ValueBinding
Throws:
java.lang.IllegalArgumentException if name is one of id or parent
java.lang.NullPointerException if name is null
 
     public abstract void setValueBinding(String nameValueBinding binding);
 
     // The set of ValueExpressions for this component, keyed by property
     // name This collection is lazily instantiated
     // The set of ValueExpressions for this component, keyed by property
     // name This collection is lazily instantiated
     @Deprecated
     protected Map<String,ValueExpressionbindings = null;

    

Return the javax.el.ValueExpression used to calculate the value for the specified attribute or property name, if any.

This method must be overridden and implemented for components that comply with JSF 1.2 and later.

Parameters:
name Name of the attribute or property for which to retrieve a javax.el.ValueExpression
Throws:
java.lang.NullPointerException if name is null
Since:
1.2
 
     public ValueExpression getValueExpression(String name) {
 
         if (name == null) {
             throw new NullPointerException();
         }
 
         Map<String,ValueExpressionmap = (Map<String,ValueExpression>)
               getStateHelper().get(..);
         return ((map != null) ? map.get(name) : null);
 
     }

    

Set the javax.el.ValueExpression used to calculate the value for the specified attribute or property name, if any.

The implementation must call javax.el.Expression.isLiteralText() on the argument expression. If isLiteralText() returns true, invoke javax.el.ValueExpression.getValue(javax.el.ELContext) on the argument expression and pass the result as the value parameter in a call to this.getAttributes().put(name, value) where name is the argument name. If an exception is thrown as a result of calling javax.el.ValueExpression.getValue(javax.el.ELContext), wrap it in a javax.faces.FacesException and re-throw it. If isLiteralText() returns false, simply store the un-evaluated expression argument in the collection of ValueExpressions under the key given by the argument name.

This method must be overridden and implemented for components that comply with JSF 1.2 and later.

Parameters:
name Name of the attribute or property for which to set a javax.el.ValueExpression
binding The javax.el.ValueExpression to set, or null to remove any currently set javax.el.ValueExpression
Throws:
java.lang.IllegalArgumentException if name is one of id or parent
java.lang.NullPointerException if name is null
Since:
1.2
 
     public void setValueExpression(String nameValueExpression binding) {
 
         if (name == null) {
             throw new NullPointerException();
         } else if ("id".equals(name) || "parent".equals(name)) {
             throw new IllegalArgumentException();
         }
 
         if (binding != null) {
             if (!binding.isLiteralText()) {
                 //if (bindings == null) {
                 //    //noinspection CollectionWithoutInitialCapacity
                 //    bindings = new HashMap<String, ValueExpression>();
                 //}
                 // add this binding name to the 'attributesThatAreSet' list
                 //List<String> sProperties = (List<String>)
                 //      getStateHelper().get(PropertyKeysPrivate.attributesThatAreSet);
 
                  List<StringsProperties =
                       (List<String>) getStateHelper().get(.);
                 if (sProperties == null) {
                     getStateHelper().add(.name);
                 } else if (!sProperties.contains(name)) {
                     getStateHelper().add(.name);
                 }
                 getStateHelper().put(..,
                                      name,
                                      binding);
                 //bindings.put(name, binding);
             } else {
                 ELContext context =
                     FacesContext.getCurrentInstance().getELContext();
                 try {
                     getAttributes().put(namebinding.getValue(context));
                 } catch (ELException ele) {
                     throw new FacesException(ele);
                 }
             }
         } else {
             //if (bindings != null) {
                 // remove this binding name from the 'attributesThatAreSet' list
 //                List<String> sProperties = getAttributesThatAreSet(false);
 //                if (sProperties != null) {
 //                    sProperties.remove(name);
 //                }
                                         name);
                 getStateHelper().remove(..name);
                 //bindings.remove(name);
                // if (bindings.isEmpty()) {
                //     bindings = null;
                // }
             }
        // }
 
     }
 
     // -------------------------------------------------------------- Properties
 
     boolean initialState;

    

An implementation of PartialStateHolder.markInitialState(), this method is called by the runtime to indicate that the instance should start tracking changes to its state.

Since:
2.0
 
     public void markInitialState() {
          = true;
     }


    

An implementation of PartialStateHolder.initialStateMarked(), this method is called by the runtime to test if the PartialStateHolder.markInitialState() method was called.

Since:
2.0
 
     public boolean initialStateMarked() {
         return ;
     }


    

An implementation of PartialStateHolder.clearInitialState(), this method is called by the runtime to tell the instance to stop tracking state changes.

Since:
2.0
 
     public void clearInitialState() {
          = false;
     }


    

Return the StateHelper instance used to help this component implement PartialStateHolder.

Since:
2.0
 
     protected StateHelper getStateHelper() {
         return getStateHelper(true);
     }


    

Like getStateHelper(), but only create a state helper instance if the argument creat is true.

Parameters:
create if true, a new StateHelper instance will be created if it does not exist already. If false, and there is no existing StateHelper instance, one will not be created and null will be returned.
Since:
2.0
 
     protected StateHelper getStateHelper(boolean create) {
 
         if (create &&  == null) {
              = new ComponentStateHelper(this);
         }
         return ;
 
     }

    

Return the TransientStateHelper instance for this UIComponent instance. The default implementation simply calls through to getTransientStateHelper(boolean) passing true as the argument.

Since:
2.1
 
     
     {
         return getTransientStateHelper(true);
     }
    
    

Return the TransientStateHelper instance for this UIComponent instance.

Parameters:
create if true create, if necessary, any internal data structures. If false, do not create any instances. In this case, it is possible for this method to return null.
Since:
2.1
 
     
     public TransientStateHelper getTransientStateHelper(boolean create) {
         
         if (create &&  == null) {
              = new ComponentStateHelper(this);
         }
         return ;
         
     }

    

For components that need to support the concept of transient state, this method will restore any state saved on a prior call to saveTransientState(javax.faces.context.FacesContext).

Since:
2.1
 
     
     public void restoreTransientState(FacesContext contextObject state)
     {
         boolean forceCreate = (state != null);
         TransientStateHelper helper = getTransientStateHelper(forceCreate);
 
         if (helper != null) {
             helper.restoreTransientState(contextstate);
         }
     }

    

For components that need to support the concept of transient state, this method will save any state that is known to be transient in nature.

Since:
2.1
 
     
     public Object saveTransientState(FacesContext context)
     {
         TransientStateHelper helper = getTransientStateHelper(false);
 
         return (helper == null) ? null : helper.saveTransientState(context);
     }
 
     private boolean isInView;


    

Return true if this component is within the view hierarchy otherwise false

Since:
2.0
 
     public boolean isInView() {
         return ;
     }


    

Updates the status as to whether or not this component is currently within the view hierarchy. This method must never be called by developers; a UIComponent's internal implementation will call it as components are added to or removed from a parent's child List or facet Map.

Parameters:
isInView flag indicating whether or not this component is within the view hierachy
Since:
2.0
 
     public void setInView(boolean isInView) {
         this. = isInView;
     }


    

Enable EL to access the clientId of a component. This is particularly useful in combination with the component and cc implicit objects. A default implementation is provided that simply calls javax.faces.context.FacesContext.getCurrentInstance() and then calls through to getClientId(javax.faces.context.FacesContext).

Since:
2.0
 
     
     public String getClientId() {
         FacesContext context = FacesContext.getCurrentInstance();
         return getClientId(context);
     }


    

Return a client-side identifier for this component, generating one if necessary. The associated javax.faces.render.Renderer, if any, will be asked to convert the clientId to a form suitable for transmission to the client.

The return from this method must be the same value throughout the lifetime of the instance, unless the id property of the component is changed, or the component is placed in a NamingContainer whose client ID changes (for example, UIData). However, even in these cases, consecutive calls to this method must always return the same value. The implementation must follow these steps in determining the clientId:

Find the closest ancestor to this component in the view hierarchy that implements NamingContainer. Call getContainerClientId() on it and save the result as the parentId local variable. Call getId() on this component and save the result as the myId local variable. If myId is null, call context.getViewRoot().createUniqueId() and assign the result to myId. If parentId is non-null, let myId equal parentId + UINamingContainer.getSeparatorChar(javax.faces.context.FacesContext) + myId. Call javax.faces.render.Renderer.convertClientId(javax.faces.context.FacesContext,java.lang.String), passing myId, and return the result.

Parameters:
context The javax.faces.context.FacesContext for the current request
Throws:
java.lang.NullPointerException if context is null
 
     public abstract String getClientId(FacesContext context);

    

Allow components that implement NamingContainer to selectively disable prepending their clientId to their descendent's clientIds by breaking the prepending logic into a seperately callable method. See getClientId() for usage.

By default, this method will call through to getClientId() and return the result.

Throws:
java.lang.NullPointerException if context is null
Since:
1.2
 
     public String getContainerClientId(FacesContext context) {
         if (context == null) {
             throw new NullPointerException();
         }
         return this.getClientId(context);
     }

    

Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the rendererType property, may be used to select the appropriate javax.faces.render.Renderer for this component instance.

 
     public abstract String getFamily();


    

Return the component identifier of this UIComponent.

 
     public abstract String getId();


    

Set the component identifier of this UIComponent (if any). Component identifiers must obey the following syntax restrictions:

  • Must not be a zero-length String.
  • First character must be a letter or an underscore ('_').
  • Subsequent characters must be a letter, a digit, an underscore ('_'), or a dash ('-').

Component identifiers must also obey the following semantic restrictions (note that this restriction is NOT enforced by the setId() implementation):

  • The specified identifier must be unique among all the components (including facets) that are descendents of the nearest ancestor UIComponent that is a NamingContainer, or within the scope of the entire component tree if there is no such ancestor that is a NamingContainer.

Parameters:
id The new component identifier, or null to indicate that this UIComponent does not have a component identifier
Throws:
java.lang.IllegalArgumentException if id is not syntactically valid
 
     public abstract void setId(String id);


    

Return the parent UIComponent of this UIComponent, if any. A component must allow child components to be added to and removed from the list of children of this component, even though the child component returns null from getParent( ).

 
     public abstract UIComponent getParent();


    

Set the parent UIComponent of this UIComponent. If parent.isInView() returns true, calling this method will first cause a javax.faces.event.PreRemoveFromViewEvent to be published, for this node, and then the children of this node. Then, once the re-parenting has occurred, a javax.faces.event.PostAddToViewEvent will be published as well, first for this node, and then for the node's children, but only if any of the following conditions are true.

This method must never be called by developers; a UIComponent's internal implementation will call it as components are added to or removed from a parent's child List or facet Map.

Parameters:
parent The new parent, or null for the root node of a component tree
 
     public abstract void setParent(UIComponent parent);


    

Return true if this component (and its children) should be rendered during the Render Response phase of the request processing lifecycle.

 
     public abstract boolean isRendered();


    

Set the rendered property of this UIComponent.

Parameters:
rendered If true render this component; otherwise, do not render this component
 
     public abstract void setRendered(boolean rendered);


    

Return the javax.faces.render.Renderer type for this UIComponent (if any).

 
     public abstract String getRendererType();


    

Set the javax.faces.render.Renderer type for this UIComponent, or null for components that render themselves.

Parameters:
rendererType Logical identifier of the type of javax.faces.render.Renderer to use, or null for components that render themselves
 
     public abstract void setRendererType(String rendererType);


    

Return a flag indicating whether this component is responsible for rendering its child components. The default implementation in UIComponentBase.getRendersChildren() tries to find the renderer for this component. If it does, it calls javax.faces.render.Renderer.getRendersChildren() and returns the result. If it doesn't, it 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 UIComponentBase.encodeChildren(javax.faces.context.FacesContext).

 
     public abstract boolean getRendersChildren();
     
 
     
     private Map<StringStringresourceBundleMap = null;
    
    

Return a Map<String,String> of the ResourceBundle for this component. A component may have a ResourceBundle associated with it. This bundle may contain localized properties relating to instances of this component. The default implementation first looks for a ResourceBundle with a base name equal to the fully qualified class name of the current UIComponent this and Locale equal to the Locale of the current UIViewRoot. If no such bundle is found, and the component is a composite component, let resourceName be the resourceName of the javax.faces.application.Resource for this composite component, replacing the file extension with ".properties". Let libraryName be the libraryName of the the javax.faces.application.Resource for this composite component. Call javax.faces.application.ResourceHandler.createResource(java.lang.String,java.lang.String), passing the derived resourceName and libraryName. Note that this will automatically allow for the localization of the ResourceBundle due to the localization facility implemented in createResource, which is specified in section JSF.2.6.1.3 of the spec prose document. If the resultant javax.faces.application.Resource exists and can be found, the InputStream for the resource is used to create a ResourceBundle. If either of the two previous steps for obtaining the ResourceBundle for this component is successful, the ResourceBundle is wrapped in a Map<String,String> and returned. Otherwise Collections.EMPTY_MAP is returned.

Since:
2.0
 
     public Map<String,StringgetResourceBundleMap() {
         
         if (null == ) {
             // See if there is a ResourceBundle under the FQCN for this class
             String className = this.getClass().getName();
             Locale currentLocale = null;
             FacesContext context = null;
             UIViewRoot root = null;
             ResourceBundle resourceBundle = null;
             
             // Step 1: look for a ResourceBundle under the FQCN of this instance
             if (null != (context = FacesContext.getCurrentInstance())) {
                 if (null != (root = context.getViewRoot())) {
                     currentLocale = root.getLocale();
                 }
             }
             if (null == currentLocale) {
                 currentLocale = Locale.getDefault();
             }
             try {
                 resourceBundle = 
                         ResourceBundle.getBundle(classNamecurrentLocale);
             } catch (MissingResourceException e) {
                 // It is not an error if there is no ResourceBundle
             }
             
             // Step 2: if this is a composite component, look for a 
             // ResourceBundle as a Resource
             if (null == resourceBundle) {
                 if (this.getAttributes().containsKey(.)) {
                     Resource ccResource = (Resource)
                             this.getAttributes().get(.);
                     if (null != ccResource) {
                         if (null != (ccResource = 
                                 findComponentResourceBundleLocaleMatch(context
                                 ccResource.getResourceName(), 
                                 ccResource.getLibraryName()))) {
                             InputStream propertiesInputStream = null;
                             try {
                                 propertiesInputStream = ccResource.getInputStream();
                                 resourceBundle = new PropertyResourceBundle(propertiesInputStream);
                             } catch (IOException ex) {
                                 Logger.getLogger(UIComponent.class.getName()).log(.nullex);
                             } finally{
                             	if(null != propertiesInputStream){
                                     try{
                                         propertiesInputStream.close();
                                     } catch(IOException ioe){
                                         if (.isLoggable(.)) {
                                             .log(.nullioe);
                                         }
                                     }
                             	}
                             }
                         }
                     }
                 }
             }
             
             // Step 3: if the previous steps yielded a ResourceBundle, wrap it
             // with a Map
             
             if (null != resourceBundle) {
                 final ResourceBundle bundle = resourceBundle;
                  = 
                         new Map() {
                             // this is an immutable Map
 
                             public String toString() {
                                 StringBuffer sb = new StringBuffer();
                                 Iterator<Map.Entry<StringObject>> entries =
                                         this.entrySet().iterator();
                                 Map.Entry<StringObjectcur;
                                 while (entries.hasNext()) {
                                     cur = entries.next();
                                     sb.append(cur.getKey()).append(": ").append(cur.getValue()).append('\n');
                                 }
 
                                 return sb.toString();
                             }
 
                             // Do not need to implement for immutable Map
                             public void clear() {
                                 throw new UnsupportedOperationException();
                             }
 
 
                             public boolean containsKey(Object key) {
                                 boolean result = false;
                                 if (null != key) {
                                     result = (null != bundle.getObject(key.toString()));
                                }
                                return result;
                            }
                            public boolean containsValue(Object value) {
                                Enumeration<Stringkeys = bundle.getKeys();
                                boolean result = false;
                                while (keys.hasMoreElements()) {
                                    Object curObj = bundle.getObject(keys.nextElement());
                                    if ((curObj == value) ||
                                            ((null != curObj) && curObj.equals(value))) {
                                        result = true;
                                        break;
                                    }
                                }
                                return result;
                            }
                            public Set<Map.Entry<StringObject>> entrySet() {
                                HashMap<StringObjectmappings = new HashMap<StringObject>();
                                Enumeration<Stringkeys = bundle.getKeys();
                                while (keys.hasMoreElements()) {
                                    String key = keys.nextElement();
                                    Object value = bundle.getObject(key);
                                    mappings.put(keyvalue);
                                }
                                return mappings.entrySet();
                            }
                            @Override
                            public boolean equals(Object obj) {
                                return !((obj == null) || !(obj instanceof Map))
                                         && entrySet().equals(((Mapobj).entrySet());
                            }
                            public Object get(Object key) {
                                if (null == key) {
                                    return null;
                                }
                                try {
                                    return bundle.getObject(key.toString());
                                } catch (MissingResourceException e) {
                                    return "???" + key + "???";
                                }
                            }
                            public int hashCode() {
                                return bundle.hashCode();
                            }
                            public boolean isEmpty() {
                                Enumeration<Stringkeys = bundle.getKeys();
                                return !keys.hasMoreElements();
                            }
                            public Set keySet() {
                                Set<StringkeySet = new HashSet<String>();
                                Enumeration<Stringkeys = bundle.getKeys();
                                while (keys.hasMoreElements()) {
                                    keySet.add(keys.nextElement());
                                }
                                return keySet;
                            }
                            // Do not need to implement for immutable Map
                            public Object put(Object kObject v) {
                                throw new UnsupportedOperationException();
                            }
                            // Do not need to implement for immutable Map
                            public void putAll(Map t) {
                                throw new UnsupportedOperationException();
                            }
                            // Do not need to implement for immutable Map
                            public Object remove(Object k) {
                                throw new UnsupportedOperationException();
                            }
                            public int size() {
                                int result = 0;
                                Enumeration<Stringkeys = bundle.getKeys();
                                while (keys.hasMoreElements()) {
                                    keys.nextElement();
                                    result++;
                                }
                                return result;
                            }
                            public java.util.Collection values() {
                                ArrayList<Objectresult = new ArrayList<Object>();
                                Enumeration<Stringkeys = bundle.getKeys();
                                while (keys.hasMoreElements()) {
                                    result.add(
                                            bundle.getObject(keys.nextElement()));
                                }
                                return result;
                            }
                        };
            }
            if (null == ) {
                 = .;
            }
        }
        
        return ;
    }
    // PENDING(rlubke): I'm sure there's a more efficient
    // way to handle this.
            String resourceNameString libraryName) {
        Resource result = null;
        ResourceBundle resourceBundle = null;
        int i;
        if (-1 != (i = resourceName.lastIndexOf("."))) {
            resourceName = resourceName.substring(0, i) +
                    ".properties";
            if (null != context) {
                result = context.getApplication().getResourceHandler().
                        createResource(resourceNamelibraryName);
                InputStream propertiesInputStream = null;
                try {
                    propertiesInputStream = result.getInputStream();
                    resourceBundle = new PropertyResourceBundle(propertiesInputStream);
                } catch (IOException ex) {
                    Logger.getLogger(UIComponent.class.getName()).log(.nullex);
                } finally{
                    if(null != propertiesInputStream){
                        try{
                            propertiesInputStream.close();
                        } catch(IOException ioe){
                            if (.isLoggable(.)) {
                                .log(.nullioe);
                            }
                        }
                    }
                }
            }
        }
        result = (null != resourceBundle) ? result : null;
        
        return result;
    }
    
    
    // This is necessary for JSF components that extend from UIComponent
    // directly rather than extending from UIComponentBase.  Such components
    // may need to have implementations provided for methods that originated
    // from a spec version more recent than the version with which the component
    // complies.  Currently this private property is only consulted in the
    // getValueExpression() method.
//    private boolean isUIComponentBase;
//    private boolean isUIComponentBaseIsSet = false;
//    private boolean isUIComponentBase() {
//        if (!isUIComponentBaseIsSet) {
//            isUIComponentBase = (this instanceof UIComponentBase);
//        }
//        return isUIComponentBase;
//    }
    // ------------------------------------------------- Tree Management Methods


    

Return a mutable List representing the child UIComponents associated with this component. The returned implementation must support all of the standard and optional List methods, plus support the following additional requirements:

    public abstract List<UIComponentgetChildren();


    

Return the number of child UIComponents that are associated with this UIComponent. If there are no children, this method must return 0. The method must not cause the creation of a child component list.

    public abstract int getChildCount();


    

Search for and return the UIComponent with an id that matches the specified search expression (if any), according to the algorithm described below.

For a method to find a component given a simple clientId, see invokeOnComponent(javax.faces.context.FacesContext,java.lang.String,javax.faces.component.ContextCallback).

Component identifiers are required to be unique within the scope of the closest ancestor NamingContainer that encloses this component (which might be this component itself). If there are no NamingContainer components in the ancestry of this component, the root component in the tree is treated as if it were a NamingContainer, whether or not its class actually implements the NamingContainer interface.

A search expression consists of either an identifier (which is matched exactly against the id property of a UIComponent, or a series of such identifiers linked by the UINamingContainer.getSeparatorChar(javax.faces.context.FacesContext) character value. The search algorithm should operates as follows, though alternate alogrithms may be used as long as the end result is the same:

  • Identify the UIComponent that will be the base for searching, by stopping as soon as one of the following conditions is met:
    • If the search expression begins with the the separator character (called an "absolute" search expression), the base will be the root UIComponent of the component tree. The leading separator character will be stripped off, and the remainder of the search expression will be treated as a "relative" search expression as described below.
    • Otherwise, if this UIComponent is a NamingContainer it will serve as the basis.
    • Otherwise, search up the parents of this component. If a NamingContainer is encountered, it will be the base.
    • Otherwise (if no NamingContainer is encountered) the root UIComponent will be the base.
  • The search expression (possibly modified in the previous step) is now a "relative" search expression that will be used to locate the component (if any) that has an id that matches, within the scope of the base component. The match is performed as follows:
    • If the search expression is a simple identifier, this value is compared to the id property, and then recursively through the facets and children of the base UIComponent (except that if a descendant NamingContainer is found, its own facets and children are not searched).
    • If the search expression includes more than one identifier separated by the separator character, the first identifier is used to locate a NamingContainer by the rules in the previous bullet point. Then, the findComponent() method of this NamingContainer will be called, passing the remainder of the search expression.

Parameters:
expr Search expression identifying the UIComponent to be returned
Returns:
the found UIComponent, or null if the component was not found.
Throws:
java.lang.IllegalArgumentException if an intermediate identifier in a search expression identifies a UIComponent that is not a NamingContainer
java.lang.NullPointerException if expr is null
    public abstract UIComponent findComponent(String expr);

    

Starting at this component in the View hierarchy, search for a component with a clientId equal to the argument clientId and, if found, call the ContextCallback.invokeContextCallback(javax.faces.context.FacesContext,javax.faces.component.UIComponent) method on the argument callback, passing the current javax.faces.context.FacesContext and the found component as arguments. This method is similar to findComponent(java.lang.String) but it does not support the leading UINamingContainer.getSeparatorChar(javax.faces.context.FacesContext) syntax for searching from the root of the View.

The default implementation will first check if this.getClientId() is equal to the argument clientId. If so, first call pushComponentToEL(javax.faces.context.FacesContext,javax.faces.component.UIComponent), then call the ContextCallback.invokeContextCallback(javax.faces.context.FacesContext,javax.faces.component.UIComponent) method on the argument callback, passing through the FacesContext argument and passing this as the component argument. Then call popComponentFromEL(javax.faces.context.FacesContext). If an Exception is thrown by the callback, wrap it in a javax.faces.FacesException and re-throw it. Otherwise, return true.

Otherwise, for each component returned by getFacetsAndChildren(), call invokeOnComponent() passing the arguments to this method, in order. The first time invokeOnComponent() returns true, abort traversing the rest of the Iterator and return true.

When calling ContextCallback.invokeContextCallback(javax.faces.context.FacesContext,javax.faces.component.UIComponent) the implementation of this method must guarantee that the state of the component passed to the callback correctly reflects the component's position in the View hierarchy with respect to any state found in the argument clientId. For example, an iterating component such as UIData will need to set its row index to correctly reflect the argument clientId before finding the appropriate child component backed by the correct row. When the callback returns, either normally or by throwing an Exception the implementation of this method must restore the state of the view to the way it was before invoking the callback.

If none of the elements from getFacetsAndChildren() returned true from invokeOnComponent(), return false.

Simple usage example to find a component by clientId.


private UIComponent found = null;

private void doFind(FacesContext context, String clientId) {
context.getViewRoot().invokeOnComponent(context, clientId,
new ContextCallback() {
public void invokeContextCallback(FacesContext context,
UIComponent component) {
found = component;
}
});
}
 

Parameters:
context the javax.faces.context.FacesContext for the current request
clientId the client identifier of the component to be passed to the argument callback.
callback an implementation of the Callback interface.
Returns:
true if the a component with the given clientId is found, the callback method was successfully invoked passing that component as an argument, and no Exception was thrown. Returns false if no component with the given clientId is found.
Throws:
java.lang.NullPointerException if any of the arguments are null
javax.faces.FacesException if the argument Callback throws an Exception, it is wrapped in a FacesException and re-thrown.
Since:
1.2
    public boolean invokeOnComponent(FacesContext contextString clientId,
            ContextCallback callbackthrows FacesException {
        if (null == context || null == clientId || null == callback) {
            throw new NullPointerException();
        }
        boolean found = false;
        if (clientId.equals(this.getClientId(context))) {
            try {
                this.pushComponentToEL(contextthis);
                callback.invokeContextCallback(contextthis);
                return true;
            } catch (Exception e) {
                throw new FacesException(e);
            } finally {
                this.popComponentFromEL(context);
            }
        } else {
            Iterator<UIComponentitr = this.getFacetsAndChildren();
            while (itr.hasNext() && !found) {
                found = itr.next().invokeOnComponent(contextclientId,
                        callback);
            }
        }
        return found;
    }
    // ------------------------------------------------ Facet Management Methods


    

Return a mutable Map representing the facet UIComponents associated with this UIComponent, keyed by facet name (which must be a String). The returned implementation must support all of the standard and optional Map methods, plus support the following additional requirements:

  • The Map implementation must implement the java.io.Serializable interface.
  • Any attempt to add a null key or value must throw a NullPointerException.
  • Any attempt to add a key that is not a String must throw a ClassCastException.
  • Any attempt to add a value that is not a UIComponent must throw a ClassCastException.
  • Whenever a new facet UIComponent is added:
    • The parent property of the component must be set to this component instance.
    • If the parent property of the component was already non-null, the component must first be removed from its previous parent (where it may have been either a child or a facet).
  • Whenever an existing facet UIComponent is removed:
    • The parent property of the facet must be set to null.
    public abstract Map<StringUIComponentgetFacets();

    

Return the number of facet UIComponents that are associated with this UIComponent. If there are no facets, this method must return 0. The method must not cause the creation of a facet component map.

For backwards compatability with classes that extend UIComponent directly, a default implementation is provided that simply calls getFacets() and then calls the size() method on the returned Map. A more optimized version of this method is provided in UIComponentBase.getFacetCount().

Since:
1.2
    public int getFacetCount() {
        return (getFacets().size());
    }



    

Convenience method to return the named facet, if it exists, or null otherwise. If the requested facet does not exist, the facets Map must not be created.

Parameters:
name Name of the desired facet
    public abstract UIComponent getFacet(String name);


    

Return an Iterator over the facet followed by child UIComponents of this UIComponent. Facets are returned in an undefined order, followed by all the children in the order they are stored in the child list. If this component has no facets or children, an empty Iterator is returned.

The returned Iterator must not support the remove() operation.

    public abstract Iterator<UIComponentgetFacetsAndChildren();
    // -------------------------------------------- Lifecycle Processing Methods


    

Broadcast the specified javax.faces.event.FacesEvent to all registered event listeners who have expressed an interest in events of this type. Listeners are called in the order in which they were added.

If the event is an instance of javax.faces.event.BehaviorEvent and the current component is the source of the event call javax.faces.event.BehaviorEvent.getBehavior() to get the javax.faces.component.behavior.Behavior for the event. Call javax.faces.component.behavior.Behavior.broadcast(javax.faces.event.BehaviorEvent) on the Behavior instance.

Parameters:
event The javax.faces.event.FacesEvent to be broadcast
Throws:
javax.faces.event.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 javax.faces.event.FacesEvent is not supported by this component
java.lang.NullPointerException if event is null
    public abstract void broadcast(FacesEvent event)
        throws AbortProcessingException;


    

Decode any new state of this UIComponent from the request contained in the specified javax.faces.context.FacesContext, and store this state as needed.

During decoding, events may be enqueued for later processing (by event listeners who have registered an interest), by calling queueEvent().

Parameters:
context javax.faces.context.FacesContext for the request we are processing
Throws:
java.lang.NullPointerException if context is null
    public abstract void decode(FacesContext context);
    
    

Perform a tree visit starting at this node in the tree.

UIComponent.visitTree() implementations do not invoke the javax.faces.component.visit.VisitCallback directly, but instead call javax.faces.component.visit.VisitContext.invokeVisitCallback(javax.faces.component.UIComponent,javax.faces.component.visit.VisitCallback) to invoke the callback. This allows VisitContext implementations to provide optimized tree traversals, for example by only calling the VisitCallback for a subset of components.

UIComponent.visitTree() implementations must call UIComponent.pushComponentToEL() before performing the visit and UIComponent.popComponentFromEL() after the visit.

Parameters:
context the VisitContext for this visit
callback the VisitCallback instance whose visit method will be called for each node visited.
Returns:
component implementations may return true to indicate that the tree visit is complete (eg. all components that need to be visited have been visited). This results in the tree visit being short-circuited such that no more components are visited.
Since:
2.0
See also:
javax.faces.component.visit.VisitContext.invokeVisitCallback(javax.faces.component.UIComponent,javax.faces.component.visit.VisitCallback) VisitContext.invokeVisitCallback()
    public boolean visitTree(VisitContext context
                             VisitCallback callback) {
        // First check to see whether we are visitable.  If not
        // short-circuit out of this subtree, though allow the
        // visit to proceed through to other subtrees.
        if (!isVisitable(context))
            return false;
        // Push ourselves to EL before visiting
        FacesContext facesContext = context.getFacesContext();
        pushComponentToEL(facesContextnull);
        try {
            // Visit ourselves.  Note that we delegate to the 
            // VisitContext to actually perform the visit.
            VisitResult result = context.invokeVisitCallback(thiscallback);
            // If the visit is complete, short-circuit out and end the visit
            if (result == .)
              return true;
            // Visit children if necessary
            if (result == .) {
                Iterator<UIComponentkids = this.getFacetsAndChildren();
                while(kids.hasNext()) {
                    boolean done = kids.next().visitTree(contextcallback);
                    // If any kid visit returns true, we are done.
                    if (done)
                        return true;
                }
            }
        }
        finally {
            // Pop ourselves off the EL stack
            popComponentFromEL(facesContext);
        }
        // Return false to allow the visit to continue
        return false;
    }

    

Return true if this component should be visited, false otherwise. Called by UIComponent.visitTree() to determine whether this component satisfies the hints returned by javax.faces.component.visit.VisitContext.getHints().

If this method returns false, the tree visited is short-circuited such that neither the component nor any of its descendents will be visited>

Custom visitTree() implementations may call this method to determine whether the component is visitable before performing any visit-related processing.

Since:
2.0
    protected boolean isVisitable(VisitContext context) {
        // VisitHints currently defines two hints that affect 
        // visitability: VIIST_RENDERED and VISIT_TRANSIENT.
        // Check for both of these and if set, verify that 
        // we comply.
        Set<VisitHinthints = context.getHints();
        if ((hints.contains(.) && 
                !this.isRendered())                    ||
            (hints.contains(.)  && 
                this.isTransient())) {
            return false;
        }
        return true;
    }

    

If our rendered property is true, render the beginning of the current state of this UIComponent to the response contained in the specified javax.faces.context.FacesContext. Call pushComponentToEL(javax.faces.context.FacesContext,javax.faces.component.UIComponent). Call javax.faces.application.Application.publishEvent(javax.faces.context.FacesContext,java.lang.Class,java.lang.Object), passing javax.faces.event.PreRenderComponentEvent.class as the first argument and the component instance to be rendered as the second argument.

If a javax.faces.render.Renderer is associated with this UIComponent, the actual encoding will be delegated to javax.faces.render.Renderer.encodeBegin(javax.faces.context.FacesContext,javax.faces.component.UIComponent).

If our rendered property is false, call pushComponentToEL(javax.faces.context.FacesContext,javax.faces.component.UIComponent) and return immediately.

Parameters:
context javax.faces.context.FacesContext for the response we are creating
Throws:
java.io.IOException if an input/output error occurs while rendering
java.lang.NullPointerException if context is null
    public abstract void encodeBegin(FacesContext contextthrows IOException;


    

If our rendered property is true, render the child UIComponents of this UIComponent. This method will only be called if the rendersChildren property is true.

If a javax.faces.render.Renderer is associated with this UIComponent, the actual encoding will be delegated to javax.faces.render.Renderer.encodeChildren(javax.faces.context.FacesContext,javax.faces.component.UIComponent). If no javax.faces.render.Renderer is associated with this UIComponent, iterate over each of the children of this component and call encodeAll(javax.faces.context.FacesContext).

Parameters:
context javax.faces.context.FacesContext for the response we are creating
Throws:
java.io.IOException if an input/output error occurs while rendering
java.lang.NullPointerException if context is null
    public abstract void encodeChildren(FacesContext contextthrows IOException;


    

If our rendered property is true, render the ending of the current state of this UIComponent.

If a javax.faces.render.Renderer is associated with this UIComponent, the actual encoding will be delegated to javax.faces.render.Renderer.encodeEnd(javax.faces.context.FacesContext,javax.faces.component.UIComponent).

Call popComponentFromEL(javax.faces.context.FacesContext). before returning regardless of the value of the rendered property.

Parameters:
context javax.faces.context.FacesContext for the response we are creating
Throws:
java.io.IOException if an input/output error occurs while rendering
java.lang.NullPointerException if context is null
    public abstract void encodeEnd(FacesContext contextthrows IOException;

    

If this component returns true from isRendered(), take the following action.

Render this component and all its children that return true from isRendered(), regardless of the value of the getRendersChildren() flag.

Throws:
java.io.IOException if an input/output error occurs while rendering
java.lang.NullPointerException if context is null
Since:
1.2
    public void encodeAll(FacesContext contextthrows IOException {
        if (context == null) {
            throw new NullPointerException();
        }
        if (!isRendered()) {
            return;
        }
        encodeBegin(context);
        if (getRendersChildren()) {
            encodeChildren(context);
        } else if (this.getChildCount() > 0) {
            for (UIComponent kid : getChildren()) {
                kid.encodeAll(context);
            }
        }
        encodeEnd(context);
    }
    
    private static ArrayDeque<UIComponent_getComponentELStack(String keyNameMap<ObjectObjectcontextAttributes)
    {
      ArrayDeque<UIComponentelStack = (ArrayDeque<UIComponent>)contextAttributes.get(keyName);
      
      if (elStack == null)
      {
        elStack = new ArrayDeque<UIComponent>();
        contextAttributes.put(keyNameelStack);
      }
      
      return elStack;
    }
    
    //private UIComponent previouslyPushed = null;
    //private UIComponent previouslyPushedCompositeComponent = null;
    //private boolean pushed;
    //private int depth;

    

Push the current UIComponent this to the javax.faces.context.FacesContext attribute map using the key CURRENT_COMPONENT saving the previous UIComponent associated with CURRENT_COMPONENT for a subsequent call to popComponentFromEL(javax.faces.context.FacesContext).

<pclass="changed_added_2_0">This method and popComponentFromEL() form the basis for the contract that enables the EL Expression "#{component}" to resolve to the "current" component that is being processed in the lifecycle. The requirements for when pushComponentToEL() and popComponentFromEL() must be called are specified as needed in the javadoc for this class.

After pushComponentToEL() returns, a call to getCurrentComponent(javax.faces.context.FacesContext) must return this UIComponent instance until popComponentFromEL() is called, after which point the previous UIComponent instance will be returned from getCurrentComponent()

Parameters:
context the javax.faces.context.FacesContext for the current request
component the component to push to the EL. If component is null the UIComponent instance that this call was invoked upon will be pushed to the EL.
Throws:
java.lang.NullPointerException if context is null
Since:
2.0
See also:
javax.faces.context.FacesContext.getAttributes()
    public final void pushComponentToEL(FacesContext contextUIComponent component) {
        if (context == null) {
            throw new NullPointerException();
        }
        if (null == component) {
            component = this;
        }
        Map<ObjectObjectcontextAttributes = context.getAttributes();
                                                               contextAttributes);
        componentELStack.push(component);
        component._isPushedAsCurrentRefCount++;
        
        // we only do this because of the spec
        boolean setCurrentComponent = false;
        setCurrentComponent = Boolean.valueOf(val);
        if (setCurrentComponent) {
            contextAttributes.put(.component);
        }
        
        // if the pushed component is a composite component, we need to update that
        // stack as well
        if (UIComponent.isCompositeComponent(component))
        {
                               contextAttributes).push(component);
          // we only do this because of the spec
          if (setCurrentComponent) {
              contextAttributes.put(.component);
          }
        }
    }
  // track whether we have been pushed as current in order to handle mismatched pushes and
  // pops of EL context stack.  We use a counter to handle cases where the same component
  // is pushed on multiple times
  private int _isPushedAsCurrentRefCount = 0;
  
  // key used to look up current component stack if FacesContext attributes
  private static final String _CURRENT_COMPONENT_STACK_KEY = 
                                                    "javax.faces.component.CURRENT_COMPONENT_STACK";
  
  // key used to look up current composite component stack if FacesContext attributes
  private static final String _CURRENT_COMPOSITE_COMPONENT_STACK_KEY = 
                                          "javax.faces.component.CURRENT_COMPOSITE_COMPONENT_STACK";
  

    

Pop the current UIComponent from the javax.faces.context.FacesContext attributes map so that the previous UIComponent, if any, becomes the current component.

Parameters:
context the javax.faces.context.FacesContext for the current request
Throws:
java.lang.NullPointerException if context is null
Since:
2.0
See also:
javax.faces.context.FacesContext.getAttributes()
    public final void popComponentFromEL(FacesContext context)
    {
      if (context == null)
      {
        throw new NullPointerException();
      }
      // detect cases where the stack has become unbalanced.  Due to how UIComponentBase
      // implemented pushing and pooping of components from the ELContext, components that
      // overrode just one of encodeBegin or encodeEnd, or only called super in one case
      // will become unbalanced.  Detect and correct for those cases here.
      // detect case where push was never called.  In that case, pop should be a no-op
      if ( < 1) {
          return;
      }
           
      Map<ObjectObjectcontextAttributes = context.getAttributes();
      
                                                             contextAttributes);
      
      // check for the other unbalanced case, a component was pushed but never popped.  Keep
      // popping those components until we get to our component
      for (UIComponent topComponent = componentELStack.peek();
           topComponent != this;
           topComponent = componentELStack.peek())
      {
          topComponent.popComponentFromEL(context);
      }
      
      // pop ourselves off of the stack
      componentELStack.pop();
        boolean setCurrentComponent = false;
        setCurrentComponent = Boolean.valueOf(val);
      
      // update the current component with the new top of stack.  We only do this because of the spec
        if (setCurrentComponent) {
            contextAttributes.put(.componentELStack.peek());
        }
      
      // if we're a composite component, we also have to pop ourselves off of the
      // composite stack
      if (UIComponent.isCompositeComponent(this))
      {
                                                             contextAttributes);
        if (!compositeELStack.isEmpty()) {
            compositeELStack.pop();
        }        
        // update the current composite component with the new top of stack.
          // We only do this because of the spec
        if (setCurrentComponent) {
              contextAttributes.put(.compositeELStack.peek());
        }
      }
    }
    
    // It is safe to cache this because components never go from being
    // composite to non-composite.
    private transient Boolean isCompositeComponent = null;


    

Return true if component is a composite component, otherwise false.

Parameters:
component the UIComponent to test
Throws:
java.lang.NullPointerException if component is null
Since:
2.0
    public static boolean isCompositeComponent(UIComponent component) {
        if (component == null) {
            throw new NullPointerException();
        }
        boolean result = false;
        if (null != component.isCompositeComponent) {
            result = component.isCompositeComponent.booleanValue();
        } else {
            result = component.isCompositeComponent =
                    (component.getAttributes().containsKey(
                               .));
        }
        return result;
    }


    

Finds the nearest composite component parent of the specified component.

Parameters:
component the component from which to start the search from
Returns:
if component is null, return null, otherwise search the component's parent hierachy for the nearest parent composite component. If no parent composite component is found, return null
Since:
2.0
    public static UIComponent getCompositeComponentParent(UIComponent component) {
        if (component == null) {
            return null;
        } else {
            if (component.compositeParent != null) {
                return component.compositeParent;
            }
            UIComponent parent = component.getParent();
            while (parent != null) {
                if (UIComponent.isCompositeComponent(parent)) {
                    if (component.isInView()) {
                        component.compositeParent = parent;
                    }
                    return parent;
                }
                parent = parent.getParent();
            }
            return null;
        }
        
    }


    

Return the UIComponent instance that is currently processing. This is equivalent to evaluating the EL expression "#{component}" and doing a getValue operation on the resultant ValueExpression.

This method must return null if there is no currently processing UIComponent

Parameters:
context javax.faces.context.FacesContext for the request we are processing
Throws:
java.lang.NullPointerException if context is null
Since:
2.0
    public static UIComponent getCurrentComponent(FacesContext context) {
        Map<ObjectObjectcontextAttributes = context.getAttributes();
                                                               contextAttributes);
      return componentELStack.peek();
    }


    

Return the closest ancestor component, relative to the component returned from getCurrentComponent(javax.faces.context.FacesContext), that is a composite component, or null if no such component exists.

Parameters:
context javax.faces.context.FacesContext for the request we are processing
Throws:
java.lang.NullPointerException if context is null
Since:
2.0
    public static UIComponent getCurrentCompositeComponent(FacesContext context) {
      // return (UIComponent)context.getAttributes().get(UIComponent.CURRENT_COMPOSITE_COMPONENT);
        Map<ObjectObjectcontextAttributes = context.getAttributes();