Package org.primefaces.model

Examples of org.primefaces.model.TreeNodeChildren


     *
     * @param node Node instance whose children to be sorted
     * @param comparator Comparator to use in sorting
     */
    public static void sortNode(TreeNode node, Comparator comparator) {
        TreeNodeChildren children = (TreeNodeChildren) node.getChildren();
       
        if(children != null && !children.isEmpty()) {
            Object[] childrenArray = children.toArray();
            Arrays.sort(childrenArray, comparator);
            for(int i = 0; i < childrenArray.length; i++) {
                children.setSibling(i, (TreeNode) childrenArray[i]);
            }
           
            for(int i = 0; i < children.size(); i++) {
                sortNode(children.get(i), comparator);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.primefaces.model.TreeNodeChildren

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.