Fixed Size Collections

Sometimes, the size of a Collection is known before processing. JETT allows a collection name to be marked as "fixed size". If JETT loops through such a collection, then it will be as if the "fixed" attribute was set to "true" on the looping tag. No content will be shifted out of the way to make room for the additional content. This is useful when preparing charts in template spreadsheets, which must refer to a specific range of Cells.

To mark a particular collection name as "fixed size", using the following method in the ExcelTransformer class:

public void addFixedSizeCollectionName(String collName);

JETT will treat ALL collections found under the given name in the template spreadsheet to be "fixed size collections".

Fixed Collection Name Example

Here's an example that uses the "fixed collection name" feature. The following code is run before the "transform" method:

Employee Salary Manager
<jt:forEach items="${employees}" var="employee">${employee.lastName}, ${employee.firstName} ${employee.salary} <jt:if test="${employee.getManager() != null}" then="${employee.manager.lastName}, ${employee.manager.firstName}"/></jt:forEach>
I am not getting moved!

...gets transformed into...

Employee Salary Manager
Stack, Robert $1000.00  
Queue, Suzie $900.00 Stack, Robert
Fudd, Elmer $800.00 Stack, Robert
Bunny, Bugs $1500.00  
I am not getting moved!