com.cc.framework.taglib
Class TagHelp

java.lang.Object
  extended bycom.cc.framework.taglib.TagHelp

public abstract class TagHelp
extends java.lang.Object

Helper for the tag library

Since:
1.0
Version:
$Revision: 1.47 $
Author:
Harald Schulz

Constructor Summary
private TagHelp()
          Constructor
 
Method Summary
static boolean checkForBaseClass(java.lang.Class theClass, java.lang.Class baseClass)
          This method checks if a class is derived from the specified base class
static boolean checkRunAtClient(RunAt runat, javax.servlet.jsp.PageContext pageContext)
          This Method checks if a component should run on the client
static org.apache.ecs.html.IMG createImage(javax.servlet.jsp.PageContext pageContext, ImageModel image)
          Creates an IMG Tag for the specified Image.
static FormElementContainerTag getContainer(javax.servlet.jsp.tagext.Tag tag)
          Searches the Tag hierarchy for a FormElementContainerTag parent
static javax.servlet.jsp.tagext.Tag getParentTag(javax.servlet.jsp.tagext.Tag tag, java.lang.Class parrentTagClass)
          Searches the Tag hierarchy for a FrameContainerTag parent
static java.lang.String getSource(javax.servlet.jsp.PageContext pageContext, java.lang.String base, java.lang.String src, java.util.Locale locale)
          Returns the localized Image resource name
static void hideButtons(ButtonContainer frame, java.lang.String controlButtonList)
          Hides all buttons in the ControlButton List.
static java.util.Locale localeFromName(javax.servlet.jsp.PageContext pageContext, java.lang.String localeName)
          Gets the Locale Object from a Locale Name
static java.util.Locale localeFromSession(javax.servlet.jsp.PageContext pageContext)
          Gets the Locale Object for the running session
static java.lang.String localize(javax.servlet.jsp.PageContext pageContext, java.lang.String keyOrString)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.String localize(javax.servlet.jsp.PageContext pageContext, java.lang.String keyOrString, java.lang.Object[] arguments)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.String localize(javax.servlet.jsp.PageContext pageContext, java.lang.String keyOrString, java.lang.Object[] arguments, java.util.Locale locale)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.String localize(javax.servlet.jsp.PageContext pageContext, java.lang.String keyOrString, java.lang.Object[] arguments, java.util.Locale locale, boolean returnNull)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.String localizeKey(javax.servlet.jsp.PageContext pageContext, java.lang.String resourceKey, java.lang.Object[] arguments, java.util.Locale locale, boolean returnNull)
          Localizes a string depending on the localization settings of the Painter context.
static java.lang.Object lookupBean(javax.servlet.jsp.PageContext pageContext, javax.servlet.jsp.tagext.TagSupport taghandler, java.lang.String name, java.lang.String property, HttpScope scope)
          Lookup a Javabean for use in a JSP tag handler.
static ImageMap lookupImageMap(javax.servlet.jsp.PageContext pageContext, java.lang.String mapName)
          Returns an image map
static java.lang.String resolveRelativePropertyName(javax.servlet.jsp.PageContext pageContext, java.lang.String relPropertyName)
          Resolves the relative property name to a fully qualified property name
static boolean showComments(javax.servlet.jsp.PageContext pageContext)
          Checks if painters should write additional comments into the output
static AlignmentType toAlignment(java.lang.String alignment)
          Creates a AlignmentType object for the specified argument.
static boolean toBoolean(java.lang.Object obj)
          Converts an object to a boolean if possible
static boolean toBoolean(java.lang.Object value, boolean defValue)
          Determines the boolean Value of the specified Object
static boolean toBoolean(java.lang.String str)
          Parses a string an returns a boolean value.
static CheckRange toCheckRange(java.lang.String range)
          Creates a CheckRange object for the specified argument.
static Color toColor(java.lang.String color)
          Creates a color object for the specified argument.
static int toInt(java.lang.String str)
          Converts an object to a integer if possible
static int[] toIntArray(java.lang.String str)
          Converts an object to a integer array if possible
static OrientationType toOrientation(java.lang.String orientation)
          Creates a OrientationType object for the specified argument.
static Permission toPermission(boolean granted)
          Creates a permission object for the specified argument.
static Permission toPermission(java.lang.String permission)
          Creates a permission object for the specified argument.
static SortOrder toSortOrder(java.lang.String sortOrder)
          Creates a sort order object for the specified argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TagHelp

private TagHelp()
Constructor

Method Detail

resolveRelativePropertyName

public static java.lang.String resolveRelativePropertyName(javax.servlet.jsp.PageContext pageContext,
                                                           java.lang.String relPropertyName)
                                                    throws javax.servlet.jsp.JspException
Resolves the relative property name to a fully qualified property name

Parameters:
pageContext - PageContext
relPropertyName - the relative property name
Returns:
absolute property name
Throws:
javax.servlet.jsp.JspException

showComments

public static boolean showComments(javax.servlet.jsp.PageContext pageContext)
Checks if painters should write additional comments into the output

