It's a simple and direct organization chart plugin. Anytime you want a tree-like chart, you can turn to OrgChart.
Source
<pe:orgchart id="orgChart"
widgetVar="orgChartViewWidget"
value="#{orgchartController.orgChartNode}"
draggable="true"
exportButton="true"
pan="true"
parentNodeSymbol="fa-folder-open"
zoom="true"
exportFileextension="pdf"
direction="#{orgchartController.direction}"
toggleSiblingsResp="true"
style="height:350px">
</pe:orgchart>
@Named
@ViewScoped
public class OrgchartController implements Serializable {
private static final long serialVersionUID = 1648477595853984820L;
private OrgChartNode orgChartNode;
private String direction = "t2b";
public OrgchartController() {
super();
init();
}
public void init() {
orgChartNode = new DefaultOrgChartNode("id1", "Node1", "content1");
orgChartNode.addChild(new DefaultOrgChartNode("id2", "Node2", "Content2"));
orgChartNode.addChild(new DefaultOrgChartNode("id3", "Node3", "Content3"));
final OrgChartNode node = new DefaultOrgChartNode("id4", "Node4", "Content4");
orgChartNode.addChild(node);
node.addChild(new DefaultOrgChartNode("id5", "Node5", "Content5"));
node.addChild(new DefaultOrgChartNode("id6", "Node6", "Content6"));
}
public static void onClick(final OrgChartClickEvent event) {
System.out.println("clicked ID: " + event.getId());
System.out.println("hierachy: " + event.getHierarchy().toString());
}
public static void onDropOver(final OrgChartDropEvent event) {
System.out.println("hierachy: " + event.getHierarchy().toString());
System.out.println("dragged node id " + event.getDraggedNodeId());
System.out.println("dropped node id " + event.getDroppedZoneId());
}
public OrgChartNode getOrgChartNode() {
return orgChartNode;
}
public void setOrgChartNode(final OrgChartNode orgChartNode) {
this.orgChartNode = orgChartNode;
}
public String getDirection() {
return direction;
}
public void setDirection(final String direction) {
this.direction = direction;
}
}