Search in sources :

Example 1 with UITreeNode

use of org.primefaces.component.tree.UITreeNode in project primefaces by primefaces.

the class UITree method visitColumns.

private boolean visitColumns(VisitContext context, Lazy<TreeNode> root, VisitCallback callback, String rowKey, boolean visitNodes) {
    String treeNodeType = null;
    if (visitNodes) {
        setRowKey(root, rowKey);
        if (rowKey == null) {
            return false;
        }
        TreeNode rowNode = getRowNode();
        if (rowNode != null) {
            treeNodeType = rowNode.getType();
        }
    }
    if (getChildCount() > 0) {
        for (UIComponent child : getChildren()) {
            if (child instanceof Columns) {
                Columns columns = (Columns) child;
                for (int i = 0; i < columns.getRowCount(); i++) {
                    columns.setRowIndex(i);
                    boolean value = visitColumnContent(context, callback, columns);
                    if (value) {
                        columns.setRowIndex(-1);
                        return true;
                    }
                }
                columns.setRowIndex(-1);
            } else if (child instanceof UIColumn) {
                if (child instanceof UITreeNode) {
                    UITreeNode uiTreeNode = (UITreeNode) child;
                    if (visitNodes && treeNodeType != null && !treeNodeType.equals(uiTreeNode.getType())) {
                        continue;
                    }
                }
                if (child.visitTree(context, callback)) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : UIColumn(javax.faces.component.UIColumn) UITreeNode(org.primefaces.component.tree.UITreeNode) TreeNode(org.primefaces.model.TreeNode) CheckboxTreeNode(org.primefaces.model.CheckboxTreeNode) Columns(org.primefaces.component.columns.Columns) UITreeNode(org.primefaces.component.tree.UITreeNode)

Aggregations

UIColumn (javax.faces.component.UIColumn)1 Columns (org.primefaces.component.columns.Columns)1 UITreeNode (org.primefaces.component.tree.UITreeNode)1 CheckboxTreeNode (org.primefaces.model.CheckboxTreeNode)1 TreeNode (org.primefaces.model.TreeNode)1