This is an archived page. It's not actively maintained.


This interface provides a predefined view adaptor for interfacing Places query results with a tree.
Gecko 1.8
Inherits from: nsINavHistoryResultObserver Last changed in Gecko 1.9 (Firefox 3)

This object removes itself from the associated result when the tree is detached; this prevents circular references. It's important to be aware of this—if you want to reuse the same viewer, you need to keep your own reference to it, then reinitialize it when the tree changes.

If you use this object and attach it to a result without attaching it to a tree, then forget about it, it will leak.

Method overview

nsINavHistoryResultNode nodeForTreeIndex(in unsigned long aIndex);
unsigned long treeIndexForNode(in nsINavHistoryResultNode aNode);


Attribute Type Description
collapseDuplicates boolean

Controls whether duplicate adjacent elements are collapsed into a single item in the tree. This prevents you from seeing multiple entries for things when you have selected to get visits. When you sort by date, the multiple entries will then appear because they will be separated (unless you clicked reload a bunch of times in a row). If you know you'll only ever want one entry per site, you should ask for URIs back instead of visits so it will be more efficient. Default = true.

Changing this value is somewhat heavyweight since it will force a tree refresh. Obsolete since Gecko 1.9
flatItemCount PRUint32 This tells you how many items are in the flattened list of results, that is how many rows are in this tree right now. The tree adaptor will also QI to nsITreeView, and this will be the same as nsITreeView.rowCount. This is only valid when a tree is attached, the result will be 0 otherwise. Read only. Obsolete since Gecko 1.9


Constant Value Description
INDEX_INVISIBLE 0xffffffff Returned by treeIndexForNode() when the requested node isn't visible (such as when its parent is collapsed). Also returned if there is no tree attached.



Returns the node for a given row index. This is only valid when a tree is attached.

nsINavHistoryResultNode nodeForTreeIndex(
  in unsigned long aIndex
The row index of the note to return.
Return value

The node located at the specified index in the tree.


Returns the row index corresponding to the specified node within the tree, or INDEX_INVISIBLE if the tree is unattached or the node is not visible (if, for example, its parent container is collapsed).

unsigned long treeIndexForNode(
  in nsINavHistoryResultNode aNode
The node whose index is to be returned. This must be a node retrieved from the same result that the viewer displays.
Return value

The row index of the node specified by aNode, or INDEX_INVISIBLE for nodes that are hidden (by their parents being collapsed, for example) or if there is no attached tree.

See also