}
protected void menuActions(String action, String name, SeparatorDefinitionBean element)
{
SiteTreeNode node = getUserSelectedNode();
MenuDefinition definition = getMenuDefinition();
MenuSeparatorDefinition oldElement = getSeparatorDefinition(element.getText());
MenuSeparatorDefinition newElement = getSeparatorDefinition(element);
if (node.getDocType() == FileType.Folder)
{
Folder folder = getJetspeedFolder(node.getNodePath());
List menuList = folder.getMenuDefinitions();
if (action.equals(SAVE_ACTION))
{
menuList.remove(definition);
if(definition.getMenuElements()!=null)
{
definition.getMenuElements().remove(oldElement);
definition.getMenuElements().add(newElement);
}else{
List elements = new ArrayList();
elements.add(newElement);
definition.setMenuElements(elements);
}
menuList.add(definition);
}
else if (action.equals(REMOVE_ACTION))
{
menuList.remove(definition);
definition.getMenuElements().remove(oldElement);
menuList.add(definition);
}
folder.setMenuDefinitions(menuList);
folderAction(folder, SAVE_ACTION);
}
else if (node.getDocType() == FileType.Page)
{
Page page = getJetspeedPage(node.getNodePath());
List menuList = page.getMenuDefinitions();
if (action.equals(SAVE_ACTION))
{
menuList.remove(definition);
if(definition.getMenuElements()!=null)
{
definition.getMenuElements().remove(oldElement);
definition.getMenuElements().add(newElement);
}else{
List elements = new ArrayList();
elements.add(newElement);
definition.setMenuElements(elements);
}
menuList.add(definition);
}
else if (action.equals(REMOVE_ACTION))
{
menuList.remove(definition);
definition.getMenuElements().remove(oldElement);
menuList.add(definition);
}
page.setMenuDefinitions(menuList);
PageAction(page, SAVE_ACTION);
}