com.revusky.niggle.templates.freemarkerimpl
Class EnumTemplateModel
java.lang.Object
|
+--com.revusky.niggle.templates.freemarkerimpl.EnumTemplateModel
- All Implemented Interfaces:
- freemarker.template.TemplateHashModel, freemarker.template.TemplateListModel, freemarker.template.TemplateModel, freemarker.template.TemplateScalarModel
- public class EnumTemplateModel
- extends java.lang.Object
- implements freemarker.template.TemplateListModel, freemarker.template.TemplateScalarModel, freemarker.template.TemplateHashModel
a freemarker template implementation that
wraps an enumeration of strings.
- Author:
- Jonathan Revusky
Field Summary |
static java.lang.String |
UNSET
|
Constructor Summary |
EnumTemplateModel(java.lang.String[] options,
java.util.Locale locale)
|
EnumTemplateModel(java.lang.String[] options,
java.lang.String title,
java.util.Locale locale)
|
Method Summary |
freemarker.template.TemplateModel |
get(int i)
|
freemarker.template.TemplateModel |
get(java.lang.String key)
|
java.lang.String |
getAsString()
|
boolean |
hasNext()
|
boolean |
isEmpty()
|
boolean |
isRewound()
|
freemarker.template.TemplateModel |
listSize()
|
freemarker.template.TemplateModel |
next()
|
void |
rewind()
|
void |
setDummyStartString(java.lang.String dummyStartString)
Used to set a string that starts off the options.
|
void |
setSelection(int index)
Sets the string at the specified index as selected |
void |
setSelection(java.lang.String selection)
Sets this string as a selected string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UNSET
public static final java.lang.String UNSET
EnumTemplateModel
public EnumTemplateModel(java.lang.String[] options,
java.lang.String title,
java.util.Locale locale)
EnumTemplateModel
public EnumTemplateModel(java.lang.String[] options,
java.util.Locale locale)
setDummyStartString
public void setDummyStartString(java.lang.String dummyStartString)
- Used to set a string that starts off the options.
This will very likely be something like "N/A"
setSelection
public void setSelection(java.lang.String selection)
- Sets this string as a selected string.
setSelection
public void setSelection(int index)
- Sets the string at the specified index as selected
- Throws:
ArrayIndexOutOfBoundsException
-
getAsString
public java.lang.String getAsString()
- Specified by:
getAsString
in interface freemarker.template.TemplateScalarModel
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface freemarker.template.TemplateModel
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface freemarker.template.TemplateListModel
isRewound
public boolean isRewound()
- Specified by:
isRewound
in interface freemarker.template.TemplateListModel
rewind
public void rewind()
- Specified by:
rewind
in interface freemarker.template.TemplateListModel
next
public freemarker.template.TemplateModel next()
throws freemarker.template.TemplateModelException
- Specified by:
next
in interface freemarker.template.TemplateListModel
get
public freemarker.template.TemplateModel get(java.lang.String key)
throws freemarker.template.TemplateModelException
- Specified by:
get
in interface freemarker.template.TemplateHashModel
get
public freemarker.template.TemplateModel get(int i)
throws freemarker.template.TemplateModelException
- Specified by:
get
in interface freemarker.template.TemplateListModel
listSize
public freemarker.template.TemplateModel listSize()
throws freemarker.template.TemplateModelException
- Specified by:
listSize
in interface freemarker.template.TemplateListModel