org.apache.cocoon.forms.datatype
Class JavaScriptSelectionListBuilder

java.lang.Object
  extended by org.apache.cocoon.forms.datatype.JavaScriptSelectionListBuilder
All Implemented Interfaces:
Contextualizable, SelectionListBuilder

public class JavaScriptSelectionListBuilder
extends Object
implements SelectionListBuilder, Contextualizable

Builds a selection list that will take its values from a JavaScript snippet. The snippet runs in scope where the list filter (if any) and the view data are available as filter and viewData respectively, along with all flowscript functions. It must return a list of (value, label) pairs.

If an item has no label, its value is used as the label. If the declaration has a catalogue attribute, the labels are interpreted as i18n keys in that catalogue.

Example:

   <fd:selection-list type="flow-function">
     return [ {value: 3, label: "three"}, {value:4} ];
   </fd:selection-list>
 

Since:
2.1.9
Version:
$Id: JavaScriptSelectionListBuilder.html 1304258 2012-03-23 10:09:27Z ilgrosso $
See Also:
JavaScriptSelectionList

Field Summary
 
Fields inherited from interface org.apache.cocoon.forms.datatype.SelectionListBuilder
ROLE
 
Constructor Summary
JavaScriptSelectionListBuilder()
           
 
Method Summary
 SelectionList build(Element selectionListElement, Datatype datatype)
           
 void contextualize(Context context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaScriptSelectionListBuilder

public JavaScriptSelectionListBuilder()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

build

public SelectionList build(Element selectionListElement,
                           Datatype datatype)
                    throws Exception
Specified by:
build in interface SelectionListBuilder
Throws:
Exception


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.