com.sas.servlet.tbeans
Class BaseCompositeTransformation

com.sas.servlet.tbeans.BaseCompositeTransformation
All Implemented Interfaces:
HttpActionProviderInterface, com.sas.beans.PropertyChangeSource, com.sas.lang.ObjectDataInterface, com.sas.servlet.tbeans.AJAXControllerURLInterface, ComplexStyleInterface, CompositeComponentInterface, RenderableInterface, TemplateInterface, com.sas.servlet.tbeans.TemplateKeyInterface, TransformationInterface, com.sas.util.WriteToPrintWriterInterface, java.io.Serializable
Direct Known Subclasses:
BaseActionCompositeTransformation, com.sas.servlet.tbeans.BaseCompositeTransformation2, BaseDataSelector, BaseDualSelector, BaseExpandCollapse, BaseExpressionEditor, BaseListEditor, BaseSelectorPanel, CheckBoxListPropertyEditor, DataSelectorListBoxView, ListBoxViewPropertyEditor, PercentCalculationsSelectorListBoxView, TextEntryPropertyEditor

public abstract class BaseCompositeTransformation
implements CompositeComponentInterface, ComplexStyleInterface, HttpActionProviderInterface, com.sas.servlet.tbeans.AJAXControllerURLInterface, com.sas.servlet.tbeans.TemplateKeyInterface

The base object for all Composite Transformation Beans. Composite TransformationBean typically consists of more than one component that make up a Selector like the Dual Selector or a Data Viewer such as the TableView or the OLPATableView.

For More Information:

Visit the AppDev Studio Developer's Site to access step-by-step examples, white papers and additional usage information at http://support.sas.com/rnd/appdev/.

Examples for this class may be found on the Examples Site.

See Also:
CompositeSupport, Serialized Form

Constructor Summary
BaseCompositeTransformation()
          Default Constructor
 
Method Summary
 java.lang.String applyTemplate(BaseTransformation tbean)
          Applies the template by getting the dictionary from the following areas:
ComponentMap - if the tbean implements com.sas.servlet.tbeans.CompositeComponentInterface ComponentStyleMap - if the tbean implements com.sas.servlet.tbeans.ComplexStyleInterface TemplateDictionary - if the tbean implements com.sas.servlet.tbeans.TemplateInterface.
 java.lang.String applyTemplate(BaseTransformation tbean, java.lang.String _template)
          Applies the template by getting the dictionary from the following areas:
ComponentMap - if the tbean implements com.sas.servlet.tbeans.CompositeComponentInterface ComponentStyleMap - if the tbean implements com.sas.servlet.tbeans.ComplexStyleInterface TemplateDictionary - if the tbean implements com.sas.servlet.tbeans.TemplateInterface.
 HttpActionProvider getActionProvider()
          Returns the ActionProvider object for all components in the composite requiring an ActionProvider.
 TransformationInterface getComponent(java.lang.String componentKey)
          Returns a reference to a component, based on the component key.
 java.util.Map getComponents()
          Returns a map with all the components in the composite in it.
 java.lang.String getDefaultTemplate()
          Returns the default template to be used for this composite.
 StyleInfo getStyleInfo(java.lang.String componentKey, java.lang.String styleKey)
          Returns the StyleInfo object for a component/style area.
 java.util.Map getStyleMap()
          Returns a Map containing all the style information for this component.
 java.lang.String getTemplate()
          Returns the template used for a component.
 java.util.HashMap getTemplateDictionary()
          Returns a user defined template dictionary for the component
 java.lang.String getTemplateFileName()
          Returns the template file name for the component
 java.lang.String getTemplateLocation()
          Returns the location the template file should be retrieved from.
 java.util.Map getVisibleComponents()
          Returns a map with all the visible components in the composite.
 boolean isFlushEnabled()
          Returns the flushEnabled flag
 void propertyChange(java.beans.PropertyChangeEvent pce)
           
 TransformationInterface removeComponent(java.lang.String componentKey)
          Removes a component from the CompositeComponentManager.
 void setActionProvider(HttpActionProvider provider)
          Sets the ActionProvider object for all components in the composite requiring an ActionProvider.
 void setCleanUpResourcesOn(boolean b)
          Set the flag that indicates whether the request and response objects should be set to null once the TransformationBean is rendered.
 TransformationInterface setComponent(java.lang.String componentKey, TransformationInterface tbean)
          Adds or sets a component to the list of components contained in the composite component.
 void setFlushEnabled(boolean flushEnabled)
          Sets the flushEnabled flag
 void setId(java.lang.String value)
          Sets the id of the component.
 void setLocale(java.util.Locale loc)
          Sets the Locale object for components in the composite.
 void setRequest(javax.servlet.http.HttpServletRequest req)
          Sets the request object for components in the composite.
 void setResponse(javax.servlet.http.HttpServletResponse resp)
          Sets the response object for components in the composite.
 void setStyleInfo(java.lang.String componentKey, java.lang.String styleKey, StyleInfo styleInfo)
          Assigns a StyleInfo object to the appropriate style area.
 void setTemplate(java.io.File file)
          Sets a template file object
 void setTemplate(java.lang.String template)
          Sets the template for this component.
 void setTemplateDictionary(java.util.HashMap dictionary)
          Sets a user defined dictionary for the component containing variables along with their associated values.
 void setTemplateFileName(java.lang.String file)
          The name of the template file.
 void setTemplateLocation(java.lang.String location)
          Sets the location the template file for this composite.
 void write(java.io.PrintWriter out)
          Writes the custom attributes of the object.
 void writeTemplate(BaseTransformation tbean, java.lang.String _template, java.io.PrintWriter out)
          Writes the template by getting the dictionary from the following areas:
