Package org.primefaces.model

Examples of org.primefaces.model.TreeNode


    writer.endElement("thead");
  }
      
    protected void encodeTbody(FacesContext context, TreeTable tt, boolean dataOnly) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    TreeNode root = (TreeNode) tt.getValue();
        String clientId = tt.getClientId(context);
    boolean empty = (root == null || root.getChildCount() == 0);
        UIComponent emptyFacet = tt.getFacet("emptyMessage");
       
        if(!dataOnly) {
            writer.startElement("tbody", null);
            writer.writeAttribute("id", clientId + "_data", null);
View Full Code Here


               
        encodeTbody(context, tt, true);
    }
   
    public void sort(TreeTable tt) {
        TreeNode root = tt.getValue();
        if(root == null)
            return;
       
        ValueExpression sortByVE = tt.getValueExpression("sortBy");
        SortOrder sortOrder = SortOrder.valueOf(tt.getSortOrder().toUpperCase(Locale.ENGLISH));
View Full Code Here

        }
       
        if(tree.isCheckboxSelection() && tree.isDynamic() && tree.isSelectionRequest(context)) {
            String selectedNodeRowKey = params.get(clientId + "_instantSelection");
            tree.setRowKey(selectedNodeRowKey);
            TreeNode selectedNode = tree.getRowNode();
            List<String> descendantRowKeys = new ArrayList<String>();
            tree.populateRowKeys(selectedNode, descendantRowKeys);
            int size = descendantRowKeys.size();
            StringBuilder sb = SharedStringBuilder.get(context, SB_DECODE_SELECTION);
           
View Full Code Here

        String clientId = tree.getClientId(context);
        String dragNodeRowKey = params.get(clientId + "_dragNode");
        String dropNodeRowKey = params.get(clientId + "_dropNode");
        String dragSource = params.get(clientId + "_dragSource");
        int dndIndex = Integer.parseInt(params.get(clientId + "_dndIndex"));
        TreeNode dragNode;
        TreeNode dropNode;
       
        if(dragSource.equals(clientId)) {
            tree.setRowKey(dragNodeRowKey);
            dragNode = tree.getRowNode();
        }
        else {
            Tree otherTree = (Tree) tree.findComponent(":" + dragSource);
            otherTree.setRowKey(dragNodeRowKey);
            dragNode = otherTree.getRowNode();
        }
       
        if(isValueBlank(dropNodeRowKey)) {
            dropNode = tree.getValue();
        }
        else {
            tree.setRowKey(dropNodeRowKey);
            dropNode = tree.getRowNode();
        }
       
        tree.setDragNode(dragNode);
        tree.setDropNode(dropNode);
       
        if(dndIndex >= 0 && dndIndex < dropNode.getChildCount())
            dropNode.getChildren().add(dndIndex, dragNode);
        else
            dropNode.getChildren().add(dragNode);
    }
View Full Code Here

            if(!vertical && rowKey.equals("root")) {
                encodeHorizontalTreeNodeChildren(context, tree, tree.getValue(), tree.getClientId(context), null, tree.isDynamic(), tree.isCheckboxSelection(), tree.isShowUnselectableCheckbox());
            }
            else {
                tree.setRowKey(rowKey);
                TreeNode node = tree.getRowNode();
                node.setExpanded(true);
               
                if(vertical) {
                    encodeTreeNodeChildren(context, tree, node, clientId, tree.isDynamic(), tree.isCheckboxSelection(), tree.isDroppable(), tree.isShowUnselectableCheckbox());
                }
                else {
View Full Code Here

        wb.finish();
  }
 
  protected void encodeMarkup(FacesContext context, Tree tree) throws IOException {
    boolean vertical = tree.getOrientation().equals("vertical");
        TreeNode root = (TreeNode) tree.getValue();
       
        if(root != null && root.getRowKey() == null) {
            root.setRowKey("root");
            tree.buildRowKeys(root);
            tree.initPreselection();
        }
   
        if(vertical)
View Full Code Here

   
    public void updateRowKeys(TreeNode node) {
        int childCount = node.getChildCount();
        if(childCount > 0) {
            for(int i = 0; i < childCount; i++) {
                TreeNode childNode = node.getChildren().get(i);

                String childRowKey = (node.getParent() == null) ? String.valueOf(i) : node.getRowKey() + "_" + i;
                childNode.setRowKey(childRowKey);
                updateRowKeys(childNode);
            }
        }
    }
View Full Code Here

   
    private void updateSelectedNodes(TreeNode node) {
        int childCount = node.getChildCount();
        if(childCount > 0) {
            for(int i = 0; i < childCount; i++) {
                TreeNode childNode = node.getChildren().get(i);
                if(childNode.isSelected()) {
                    addToPreselection(childNode);
                }

                updateSelectedNodes(childNode);
            }
View Full Code Here

            }
        }
    }
   
    public void refreshSelectedNodeKeys() {
        TreeNode root = this.getValue();
        this.preselection = null;
        updateSelectedNodes(root);
        initPreselection();
    }
View Full Code Here

        Object selection = this.getSelection();
        String selectionMode = this.getSelectionMode();
       
        if(selection != null) {
            if(selectionMode.equals("single")) {
                TreeNode node = (TreeNode) selection;
                value = node.getRowKey();
            }
            else {
                TreeNode[] nodes = (TreeNode[]) selection;
                StringBuilder builder = SharedStringBuilder.get(SB_GET_SELECTED_ROW_KEYS_AS_STRING);
               
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.