Wt Tree List example

This is a simple demo of a treelist, implemented using Wt.

The leafs of the tree contain the source code of the tree-list in the classes TreeNode and IconPair, as well as the implementation of this demo itself in the class DemoTreeList.

Examples(2)

Use the following buttons to change the tree contents:

Remarks:

  • This is not the instantiation of a pre-defined tree list component, but the full implementation of such a component, in about 350 lines of C++ code !

    In comparison, the Apache MyFaces JSF implementation of tree2, with similar functionality, uses about 2400 lines of Java, and 140 lines of JavaScript code.

  • Once loaded, the tree list does not require any interaction with the server for handling the click events on the and icons, because these events have been connected to slots using STATIC connections. Such connections are converted to the appropriate JavaScript code that is inserted into the page. Still, the events are signaled to the server to update the application state.

  • In contrast, the buttons for manipulating the tree contents use DYNAMIC connections, and thus the update is computed at server-side, and communicated back to the browser (by default using AJAX).

  • When loading a page, only visible widgets (that are not setHidden(true)) are transmitted. The remaining widgets are loaded in the background after rendering the page. As a result the application is loaded as fast as possible.

  • The browser reload button is supported and behaves as expected: the page is reloaded from the server. Again, only visible widgets are transmitted immediately.

    (For the curious, this is the way to see the actual HTML/JavaScript code !)