ComponentMap - if the tbean implements com.sas.servlet.tbeans.CompositeComponentInterface ComponentStyleMap - if the tbean implements com.sas.servlet.tbeans.ComplexStyleInterface TemplateDictionary - if the tbean implements com.sas.servlet.tbeans.TemplateInterface.
 
Methods inherited from class com.sas.servlet.tbeans.BaseTransformation
addPropertyChangeListener, addPropertyChangeListener, cleanUpResources, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getCustomAttributes, getDescription, getId, getInputTransform, getLocale, getName, getObjectData, getObjectDataProperty, getOutputTransform, getRequest, getResponse, getTagEpilog, getTagProlog, hasListeners, isCleanUpResourcesOn, isVisible, removePropertyChangeListener, removePropertyChangeListener, setCustomAttributes, setInputTransform, setLocaleDependentProperties, setName, setObjectData, setObjectDataProperty, setOutputTransform, setTagEpilog, setTagProlog, setVisible, toString, write, write, write
 
Methods inherited from interface com.sas.actionprovider.HttpActionProviderInterface
getRequest
 

Constructor Detail

BaseCompositeTransformation

public BaseCompositeTransformation()
Default Constructor

Method Detail

getComponent

public TransformationInterface getComponent(java.lang.String componentKey)
Returns a reference to a component, based on the component key.

Specified by:
getComponent in interface CompositeComponentInterface
Parameters:
componentKey - key for component
Returns:
tbean with the specified component key.

setComponent

public TransformationInterface setComponent(java.lang.String componentKey,
                                            TransformationInterface tbean)
Adds or sets a component to the list of components contained in the composite component. Components .must all have a unique componentKey. ComponentKeys are defined for complex and composite components in com.sas.servlet.tbeans.component-name.component-nameKeysInterface.

Specified by:
setComponent in interface CompositeComponentInterface
Parameters:
componentKey - unique component keys.
tbean - Transformation Bean.
Returns:
the object that was added if successful or null if the add is unsuccessful.

removeComponent

public TransformationInterface removeComponent(java.lang.String componentKey)
Removes a component from the CompositeComponentManager.

Specified by:
removeComponent in interface CompositeComponentInterface
Parameters:
TransformationInerface - object
Returns:
TransformationInterface object if successful null if unsuccessful

getStyleInfo

public StyleInfo getStyleInfo(java.lang.String componentKey,
                              java.lang.String styleKey)
                       throws java.lang.NullPointerException
Returns the StyleInfo object for a component/style area. StyleKeys are defined for complex and composite components in com.sas.servlet.tbeans.component-name.component-name.html.component-nameStyleKeysInterface.

