com.cc.framework.ui.painter
Class PainterHelp

java.lang.Object
  extended bycom.cc.framework.ui.painter.PainterHelp

public abstract class PainterHelp
extends java.lang.Object

Utility class for painters

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

Constructor Summary
private PainterHelp()
          Constructor
 
Method Summary
static org.apache.ecs.ConcreteElement appendConverter(RequestContext ctx, org.apache.ecs.ConcreteElement element, java.lang.String controlName, Converter converter)
          Adds a hidden field for the converter that was used to render the HTML element
static org.apache.ecs.ConcreteElement applyDesignRules(org.apache.ecs.ConcreteElement element, DesignRule[] rules, DeferredEnvironment env)
          This method searches for all matching rules and applies the design to the given HTML element
static org.apache.ecs.ConcreteElement applyDesignRules(javax.servlet.jsp.PageContext ctx, org.apache.ecs.ConcreteElement element, DesignRule[] rules, java.lang.Object bean)
          This method searches for all matching rules and applies the design to the given HTML element
static java.lang.Object callPropertyGet(java.lang.Object bean, java.lang.String property)
          Processes the Getter-Method for the specified Property on the Bean
static java.lang.String callPropertyGetStr(java.lang.Object bean, java.lang.String property)
          Method callPropertyGetStr
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 org.apache.ecs.html.IMG createImage(javax.servlet.jsp.PageContext pageContext, ImageModel image, java.util.Locale locale)
          Creates an IMG Tag for the specified Image.
static java.lang.String createImageStr(javax.servlet.jsp.PageContext pageContext, ImageModel image)
          Creates an IMG Tag for the specified Image
static java.lang.String createImageStr(javax.servlet.jsp.PageContext pageContext, ImageModel image, java.util.Locale locale)
          Creates an IMG Tag for the specified Image
static org.apache.ecs.html.Input createInput(javax.servlet.jsp.PageContext pageContext, ImageModel image)
          Creates an Input Tag for the specified Image.
static org.apache.ecs.html.Input createInput(javax.servlet.jsp.PageContext pageContext, ImageModel image, java.util.Locale locale)
          Creates an Input Tag for the specified Image.
static java.lang.String createScriptHandler(ClientHandler handler)
          Adds the client handler to the button
static java.lang.String decorateLink(javax.servlet.jsp.PageContext ctx, Hyperlink link)
          Decorates the URL with RequestDecorator settings and appends the JSESSIONID when URL-rewriting is enabled to track sessions Every URL has to be decorated this way!
static java.lang.String decorateURL(javax.servlet.jsp.PageContext ctx, java.lang.String url)
          Decorates the URL with RequestDecorator settings and appends the JSESSIONID when URL-rewriting is enabled to track sessions Every URL has to be decorated this way!
static java.lang.String encodeURL(javax.servlet.jsp.PageContext pageContext, java.lang.String src)
          Method encodeURL
static org.apache.ecs.ElementContainer formatElements(java.lang.String pattern, org.apache.ecs.ConcreteElement[] elements)
          This method works similar to java.text.MessageFormat with the only difference that it concatenates ConcreteElement's into an ElementContainer
static java.lang.String getFrameworkString(javax.servlet.jsp.PageContext pageContext, java.lang.String resourceId, java.lang.Object[] arguments, java.util.Locale locale, boolean returnNull)
          Returns a framework string resource
static java.lang.String getSmartCaption(java.lang.String caption, java.lang.String detail)
          Method getSmartCaption
static java.lang.String getSmartDetail(java.lang.String caption, java.lang.String detail)
          Method getSmartDetail
static java.lang.String getSource(javax.servlet.jsp.PageContext pageContext, ImageModel image, java.util.Locale locale)
          Returns the localized Image resource name
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 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.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)
          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 void setScriptHandler(org.apache.ecs.ConcreteElement element, ClientEvent event, java.lang.String handler)
          Sets a Script-Handler for the specified control.
static void setScriptHandler(org.apache.ecs.ConcreteElement element, ClientHandler handler)
          Sets a Script-Handler for the specified control.
