Package org.primefaces.model

Examples of org.primefaces.model.TreeModel


   
    if(params.containsKey(clientId) && params.containsKey(rowKeyParam) && params.containsKey(actionParam)) {
      String rowKey = params.get(rowKeyParam);
      String event = params.get(actionParam);
      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;
      }
    }
   
    //Selection
    if(params.containsKey(selectionParam)) {
      String selectedNodesValue = params.get(selectionParam);
      boolean isSingle = tree.getSelectionMode().equalsIgnoreCase("single");
     
      if(selectedNodesValue.equals("")) {
        if(isSingle)
          tree.setSelection(null);
        else
          tree.setSelection(new TreeNode[0]);
      }
      else {
        String[] selectedRowKeys = selectedNodesValue.split(",");
        TreeModel model = new TreeModel((TreeNode) tree.getValue());
       
        if(isSingle) {
          TreeNode selectedNode = treeExplorer.findTreeNode(selectedRowKeys[0], model);
          tree.setSelection(selectedNode);
         
        } else {
          TreeNode[] selectedNodes = new TreeNode[selectedRowKeys.length];

          for(int i = 0 ; i < selectedRowKeys.length; i++) {
            selectedNodes[i] = treeExplorer.findTreeNode(selectedRowKeys[i], model);
            model.setRowIndex(-1)//reset
          }
         
          tree.setSelection(selectedNodes);
        }
      }
View Full Code Here


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

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

   
    if(params.containsKey(clientId) && params.containsKey(rowKeyParam) && params.containsKey(actionParam)) {
      String rowKey = params.get(rowKeyParam);
      String event = params.get(actionParam);
      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;
      }
    }
   
    if(params.containsKey(selectionParam)) {
      String selectedNodesValue = params.get(selectionParam);
     
      if(selectedNodesValue.equals(""))
        tree.setSelection(new TreeNode[0]);
      else {
        String[] selectedRowKeys = selectedNodesValue.split(",");
        TreeNode[] selectedNodes = new TreeNode[selectedRowKeys.length];
        TreeModel model = new TreeModel((TreeNode) tree.getValue());
       
        for(int i = 0 ; i < selectedRowKeys.length; i++) {
          selectedNodes[i] = treeExplorer.findTreeNode(selectedRowKeys[i], model);
          model.setRowIndex(-1)//reset
        }
       
        tree.setSelection(selectedNodes);
      }
    }
View Full Code Here

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

TOP

Related Classes of org.primefaces.model.TreeModel

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.