net.windward.tags
Class OutTag
net.windward.tags.BaseTag
|
+--net.windward.tags.OutTag
- public class OutTag
- extends BaseTag
Display the contents of a node. This tag represents a <wr:out ...> in the template. The simple usage is:
<wr:out select="./name"/> which will replace that tag with the text in the referenced node in the
final report, <wr:out value="${key}"/>, and <wr:out evaluate="${key}"/>
which will replace that tag with the text in the referenced keys and then evaluate the expression (+-*%/<>!=) in
the final report. In the value= case, you can use items from the default data set, the setQuery tags, and the
datasource setMap items. It is a pure text substitution - no query is performed against the dataset and no
processing is performed on the data.
The full list of attributes are:
- Must be exactly one of:
- select - the node whose text will be substituted in.
- value - the text that will be substituted in.
- evaluate - the text that will be evaluated.
- default - optional - the text to substitute in if the node does not exist. This is not used if the node
exists but is empty. This is used for value= if the final substituted string is empty.
- type - optional - This involves the use of NumberFormat & DateFormat. This attribute defines both how the text
in the node is parsed and how it is displayed. In both cases it uses the report locale to parse and display the
text. Numbers are parsed using DecimalFormat.parse(). Date/time can be in the SHORT, MEDIUM, LONG, or FULL format.
They can also be a long used in the constructor for the Date class. This may be used with value=.
Allowed values are:
- NUMBER - will display in the locale equivilent of 123,456.78
- CURRENCY - will display in the locale equivilent of $123,456.78 and ($123,456.78)
- PERCENT - will display in the locale equivilent of 55%
- DATE - will display the date in the locale specific format. The node does not need a time in this case
- TIME - will display the time in the locale specific format. The node does not need a date in this case
- BOTH - will display the date & time in the locale specific format.
- RTF - The data is a rtf file.
- XML - The data is a WordML file.
- BITMAP - the node data is assumed to be a uuencoded string of a file image for a jpeg or png bitmap file.
It will be uudecoded, read in as a bitmap, and placed in the report.
- display - optional - can be the text notEmpty, notNull, always, or a string that is evaluated to be true or false.
If displayed is false, then if the out tag is the only item in a paragraph, the paragraph will be deleted.
- notEmpty - only displayed if the select is a string.
- notNull - displayed if the select exists, even if null or 0 length string value.
- always - displayed even if the select returns nothing.
- true/false(evaluate) - displayed if the value evaluates to true. If it evaluates to false it is not displayed
even if there is a non-null value for the select.
- input - optional - In the case of NUMBER/CURRENCY/PERCENT, pattern is passed to DecimalFormat.applyPattern().
In the case of type=DATE/TIME/BOTH, this pattern can be used two different ways. If it has
the value SHORT, MEDIUM, LONG, or FULL, then it will pass that value in to DateFormat. If it has any other value,
the pattern is passed to SimpleDateFormat.applyPattern(). This may be used with value=. If your dates are in the
xsd:dateTime format, use input=”yyyy-MM-dd'T'HH:mm:ss”
- pattern - optional - In the case of NUMBER/CURRENCY/PERCENT, pattern is passed to DecimalFormat.applyPattern()
for the output. In the case of type=DATE/TIME/BOTH, this pattern can be used two different ways. If it has
the value SHORT, MEDIUM, LONG, or FULL, then it will pass that value in to DateFormat and return the standard
date/time/both for the locale. If it has any other value, the pattern is passed to SimpleDateFormat and that class
is used to format the text returned. This may be used with value=.
- wrap - optional - This is only for the case where type='BITMAP' and sets how the image is placed with respect
to the text next to it. Allowed values are:
- BEHIND - places the image under the text. The text continues over the image.
- FRONT - places the image over the text. The text continues under the image.
- INLINE - places the bitmap after preceeding text and following text follows the image. This is the default.
- SQUARE - similiar to INLINE except text continues to break on both sides of the image while INLINE will
always move the next line of text below the image.
There are several attempts to parse the input string. For a number/currency/percent, it first attempts to
parse the string using the appropiate NumberFormat.parse() method and using NumberFormat.applyPattern(). If
this fails, it then tries Double.parseDouble(). If that fails it will then throw NodeFormatException.
For date/time/both it makes three passes when attempting to parse. First it will try DateFormat.parse() using
DateFormat.applyPattern(input=). If that fails, it will try in order DateFormat.parse() using the patterns FULL,
LONG, MEDIUM, and SHORT without using applyPattern(input=). If that fails it will assume nodeText is a long and
try Date (Long.parseLong()). If it is not a long, it will throw a NumberFormatException.
It is an error to enter <wr:out select="./name"> ... </wr:out>
This tag follows the jstl examples of c:out, x:out, fmt:formatNumber, and fmt:formatDate.
- Version:
- 2.0 November 1, 2003
- See Also:
DateFormat,
java.text.DecimalFormat,
NumberFormat,
SimpleDateFormat,
ProcessReportAPI
| Fields inherited from class net.windward.tags.BaseTag |
CHART, COLUMN, DISPLAY_ALWAYS, DISPLAY_NOT_EMPTY, DISPLAY_NOT_NULL, ELSE, END_FOREACH, END_IF, END_LINK, END_MATRIX, ESCAPE, FOREACH, FUNCTION, HTML, IF, IMPORT, LINK, MATRIX, OUT, PROP_COMMENT, PROP_DATASOURCE, PROP_DEFAULT, PROP_DISPLAY, PROP_ENABLED, PROP_INPUT, PROP_PATTERN, PROP_TITLE, PROP_TYPE, PROP_VAR, PROP_WRAP, QUERY, ROW, SET, TAG_DISPLAY_DEFAULT, TAG_DISPLAY_SELECT, TAG_DISPLAY_TAG, TYPE_BITMAP, TYPE_BOTH, TYPE_CURRENCY, TYPE_DATE, TYPE_NUMBER, TYPE_PERCENT, TYPE_TIME, WRAP_BEHIND, WRAP_FRONT, WRAP_INLINE, WRAP_SQUARE |
|
Constructor Summary |
OutTag(java.util.Map map,
boolean selfContained,
boolean ignoreErrors)
Create an import element using the passed in map values. |
|
Method Summary |
net.windward.document.Element |
dup(boolean sameRefId)
Makes a duplicate of this object. |
java.lang.String |
formatText(java.lang.String nodeText,
java.util.Locale locale,
boolean returnRaw)
Returns the nodeText, converted as requested by the attributes. |
int |
getXmlType()
Returns which type of xml element this is. |
java.lang.String |
toDisplay(int type)
How this node is displayed on the page when in a field. |
java.lang.String |
toString()
Returns this object as a string. |
java.lang.String |
toText()
Converts this node back in to it's string representation in the document |
| Methods inherited from class net.windward.tags.BaseTag |
containsAttribute, factory, factory, getAttribute, getAttributes, getBean, getDatasource, getIntAttribute, getLevel, getMode, getNode, getType, setLevel, setNode, toTagText |
MODE_SELECT
public static final int MODE_SELECT
MODE_VALUE
public static final int MODE_VALUE
MODE_EVALUATE
public static final int MODE_EVALUATE
OutTag
public OutTag(java.util.Map map,
boolean selfContained,
boolean ignoreErrors)
throws TagException
- Create an import element using the passed in map values.
- Parameters:
map - Must have a select entry.selfContained - Must be true.ignoreErrors - - Throws:
TagException - thrown if illegal parameters passed in.
toText
public java.lang.String toText()
throws TagException
- Converts this node back in to it's string representation in the document
- Overrides:
toText in class BaseTag
- Returns:
- <=:xpath> type string.
toDisplay
public java.lang.String toDisplay(int type)
- How this node is displayed on the page when in a field.
- Overrides:
toDisplay in class BaseTag
- Parameters:
type - One of the DISPLAY_* constants- Returns:
- title, end of select, or <cmd> type string.
dup
public net.windward.document.Element dup(boolean sameRefId)
- Makes a duplicate of this object. A deep clone is done so the new object shares nothing
with the original object.
- Parameters:
sameRefId - - Returns:
- The new duplicate of this object
getXmlType
public int getXmlType()
- Returns which type of xml element this is.
- Overrides:
getXmlType in class BaseTag
- Returns:
- OUT
formatText
public java.lang.String formatText(java.lang.String nodeText,
java.util.Locale locale,
boolean returnRaw)
- Returns the nodeText, converted as requested by the attributes. The default operation is to return nodeText.
There are several attempts to parse the input string. For a number/currency/percent, it first attempts to
parse the string using the appropiate NumberFormat.parse() method and using NumberFormat.applyPattern(). If
this fails, it then tries Double.parseDouble(). If that fails it will then throw NodeFormatException.
For date/time/both it makes three passes when attempting to parse. First it will try DateFormat.parse() using
DateFormat.applyPattern(). If that fails, it will try in order DateFormat.parse() using the patterns FULL,
LONG, MEDIUM, and SHORT without using applyPattern(). If that fails it will assume nodeText is a long and
try Date (Long.parseLong()). If it is not a long, it will throw a NumberFormatException.
- Parameters:
nodeText - The text in a xml node.locale - The local used for parsing and displaying the text.returnRaw - true if the returned value should be the number/date in the raw format.- Returns:
- The passed in text converted as requested.
- Throws:
java.lang.NumberFormatException - thrown if cannot parse the nodeText.
toString
public java.lang.String toString()
- Returns this object as a string.
- Returns:
- A String listing this element.
Copyright © 2002 - 2008 Windward Reports - All Rights Reserved. java reporting software