Formatting Tree Nodes

If you want to format tree nodes, simply use the cell format feature as described here. The tree formatting works like the table formatting.
The only difference is the node icon, because the tree has different states for nodes, like expanded or leaf.

The icon can be handled using INodeFormatter.


Our GUI contains a tree which shows three layers. The first layer contains all available sessions, the second layer all sub sessions of the selected session, and the third layer contains all objects of the selected sub session.

The following lines show the definition and use of node formatting:

/** Session image. */
private static final UIImage IMAGE_SESSION     = UIImage.getImage("/com/sibvisions/apps/demo/images/session.png");
/** Sub Session image. */
private static final UIImage IMAGE_SUBSESSION  = UIImage.getImage("/com/sibvisions/apps/demo/images/subsession.png");
/** Object image. */
private static final UIImage IMAGE_OBJECTS     = UIImage.getImage("/com/sibvisions/apps/demo/images/objects.png");
/** the master sessions. */
private RemoteDataBook rdbSessions = new RemoteDataBook();
/** the sub sessions. */
private RemoteDataBook rdbSubSessions = new RemoteDataBook();
/** the objects of sub sessions. */
private RemoteDataBook rdbSubSessionObjects = new RemoteDataBook();
/** the session/object tree. **/
private UITree treeSessions = new UITree();
private void initializeUI() throws Throwable
    treeSessions.setNodeFormatter(this, "getNodeImage");
    treeSessions.setDataBooks(rdbSessions, rdbSubSessions, rdbSubSessionObjects);
public IImage getNodeImage(IDataBook pDataBook, IDataPage pDataPage, IDataRow pDataRow, String pColumnName, int pRow, boolean pExpanded, boolean pLeaf)
    if (pDataBook == rdbSessions)
        return IMAGE_SESSION;
    else if (pDataBook == rdbSubSessions)
        return IMAGE_SUBSESSION;
    else if (pDataBook == rdbSubSessionObjects)
        return IMAGE_OBJECTS;
    return null;
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information