org.apache.commons.jelly.tags.fmt
Class BundleTag

java.lang.Object
  extended byorg.apache.commons.jelly.TagSupport
      extended byorg.apache.commons.jelly.tags.fmt.BundleTag
All Implemented Interfaces:
org.apache.commons.jelly.Tag

public class BundleTag
extends org.apache.commons.jelly.TagSupport

Support for tag handlers for <bundle>, the resource bundle loading tag in JSTL.

Version:
1.1
Author:
Willie Vu

Field Summary
private  org.apache.commons.jelly.expression.Expression basename
           
private  java.lang.String ebasename
          evaluated basename
private static java.util.Locale EMPTY_LOCALE
           
private  java.lang.String eprefix
          evaluated prefix
private  LocalizationContext locCtxt
           
private  org.apache.commons.jelly.expression.Expression prefix
           
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
BundleTag()
           
 
Method Summary
 void doTag(org.apache.commons.jelly.XMLOutput output)
          Evaluates this tag after all the tags properties have been initialized.
private static java.util.ResourceBundle findMatch(java.lang.String basename, java.util.Locale pref, java.lang.ClassLoader cl)
           
 LocalizationContext getLocalizationContext()
           
static LocalizationContext getLocalizationContext(org.apache.commons.jelly.JellyContext jc)
          Gets the default I18N localization context.
static LocalizationContext getLocalizationContext(org.apache.commons.jelly.JellyContext jc, java.lang.String basename)
          Gets the resource bundle with the given base name, whose locale is determined as follows: Check if a match exists between the ordered set of preferred locales and the available locales, for the given base name.
 java.lang.String getPrefixAsString()
           
 void setBasename(org.apache.commons.jelly.expression.Expression basename)
          Setter for property basename.
 void setPrefix(org.apache.commons.jelly.expression.Expression prefix)
          Setter for property prefix.
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_LOCALE

private static final java.util.Locale EMPTY_LOCALE

basename

private org.apache.commons.jelly.expression.Expression basename

prefix

private org.apache.commons.jelly.expression.Expression prefix

ebasename

private java.lang.String ebasename
evaluated basename


eprefix

private java.lang.String eprefix
evaluated prefix


locCtxt

private LocalizationContext locCtxt
Constructor Detail

BundleTag

public BundleTag()
Method Detail

getLocalizationContext

public LocalizationContext getLocalizationContext()

getPrefixAsString

public java.lang.String getPrefixAsString()

doTag

public void doTag(org.apache.commons.jelly.XMLOutput output)
           throws org.apache.commons.jelly.JellyTagException
Evaluates this tag after all the tags properties have been initialized.

Throws:
org.apache.commons.jelly.JellyTagException

getLocalizationContext

public static LocalizationContext getLocalizationContext(org.apache.commons.jelly.JellyContext jc)
Gets the default I18N localization context.

Parameters:
jc - Page in which to look up the default I18N localization context

getLocalizationContext

public static LocalizationContext getLocalizationContext(org.apache.commons.jelly.JellyContext jc,
                                                         java.lang.String basename)
Gets the resource bundle with the given base name, whose locale is determined as follows: Check if a match exists between the ordered set of preferred locales and the available locales, for the given base name. The set of preferred locales consists of a single locale (if the org.apache.commons.jelly.tags.fmt.locale configuration setting is present).

If no match was found in the previous step, check if a match exists between the fallback locale (given by the org.apache.commons.jelly.tags.fmt.fallbackLocale configuration setting) and the available locales, for the given base name.

Parameters:
basename - Resource bundle base name
Returns:
Localization context containing the resource bundle with the given base name and the locale that led to the resource bundle match, or the empty localization context if no resource bundle match was found

findMatch

private static java.util.ResourceBundle findMatch(java.lang.String basename,
                                                  java.util.Locale pref,
                                                  java.lang.ClassLoader cl)

setBasename

public void setBasename(org.apache.commons.jelly.expression.Expression basename)
Setter for property basename.

Parameters:
basename - New value of property basename.

setPrefix

public void setPrefix(org.apache.commons.jelly.expression.Expression prefix)
Setter for property prefix.

Parameters:
prefix - New value of property prefix.