Package org.apache.jetspeed.om.folder

Examples of org.apache.jetspeed.om.folder.MenuDefinition


    }

    protected void menuActions(String action, String options, OptionsDefinitionBean element)
    {
        SiteTreeNode node = getUserSelectedNode();
        MenuDefinition definition = getMenuDefinition();
        MenuOptionsDefinition oldElement = getOptionsDefinition(options);
        MenuOptionsDefinition newElement = getOptionsDefinition(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);
        }
View Full Code Here


        getMenuElements(definition, MenuElement.OPTION_ELEMENT_TYPE);
    }

    protected void menuActions(String action, String name, JetspeedMenuDefinition element)
    {
        MenuDefinition oldElement = getDefinition(name);
        SiteTreeNode node = getUserSelectedNode();
        MenuDefinition newElement = getMenuDefinition(document.getType(), element);
        if (oldElement != null && oldElement.getMenuElements() != null)
        {
            newElement.setMenuElements(oldElement.getMenuElements());
        }
        if (node.getDocType() == FileType.Folder)
        {
            Folder folder = getJetspeedFolder(node.getNodePath());
            List menuList = folder.getMenuDefinitions();
View Full Code Here

    }

    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);
        }
View Full Code Here

    }

    protected void menuActions(String action, String name, IncludesDefinitionBean element)
    {
        SiteTreeNode node = getUserSelectedNode();
        MenuDefinition definition = getMenuDefinition();
        MenuIncludeDefinition oldElement = getIncludesDefinition(name);
        MenuIncludeDefinition newElement = getIncludesDefinition(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);
        }
View Full Code Here

    }

    protected void menuActions(String action, String name, ExcludesDefinitionBean element)
    {
        SiteTreeNode node = getUserSelectedNode();
        MenuDefinition definition = getMenuDefinition();
        MenuExcludeDefinition oldElement = getExcludeDefinition(name);
        MenuExcludeDefinition newElement = getExcludesDefinition(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);
        }
View Full Code Here

        return null;
    }
   
    public MenuDefinition getDefinition(String name)
    {
        MenuDefinition definition = null;
        boolean found = true;
        try
        {
            if (document.getType().equals(PortalSiteManager.FOLDER_NODE_TYPE))
            {
View Full Code Here

    private MenuDefinition getMenu(List menuDefinitions,String name)
    {
        for (int index = 0; index < menuDefinitions.size(); index++)
        {
            MenuDefinition definition = (MenuDefinition) menuDefinitions.get(index);
            if (definition.getName().equals(name))
            {
                return definition;
            }
        }
        if (document.getType().equals(PortalSiteManager.PAGE_NODE_TYPE))
View Full Code Here

        return getServiceLocator().getPageManager().newFolderMenuDefinition();
    }
   
    private MenuDefinition getMenuDefinition(String type,JetspeedMenuDefinition menuDefinition)
    {       
        MenuDefinition definition = null;
        if (document.getType().equals(PortalSiteManager.PAGE_NODE_TYPE))
        {
            definition =  getServiceLocator().getPageManager().newPageMenuDefinition();
        }else{
            definition = getServiceLocator().getPageManager().newFolderMenuDefinition();   
        }
        definition.setDepth(menuDefinition.getDepth());
        definition.setName(menuDefinition.getName());
        definition.setOptions(menuDefinition.getOptions());
        definition.setOrder(menuDefinition.getOrder());
        definition.setPaths(menuDefinition.isPaths());
        definition.setRegexp(menuDefinition.isRegexp());
        definition.setTitle(menuDefinition.getTitle());
        definition.setShortTitle(menuDefinition.getShortTitle());
        definition.setSkin(menuDefinition.getSkin());
        definition.setProfile(menuDefinition.getProfile());       
        return definition;
    }
View Full Code Here

    }

    private void getMenus(JetspeedDocument document,
            DefaultMutableTreeNode menuNode)
    {
        MenuDefinition definitaion = null;
        DefaultMutableTreeNode menu = null;
        List menuDefinitions = null;
        if (getUserSelectedNode().getDocType() == FileType.Folder)
        {
            menuDefinitions = getJetspeedFolder(document.getPath())
                    .getMenuDefinitions();
        } else
        {
            menuDefinitions = getJetspeedPage(document.getPath())
                    .getMenuDefinitions();
        }
        if (menuDefinitions == null || menuDefinitions.size() == 0) { return; }
        Iterator menuItreator = menuDefinitions.iterator();
        while (menuItreator.hasNext())
        {
            definitaion = (MenuDefinition) menuItreator.next();
            menu = new DefaultMutableTreeNode(new MenuTreeNode(definitaion.getName(),document.getPath(),document.getType(),getServiceLocator()));
            menuNode.add(menu);
        }
    }
View Full Code Here

    {
        PageManager pageManger = getServiceLocator().getPageManager();
        if (srcElement instanceof MenuDefinition)
        {
            // create the new menu element and copy attributes
            MenuDefinition source = (MenuDefinition) srcElement;
            MenuDefinition menu = null;
            if (type.equals(PAGE_NODE_TYPE))
            {
                menu = pageManger.newPageMenuDefinition();
            } else if (type.equals(FOLDER_NODE_TYPE))
            {
                menu = pageManger.newFolderMenuDefinition();
            }
            menu.setDepth(source.getDepth());
            menu.setName(source.getName());
            menu.setOptions(source.getOptions());
            menu.setOrder(source.getOrder());
            menu.setPaths(source.isPaths());
            menu.setProfile(source.getProfile());
            menu.setRegexp(source.isRegexp());
            menu.setShortTitle(source.getShortTitle());
            menu.setSkin(source.getSkin());
            menu.setTitle(source.getTitle());
            // copy locale specific metadata
            menu.getMetadata().copyFields(source.getMetadata().getFields());
            // recursively copy menu elements
            List elements = source.getMenuElements();
            if (elements != null)
            {
                List copiedElements = new ArrayList();
                Iterator elementsIter = elements.iterator();
                while (elementsIter.hasNext())
                {
                    Object element = elementsIter.next();
                    Object copiedElement = copyMenuElement(type, element);
                    if (copiedElement != null)
                    {
                        copiedElements.add(copiedElement);
                    }
                }
                menu.setMenuElements(copiedElements);
            }
            return menu;
        } else if (srcElement instanceof MenuExcludeDefinition)
        {
            // create the new menu exclude element and copy attributes
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.folder.MenuDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.