static boolean showComments(javax.servlet.jsp.PageContext pageContext)
          Checks if painters should write additional comments into the output
static boolean toBoolean(java.lang.Object value, boolean defValue)
          Determines the boolean Value of the specified Object
static void writeCssInclude(javax.servlet.jsp.JspWriter writer, java.lang.String href)
          Helper method to write a Cascading Stylesheet include to the given JSP writer
static void writeCssInclude(javax.servlet.jsp.JspWriter writer, java.lang.String href, java.nio.charset.Charset charset)
          Helper method to write a Cascading Stylesheet include to the given JSP writer
static void writeJsInclude(javax.servlet.jsp.JspWriter writer, java.lang.String src)
          Helper method to write a JavaScript include to the given JSP writer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PainterHelp

private PainterHelp()
Constructor

Method Detail

writeCssInclude

public static void writeCssInclude(javax.servlet.jsp.JspWriter writer,
                                   java.lang.String href)
                            throws java.io.IOException
Helper method to write a Cascading Stylesheet include to the given JSP writer

Parameters:
writer - the JSP writer
href - the CSS resource reference or null
Throws:
java.io.IOException

writeCssInclude

public static void writeCssInclude(javax.servlet.jsp.JspWriter writer,
                                   java.lang.String href,
                                   java.nio.charset.Charset charset)
                            throws java.io.IOException
Helper method to write a Cascading Stylesheet include to the given JSP writer

Parameters:
writer - the JSP writer
href - the CSS resource reference or null
charset - the character encoding of the cascading Stylesheet file
Throws:
java.io.IOException

writeJsInclude

public static void writeJsInclude(javax.servlet.jsp.JspWriter writer,
                                  java.lang.String src)
                           throws java.io.IOException
Helper method to write a JavaScript include to the given JSP writer

Parameters:
writer - the JSP writer
src - the script URL or null
Throws:
java.io.IOException

showComments

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

Parameters:
pageContext - JspPage Context
Returns:
boolean

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

appendConverter

public static org.apache.ecs.ConcreteElement appendConverter(RequestContext ctx,
                                                             org.apache.ecs.ConcreteElement element,
                                                             java.lang.String controlName,
                                                             Converter converter)
Adds a hidden field for the converter that was used to render the HTML element

Parameters:
ctx - RequestContext
element - The HTML element
controlName - The controls Name - The name used as the request parameter
converter - The converter that was used to render the Control
Returns:
HTML Element

applyDesignRules

public static org.apache.ecs.ConcreteElement applyDesignRules(javax.servlet.jsp.PageContext ctx,
                                                              org.apache.ecs.ConcreteElement element,
                                                              DesignRule[] rules,
                                                              java.lang.Object bean)
This method searches for all matching rules and applies the design to the given HTML element

Parameters:
ctx - JSP Page context
element - the HTML element to modify
rules - list of rules
bean - the bean that holds the values to check
Returns:
the HTML element

applyDesignRules

public static org.apache.ecs.ConcreteElement applyDesignRules(org.apache.ecs.ConcreteElement element,
                                                              DesignRule[] rules,
                                                              DeferredEnvironment env)
This method searches for all matching rules and applies the design to the given HTML element

Parameters:
element - the HTML element to modify
rules - list of rules
env - the environment in which the expression can be evaluated
Returns:
the HTML element

decorateURL

public static java.lang.String decorateURL(javax.servlet.jsp.PageContext ctx,
                                           java.lang.String url)
Decorates the URL with RequestDecorator settings and appends the JSESSIONID when URL-rewriting is enabled to track sessions Every URL has to be decorated this way!

Parameters:
ctx - JspPageContext
url - the URL to encode
Returns:
encoded URL

decorateLink

public static java.lang.String decorateLink(javax.servlet.jsp.PageContext ctx,
                                            Hyperlink link)
Decorates the URL with RequestDecorator settings and appends the JSESSIONID when URL-rewriting is enabled to track sessions Every URL has to be decorated this way!

Parameters:
ctx - JspPageContext
link - the Hyperlink
Returns:
encoded URL

