Package org.primefaces.model

Examples of org.primefaces.model.TreeNode


            AjaxBehaviorEvent behaviorEvent = (AjaxBehaviorEvent) event;

            if(eventName.equals("expand")) {
                String nodeKey = params.get(clientId + "_expand");
                this.setRowKey(nodeKey);
                TreeNode node = this.getRowNode();

                wrapperEvent = new NodeExpandEvent(this, behaviorEvent.getBehavior(), node);
                wrapperEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
            }
            else if(eventName.equals("collapse")) {
                String nodeKey = params.get(clientId + "_collapse");
                this.setRowKey(nodeKey);
                TreeNode node = this.getRowNode();

                wrapperEvent = new NodeCollapseEvent(this, behaviorEvent.getBehavior(), node);
                wrapperEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
            }
            else if(eventName.equals("select")) {
                String nodeKey = params.get(clientId + "_instantSelect");
                this.setRowKey(nodeKey);
                TreeNode node = this.getRowNode();

                wrapperEvent = new NodeSelectEvent(this, behaviorEvent.getBehavior(), node);
                wrapperEvent.setPhaseId(behaviorEvent.getPhaseId());
           
            else if(eventName.equals("unselect")) {
                String nodeKey = params.get(clientId + "_instantUnselect");
                this.setRowKey(nodeKey);
                TreeNode node = this.getRowNode();

                wrapperEvent = new NodeUnselectEvent(this, behaviorEvent.getBehavior(), node);
                wrapperEvent.setPhaseId(behaviorEvent.getPhaseId());
            }
            else if(eventName.equals("colResize")) {
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

   
    if(params.containsKey(clientId)) {
      String rowKey = params.get(clientId + "_rowKey");
      String event = params.get(clientId + "_event");
     
      TreeNode root = (TreeNode) tree.getValue();
      TreeNode currentNode = treeExplorer.findTreeNode(rowKey, new TreeModel(root));
     
      switch(TreeNodeEvent.valueOf(event)) {
        case SELECT:
          tree.queueEvent(new NodeSelectEvent(tree, currentNode));
        break;
       
        case EXPAND:
          currentNode.setExpanded(true);
          tree.queueEvent(new NodeExpandEvent(tree, currentNode));
        break;
         
        case COLLAPSE:
          currentNode.setExpanded(false);
          tree.queueEvent(new NodeCollapseEvent(tree, currentNode));
        break;
      }
    }
  }
View Full Code Here

  public void encodePartially(FacesContext facesContext, UIComponent component) throws IOException {
    Tree tree = (Tree) component;
    ResponseWriter writer = facesContext.getResponseWriter();
    Map<String,String> params = facesContext.getExternalContext().getRequestParameterMap();
    String clientId = tree.getClientId(facesContext);
    TreeNode root = (TreeNode) tree.getValue();
   
    String rowKey = params.get(clientId + "_rowKey");
    TreeNode currentNode = treeExplorer.findTreeNode(rowKey, new TreeModel(root));
    int rowIndex = 0;
   
    ServletResponse response = (ServletResponse) facesContext.getExternalContext().getResponse();
    response.setContentType("text/xml");
   
    writer.write("<nodes>");
   
    for(Iterator<TreeNode> iterator = currentNode.getChildren().iterator(); iterator.hasNext();) {
      TreeNode child = iterator.next();
     
      writer.write("<node>");
        writer.write("<label>" + child.toString() + "</label>");
        writer.write("<rowKey>" + rowKey + "." + rowIndex + "</rowKey>");
        writer.write("<isLeaf>" + child.isLeaf() + "</isLeaf>");
      writer.write("</node>");
     
      rowIndex ++;
    }
   
View Full Code Here

  protected void encodeTreeWidget(FacesContext facesContext, Tree tree) throws IOException {
    ResponseWriter writer = facesContext.getResponseWriter();
    String clientId = tree.getClientId(facesContext);
    String formClientId = null;
    String treeVar = createUniqueWidgetVar(facesContext, tree);
    TreeNode root = (TreeNode) tree.getValue();
   
    UIComponent parentForm = ComponentUtils.findParentForm(facesContext, tree);
    if(parentForm != null)
      formClientId = parentForm.getClientId(facesContext);
    else
      throw new FacesException("Tree:" + clientId + " needs to be enclosed in a form");
     
    writer.startElement("script", null);
    writer.writeAttribute("type", "text/javascript", null);
   
    writer.write("PrimeFaces.onContentReady('" + clientId + "', function() {\n");
    writer.write(treeVar + " = new PrimeFaces.widget.TreeView('" + clientId + "_container', [\n");
   
    int rowIndex = 0;
    for (Iterator<TreeNode> iterator = root.getChildren().iterator(); iterator.hasNext();) {
      encodeTreeNode(facesContext, tree, iterator.next(), String.valueOf(rowIndex));
      rowIndex ++;
     
      if(iterator.hasNext())
        writer.write(",");
View Full Code Here

    private TreeNode selectedNode;

    public BookController() {
        root = new DefaultTreeNode("Root", null);

        TreeNode chapter1 = new DefaultTreeNode(new BookTreeNode("Getting Started with PrimeFaces", null), root);
        TreeNode chapter2 = new DefaultTreeNode(new BookTreeNode("Theming Concept", null), root);
        TreeNode chapter3 = new DefaultTreeNode(new BookTreeNode("Enhanced Inputs and Selects", null), root);
        TreeNode chapter4 = new DefaultTreeNode(new BookTreeNode("Grouping Content with Panels", null), root);
        TreeNode chapter5 = new DefaultTreeNode(new BookTreeNode("Data Iteration Components", null), root);
        TreeNode chapter6 = new DefaultTreeNode(new BookTreeNode("Endless Menu Variations", null), root);
        TreeNode chapter7 = new DefaultTreeNode(new BookTreeNode("Working with Files and Images", null), root);
        TreeNode chapter8 = new DefaultTreeNode(new BookTreeNode("Drag Me, Drop Me", null), root);
        TreeNode chapter9 = new DefaultTreeNode(new BookTreeNode("Creating Charts and Maps", null), root);
        TreeNode chapter10 = new DefaultTreeNode(new BookTreeNode("Miscellaneous, Advanced Use Cases", null), root);
        TreeNode chapter11 = new DefaultTreeNode(new BookTreeNode("Writing of Custom Components", null), root);
        TreeNode chapter12 = new DefaultTreeNode(new BookTreeNode("PrimeFaces Extensions in Action", null), root);

        constructChapter1(chapter1);
        constructChapter2(chapter2);
        constructChapter3(chapter3);
        constructChapter4(chapter4);
View Full Code Here

  private TreeNode root;

  public TreeController() {
    root = new DefaultTreeNode("Root", null);

    TreeNode node0 = new DefaultTreeNode("Tree node 0", root);
    node0.setExpanded(true);

    TreeNode node1 = new DefaultTreeNode("Tree node 1", root);
    new DefaultTreeNode("Tree node 2", root);

    TreeNode node00 = new DefaultTreeNode("Tree node 0.0", node0);
    node00.setExpanded(true);

    TreeNode node01 = new DefaultTreeNode("Tree node 0.1", node0);

    TreeNode node10 = new DefaultTreeNode("Tree node 1.0", node1);
    new DefaultTreeNode("Tree node 1.1", node1);

    TreeNode node000 = new DefaultTreeNode("Tree node 0.0.0", node00);
    node000.setExpanded(true);

    new DefaultTreeNode("Tree node 0.0.1", node00);
    new DefaultTreeNode("Tree node 0.1.0", node01);

    new DefaultTreeNode("Tree node 1.0.0", node10);
View Full Code Here

    @PostConstruct
    protected void initialize() {
        root = new DefaultTreeNode("Root", null);

        TreeNode node0 = new DefaultTreeNode("Folder 0", root);
        TreeNode node1 = new DefaultTreeNode("Folder 1", root);
        TreeNode node2 = new DefaultTreeNode("Folder 2", root);
        TreeNode node00 = new DefaultTreeNode("Folder 0.0", node0);
        TreeNode node01 = new DefaultTreeNode("Folder 0.1", node0);
        TreeNode node10 = new DefaultTreeNode("Folder 1.0", node1);
        new DefaultTreeNode("File 1.1", node1);
        new DefaultTreeNode("File 2.0", node2);
        new DefaultTreeNode("File 0.0.0", node00);
        new DefaultTreeNode("File 0.0.1", node00);
        new DefaultTreeNode("File 0.1.0", node01);
View Full Code Here

    private TreeNode selectedNode;
    private TreeNode[] selectedNodes;

    public TreeController() {
        root = new DefaultTreeNode("Root", null);
        TreeNode node1 = new DefaultTreeNode("Node1", root);
        TreeNode node2 = new DefaultTreeNode("Node2", root);

        TreeNode node11 = new DefaultTreeNode("Node1.1", node1);
        TreeNode node12 = new DefaultTreeNode("Node1.2", node1);

        TreeNode node21 = new DefaultTreeNode("Node2.1", node2);
        TreeNode node211 = new DefaultTreeNode("Node2.1.1", node21);

        // tree with node types
        rootWithType = new DefaultTreeNode("node", "Root", null);
        TreeNode node1_type = new DefaultTreeNode("node", "Node1", rootWithType);
        TreeNode node2_type = new DefaultTreeNode("node", "Node2", rootWithType);

        TreeNode node11_type = new DefaultTreeNode("leaf", "Node1.1", node1_type);
        TreeNode node12_type = new DefaultTreeNode("leaf", "Node1.2", node1_type);

        TreeNode node21_type = new DefaultTreeNode("node", "Node2.1", node2_type);
        TreeNode node211_type = new DefaultTreeNode("leaf", "Node2.1.1", node21_type);
    }
View Full Code Here

    private TreeNode[] selectedItems;

    public TreeTableController() {
        root = new DefaultTreeNode("root", null);

        TreeNode node1 = new DefaultTreeNode("node", new TreeTableElement("Node1", "1st Column", "2nd Column"), root);
        TreeNode node2 = new DefaultTreeNode("node", new TreeTableElement("Node2", "1st Column", "2nd Column"), root);

        TreeNode node11 = new DefaultTreeNode("leaf", new TreeTableElement("Node1.1", "1st Column", "2nd Column"), node1);
        TreeNode node12 = new DefaultTreeNode("leaf", new TreeTableElement("Node1.2", "1st Column", "2nd Column"), node1);

        TreeNode node21 = new DefaultTreeNode("node", new TreeTableElement("Node2.1", "1st Column", "2nd Column"), node2);
        TreeNode node211 = new DefaultTreeNode("leaf", new TreeTableElement("Node2.1.1", "1st Column", "2nd Column"), node21);
    }
View Full Code Here

TOP

Related Classes of org.primefaces.model.TreeNode

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.