Package org.primefaces.model

Examples of org.primefaces.model.DefaultTreeNode


    @Mocked DataTable groupsDataTable;


    @Test
    public void testLoadNamespace() throws Exception {
        final TreeNode newContent = new DefaultTreeNode();
        newContent.setSelected(false);
        final TreeNode selectedNode = new DefaultTreeNode();
        selectedNode.setSelected(true);
        final List<Content> contentList = new ArrayList<Content>();
        contentList.add(new Content());
        new NonStrictExpectations() {{
            facesContext.getPartialViewContext(); result = partialViewContext;
            partialViewContext.isAjaxRequest(); result = false;
            theTree.getContentHolder(); result = contentHolder;
            contentHolder.find(new ContentKey(null, "namespace", "namespace")); result = newContent;
            theTree.getSelectedNode(); result = selectedNode;
            pageContent.getNamespace(); result = Namespace.createFromString("net.tralfamadore");
            pageContent.getNamespaceContents(); result = new Vector<BaseContent>();
            theTree.getContentManager(); result = contentManager;
            contentManager.loadContent((Namespace)any); result = contentList;
        }};
        pageContent.setNamespaceContents(new ArrayList<BaseContent>());
        adminController.setIncomingNamespace("namespace");
        adminController.pageContent = new PageContent();
        adminController.pageContent.setTheContent(Namespace.createFromString("net.tralfamadore"));
        adminController.loadNamespace();

        assertTrue(newContent.isSelected());
        assertFalse(selectedNode.isSelected());

        assertEquals(1, pageContent.getNamespaceContents().size());
    }
View Full Code Here


        assertEquals(1, pageContent.getNamespaceContents().size());
    }

    @Test
    public void testLoadTopLevelNamespace() throws Exception {
        final TreeNode newContent = new DefaultTreeNode();
        newContent.setSelected(false);
        final TreeNode selectedNode = new DefaultTreeNode();
        selectedNode.setSelected(true);
        final List<Content> contentList = new ArrayList<Content>();
        contentList.add(new Content());
        new NonStrictExpectations() {{
            facesContext.getPartialViewContext(); result = partialViewContext;
            partialViewContext.isAjaxRequest(); result = false;
            theTree.getContentHolder(); result = contentHolder;
            contentHolder.find(new ContentKey(null, "namespace", "namespace")); result = newContent;
            theTree.getSelectedNode(); result = selectedNode;
            pageContent.getNamespace(); result = Namespace.createFromString("net");
            pageContent.getNamespaceContents(); result = new Vector<BaseContent>();
            theTree.getContentManager(); result = contentManager;
            contentManager.loadContent((Namespace) any); result = contentList;
            contentManager.loadChildNamespaces((Namespace) any); result = Collections.emptyList();
        }};
        pageContent.setNamespaceContents(new ArrayList<BaseContent>());
        adminController.setIncomingNamespace("namespace");
        adminController.pageContent = new PageContent();
        adminController.pageContent.setTheContent(Namespace.createFromString("net"));
        adminController.loadNamespace();

        assertTrue(newContent.isSelected());
        assertFalse(selectedNode.isSelected());

        assertEquals(2, pageContent.getNamespaceContents().size());
    }
View Full Code Here

        assertEquals(2, pageContent.getNamespaceContents().size());
    }

    @Test
    public void testLoadContent() throws Exception {
        final TreeNode newContent = new DefaultTreeNode();
        newContent.setSelected(false);
        final TreeNode selectedNode = new DefaultTreeNode();
        selectedNode.setSelected(true);
        new NonStrictExpectations() {{
            facesContext.getPartialViewContext(); result = partialViewContext;
            partialViewContext.isAjaxRequest(); result = false;
            theTree.getContentHolder(); result = contentHolder;
            contentHolder.find(new ContentKey("content", "namespace", "content")); result = newContent;
            theTree.getSelectedNode(); result = selectedNode;
        }};
        adminController.setIncomingContentName("content");
        adminController.setIncomingNamespace("namespace");
        adminController.loadContent();
        assertTrue(newContent.isSelected());
        assertFalse(selectedNode.isSelected());
    }
View Full Code Here

        }};
    }

    @Test
    public void testLoadStyle() throws Exception {
        final TreeNode newContent = new DefaultTreeNode();
        newContent.setSelected(false);
        final TreeNode selectedNode = new DefaultTreeNode();
        selectedNode.setSelected(true);
        new NonStrictExpectations() {{
            facesContext.getPartialViewContext(); result = partialViewContext;
            partialViewContext.isAjaxRequest(); result = false;
            theTree.getContentHolder(); result = contentHolder;
            contentHolder.find(new ContentKey("style", "namespace", "style")); result = newContent;
            theTree.getSelectedNode(); result = selectedNode;
        }};
        adminController.setIncomingContentName("style");
        adminController.setIncomingNamespace("namespace");
        adminController.loadStyle();
        assertTrue(newContent.isSelected());
        assertFalse(selectedNode.isSelected());
    }
