org.apache.shale.util
Class Tags

java.lang.Object
  extended by org.apache.shale.util.Tags

public class Tags
extends Object

A utility class for JSF tags. An instance of this class is specified as an application-scoped managed bean in faces-config.xml, under the name org.apache.shale.TAG_UTILITY_BEAN. The org.apache.shale.taglib.CommonsValidatorTag uses that managed bean.

Nearly all of the methods of this class set a component attribute or create a value- or method-binding, given a String representation of the value. The methods check to see whether the value is a value reference (ie. #{...}); if so, the methods set value bindings or method bindings, as appropriate, for the component.

$Id: Tags.java 482453 2006-12-05 02:10:40Z rahul $


Constructor Summary
Tags()
           
 
Method Summary
 Object eval(String expression)
          Evaluate the expression.
 Boolean evalBoolean(String expression)
          Evaluate the expression and return a Boolean.
 Double evalDouble(String expression)
          Evaluate the expression and return a Double.
 Integer evalInteger(String expression)
          Evaluate the expression and return an Integer.
 String evalString(String expression)
          Evaluate the expression.
 void setAction(javax.faces.component.UIComponent component, String attributeValue)
          Sets the component's Action by setting a method binding with the given attribute value.
 void setActionListener(javax.faces.component.UIComponent component, String attributeValue)
          Sets the component's ActionListener by setting a method binding with the given attribute value.
 void setBoolean(javax.faces.component.UIComponent component, String attributeName, String attributeValue)
          Sets the component's attributeName with the given attributeValue as a Boolean.
 void setDouble(javax.faces.component.UIComponent component, String attributeName, String attributeValue)
          Sets the component's attributeName with the given attributeValue as a Double.
 void setInteger(javax.faces.component.UIComponent component, String attributeName, String attributeValue)
          Sets the component's attributeName with the given attributeValue as a Integer.
 void setMethodBinding(javax.faces.component.UIComponent component, String attributeName, String attributeValue, Class[] paramTypes)
          Sets the component's attributeName with the given attributeValue as a MethodBinding.
 void setString(javax.faces.component.UIComponent component, String attributeName, String attributeValue)
          Sets the component's attributeName with the given attributeValue as a String.
 void setValidator(javax.faces.component.UIComponent component, String attributeValue)
          Sets the component's Validator by setting a method binding with the given attribute value.
 void setValueBinding(javax.faces.component.UIComponent component, String attributeName, String attributeValue)
          Sets the component's attributeName with the given attributeValue as a ValueBinding.
 void setValueChangeListener(javax.faces.component.UIComponent component, String attributeValue)
          Sets the component's ValueChangeListener by setting a method binding with the given attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tags

public Tags()
Method Detail

setString

public void setString(javax.faces.component.UIComponent component,
                      String attributeName,
                      String attributeValue)

Sets the component's attributeName with the given attributeValue as a String.

If the attributeValue is null, do nothing. If attributeValue is a value reference, set a value binding for the component. Otherwise, store the attributeValue in the component's attribute map.

Parameters:
component - The JSF component
attributeName - The name of the attribute to set
attributeValue - The value of the attribute

setInteger

public void setInteger(javax.faces.component.UIComponent component,
                       String attributeName,
                       String attributeValue)

Sets the component's attributeName with the given attributeValue as a Integer.

If the attributeValue is null, do nothing. If attributeValue is a value reference, set a value binding for the component. Otherwise, store the attributeValue in the component's attribute map.

Parameters:
component - The JSF component
attributeName - The name of the attribute to set
attributeValue - The value of the attribute

setDouble

public void setDouble(javax.faces.component.UIComponent component,
                      String attributeName,
                      String attributeValue)

Sets the component's attributeName with the given attributeValue as a Double.

If the attributeValue is null, do nothing. If attributeValue is a value reference, set a value binding for the component. Otherwise, store the attributeValue in the component's attribute map.

Parameters:
component - The JSF component
attributeName - The name of the attribute to set
attributeValue - The value of the attribute

setBoolean

public void setBoolean(javax.faces.component.UIComponent component,
                       String attributeName,
                       String attributeValue)

Sets the component's attributeName with the given attributeValue as a Boolean.

If the attributeValue is null, do nothing. If attributeValue is a value reference, set a value binding for the component. Otherwise, store the attributeValue in the component's attribute map.

Parameters:
component - The JSF component
attributeName - The name of the attribute to set
attributeValue - The value of the attribute

setValueBinding

public void setValueBinding(javax.faces.component.UIComponent component,
                            String attributeName,
                            String attributeValue)

Sets the component's attributeName with the given attributeValue as a ValueBinding.

If the attributeValue is null, do nothing. If attributeValue is a value reference, set a value binding for the component. Otherwise, store the attributeValue in the component's attribute map.

Parameters:
component - The JSF component
attributeName - The name of the attribute to set
attributeValue - The value of the attribute

setActionListener

public void setActionListener(javax.faces.component.UIComponent component,
                              String attributeValue)

Sets the component's ActionListener by setting a method binding with the given attribute value.

Parameters:
component - The JSF component
attributeValue - The value of the attribute

setValueChangeListener

public void setValueChangeListener(javax.faces.component.UIComponent component,
                                   String attributeValue)

Sets the component's ValueChangeListener by setting a method binding with the given attribute value.

Parameters:
component - The JSF component
attributeValue - The value of the attribute

setValidator

public void setValidator(javax.faces.component.UIComponent component,
                         String attributeValue)

Sets the component's Validator by setting a method binding with the given attribute value.

Parameters:
component - The JSF component
attributeValue - The value of the attribute

setAction

public void setAction(javax.faces.component.UIComponent component,
                      String attributeValue)

Sets the component's Action by setting a method binding with the given attribute value.

Parameters:
component - The JSF component
attributeValue - The value of the attribute

setMethodBinding

public void setMethodBinding(javax.faces.component.UIComponent component,
                             String attributeName,
                             String attributeValue,
                             Class[] paramTypes)

Sets the component's attributeName with the given attributeValue as a MethodBinding.

If the attributeValue is null, do nothing. If attributeValue is a value reference, set a value binding for the component. Otherwise, store the attributeValue in the component's attribute map.

Parameters:
component - The JSF component
attributeName - The name of the attribute to set
attributeValue - The value of the attribute
paramTypes - Signature for method parameters

eval

public Object eval(String expression)

Evaluate the expression. If it's a value reference, get the reference's value. Otherwise, return the expression.

Parameters:
expression - The expression

evalString

public String evalString(String expression)

Evaluate the expression. If it's a value reference, get the reference's value as a String. Otherwise, return the expression.

Parameters:
expression - The expression

evalInteger

public Integer evalInteger(String expression)

Evaluate the expression and return an Integer.

Parameters:
expression - The expression

evalDouble

public Double evalDouble(String expression)

Evaluate the expression and return a Double.

Parameters:
expression - The expression

evalBoolean

public Boolean evalBoolean(String expression)

Evaluate the expression and return a Boolean.

Parameters:
expression - The expression


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.