com.revusky.niggle.templates.freemarkerimpl
Class LazyList

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

public class LazyList
extends FreemarkerPresentationWrapper
implements freemarker.template.TemplateListModel, freemarker.template.TemplateHashModel

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.revusky.niggle.templates.freemarkerimpl.FreemarkerPresentationWrapper
CASE_INSENSITIVE
 
Fields inherited from class com.revusky.niggle.templates.PresentationWrapper
contentType, interaction, locale, recordWrapperClass
 
Constructor Summary
LazyList(java.util.List list, ServletInteraction interaction, java.lang.String contentType)
           
 
Method Summary
 freemarker.template.TemplateModel get(int i)
           
 freemarker.template.TemplateModel get(java.lang.String s)
           
 boolean hasNext()
           
 boolean isEmpty()
           
 boolean isRewound()
           
 freemarker.template.TemplateModel listSize()
           
 freemarker.template.TemplateModel next()
           
 void rewind()
           
 
Methods inherited from class com.revusky.niggle.templates.freemarkerimpl.FreemarkerPresentationWrapper
createNestedHash, createWrapper, normalizeMap, wrapString
 
Methods inherited from class com.revusky.niggle.templates.PresentationWrapper
createRecordWrapper, getLocale, inheritFrom, setContentType, setRecord, setRecordWrapperClass, setSessionContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyList

public LazyList(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

get

public freemarker.template.TemplateModel get(java.lang.String s)
                                      throws freemarker.template.TemplateModelException
Specified by:
get in interface freemarker.template.TemplateHashModel