createScriptHandler

public static java.lang.String createScriptHandler(ClientHandler handler)
Adds the client handler to the button

Parameters:
handler - Collection with ClientHandler
Returns:
String with the ClientHandlers

setScriptHandler

public static void setScriptHandler(org.apache.ecs.ConcreteElement element,
                                    ClientHandler handler)
Sets a Script-Handler for the specified control.

Parameters:
element - The control
handler - The client handler

setScriptHandler

public static void setScriptHandler(org.apache.ecs.ConcreteElement element,
                                    ClientEvent event,
                                    java.lang.String handler)
Sets a Script-Handler for the specified control.

Parameters:
element - The control
event - The event to set a handler for
handler - The Script text

encodeURL

public static java.lang.String encodeURL(javax.servlet.jsp.PageContext pageContext,
                                         java.lang.String src)
Method encodeURL

Parameters:
pageContext - PageContext
src - URL to encode
Returns:
String

callPropertyGet

public static java.lang.Object callPropertyGet(java.lang.Object bean,
                                               java.lang.String property)
Processes the Getter-Method for the specified Property on the Bean

Parameters:
bean - Bean with the specified Property
property - Name of the Property
Returns:
Object

callPropertyGetStr

public static java.lang.String callPropertyGetStr(java.lang.Object bean,
                                                  java.lang.String property)
Method callPropertyGetStr

Parameters:
bean - Object
property - Property
Returns:
String

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

formatElements

public static org.apache.ecs.ElementContainer formatElements(java.lang.String pattern,
                                                             org.apache.ecs.ConcreteElement[] elements)
This method works similar to java.text.MessageFormat with the only difference that it concatenates ConcreteElement's into an ElementContainer

Parameters:
pattern - Formatting pattern with "{0}" markups
elements - The elements that should be placed in the markups
Returns:
ElementContainer

createInput

public static org.apache.ecs.html.Input createInput(javax.servlet.jsp.PageContext pageContext,
                                                    ImageModel image)
Creates an Input Tag for the specified Image.

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

createInput

public static org.apache.ecs.html.Input createInput(javax.servlet.jsp.PageContext pageContext,
                                                    ImageModel image,
                                                    java.util.Locale locale)
Creates an Input Tag for the specified Image.

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

createImage

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

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

createImage

public static org.apache.ecs.html.IMG createImage(javax.servlet.jsp.PageContext pageContext,
                                                  ImageModel image,
                                                  java.util.Locale locale)
Creates an IMG Tag for the specified Image.

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

createImageStr

public static java.lang.String createImageStr(javax.servlet.jsp.PageContext pageContext,
                                              ImageModel image)
Creates an IMG Tag for the specified Image

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

createImageStr

public static java.lang.String createImageStr(javax.servlet.jsp.PageContext pageContext,
                                              ImageModel image,
                                              java.util.Locale locale)
Creates an IMG Tag for the specified Image

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

getSmartCaption

public static java.lang.String getSmartCaption(java.lang.String caption,
                                               java.lang.String detail)
Method getSmartCaption

Parameters:
caption - Caption
detail - Detail
Returns:
String

getSmartDetail

public static java.lang.String getSmartDetail(java.lang.String caption,
                                              java.lang.String detail)
Method getSmartDetail

Parameters:
caption - Caption
detail - Detail
Returns:
String

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.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
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)
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

getFrameworkString

public static java.lang.String getFrameworkString(javax.servlet.jsp.PageContext pageContext,
                                                  java.lang.String resourceId,
                                                  java.lang.Object[] arguments,
                                                  java.util.Locale locale,
                                                  boolean returnNull)
Returns a framework string resource

Parameters:
pageContext - JSP Page Context
resourceId - Id of the resource/key
arguments - MessageFormat arguments or null
locale - Locale or null
returnNull - controls whether to return null or a not present indicator
Returns:
The value for the resource id

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

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

getSource

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

Parameters:
pageContext - JSP Page Context
image - The image
locale - Locale or null
Returns:
localized resource name

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


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