nsIXULTemplateResult 编辑

content/xul/templates/public/nsIXULTemplateResult.idlScriptable A single result generated from a template query. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3)

Each result is identified by an id, which must be unique within the set of results produced from a query. The result may optionally be identified by an RDF resource. Generally, the result and its id will be able to uniquely identify a node in the source data, such as an RDF or XML node. In other contexts, such as a database query, a result would represent a particular record. A result is expected to only be created by a query processor. Each result also contains a set of variable bindings. The value for a particular variable may be retrieved using the getBindingFor() and getBindingObjectFor() methods.

Method overview

AString getBindingFor(in nsIAtom aVar);
nsISupports getBindingObjectFor(in nsIAtom aVar);
void hasBeenRemoved();
void ruleMatched(in nsISupports aQuery, in nsIDOMNode aRuleNode);

Attributes

AttributeTypeDescription
idAStringID of the result. The DOM element created for this result, if any, will have its id attribute set to this value. The id must be unique for a query.
isContainerbooleantrue if the result represents a container. Read only.
isEmptybooleantrue if the result represents an empty container. Read only.
mayProcessChildrenbooleantrue if the template builder may use this result as the reference point for additional recursive processing of the template. The template builder will reprocess the template using this result as the reference point and generate output content that is expected to be inserted as children of the output generated for this result. If false, child content is not processed. This property identifies only the default handling and may be overridden by syntax used in the template. Read only.
resourcensIRDFResourceResource for the result, which may be null. If set, the resource uri must be the same as the ID property. Read only.
typeAStringThe type of the object. The predefined value 'separator' may be used for separators. Other values may be used for application specific purposes. Read only.

Methods

getBindingFor()

Get the string representation of the value of a variable for this result. This string will be used in the action body from a template as the replacement text. For instance, if the text ?name appears in an attribute within the action body, it will be replaced with the result of this method. The question mark is considered part of the variable name, thus aVar should be ?name and not simply name.

AString getBindingFor(
  in nsIAtom aVar
);
Parameters
aVar
The variable to look up.
Return value

The value for the variable or a null string if it has no value.

getBindingObjectFor()

Get an object value for a variable such as ?name for this result. This method may return null for a variable, even if getBindingFor() returns a non-null value for the same variable. This method is provided as a convenience when sorting results.

nsISupports getBindingObjectFor(
  in nsIAtom aVar
);
Parameters
aVar
The variable to look up.
Return value

The value for the variable or null if it has no value.

hasBeenRemoved()

Indicate that the output for a result has been removed and that the result is no longer being used by the builder.

void hasBeenRemoved();
Parameters

None.

ruleMatched()

Indicate that a particular rule of a query has matched and that output will be generated for it. Both the query as compiled by the query processor's nsIXULTemplateQueryProcessor.compileQuery() method and the XUL <rule> element are supplied. The query must always be one that was compiled by the query processor that created this result. The <rule> element must always be a child of the <query> element that was used to compile the query.

void ruleMatched(
  in nsISupports aQuery,
  in nsIDOMNode aRuleNode
);
Parameters
aQuery
The query that matched.
aRuleNode
The rule node that matched.

See also

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

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

发布评论

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

词条统计

浏览:26 次

字数:8122

最后编辑:7 年前

编辑次数:0 次

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