Adding a Visitor a Statistical Component


This Howto page describes how to add a new visitor over a document. The creation of a statistic component is depicted step by step. The idea is to have displayed the number of children if we are viewing a folder, or the size of a page if one is visited.

3 new classes and 1 class extension are needed:

Step by step

This code display a purple box titled 'Folder Statistic' displaying the number of chidren.


In this howto we have learned how to create a new template. As remainder a hierarchy of template is used for describing the visual aspect of the wiki. We want to add a new component (a purple box), so we add a new Template.

In order to be displayed in a web browser, a visitor rendered is run over the whole template structure and on the page or the folder displayed. This visitor need to be extended (or a new can be redefined using subclassing) in order to display the new component.

Our new component need to know the textual size of a page, we create a new visitor charged to compute the number of character a page contains.

That's all folk! Enjoy!