|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.servlet.tbeans.tableview.html.CellContentsSimpleTemplateRenderer
public class CellContentsSimpleTemplateRenderer
The CellContentsSimpleTemplateRenderer is a TransformationBean that generates the appropriate HTML 4.0 based on the contents of a SimpleTemplate. It allows a way to render the cell's content by substituting values from the TableView's model into the template string. The template string can contain any valid html. The substitution variables for the template string should be the NAME of the column.
The getCellContentsRendererComponent
method
will set the values and variable names from the TableView's
model onto the valueDictionary
.
The write
method will actually call the
format
method and render its value to the
output writer.
For example, assume we have 2 columns in our data model. The COLUMNNAME for column 1 is "Foo" and the COLUMNNAME for column 2 is "Bar". If you want to render the contents of the TableView such that the 1st column of the model is a URL and the 2nd column is the value to display, then you would sent the template string to be:
<a href="%Foo">%Bar</a>
There are other special keys which will also be added to the
valueDictionary
. These keys extend the flexibility
and power that this special cell contents renderer allows in
rendering a cell in the table. The special keys are:
For More Information:
JSP custom tags provide an alternative to using the TransformationBeans. Visit the Custom Tag Library Reference for additional information on the sas:CellContentsSimpleTemplateRenderer custom tag.
Note: A snapshot of the AppDev Studio Developers Site is installed on your local Web server when you install AppDev Studio. To access the site from webAF, select Help -> Developer Site .
Field Summary |
---|
Fields inherited from class com.sas.util.SimpleTemplate |
---|
_toStringCache, _toStringCacheClearedOnFormat, _toStringCachingEnabled, allowClassLoading, closec, closeStr, dirty, dmapNames, dmapValues, openc, openStr, RB_KEY, submit_string, temp_string_array, template_string, text_and_token_string_array, vdelimiter, writer |
Constructor Summary | |
---|---|
CellContentsSimpleTemplateRenderer()
Default Constructor |
|
CellContentsSimpleTemplateRenderer(boolean allowClassLoading)
Construct a CellContentsSimpleTemplateRenderer object with the specified template |
|
CellContentsSimpleTemplateRenderer(java.util.Map dictionary)
Construct a CellContentsSimpleTemplateRenderer with the object that implements the java.util.Map interface. |
|
CellContentsSimpleTemplateRenderer(java.util.Map dictionary,
boolean allowClassLoading)
Construct a CellContentsSimpleTemplateRenderer with the object that implements the java.util.Map Interface. |
|
CellContentsSimpleTemplateRenderer(java.lang.String pattern)
Construct a CellContentsSimpleTemplateRenderer object with the specified template |
|
CellContentsSimpleTemplateRenderer(java.lang.String pattern,
boolean allowClassLoading)
Construct a CellContentsSimpleTemplateRenderer object with the specified template |
|
CellContentsSimpleTemplateRenderer(java.lang.String pattern,
char marker,
char open,
char close)
Construct a CellContentsSimpleTemplateRenderer with the specified template. |
|
CellContentsSimpleTemplateRenderer(java.lang.String pattern,
char marker,
char open,
char close,
boolean allowClassLoading)
Construct a CellContentsSimpleTemplateRenderer with the specified template. |
|
CellContentsSimpleTemplateRenderer(java.lang.String pattern,
java.util.Map dictionary)
Construct a CellContentsSimpleTemplateRenderer with the specified template and object that implements the java.util.Map interface. |
|
CellContentsSimpleTemplateRenderer(java.lang.String pattern,
java.util.Map dictionary,
char marker,
char open,
char close)
Construct a CellContentsSimpleTemplateRenderer with the specified template and object that implements the java.util.Map Interface. |
|
CellContentsSimpleTemplateRenderer(java.lang.String pattern,
java.util.Map dictionary,
char marker,
char open,
char close,
boolean allowClassLoading)
Construct a CellContentsSimpleTemplateRenderer with the specified template and object that implements the java.util.Map Interface. |
Method Summary | |
---|---|
ActionList |
getActions()
Gets the list of valid actions for this cell. |
TransformationInterface |
getCellContentsRendererComponent(AbstractBaseTableView viewer,
java.lang.Object value,
ActionList actions)
Returns the tbean used for rendering the contents of the tableview's cell. |
java.lang.String |
getCustomAttributes()
This method always returns null. |
java.lang.String |
getDescription()
This method always returns null. |
java.lang.String |
getId()
This method always returns null. |
com.sas.util.transforms.TransformInterface |
getInputTransform()
Gets the input transformer to be used when loading values into the valueDictionary. |
java.util.Locale |
getLocale()
Gets the locale. |
java.lang.String |
getName()
This method always returns null. |
java.lang.String |
getNullTextString()
Gets the String value to be written when the cell text is null. |
javax.servlet.http.HttpServletRequest |
getRequest()
Gets the current request object. |
javax.servlet.http.HttpServletResponse |
getResponse()
Gets the current response object. |
AbstractBaseTableView |
getTableView()
Gets the instance of the AbstractBaseTableView containing this cell. |
java.lang.String |
getTagEpilog()
Returns a string to be written after to any tag information |
java.lang.String |
getTagProlog()
Returns a string to be written prior to any tag information |
boolean |
isEncodeText()
Gets the boolean indicating whether the cell text will be encoded using com.sas.util.Strings.quoteForXML. |
boolean |
isVisible()
Returns whether or not the transformation bean should be written |
void |
setActions(ActionList actions)
Sets the list of valid actions for this cell. |
void |
setCustomAttributes(java.lang.String value)
This method is not implemented. |
void |
setDescription(java.lang.String value)
This method is not implemented. |
void |
setEncodeText(boolean encodeText)
Sets the boolean indicating whether the cell text will be encoded using com.sas.util.Strings.quoteForXML. |
void |
setId(java.lang.String value)
This method is not implemented. |
void |
setInputTransform(com.sas.util.transforms.TransformInterface transform)
Sets the input transformer to be used when loading values into the valueDictionary. |
void |
setLocale(java.util.Locale loc)
Set the locale |
void |
setName(java.lang.String value)
This method is not implemented. |
void |
setNullTextString(java.lang.String nullTextString)
Sets the String value to be written when the cell text is null. |
void |
setRequest(javax.servlet.http.HttpServletRequest request)
Sets the request object. |
void |
setResponse(javax.servlet.http.HttpServletResponse response)
Sets the response object. |
void |
setTableView(AbstractBaseTableView viewer)
Sets the instance of the AbstractBaseTableView containing this cell. |
void |
setTagEpilog(java.lang.String epilog)
Sets a string to be written after to any tag information |
void |
setTagProlog(java.lang.String prolog)
Sets a string to be written prior to any tag information |
void |
setVisible(boolean b)
Sets the visibility parameter for a tbean. |
void |
write(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Writes the transformed representation of the object. |
void |
write(java.io.OutputStream out)
Writes the transformed representation of the object. |
void |
write(java.io.PrintWriter out)
Writes the transformed representation of the object. |
void |
write(java.io.Writer out)
Writes the transformed representation of the object. |
Methods inherited from class com.sas.util.SimpleTemplate |
---|
checkToStringCache, clearToStringCache, findVarDelimiter, format, format, format, format, format, format, formatValueObject, formatWith, formatWith, formatWith, formatWith, formatWith, formatWith, formatWith, formatWith, getClassLoading, getClose, getExtendedBeanInfo, getMarker, getNameDictionary, getNameDictionary, getNameDictionary, getNotFoundNames, getOpen, getTemplate, getTextAndTokens, getValue, getValueDictionary, getWriter, init, init, isToStringCacheClearedOnFormat, isToStringCachingEnabled, notFound, parseFields, parseStringTokens, parseToken, processText, setClassLoading, setClose, setMarker, setOpen, setTemplate, setTextAndTokens, setToStringCacheClearedOnFormat, setToStringCachingEnabled, setValueDictionary, setWriter, tokenizeField, tokenizeTemplate, updateNamesDictionary |
Constructor Detail |
---|
public CellContentsSimpleTemplateRenderer()
public CellContentsSimpleTemplateRenderer(java.lang.String pattern)
pattern
- specified templatepublic CellContentsSimpleTemplateRenderer(java.lang.String pattern, java.util.Map dictionary)
pattern
- specified templatedictionary
- collection object that implements java.util.Map interfacepublic CellContentsSimpleTemplateRenderer(java.lang.String pattern, java.util.Map dictionary, char marker, char open, char close)
pattern
- specified templatedictionary
- colleciton object that implements java.util.Map interfacemarker
- the character to used to mark template expansion strings
in the template. The default is '%'open
- the character to use instead of the default '(' to open
expansion options after the marker/nameclose
- the character to use instead of the default ')' to close
expansion options after the marker/namepublic CellContentsSimpleTemplateRenderer(java.lang.String pattern, char marker, char open, char close)
pattern
- specified templatemarker
- the character to used to mark template expansion strings
in the template. The default is '%'open
- the character to use instead of the default '(' to open
expansion options after the marker/nameclose
- the character to use instead of the default ')' to close
expansion options after the marker/namepublic CellContentsSimpleTemplateRenderer(java.util.Map dictionary)
dictionary
- collection object that implements java.util.Map interfacepublic CellContentsSimpleTemplateRenderer(boolean allowClassLoading)
allowClassLoading
- enable or disable the ability to load classes via the patternpublic CellContentsSimpleTemplateRenderer(java.lang.String pattern, boolean allowClassLoading)
pattern
- specified templateallowClassLoading
- enable or disable the ability to load classes via the patternpublic CellContentsSimpleTemplateRenderer(java.lang.String pattern, java.util.Map dictionary, char marker, char open, char close, boolean allowClassLoading)
pattern
- specified templatedictionary
- object that implements java.util.Map interfacemarker
- the character to used to mark template expansion strings
in the template. The default is '%'open
- the character to use instead of the default '(' to open
expansion options after the marker/nameclose
- the character to use instead of the default ')' to close
expansion options after the marker/nameallowClassLoading
- enable or disable the ability to load classes via the patternpublic CellContentsSimpleTemplateRenderer(java.lang.String pattern, char marker, char open, char close, boolean allowClassLoading)
pattern
- specified templatemarker
- the character to used to mark template expansion strings
in the template. The default is '%'open
- the character to use instead of the default '(' to open
expansion options after the marker/nameclose
- the character to use instead of the default ')' to close
expansion options after the marker/nameallowClassLoading
- enable or disable the ability to load classes via the patternpublic CellContentsSimpleTemplateRenderer(java.util.Map dictionary, boolean allowClassLoading)
dictionary
- object that implements java.util.Map interfaceallowClassLoading
- enable or disable the ability to load classes via the patternMethod Detail |
---|
public TransformationInterface getCellContentsRendererComponent(AbstractBaseTableView viewer, java.lang.Object value, ActionList actions)
getCellContentsRendererComponent
in interface TableCellContentsRenderer
viewer
- the instance of the tableview being written.value
- the value to display as the cell's contentsactions
- an actionlist of all the valid actions for this cell
public void write(java.io.PrintWriter out) throws java.io.IOException
request
and response
back to null
at the end of the method.
write
in interface TransformationInterface
out
- The output stream
java.io.IOException
- Thrown if some type of I/O error occurspublic void write(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
write
in interface TransformationInterface
req
- The request objectresp
- The response object
javax.servlet.ServletException
- Thrown if some type of servlet
error occurs
java.io.IOException
- Thrown if some type of I/O error occurspublic void write(java.io.Writer out) throws java.io.IOException
write
in interface TransformationInterface
out
- The output stream
java.io.IOException
- Thrown if some type of I/O error occurspublic void write(java.io.OutputStream out) throws java.io.IOException
write
in interface TransformationInterface
out
- The output stream
java.io.IOException
- Thrown if some type of I/O error occurspublic void setId(java.lang.String value)
setId
in interface TransformationInterface
value
- Not used since this method is not implemented.public java.lang.String getId()
getId
in interface TransformationInterface
public void setCustomAttributes(java.lang.String value)
setCustomAttributes
in interface TransformationInterface
value
- Not used since this method is not implemented.public java.lang.String getCustomAttributes()
getCustomAttributes
in interface TransformationInterface
public void setDescription(java.lang.String value)
setDescription
in interface TransformationInterface
value
- Not used since this method is not implemented.public java.lang.String getDescription()
getDescription
in interface TransformationInterface
public void setLocale(java.util.Locale loc)
setLocale
in interface TransformationInterface
locale
- public java.util.Locale getLocale()
getLocale
in interface TransformationInterface
public void setNullTextString(java.lang.String nullTextString)
nullTextString
- The String to be written when the text is nullpublic java.lang.String getNullTextString()
public void setEncodeText(boolean encodeText)
encodeText
- Flag indicating whether to set text encoding.public boolean isEncodeText()
public void setName(java.lang.String value)
setName
in interface TransformationInterface
value
- Not used since this method is not implemented.public java.lang.String getName()
getName
in interface TransformationInterface
public void setRequest(javax.servlet.http.HttpServletRequest request)
setRequest
in interface TransformationInterface
request
- The request objectpublic javax.servlet.http.HttpServletRequest getRequest()
getRequest
in interface TransformationInterface
public void setResponse(javax.servlet.http.HttpServletResponse response)
setResponse
in interface TransformationInterface
response
- The response objectpublic javax.servlet.http.HttpServletResponse getResponse()
getResponse
in interface TransformationInterface
public java.lang.String getTagProlog()
getTagProlog
in interface TransformationInterface
TransformationInterface.setTagProlog(String)
public void setTagProlog(java.lang.String prolog)
setTagProlog
in interface TransformationInterface
prolog
- string to be written prior to any tag informationpublic java.lang.String getTagEpilog()
getTagEpilog
in interface TransformationInterface
public void setTagEpilog(java.lang.String epilog)
setTagEpilog
in interface TransformationInterface
epilog
- string to be written after to any tag informationpublic void setActions(ActionList actions)
setActions
in interface TableCellContentsRenderer
actions
- an actionlist of all the valid actions for this cellpublic ActionList getActions()
getActions
in interface TableCellContentsRenderer
public void setTableView(AbstractBaseTableView viewer)
setTableView
in interface TableCellContentsRenderer
tableview
- an instance of AbstractBaseTableView containing this cellpublic AbstractBaseTableView getTableView()
getTableView
in interface TableCellContentsRenderer
public void setVisible(boolean b)
setVisible
in interface TransformationInterface
b
- true to display the tbean, false otherwise.public boolean isVisible()
isVisible
in interface TransformationInterface
public void setInputTransform(com.sas.util.transforms.TransformInterface transform)
transform
- The inputTransformpublic com.sas.util.transforms.TransformInterface getInputTransform()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |