In Primefaces I would like to expand a `<p:treeNode>`, when i click on its label, not when i click on the little triangle. 
Cant find any .xhtml document, but found that nodes are created this way:

```
...
final TreeNode parentNode = this.addNode(false, "Parent", this.root, targetView1); //first parameter means start expanded or not
this.addNode(, "ChildNode", parentNode, "targetView2");
...

```

Is it possible? Thank you.
['https://Stackoverflow.com/questions/43408454', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4419468/']
Just in case anyone is interested in a solution that I believe @Kukeltje is referring to here is my interpretation: 

XHTML:

```
    <p:tree value="#{Bean.rootNode}" var="node" style="width: 100%" id="tree" selectionMode="single">
         <p:treeNode id="node">                                
            <h:outputText value="#{node.name}"  /> 
         </p:treeNode>    
         <p:ajax event="select" update=":form:tree" listener="#{Bean.onNodeSelect}" />
    </p:tree>

```

Bean:

```
public void onNodeSelect(NodeSelectEvent event) {
    if (event.getTreeNode().isExpanded()) {
        //closes if it is open.
        event.getTreeNode().setExpanded(false);
    } else {
        //open if it is closed.
        collapsingORexpanding(event.getTreeNode(), false);//this is so all children are closed under this node. trust me, you want this...
        event.getTreeNode().setExpanded(true);
    }
}

public void collapsingORexpanding(TreeNode n, boolean option) {
    if (n.getChildren().isEmpty()) {
        n.setSelected(false);
    } else {
        for (TreeNode s : n.getChildren()) {
            collapsingORexpanding(s, option);
        }
        n.setExpanded(option);
        n.setSelected(false);
    }
}

```
Add [selection](https://www.primefaces.org/showcase/ui/data/tree/selection.xhtml) to your viewer:

```
[(selection)]="selectedTreeNode"
(onNodeSelect)="onNodeSelect($event)"

```

Define your value in your controller:

`selectedTreeNode: TreeNode;`

Handle `onNodeSelect()`:

```
onNodeSelect(event: any) {
    this.selectedTreeNode.expanded = !this.selectedTreeNode.expanded;
}

```

Cheers!