com.sas.taglib
Class Util

com.sas.taglib.Util

public class Util

Collection of static utility methods for use within JSP custom tags and customizers


Constructor Summary
Util()
           
 
Method Summary
static java.util.Vector addSubTagVector(java.util.Vector parent, java.lang.String tagName)
          Creates a new subtag vector and adds it to the parent vector.
static void addSubTagVector(java.util.Vector parent, java.util.Vector subVector)
          Adds the subVector to the parent vector as teh body vector portion of the vector.
static java.lang.String customTagVectorToString(java.util.Vector data, java.lang.String indent)
          This method takes a custom tag in Vector form and converts it to a custom tag String.
static java.lang.String escapeEmbeddedQuotes(java.lang.String s)
           
static java.lang.String escapeEscapeCharacters(java.lang.String s)
           
static java.lang.String getCustomTagVectorAttribute(java.util.Vector data, java.lang.String attribute)
          Gets the value of a given attribute from the custom tag vector.
static java.util.Vector getSubTagVector(java.util.Vector parent, java.lang.String tagName)
          Returns the subtag vector with the given custom tag name.
static boolean isCustomTagVectorEmpty(java.util.Vector vector)
          Removes a subtag vector with the given name from the given parent vector if the subtag vector exists.
static void removeAllSubTagVectors(java.util.Vector parent, java.lang.String tagName)
          Removes all subtag vectors with the given name from the given parent vector.
static java.lang.String removeSpecialCharsFromBody(java.lang.String body)
          Removes all tabs, newlines, and return characters from the start of the string passed in.
static void removeSubTagVector(java.util.Vector parent, java.lang.String tagName)
          Removes a subtag vector with the given name from the given parent vector if the subtag vector exists.
static java.lang.String replaceSpecialChars(java.lang.String s)
           
static void setCustomTagVectorAttribute(java.util.Vector data, java.lang.String attribute, java.lang.String value)
          Sets the value of a given attribute onto the custom tag vector.
 

Constructor Detail

Util

public Util()
Method Detail

customTagVectorToString

public static java.lang.String customTagVectorToString(java.util.Vector data,
                                                       java.lang.String indent)
This method takes a custom tag in Vector form and converts it to a custom tag String. Each subtag will be indented the specified indent String. The main vector represents the parent tag. The list of each element of the Vector are: String name = (String)data.elementAt(0); Vector attributeVector = (Vector)data.elementAt(1); Vector body = (Vector)data.elementAt(2); The Attribute Vector is an Enumeration of Vectors which each represent a property name/value pair: Enumeration attributeEnum = attributeVector.elements(); Vector paramOne = (Vector)attributeEnum.nextElement(); String name = property.firstElement().toString(); String value = property.lastElement().toString();


replaceSpecialChars

public static java.lang.String replaceSpecialChars(java.lang.String s)

escapeEmbeddedQuotes

public static java.lang.String escapeEmbeddedQuotes(java.lang.String s)

escapeEscapeCharacters

public static java.lang.String escapeEscapeCharacters(java.lang.String s)

removeSpecialCharsFromBody

public static java.lang.String removeSpecialCharsFromBody(java.lang.String body)
Removes all tabs, newlines, and return characters from the start of the string passed in.

Parameters:
the - string in which the tabs ("e\t"e), newlines "e\n"e), and return characters "e\r"e) are removed from

setCustomTagVectorAttribute

public static void setCustomTagVectorAttribute(java.util.Vector data,
                                               java.lang.String attribute,
                                               java.lang.String value)
Sets the value of a given attribute onto the custom tag vector. If the attribute already exist in the vector, then the value is changed for that attribute. If the attribute doe not exist in the vector, then the attribute pair is added to the vector.


getCustomTagVectorAttribute

public static java.lang.String getCustomTagVectorAttribute(java.util.Vector data,
                                                           java.lang.String attribute)
Gets the value of a given attribute from the custom tag vector. If the attribute does not exist in the vector, then the attribute pair is added to the vector.


getSubTagVector

public static java.util.Vector getSubTagVector(java.util.Vector parent,
                                               java.lang.String tagName)
Returns the subtag vector with the given custom tag name.


addSubTagVector

public static java.util.Vector addSubTagVector(java.util.Vector parent,
                                               java.lang.String tagName)
Creates a new subtag vector and adds it to the parent vector.


addSubTagVector

public static void addSubTagVector(java.util.Vector parent,
                                   java.util.Vector subVector)
Adds the subVector to the parent vector as teh body vector portion of the vector.


removeSubTagVector

public static void removeSubTagVector(java.util.Vector parent,
                                      java.lang.String tagName)
Removes a subtag vector with the given name from the given parent vector if the subtag vector exists.


removeAllSubTagVectors

public static void removeAllSubTagVectors(java.util.Vector parent,
                                          java.lang.String tagName)
Removes all subtag vectors with the given name from the given parent vector.


isCustomTagVectorEmpty

public static boolean isCustomTagVectorEmpty(java.util.Vector vector)
Removes a subtag vector with the given name from the given parent vector if the subtag vector exists.




Copyright © 2009 SAS Institute Inc. All Rights Reserved.