}
}
else
{
// Gather the children
DataObjectList links = LinkDataObject.getLinkDataList(context,
navBar);
MarlinBean choice = new MarlinBean(CHOICE_NAME);
int maxVisited = (int) currentValue;
Object maxVisitedObj = navBar.getAttributeValue(context,
MAX_VISITED_ATTR);
if (maxVisitedObj instanceof Number)
maxVisited = ((Number) maxVisitedObj).intValue();
// Sanity check the "maxVisited" attribute
maxVisited = Math.min(maxVisited,
links == null ? 0 : links.getLength());
// Add one option per link, but only go up to the "maxVisited"
// value. (BTW, since maxVisited is 1-indexed, but i is 0-indexed,
// this is an _inclusive_ range here)
for (int i = 0; i < maxVisited; i++)
{
DataObject link = links.getItem(i);
MarlinBean option = new MarlinBean(OPTION_NAME);
option.setAttributeValue(TEXT_ATTR,
link.selectValue(context, TEXT_ATTR));
option.setAttributeValue(VALUE_ATTR, IntegerUtils.getString(i + 1));