parentNode = parentNode.getParent();
}
}
// convert elements views into menu elements
DefaultMenuOptionsDefinition defaultMenuOptionsDefinition = null;
ListIterator elementViewsIter = elementViews.listIterator();
while (elementViewsIter.hasNext())
{
Node elementView = (Node)elementViewsIter.next();
MenuElement menuElement = null;
// convert folders into nested menus if depth specified
// with no paths expansion, (negative depth values are
// interpreted as complete menu expansion)
if ((elementView instanceof Folder) && ((depth < 0) || (depth > 1)) && !paths)
{
// construct menu definition and associated menu
MenuDefinition nestedMenuDefinition = new DefaultMenuDefinition(elementView.getUrl(), depth - 1, locatorName);
menuElement = new MenuImpl(view, this, nestedMenuDefinition, null, context, null);
}
else
{
// construct shared default menu option definition and menu option
if (defaultMenuOptionsDefinition == null)
{
defaultMenuOptionsDefinition = new DefaultMenuOptionsDefinition(options, depth, paths, regexp, locatorName, order);
}
menuElement = new MenuOptionImpl(view, this, elementView, defaultMenuOptionsDefinition);
}
// replace element view with menu element