The Span Tag
The "span" tag allows merged regions to have their length or width dynamically
specified with a factor. This tag must be bodiless. It is usually used close to --
but not inside of -- a looping tag so that it can match the
displayed height or width of a nearby Collection. If borders exist on the cell in
which this tag is located, then the borders will be changed to match the resultant
merged region (if any).
Attributes
- The "span" tag supports all base tag attributes.
- factor: int Optional. This is the factor with which to
multiply the height of the merged region in which this tag is contained. For
example, if the merged region is 2 cells tall, and the factor is 3, then content
below the merged region is shifted downward, and the merged region is grown to a
height of 6 cells. If there is no merged region, then the cell is treated as if it
was a merged region of height 1 and width 1, and a new merged region is created if
necessary. This value must not be negative. If it is zero, then the block (and
any merged region) is removed and content below is shifted up to overwrite the
block. Out of factor and adjust, at least one must be
specified.
- adjust: int Optional. This is an adjustment to the size of
the merged region, applied after factor multiplies the size. For
example, if the merged region is 2 cells tall, the factor is 3, and
the adjust is 1, then the size will be 2 * 3 + 1 = 7
cells tall. Out of factor and adjust, at least one must
be specified.
- value: Object Required. The value of the cell after
processing. Rich Text String formatting is supported for this attribute.
- expandRight: Boolean Optional. If true, then expand to the
right instead of downward. Content to the right of the merged region will be
shifted to the right to make way for the bigger merged region. Default: false
(downward).
- fixed: Boolean Optional. If true, then the tag will assume
that the proper space is present into which this merged region will expand, so it
will NOT shift other content out of the way to make room for it. Default: false
(shifting content out of the way will occur).
Example
A List of Employees inside a Department is
available in the beans map. There are 2 employees in the department.
Department |
Employees |
<jt:span factor="${dept.employees.size}"
value="Dept. Name: ${dept.name}"/> |
<jt:forEach items="${dept.employees}" var="${emp}">First: ${emp.firstName} |
Last: ${emp.lastName} |
Salary: |
${emp.salary}</jt:forEach> |
|
|
|
|
|
|
...gets transformed into...
Department |
Employees |
Dept. Name: Cartoon Characters |
First: Bugs |
Last: Bunny |
Salary: |
$1500 |
First: Elmer |
Last: Fudd |
Salary: |
$800 |
Adjust Example
In this example, an adjustment is made to the size of the merged region.
<jt:span
factor="${dept.employees.size}" adjust="1"
value="Department: ${dept.name}"/> |
|
|
|
|
Employee Count: ${dept.employees.size} |
<jt:forEach items="${dept.employees}" var="${emp}" copyRight="true">First: ${emp.firstName} |
Last: ${emp.lastName} |
|
|
Salary: |
${emp.salary}</jt:forEach> |
|
|
... gets transformed into...
Department: Cartoon Characters |
Employee Count: 2 |
First: Bugs |
Last: Bunny |
First: Elmer |
Last: Fudd |
Salary: |
$1500 |
Salary: |
$800 |