com.ibm.xsp.resource
Class BundleResource

java.lang.Object
  extended by com.ibm.xsp.complex.ValueBindingObjectImpl
      extended by com.ibm.xsp.resource.AbstractResource
          extended by com.ibm.xsp.resource.BundleResource
All Implemented Interfaces:
ComponentBindingObject, ValueBindingObject, DataPublishingObject, Resource, javax.faces.component.StateHolder

public class BundleResource
extends AbstractResource
implements DataPublishingObject

Corresponds to the xp:bundleResource tag which is used to load strings for translation


Field Summary
 
Fields inherited from class com.ibm.xsp.resource.AbstractResource
FAMILY
 
Constructor Summary
BundleResource()
           
 
Method Summary
 java.util.ResourceBundle getContents()
          Loads the contents from the "src" location as a Java ResourceBundle object, method may be invoked programmatically but be aware that it may throw exceptions.
 java.lang.String getSrc()
          Return the src file
 java.lang.String getVar()
          Returns the var used to access resource in bundle
protected  java.lang.Object loadContents(java.lang.String url, java.lang.String charset)
          Load the contents from the URI specified source.
 void popData(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.util.Map<java.lang.String,java.lang.Object> requestMap)
          Pop the data associated with this data source from the request map, note, if values were added to the shadowedData list during DataPublishingObject.pushData(FacesContext, UIComponent, Map, List), then it is not necessary to remove them from the request map in this method (as the calling class will remove them).
 void pushData(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.util.Map<java.lang.String,java.lang.Object> requestMap, java.util.List<DataPublisher.ShadowedObject> shadowedData)
          Publishes the translated ResourceBundle loaded by this resource, under the variable name provided by getVar().
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setSrc(java.lang.String src)
          The src file to set.
 void setVar(java.lang.String var)
          The var to set to access resources in bundle
 
Methods inherited from class com.ibm.xsp.resource.AbstractResource
encodeObject, equals, getFamily, getRendererType, getServerResourceContents, getUniqueId, isRendered, setRendered, setRendererType
 
Methods inherited from class com.ibm.xsp.complex.ValueBindingObjectImpl
getComponent, getFacesContext, getValueBinding, isTransient, setComponent, setTransient, setValueBinding
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleResource

public BundleResource()
Method Detail

getSrc

public java.lang.String getSrc()
Return the src file

Returns:
Returns the src

setSrc

public void setSrc(java.lang.String src)
The src file to set.

Parameters:
src -

getVar

public java.lang.String getVar()
Returns the var used to access resource in bundle

Returns:
Returns the var.

setVar

public void setVar(java.lang.String var)
The var to set to access resources in bundle

Parameters:
var -

getContents

public java.util.ResourceBundle getContents()
                                     throws java.io.IOException
Loads the contents from the "src" location as a Java ResourceBundle object, method may be invoked programmatically but be aware that it may throw exceptions.

Returns:
contents of ResourceBundle
Throws:
{@link - IOException}
java.io.IOException

loadContents

protected java.lang.Object loadContents(java.lang.String url,
                                        java.lang.String charset)
                                 throws java.io.IOException
Description copied from class: AbstractResource
Load the contents from the URI specified source.

Overrides:
loadContents in class AbstractResource
Throws:
java.io.IOException

pushData

public void pushData(javax.faces.context.FacesContext context,
                     javax.faces.component.UIComponent component,
                     java.util.Map<java.lang.String,java.lang.Object> requestMap,
                     java.util.List<DataPublisher.ShadowedObject> shadowedData)
              throws FacesExceptionEx
Publishes the translated ResourceBundle loaded by this resource, under the variable name provided by getVar(). Note, this does not override AbstractResource#getServerCharset(), because the bundle properties files must be encoded in "ISO-8859-1".

Specified by:
pushData in interface DataPublishingObject
Parameters:
{@link - javax.faces.context.FacesContext}
{@link - java.util.Map}
{@link - java.util.List}
Throws:
{@link - IOException}
FacesExceptionEx

popData

public void popData(javax.faces.context.FacesContext context,
                    javax.faces.component.UIComponent component,
                    java.util.Map<java.lang.String,java.lang.Object> requestMap)
             throws FacesExceptionEx
Description copied from interface: DataPublishingObject
Pop the data associated with this data source from the request map, note, if values were added to the shadowedData list during DataPublishingObject.pushData(FacesContext, UIComponent, Map, List), then it is not necessary to remove them from the request map in this method (as the calling class will remove them). This method should do any further tidying up required.

Specified by:
popData in interface DataPublishingObject
Throws:
FacesExceptionEx

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class AbstractResource

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class AbstractResource