nsINavHistoryContainerResultNode 编辑

toolkit/components/places/public/nsINavHistoryService.idlScriptable A foundation for the interfaces that provide a description of a query result on the Places service that describes a container (which is any kind of grouping, including bookmark folders). 1.0 66 Introduced Gecko 1.9 Inherits from: nsINavHistoryResultNode Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Method overview

nsINavHistoryResultNode findNodeByDetails(in AUTF8String aURIString, in PRTime aTime, in long long aItemId, in boolean aRecursive);
nsINavHistoryResultNode getChild(in unsigned long aIndex);
unsigned long getChildIndex(in nsINavHistoryResultNode aNode);

Attributes

AttributeTypeDescription
childCountunsigned longThe number of child nodes; accessing this throws an NS_ERROR_NOT_AVAILABLE exception of containerOpen is false. Read only.
childrenReadOnlybooleanfalse if the node's list of children can be modified (by adding or removing children, or rearranging them), or true if the user interface should not allow the list of children to be altered. Read-only.

This is false for bookmark folder nodes unless the setFolderReadOnly() method has been called to specifically make the folder read-only. It's true for non-folder nodes.

If this container is a remote container, this flag may be redefined by the remote container provider. Read-only.

containerOpenbooleanSet this to true to allow descent into this container. When closed, attempting to call getChild() or access childCount results in an error. When you're done reading the container's children, set this to false.

For HOST and DAY groupings, doing this has no performance cost since the children have already been computed. For queries and bookmark folders, however, being open means they must keep themselves up-to-date by listening for updates and re-querying as needed.

dynamicContainerTypeAUTF8StringA string representing the dynamic container API service responsible for this container. Accessing this throws an exception if the node isn't a dynamic container. Read only.
hasChildrenbooleanIndicates whether or not the node can have children, and may be used whether the container is open or closed. When the container is closed, the result is an exact answer if the node can be populated easily (for example, for bookmark folders). If it can't be populated easily (for complex history queries, for example), the result is always true.

When the container is open, the result is always accurate.

This value is intended to be used to see if the "+" should be drawn next to a tree item, indicating that the item can be opened. Read-only.

remoteContainerType Obsolete since Gecko 1.9AUTF8StringA string representing the remote container service API that is responsible for this container. If there is no such API, this value is an empty string. Read only.

The container may be a RESULT_TYPE_REMOTE_CONTAINER node that has been dynamically generated by the remote container API, or a bookmark folder (RESULT_TYPE_FOLDER) for which some service (such as livemarks) has registered to provide certain operations.

stateunsigned shortThe current state of the container. This is one of the state constants.

Constants

State constants

ConstantValueDescription
STATE_CLOSED
0The container is closed.
STATE_LOADING
1The container has been opened asynchronously, but is still loading and is not all the way opened yet.
STATE_OPENED
2The container is open.

Methods

findNodeByDetails()

Returns a node matching specified details.

nsINavHistoryResultNode findNodeByDetails(
  in AUTF8String aURIString,
  in PRTime aTime,
  in long long aItemId,
  in boolean recursive
);
Parameters
aURIString
The URI attribute value to match on.
aTime
The time attribute to match on.
aItemId
The item ID to match on.
aRecursive
If true, the search will recurse through all child containers of the current container; if false, only direct children of the container are searched.
Return value

An nsINavHistoryResultNode of a node matching the specified details or null if no match is found.

Exceptions thrown
NS_ERROR_NOT_AVAILABLE
The container is not open.

getChild()

Returns the child node at the specified index.

 nsINavHistoryResultNode getChild(
   in unsigned long aIndex
 );
Parameters
aIndex
The index into the child list of the node to fetch.
Returns

The node located at the specified index.

Exceptions thrown
NS_ERROR_NOT_AVAILABLE
The containerOpen attribute is currently false, indicating that the node isn't open for access.

getChildIndex()

Returns the index of a direct child of this container.

unsigned long getChildIndex(
  in nsINavHistoryResultNode aNode
);
Parameters
aNode
The node whose index is to be returned.
Return value

The index of the specified node into the list of immediate children of the container.

Exceptions thrown
NS_ERROR_NOT_AVAILABLE
The container isn't open (that is, containerOpen is false).
NS_ERROR_INVALID_ARG
The specified node isn't a direct child of this container.

Remarks

There are a number of untested methods on this interface that are not documented at present, and are disabled in the idl file.

See also

nsINavHistoryResultNode, nsINavHistoryService

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

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

发布评论

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

词条统计

浏览:54 次

字数:9703

最后编辑:7年前

编辑次数:0 次

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