Specified by:
getStyleInfo in interface CompositeComponentInterface
Parameters:
componentKey - key to access the appropriate component
styleAreKey - key to identify the style area. styleArea keys are defined for each component.
Returns:
StyleInfo object
Throws:
java.lang.NullPointerException - Thrown if some type of null pointer error occurs

setStyleInfo

public void setStyleInfo(java.lang.String componentKey,
                         java.lang.String styleKey,
                         StyleInfo styleInfo)
                  throws java.lang.NullPointerException
Assigns a StyleInfo object to the appropriate style area. StyleKeys are defined for complex and composite components in com.sas.servlet.tbeans.component-name.component-name.html.component-nameStyleKeysInterface.

Specified by:
setStyleInfo in interface CompositeComponentInterface
Parameters:
componentKey - key to access the appropriate component,
styleAreaKey - key to identify the style area
styleInfo - the StyleInfo object
Throws:
java.lang.NullPointerException - Thrown if some type of null pointer error occurs

getComponents

public java.util.Map getComponents()
Returns a map with all the components in the composite in it.

Specified by:
getComponents in interface CompositeComponentInterface
Returns:
map will all the components in it.

getVisibleComponents

public java.util.Map getVisibleComponents()
Returns a map with all the visible components in the composite.

Specified by:
getVisibleComponents in interface CompositeComponentInterface
Returns:
map will all the components in it.

setRequest

public void setRequest(javax.servlet.http.HttpServletRequest req)
Sets the request object for components in the composite.

Specified by:
setRequest in interface HttpActionProviderInterface
Specified by:
setRequest in interface TransformationInterface
Overrides:
setRequest in class BaseTransformation
Parameters:
req - HttpServletRequest Object
See Also:
HttpActionProviderInterface.getRequest()

setResponse

public void setResponse(javax.servlet.http.HttpServletResponse resp)
Sets the response object for components in the composite.

Specified by:
setResponse in interface TransformationInterface
Overrides:
setResponse in class BaseTransformation
Parameters:
resp - HttpServletResponse Object

setLocale

public void setLocale(java.util.Locale loc)
Sets the Locale object for components in the composite.

Specified by:
setLocale in interface TransformationInterface
Overrides:
setLocale in class BaseTransformation
Parameters:
loc - Locale Object

getStyleMap

public java.util.Map getStyleMap()
Returns a Map containing all the style information for this component.

Specified by:
getStyleMap in interface ComplexStyleInterface
Returns:
Map containing all component style information

getTemplate

public java.lang.String getTemplate()
Description copied from interface: TemplateInterface
Returns the template used for a component.

Specified by:
getTemplate in interface TemplateInterface
Returns:
a string representing the template on this component. Return null if no template set.

setTemplate

public void setTemplate(java.lang.String template)
Description copied from interface: TemplateInterface
Sets the template for this component.

Specified by:
setTemplate in interface TemplateInterface

setTemplateFileName

public void setTemplateFileName(java.lang.String file)
Description copied from interface: TemplateInterface
The name of the template file.

Specified by:
setTemplateFileName in interface TemplateInterface
Parameters:
file - the file name containing the template

getTemplateFileName

public java.lang.String getTemplateFileName()
Description copied from interface: TemplateInterface
Returns the template file name for the component

Specified by:
getTemplateFileName in interface TemplateInterface
Returns:
the template file name

setTemplate

public void setTemplate(java.io.File file)
Description copied from interface: TemplateInterface
Sets a template file object

Specified by:
setTemplate in interface TemplateInterface
Parameters:
file - The file object that contains the template file

getTemplateDictionary

public java.util.HashMap getTemplateDictionary()
Description copied from interface: TemplateInterface
Returns a user defined template dictionary for the component

Specified by:
getTemplateDictionary in interface TemplateInterface
Returns:
the template dictionary

setTemplateDictionary

public void setTemplateDictionary(java.util.HashMap dictionary)
Description copied from interface: TemplateInterface
Sets a user defined dictionary for the component containing variables along with their associated values.

Specified by:
setTemplateDictionary in interface TemplateInterface

getDefaultTemplate

