/*
* (non-Javadoc)
* @see de.odysseus.calyxo.base.taglib.html.AbstractTag#getBodyContent()
*/
public String getBodyContent() throws Exception {
ListModel listModel = selectTag.getListModel();
GroupModel groupModel = selectTag.getGroupModel();
int order = getListModelOrder();
boolean descend = sort.startsWith("-");
Locale locale = I18nSupport.getInstance(pageContext).getLocale(pageContext);
Iterator values = listModel.getValues(order, descend, locale);
StringBuffer s = new StringBuffer();
while (values.hasNext()) {
Object value = values.next();
String key = listModel.getKey(value);
s.append("<option");
s.append(" value=\"");
s.append(key);
s.append("\"");
if (groupModel.isSelected(key)) {
s.append(" selected=\"selected\"");
} else if (!groupModel.isSelectionAvailable()) {
if (key.equals(this.key) || keys != null && keys.contains(key)) {
s.append(" selected=\"selected\"");
}
}
appendAttributes(s);
s.append(">");
s.append(listModel.getLabel(value, locale));
s.append("</option>");
}
return s.toString();
}