org.apache.cocoon.forms.datatype
Class EnumSelectionList

java.lang.Object
  extended byorg.apache.cocoon.forms.datatype.EnumSelectionList
All Implemented Interfaces:
SelectionList

public class EnumSelectionList
extends Object
implements SelectionList

This type of selection list outputs a list of items corresponding to the possible instances of an EnumType.

Example usage:

 <fd:selection-list type="enum" class="com.example.Sex"/>
 

Produces the following output:

 <fi:selection-list>
   <fi:item value=""/>
   <fi:item value="com.example.Sex.MALE">
     <fi:label>
       <i18n:text>com.example.Sex.MALE</i18n:text>
     </fi:label>
   </fi:item>
   <fi:item value="com.example.Sex.FEMALE">
     <fi:label>
       <i18n:text>com.example.Sex.FEMALE</i18n:text>
     </fi:label>
   </fi:item>
 </fi:selection-list>
 

If you don't want an initial null value, add a nullable="false" attribute to the fd:selection-list element.

Version:
$Id: EnumSelectionList.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
static String TEXT_EL
           
 
Fields inherited from interface org.apache.cocoon.forms.datatype.SelectionList
ITEM_EL, LABEL_EL, SELECTION_LIST_EL
 
Constructor Summary
EnumSelectionList(String className, Datatype datatype, boolean nullable)
           
EnumSelectionList(String className, Datatype datatype, boolean nullable, String nullText)
           
 
Method Summary
 void generateSaxFragment(ContentHandler contentHandler, Locale locale)
           
 Datatype getDatatype()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT_EL

public static final String TEXT_EL
See Also:
Constant Field Values
Constructor Detail

EnumSelectionList

public EnumSelectionList(String className,
                         Datatype datatype,
                         boolean nullable)
                  throws ClassNotFoundException
Parameters:
className -
datatype -

EnumSelectionList

public EnumSelectionList(String className,
                         Datatype datatype,
                         boolean nullable,
                         String nullText)
                  throws ClassNotFoundException
Method Detail

getDatatype

public Datatype getDatatype()
Specified by:
getDatatype in interface SelectionList

generateSaxFragment

public void generateSaxFragment(ContentHandler contentHandler,
                                Locale locale)
                         throws SAXException
Specified by:
generateSaxFragment in interface SelectionList
Throws:
SAXException


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.