public java.lang.String getDefaultTemplate()
Description copied from interface: TemplateInterface
Returns the default template to be used for this composite. If no customized template has been applied and the template file cannot be found or read, this template is used to provide at least a minimum amount of functionality and may or may not have styling or formatting applied to it.

Specified by:
getDefaultTemplate in interface TemplateInterface
Returns:
default template to be used for this composite

applyTemplate

public java.lang.String applyTemplate(BaseTransformation tbean,
                                      java.lang.String _template)
Applies the template by getting the dictionary from the following areas:

Parameters:
tbean - The TransformationBean which implements a com.sas.servlet.tbeans.TemplateInterface
_template - Custom Template. If null and tbean implements TemplateInterface, getTemplate() or getTemplateFileName() will be used
Returns:
the applied template

writeTemplate

public void writeTemplate(BaseTransformation tbean,
                          java.lang.String _template,
                          java.io.PrintWriter out)
Writes the template by getting the dictionary from the following areas:

Parameters:
tbean - The TransformationBean which implements a com.sas.servlet.tbeans.TemplateInterface
_template - Custom Template. If null and tbean implements TemplateInterface, getTemplate() or getTemplateFileName() will be used
out - The PrintWriter to which the template will be written.

applyTemplate

public java.lang.String applyTemplate(BaseTransformation tbean)
Applies the template by getting the dictionary from the following areas:

Parameters:
tbean - The TransformationBean which implements a com.sas.servlet.tbeans.TemplateInterface
Returns:
the applied template

setTemplateLocation

public void setTemplateLocation(java.lang.String location)
Description copied from interface: TemplateInterface
Sets the location the template file for this composite. If the location is set to null, then the default location as determined by the ComponentPropertyManager will be used.

Specified by:
setTemplateLocation in interface TemplateInterface

getTemplateLocation

public java.lang.String getTemplateLocation()
Description copied from interface: TemplateInterface
Returns the location the template file should be retrieved from.

Specified by:
getTemplateLocation in interface TemplateInterface
Returns:
the location the template file should be retrieved from

setCleanUpResourcesOn

public void setCleanUpResourcesOn(boolean b)
Set the flag that indicates whether the request and response objects should be set to null once the TransformationBean is rendered. The flag is true by default. This flag allows an application to control this setting in cases where the cleanup should be delayed.

Overrides:
setCleanUpResourcesOn in class BaseTransformation
Parameters:
b - set to true by default
See Also:
BaseTransformation.isCleanUpResourcesOn()

setId

public void setId(java.lang.String value)
Sets the id of the component. The id of the components that are added to this composite class will be renamed according to the id set here. However, if the id of a component is different than the default id, the id of that component will remain the same.

Specified by:
setId in interface TransformationInterface
Overrides:
setId in class BaseTransformation
Parameters:
value - The new id

setActionProvider

public void setActionProvider(HttpActionProvider provider)
Sets the ActionProvider object for all components in the composite requiring an ActionProvider.

Specified by:
setActionProvider in interface HttpActionProviderInterface
Parameters:
provider - HttpActionProvider Object
See Also:
HttpActionProviderInterface.getActionProvider()

getActionProvider

public HttpActionProvider getActionProvider()
Returns the ActionProvider object for all components in the composite requiring an ActionProvider.

Specified by:
getActionProvider in interface HttpActionProviderInterface
Parameters:
provider - HttpActionProvider Object
Returns:
the ActionProvider object
See Also:
HttpActionProviderInterface.setActionProvider(com.sas.actionprovider.HttpActionProvider)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent pce)

write

public void write(java.io.PrintWriter out)
           throws java.io.IOException
Writes the custom attributes of the object. All transformation beans should override this method and call SUPER.

Specified by:
write in interface TransformationInterface
Specified by:
write in interface com.sas.util.WriteToPrintWriterInterface
Overrides:
write in class BaseTransformation
Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs

isFlushEnabled

public boolean isFlushEnabled()
Returns the flushEnabled flag

Returns:
boolean true if the commands have to be flushed after writing, false otherwise

setFlushEnabled

public void setFlushEnabled(boolean flushEnabled)
Sets the flushEnabled flag

Parameters:
boolean - flushEnabled, true if the commands have to be flushed after writing, false otherwise



Copyright © 2009 SAS Institute Inc. All Rights Reserved.