Parameters:
pageContext - JspPage
Returns:
boolean

hideButtons

public static void hideButtons(ButtonContainer frame,
                               java.lang.String controlButtonList)
                        throws javax.servlet.jsp.JspException
Hides all buttons in the ControlButton List.

Parameters:
frame - The framed control
controlButtonList - A semicolon delimited list of ControlButton names
Throws:
javax.servlet.jsp.JspException - Is thrown when a invalid ControlButton Name is specified

checkRunAtClient

public static boolean checkRunAtClient(RunAt runat,
                                       javax.servlet.jsp.PageContext pageContext)
This Method checks if a component should run on the client

Parameters:
runat - RunAt setting of the component
pageContext - JSP Page Context
Returns:
Returns true when the component should run on the client

localeFromSession

public static java.util.Locale localeFromSession(javax.servlet.jsp.PageContext pageContext)
Gets the Locale Object for the running session

Parameters:
pageContext - JSP Page Context
Returns:
Locale Object or null

localeFromName

public static java.util.Locale localeFromName(javax.servlet.jsp.PageContext pageContext,
                                              java.lang.String localeName)
Gets the Locale Object from a Locale Name

Parameters:
pageContext - JSP Page Context
localeName - The Name
Returns:
Locale Object or null

getSource

public static java.lang.String getSource(javax.servlet.jsp.PageContext pageContext,
                                         java.lang.String base,
                                         java.lang.String src,
                                         java.util.Locale locale)
Returns the localized Image resource name

Parameters:
pageContext - JSP Page Context
base - Base Directory or resource key
src - Resource name
locale - Locale or null
Returns:
localized Resource name

toBoolean

public static boolean toBoolean(java.lang.Object value,
                                boolean defValue)
Determines the boolean Value of the specified Object

Parameters:
value - Object
defValue - Default Value
Returns:
boolean

localize

public static java.lang.String localize(javax.servlet.jsp.PageContext pageContext,
                                        java.lang.String keyOrString)
Localizes a string depending on the localization settings of the Painter context.

Parameters:
pageContext - JSP Page Context
keyOrString - String Literal or Resource Key
Returns:
localized String

localize

public static java.lang.String localize(javax.servlet.jsp.PageContext pageContext,
                                        java.lang.String keyOrString,
                                        java.lang.Object[] arguments)
Localizes a string depending on the localization settings of the Painter context.

Parameters:
pageContext - JSP Page Context
keyOrString - String Literal or Resource Key
arguments - MessageFormat arguments or null
Returns:
localized String

localize

public static java.lang.String localize(javax.servlet.jsp.PageContext pageContext,
                                        java.lang.String keyOrString,
                                        java.lang.Object[] arguments,
                                        java.util.Locale locale)
Localizes a string depending on the localization settings of the Painter context.

Parameters:
pageContext - JSP Page Context
keyOrString - String Literal or Resource Key
arguments - MessageFormat arguments or null
locale - Locale or null
Returns:
localized String

localize

public static java.lang.String localize(javax.servlet.jsp.PageContext pageContext,
                                        java.lang.String keyOrString,
                                        java.lang.Object[] arguments,
                                        java.util.Locale locale,
                                        boolean returnNull)
Localizes a string depending on the localization settings of the Painter context. A key is searched in the following order:
  1. If no user defined resource bundle is used. The resource is searched under the STRUTS_MESSAGES_KEY.
  2. If an user defined resource bundle is used (key@bundle) the resource is searched in the specified resource bundle.
  3. If the key was not found before, the resource is searched in the framework resource bundle under the key Globals.MESSAGE.

Parameters:
pageContext - JSP Page Context
keyOrString - The String literal or resource key.
arguments - MessageFormat arguments or null
locale - Locale or null
returnNull - controls whether to return null or a not present indicator
Returns:
localized String

localizeKey

public static java.lang.String localizeKey(javax.servlet.jsp.PageContext pageContext,
                                           java.lang.String resourceKey,
                                           java.lang.Object[] arguments,
                                           java.util.Locale locale,
                                           boolean returnNull)
Localizes a string depending on the localization settings of the Painter context. A key is searched in the following order:
  1. If no user defined resource bundle is used. The resource is searched under the STRUTS_MESSAGES_KEY.
  2. If an user defined resource bundle is used (key@bundle) the resource is searched in the specified resource bundle.
  3. If the key was not found before, the resource is searched in the framework resource bundle under the key Globals.MESSAGE.

Parameters:
pageContext - JSP Page Context
resourceKey - The resource key.
arguments - MessageFormat arguments or null
locale - Locale or null
returnNull - controls whether to return null or a not present indicator
Returns:
localized String

createImage

public static org.apache.ecs.html.IMG createImage(javax.servlet.jsp.PageContext pageContext,
                                                  ImageModel image)
Creates an IMG Tag for the specified Image. No localization will be done!

Parameters:
pageContext - JSP Page Context
image - ImageModel
Returns:
IMG-Element

getContainer

public static FormElementContainerTag getContainer(javax.servlet.jsp.tagext.Tag tag)
                                            throws javax.servlet.jsp.JspException
