net.sf.chainedoptions.support
Class FirstItemStrategy

java.lang.Object
  extended by net.sf.chainedoptions.support.FirstItemStrategy
All Implemented Interfaces:
ChainedOptionStrategy

public class FirstItemStrategy
extends java.lang.Object
implements ChainedOptionStrategy

A ChainedOptionStrategy that adds no extra items and returns the first in the option list as default value.

Author:
Mattias Arthursson

Constructor Summary
FirstItemStrategy()
           
 
Method Summary
 java.util.List adjustAndSort(java.util.List options, java.lang.Object context)
          Just sort the options for this implementation.
 java.lang.String getDefaultValue(java.util.List options, java.lang.Object context)
          Return the value of the first item as default value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FirstItemStrategy

public FirstItemStrategy()
Method Detail

adjustAndSort

public java.util.List adjustAndSort(java.util.List options,
                                    java.lang.Object context)
Just sort the options for this implementation.

Specified by:
adjustAndSort in interface ChainedOptionStrategy
Parameters:
options - the options to sort.
context - ignored for this implementation.
Returns:
a new Sorted list containing the options.
See Also:
LabelValueBean

getDefaultValue

public java.lang.String getDefaultValue(java.util.List options,
                                        java.lang.Object context)
Return the value of the first item as default value. If the list is empty, return empty String.

Specified by:
getDefaultValue in interface ChainedOptionStrategy
Parameters:
options - the list of options.
context - ignored for this implementation.
Returns:
the value of the first item in the List if the List is not empty, empty String otherwise.


Copyright ? 2005. All Rights Reserved.