Tree - Selection Tree provides three selection modes, "single", "multiple" and "checkbox".

Single

Multiple with metakey

Checkbox

<h:form>
    <p:growl id="msgs" showDetail="true" escape="false"/>

    <h3 style="margin-top:0">Single</h3>
    <p:tree value="#{treeSelectionView.root1}" var="doc"
                selectionMode="single"
                selection="#{treeSelectionView.selectedNode}">
        <p:treeNode expandedIcon="ui-icon-folder-open" collapsedIcon="ui-icon-folder-collapsed">
            <h:outputText value="#{doc.name}"/>
        </p:treeNode>
        <p:treeNode type="document" icon="ui-icon-document">
            <h:outputText value="#{doc.name}" />
        </p:treeNode>
        <p:treeNode type="picture" icon="ui-icon-image">
            <h:outputText value="#{doc.name}" />
        </p:treeNode>
        <p:treeNode type="mp3" icon="ui-icon-video">
            <h:outputText value="#{doc.name}" />
        </p:treeNode>
    </p:tree>

    <p:commandButton value="Display" update="msgs" icon="ui-icon-newwin"
                        actionListener="#{treeSelectionView.displaySelectedSingle}"/>

    <h3>Multiple with metakey</h3>
    <p:tree value="#{treeSelectionView.root2}" var="doc"
                selectionMode="multiple"
                selection="#{treeSelectionView.selectedNodes1}">
        <p:treeNode expandedIcon="ui-icon-folder-open" collapsedIcon="ui-icon-folder-collapsed">
            <h:outputText value="#{doc.name}"/>
        </p:treeNode>
        <p:treeNode type="document" icon="ui-icon-document">
            <h:outputText value="#{doc.name}" />
        </p:treeNode>
        <p:treeNode type="picture" icon="ui-icon-image">
            <h:outputText value="#{doc.name}" />
        </p:treeNode>
        <p:treeNode type="mp3" icon="ui-icon-video">
            <h:outputText value="#{doc.name}" />
        </p:treeNode>
    </p:tree>

    <p:commandButton value="Display" update="msgs" icon="ui-icon-newwin"
                actionListener="#{treeSelectionView.displaySelectedMultiple(treeSelectionView.selectedNodes1)}"/>

    <h3>Checkbox</h3>
    <p:tree value="#{treeSelectionView.root3}" var="doc"
                selectionMode="checkbox"
                selection="#{treeSelectionView.selectedNodes2}">
        <p:treeNode icon="ui-icon-note">
            <h:outputText value="#{doc.name}"/>
        </p:treeNode>
        <p:treeNode type="document" icon="ui-icon-document">
            <h:outputText value="#{doc.name}" />
        </p:treeNode>
        <p:treeNode type="picture" icon="ui-icon-image">
            <h:outputText value="#{doc.name}" />
        </p:treeNode>
        <p:treeNode type="mp3" icon="ui-icon-video">
            <h:outputText value="#{doc.name}" />
        </p:treeNode>
    </p:tree>

    <p:commandButton value="Display" update="msgs" icon="ui-icon-newwin"
                actionListener="#{treeSelectionView.displaySelectedMultiple(treeSelectionView.selectedNodes2)}"/>
</h:form>
                
PrimeTek, Copyright © 2017
All rights reserved.
Running PrimeFaces-6.2-SNAPSHOT on Mojarra-2.3.2.