Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * $Id: UIComponentTag.java,v 1.60 2007/03/14 19:20:38 rlubke Exp $
   */
  
  /*
   * The contents of this file are subject to the terms
   * of the Common Development and Distribution License
   * (the License). You may not use this file except in
   * compliance with the License.
  * 
  * You can obtain a copy of the License at
  * https://javaserverfaces.dev.java.net/CDDL.html or
  * legal/CDDLv1.0.txt. 
  * See the License for the specific language governing
  * permission and limitations under the License.
  * 
  * When distributing Covered Code, include this CDDL
  * Header Notice in each file and include the License file
  * at legal/CDDLv1.0.txt.    
  * If applicable, add the following below the CDDL Header,
  * with the fields enclosed by brackets [] replaced by
  * your own identifying information:
  * "Portions Copyrighted [year] [name of copyright owner]"
  * 
  * [Name of File] [ver.__] [Date]
  * 
  * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
  */
 
 package javax.faces.webapp;
 
 

UIComponentTag is the base class for all JSP custom actions that correspond to user interface components in a page that is rendered by JavaServer Faces.

In this version of the specification, UIComponentTag extends UIComponentClassicTagBase to add properties that use the Faces 1.1 Expression Language.

Deprecated:
Use of this class has been replaced with UIComponentELTag, which extends UIComponentClassicTagBase to add properties that use the EL API introduced as part of JSP 2.1.
 
 
 public abstract class UIComponentTag extends UIComponentClassicTagBase implements Tag {
 
     // ------------------------------------------------------------- Properties
 
    

The value binding expression (if any) used to wire up this component to a javax.faces.component.UIComponent property of a JavaBean class.

 
     private String binding = null;


    

Set the value binding expression for our component.

Parameters:
binding The new value binding expression
Throws:
java.lang.IllegalArgumentException if the specified binding is not a valid value binding expression.
 
     public void setBinding(String bindingthrows JspException {
 	if (!isValueReference(binding)) {
 	    throw new IllegalArgumentException();
         }
 
 	this. = binding;
     }
 
     protected boolean hasBinding() {
 	return null != ;
     }



    

An override for the rendered attribute associated with our javax.faces.component.UIComponent.

 
     private String rendered = null;


    

Set an override for the rendered attribute.

Parameters:
rendered The new value for rendered attribute
    public void setRendered(String rendered) {
        this. = rendered;
    }


    

Flag indicating whether or not rendering should occur.

    private boolean suppressed = false;
    protected boolean isSuppressed() {
        return ();
    }


    

Return true if the specified value conforms to the syntax requirements of a value binding expression. Such expressions ` * may be used on most component tag attributes to signal a desire for deferred evaluation of the attribute or property value to be set on the underlying javax.faces.component.UIComponent.

Parameters:
value The value to evaluate
Throws:
java.lang.NullPointerException if value is null
    public static boolean isValueReference(String value) {
	if (value == null) {
	    throw new NullPointerException();
	}
        if ((value.indexOf("#{") != -1) &&
            (value.indexOf("#{") < value.indexOf('}'))) {
            return true;
        }
        return false;
    }
    // ------------------------------------------ Methods from Tag

    

Release any resources allocated during the execution of this tag handler.

    public void release() {
	this. = false;
	this. = null;
        this. = null;
	super.release();
    }
    // ----------------  Concrete Implementations of methods from superclass

    

Parameters:
component
    protected void setProperties(UIComponent component) {
        // The "id" property is explicitly set when components are created
        // so it does not need to be set here
        if ( != null) {
	    if (isValueReference()) {
		component.setValueBinding("rendered"vb);
	    } else {
	    }
        }
	if (getRendererType() != null) {
	    component.setRendererType(getRendererType());
	}
    }





    

Implement createComponent using Faces 1.1 EL API.

Parameters:
context
newId
    protected UIComponent createComponent(FacesContext contextString newId) {
        UIComponent component;
        Application application = context.getApplication();
        if ( != null) {
            ValueBinding vb = application.createValueBinding();
            component = application.createComponent(vbcontext,
                                                    getComponentType());
	    component.setValueBinding("binding"vb);
        } else {
            component = application.createComponent(getComponentType());
        }
        component.setId(newId);
        setProperties(component);
        return component;
    }
    // Tag tree navigation

    

Locate and return the nearest enclosing UIComponentTag if any; otherwise, return null.

Parameters:
context PageContext for the current page
    public static UIComponentTag getParentUIComponentTag(PageContext context) {
        UIComponentClassicTagBase result =
             getParentUIComponentClassicTagBase(context);
        if (!(result instanceof UIComponentTag)) {
            return new UIComponentTagAdapter(result);
        }
        return ((UIComponentTagresult);
    }
    // --------------------------------------------------------- Private Classes


    
This adatper exposes a UIComponentClassicTagBase as a UIComponentTag for 1.1 component libraries that rely on UIComponent.getParentUIComponentTag(). This will work for most use cases, but there are probably some edge cases out there that we're not aware of.
    private static class UIComponentTagAdapter extends UIComponentTag {
        public UIComponentTagAdapter(UIComponentClassicTagBase classicDelegate) {
            this. = classicDelegate;
        }
        public String getComponentType() {
            return .getComponentType();
        }
        public String getRendererType() {
            return .getRendererType();
        }
        public int doStartTag() throws JspException {
            throw new IllegalStateException();
        }
        public int doEndTag() throws JspException {
            throw new IllegalStateException();
        }
        public UIComponent getComponentInstance() {
            return .getComponentInstance();
        }
        public boolean getCreated() {
            return .getCreated();
        }
        public Tag getParent() {
            return .getParent();
        }
        public void setParent(Tag parent) {
            throw new IllegalStateException();
        }
                
    }
New to GrepCode? Check out our FAQ X