View Full Code Here

    }

    @SuppressWarnings({"unchecked"})
    @Test
    public void testFetchNamespaceContents() throws Exception {
        final TreeNode newContent = new DefaultTreeNode();
        newContent.setSelected(false);
        final TreeNode selectedNode = new DefaultTreeNode();
        selectedNode.setSelected(true);
        final List<Content> contentList = new ArrayList<Content>();
        contentList.add(new Content());
        new NonStrictExpectations() {
            Namespace namespace;
            List<BaseContent> namespaceContents;
            {
                facesContext.getPartialViewContext(); result = partialViewContext;
                partialViewContext.isAjaxRequest(); result = false;
                theTree.getContentHolder(); result = contentHolder;
                contentHolder.find(new ContentKey(null, "namespace", "namespace")); result = newContent;
                newContent.getData(); result = namespace;
                selectedNode.getData(); result = namespace;
                theTree.getSelectedNode(); result = selectedNode;
                pageContent.getNamespaceContents(); result = new Vector<BaseContent>();
                theTree.getContentManager(); result = contentManager;
                contentManager.loadContent((Namespace)any); result = contentList;
View Full Code Here

        if(namespace.getParent() != null)
            parentKey = new ContentKey(null, namespace.getParent().getFullName(), "namespace");

        TreeNode parent = allContent.get(parentKey);
        parent = parent == null ? rootNode : parent;
        TreeNode newNode = new DefaultTreeNode("namespace", namespace, parent);
        newNode.setExpanded(true);
        namespace.setTreeNode(newNode);
        allContent.put(contentKey, newNode);
    }
View Full Code Here

    public void add(Content content) {
        ContentKey contentKey = new ContentKey(content.getName(), content.getNamespace().getFullName(), "content");
        ContentKey parentKey = new ContentKey(null, content.getNamespace().getFullName(), "namespace");

        TreeNode parent = allContent.get(parentKey);
        TreeNode newNode = new DefaultTreeNode("content", content, parent);
        newNode.setExpanded(true);
        content.setTreeNode(newNode);
        allContent.put(contentKey, newNode);
    }
View Full Code Here

    public void add(Style style) {
        ContentKey contentKey = new ContentKey(style.getName(), style.getNamespace().getFullName(), "style");
        ContentKey parentKey = new ContentKey(null, style.getNamespace().getFullName(), "namespace");

        TreeNode parent = allContent.get(parentKey);
        TreeNode newNode = new DefaultTreeNode("style", style, parent);
        style.setTreeNode(newNode);
        newNode.setExpanded(true);
        if(!allContent.containsKey(contentKey))
            allContent.put(contentKey, newNode);
    }
View Full Code Here

    private TreeNode root;
    private TreeNode selectedNode;

    public TheTree() {
        root = new DefaultTreeNode("Root", null);
    }
View Full Code Here

@ManagedBean(name = "documentService")
@ApplicationScoped
public class DocumentService {
    
    public TreeNode createDocuments() {
        TreeNode root = new DefaultTreeNode(new Document("-", "Files", "-", "Folder", "-", "-", "-"), null);
        
        TreeNode nivel1 = new DefaultTreeNode(new Document("Financeira", "-", "-", "-", "-", "-", "-"), root);
        TreeNode nivel2 = new DefaultTreeNode(new Document("Clientes/Cooperados", "-", "-", "-", "-", "-", "-"), root);
        TreeNode nivel3 = new DefaultTreeNode(new Document("Processos", "-", "-", "-", "-", "-", "-"), root);
        TreeNode nivel4 = new DefaultTreeNode(new Document("Pessoas/conhecimento", "-", "-", "-", "-", "-", "-"), root);
        
        TreeNode sub1_1 = new DefaultTreeNode(new Document("-", "Redução de custos operacionais", "Indice  de custos e despesas por boletim", "5%", "0", "Finanças", "Reduzir os custos  dos boletins."), nivel1);
        TreeNode sub1_2 = new DefaultTreeNode(new Document("-", "Redução da inadimplencia", "Percentual  de inadimplência dos convênios", "5%", "0", "Finanças", "Plano de recupeção de credito"), nivel1);
        TreeNode sub1_3 = new DefaultTreeNode(new Document("-", "Aumento do faturamento", "Reajuste percentual de contratos por convênio", "70%", "0", "Convênio", "Renovar contratos com valores da CBHPM 2012"), nivel1);
       
       
        TreeNode sub2_1 = new DefaultTreeNode(new Document("-", "Promover o uso do Anestesix", "Índice de boletins digitados online", "70%", "25%", "TI", "-"), nivel2);
        TreeNode sub2_2 = new DefaultTreeNode(new Document("-", "Sistema de protocolo", "Número de protocolo de manifestações dos cooperados", "100%", "0%", "Cooperado", "Renovar contratos com valores da CBHPM 2012"), nivel2);
      
        TreeNode sub2_1_1 = new DefaultTreeNode(new Document("-", "-", "-", "-", "-", "-", "Criar vídeo tutorial explanando as opções do sistema e como utilizá-lo"), sub2_1);
        TreeNode sub2_1_2 = new DefaultTreeNode(new Document("-", "-", "-", "-", "-", "-", "Visitar grandes serviços para expor pessoalmente os benefícios da digitação online"), sub2_1);
        TreeNode sub2_1_3 = new DefaultTreeNode(new Document("-", "-", "-", "-", "-", "-", "Criar central de atendimento a dúvidas e sugestões"), sub2_1);
        TreeNode sub2_1_4 = new DefaultTreeNode(new Document("-", "-", "-", "-", "-", "-", "Padronizar processo de geração de login e senha para o Anestesix"), sub2_1);
        TreeNode sub2_1_5 = new DefaultTreeNode(new Document("-", "-", "-", "-", "-", "-", "Criar local para informar das atualizações no sistema e das novas funcionalidades"), sub2_1);
      
        TreeNode subb = new DefaultTreeNode(new Document("teste"), sub2_1);
                
        return root;
    }
View Full Code Here

TOP

Related Classes of org.primefaces.model.DefaultTreeNode

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.