Searches the Tag hierarchy for a FormElementContainerTag parent

Parameters:
tag - the tag to start searching
Returns:
Container
Throws:
javax.servlet.jsp.JspException - is thrown when no parent is present

getParentTag

public static javax.servlet.jsp.tagext.Tag getParentTag(javax.servlet.jsp.tagext.Tag tag,
                                                        java.lang.Class parrentTagClass)
                                                 throws javax.servlet.jsp.JspException
Searches the Tag hierarchy for a FrameContainerTag parent

Parameters:
tag - the tag to start searching
parrentTagClass - The Type of the parent tag
Returns:
The Parent tag
Throws:
javax.servlet.jsp.JspException - is thrown when no parent is present

lookupBean

public static java.lang.Object lookupBean(javax.servlet.jsp.PageContext pageContext,
                                          javax.servlet.jsp.tagext.TagSupport taghandler,
                                          java.lang.String name,
                                          java.lang.String property,
                                          HttpScope scope)
                                   throws javax.servlet.jsp.JspException
Lookup a Javabean for use in a JSP tag handler.

Parameters:
pageContext - JSP page context
taghandler - the current tag handler
name - Name of the bean
property - Name of a beans property
scope - the scope where the bean should be located
Returns:
Java Bean or null
Throws:
javax.servlet.jsp.JspException - is thrown in case of an error

lookupImageMap

public static ImageMap lookupImageMap(javax.servlet.jsp.PageContext pageContext,
                                      java.lang.String mapName)
                               throws javax.servlet.jsp.JspException
Returns an image map

Parameters:
pageContext - The page context
mapName - The name of the image map
Returns:
The image map
Throws:
javax.servlet.jsp.JspException - If the image map can not be found

checkForBaseClass

public static boolean checkForBaseClass(java.lang.Class theClass,
                                        java.lang.Class baseClass)
This method checks if a class is derived from the specified base class

Parameters:
theClass - the class to check
baseClass - the base class
Returns:
returns true if the class is derived from the base class

toBoolean

public static boolean toBoolean(java.lang.Object obj)
                         throws javax.servlet.jsp.JspException
Converts an object to a boolean if possible

Parameters:
obj - The object to convert
Returns:
The boolean value
Throws:
javax.servlet.jsp.JspException - If the object can't be converted

toInt

public static int toInt(java.lang.String str)
                 throws javax.servlet.jsp.JspException
Converts an object to a integer if possible

Parameters:
str - The string to convert
Returns:
The integer value
Throws:
javax.servlet.jsp.JspException - If the object can't be converted

toIntArray

public static int[] toIntArray(java.lang.String str)
                        throws javax.servlet.jsp.JspException
Converts an object to a integer array if possible

Parameters:
str - The string to convert
Returns:
The integer array
Throws:
javax.servlet.jsp.JspException - If the object can't be converted

toBoolean

public static boolean toBoolean(java.lang.String str)
                         throws javax.servlet.jsp.JspException
Parses a string an returns a boolean value.

Parameters:
str - The string to parse
Returns:
The boolean value
Throws:
javax.servlet.jsp.JspException - If the argument can't be parsed

toPermission

public static Permission toPermission(java.lang.String permission)
                               throws javax.servlet.jsp.JspException
Creates a permission object for the specified argument.

Parameters:
permission - The string to parse
Returns:
The permission object
Throws:
javax.servlet.jsp.JspException - If the argument can not be parsed

toPermission

public static Permission toPermission(boolean granted)
Creates a permission object for the specified argument.

Parameters:
granted - grant
Returns:
The permission object

toOrientation

public static OrientationType toOrientation(java.lang.String orientation)
                                     throws javax.servlet.jsp.JspException
Creates a OrientationType object for the specified argument.

Parameters:
orientation - The string to parse
Returns:
The OrientationType object
Throws:
javax.servlet.jsp.JspException - If the argument can not be parsed

toSortOrder

public static SortOrder toSortOrder(java.lang.String sortOrder)
                             throws javax.servlet.jsp.JspException
Creates a sort order object for the specified argument.

Parameters:
sortOrder - The string to parse
Returns:
The sort order object
Throws:
javax.servlet.jsp.JspException - If the argument can not be parsed

toAlignment

public static AlignmentType toAlignment(java.lang.String alignment)
                                 throws javax.servlet.jsp.JspException
Creates a AlignmentType object for the specified argument.

Parameters:
alignment - The string to parse
Returns:
The alignment object
Throws:
javax.servlet.jsp.JspException - If the argument can not be parsed

toCheckRange

public static CheckRange toCheckRange(java.lang.String range)
                               throws javax.servlet.jsp.JspException
Creates a CheckRange object for the specified argument.

Parameters:
range - The string to parse
Returns:
The check range object
Throws:
javax.servlet.jsp.JspException - If the argument can not be parsed

toColor

public static Color toColor(java.lang.String color)
Creates a color object for the specified argument.

Parameters:
color - The string with the color value to parse
Returns:
The color object


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.