nsINavHistoryResultTreeViewer 编辑

toolkit/components/places/public/nsINavHistoryService.idlScriptable This interface provides a predefined view adaptor for interfacing Places query results with a tree. 1.0 66 Introduced 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);

Attributes

AttributeTypeDescription
collapseDuplicatesboolean

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
flatItemCountPRUint32This 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

Constants

ConstantValueDescription
INDEX_INVISIBLE0xffffffffReturned by treeIndexForNode() when the requested node isn't visible (such as when its parent is collapsed). Also returned if there is no tree attached.

Methods

nodeForTreeIndex()

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

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

The node located at the specified index in the tree.

treeIndexForNode()

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
);
Parameters
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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:93 次

字数:5886

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文