com.niggle.templates.freemarkerimpl
Class LazyListTemplate

java.lang.Object
  |
  +--com.niggle.templates.PresentationWrapper
        |
        +--com.niggle.templates.freemarkerimpl.FreemarkerPresentationWrapper
              |
              +--com.niggle.templates.freemarkerimpl.LazyListTemplate
All Implemented Interfaces:
freemarker.template.TemplateListModel, freemarker.template.TemplateModel

public class LazyListTemplate
extends FreemarkerPresentationWrapper
implements freemarker.template.TemplateListModel

A "lazy" list implementation of the freemarker TemplateListModel interface for exposing a collection of records at one go.

Author:
Jonathan Revusky

Fields inherited from class com.niggle.templates.PresentationWrapper
contentType, interaction, locale, recordTemplateClass
 
Constructor Summary
LazyListTemplate(java.util.List list, ServletInteraction interaction, java.lang.String contentType)
           
 
Method Summary
 freemarker.template.TemplateModel get(int i)
           
 boolean hasNext()
           
 boolean isEmpty()
           
 boolean isRewound()
           
 freemarker.template.TemplateModel listSize()
           
 freemarker.template.TemplateModel next()
           
 void rewind()
           
 
Methods inherited from class com.niggle.templates.freemarkerimpl.FreemarkerPresentationWrapper
createNestedHash, createWrapper, normalizeMap, wrapString
 
Methods inherited from class com.niggle.templates.PresentationWrapper
createRecordWrapper, inheritFrom, setContentType, setRecord, setRecordTemplateClass, setSessionContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyListTemplate

public LazyListTemplate(java.util.List list,
                        ServletInteraction interaction,
                        java.lang.String contentType)
Parameters:
list, - a List of the records. A null will be massaged into an empty list.
Method Detail

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface freemarker.template.TemplateModel

rewind

public void rewind()
Specified by:
rewind in interface freemarker.template.TemplateListModel

isRewound

public boolean isRewound()
Specified by:
isRewound in interface freemarker.template.TemplateListModel

next

public freemarker.template.TemplateModel next()
                                       throws freemarker.template.TemplateModelException
Specified by:
next in interface freemarker.template.TemplateListModel

hasNext

public boolean hasNext()
Specified by:
hasNext in interface freemarker.template.TemplateListModel

listSize

public freemarker.template.TemplateModel listSize()
                                           throws freemarker.template.TemplateModelException
Specified by:
listSize in interface freemarker.template.TemplateListModel

get

public freemarker.template.TemplateModel get(int i)
                                      throws freemarker.template.TemplateModelException
Specified by:
get in interface freemarker.template.TemplateListModel