• Paragraph
    • Image
    • CMS
    • System
    • Development

Tree

The jp:tree component can be used for the hierarchical representation of data with a flexible number of hierarchy levels. Each scope of hierarchies need to be implemented as a TreeHandler extended the SbTreeXHander where X is the hierarchy level.

In the example the JeeCmsTreeHandler is implementing a two-level structure. The super-constructor has to be called with three parameters:

  • JeeslTreeSelected : This is a callback object which is called after a selection
  • JeeslTreeCache : This object is handling the child elements for each level, mostly implemented in a cache.
  • JeeTreeStore : This object allows storing of selections e.g. in a session Bean. In the init -method of the JeeskTreeHandler the previously selected element can be retrieved.

In the given example the JeeslTreeCache and JeeTreeStore are created in the constructor for simplicity. In production environment often AppScoped (for the cache) and SessionScoped (for the store) beans are provided.

A good starting point for a own implementation

  • of SbTree2Handler is to assume a global view and ignore security aware views and/or domain roles on the specific hierarchy levels.
  • of JeeslTreeCache is to directly use facade methods.
  • of JeeTreeStore is to do nothing

Start with a two-level hierarchy and then extend it!

<jp:sbTree handler="#{sbTreeBean.sbhTree}" update="@form :grid"/>