public String getContent(RunData data, String name, String value, Map parms)
{
init(data);
Select select = null;
if ( layout.equalsIgnoreCase(LAYOUT_LIST) )
{
select = new Select(name, new Integer(size).intValue());
} else
{
select = new Select(name);
}
if ( multiple )
{
select.setMultiple(multiple);
}
if ( items != null )
{
boolean sort = new Boolean((String)this.getParm(SORT, "false")).booleanValue();
if ( sort )
{
Arrays.sort(items);
}
for ( int i=0; i < items.length; i++ )
{
Option option = new Option(items[i]).addElement(items[i]);
if (multiple)
{
option.setSelected(value.indexOf(items[i]) >= 0);
}
else
{
option.setSelected(items[i].equalsIgnoreCase(value));
}
select.addElement(option);
}
}
// If no items to display, do not display empty control
boolean nullIfEmpty = new Boolean((String)this.getParm(NULL_IF_EMPTY, "false")).booleanValue();
if ( this.items == null || (nullIfEmpty && items.length == 0) )
{
return null;
}
return select.toString();
}