michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIAtom; michael@0: interface nsIDOMNode; michael@0: interface nsIRDFResource; michael@0: michael@0: /** michael@0: * A single result generated from a template query. Each result is identified michael@0: * by an id, which must be unique within the set of results produced from a michael@0: * query. The result may optionally be identified by an RDF resource. michael@0: * michael@0: * Generally, the result and its id will be able to uniquely identify a node michael@0: * in the source data, such as an RDF or XML node. In other contexts, such as michael@0: * a database query, a result would represent a particular record. michael@0: * michael@0: * A result is expected to only be created by a query processor. michael@0: * michael@0: * Each result also contains a set of variable bindings. The value for a michael@0: * particular variable may be retrieved using the getBindingFor and michael@0: * getBindingObjectFor methods. michael@0: */ michael@0: [scriptable, uuid(ebea0230-36fa-41b7-8e31-760806057965)] michael@0: interface nsIXULTemplateResult : nsISupports michael@0: { michael@0: /** michael@0: * True if the result represents a container. michael@0: */ michael@0: readonly attribute boolean isContainer; michael@0: michael@0: /** michael@0: * True if the result represents an empty container. michael@0: */ michael@0: readonly attribute boolean isEmpty; michael@0: michael@0: /** michael@0: * True if the template builder may use this result as the reference point michael@0: * for additional recursive processing of the template. The template builder michael@0: * will reprocess the template using this result as the reference point and michael@0: * generate output content that is expected to be inserted as children of the michael@0: * output generated for this result. If false, child content is not michael@0: * processed. This property identifies only the default handling and may be michael@0: * overriden by syntax used in the template. michael@0: */ michael@0: readonly attribute boolean mayProcessChildren; michael@0: michael@0: /** michael@0: * ID of the result. The DOM element created for this result, if any, will michael@0: * have its id attribute set to this value. The id must be unique for a michael@0: * query. michael@0: */ michael@0: readonly attribute AString id; michael@0: michael@0: /** michael@0: * Resource for the result, which may be null. If set, the resource uri michael@0: * must be the same as the ID property. michael@0: */ michael@0: readonly attribute nsIRDFResource resource; michael@0: michael@0: /** michael@0: * The type of the object. The predefined value 'separator' may be used michael@0: * for separators. Other values may be used for application specific michael@0: * purposes. michael@0: */ michael@0: readonly attribute AString type; michael@0: michael@0: /** michael@0: * Get the string representation of the value of a variable for this michael@0: * result. This string will be used in the action body from a template as michael@0: * the replacement text. For instance, if the text ?name appears in an michael@0: * attribute within the action body, it will be replaced with the result michael@0: * of this method. The question mark is considered part of the variable michael@0: * name, thus aVar should be ?name and not simply name. michael@0: * michael@0: * @param aVar the variable to look up michael@0: * michael@0: * @return the value for the variable or a null string if it has no value michael@0: */ michael@0: AString getBindingFor(in nsIAtom aVar); michael@0: michael@0: /** michael@0: * Get an object value for a variable such as ?name for this result. michael@0: * michael@0: * This method may return null for a variable, even if getBindingFor returns michael@0: * a non-null value for the same variable. This method is provided as a michael@0: * convenience when sorting results. michael@0: * michael@0: * @param aVar the variable to look up michael@0: * michael@0: * @return the value for the variable or null if it has no value michael@0: */ michael@0: nsISupports getBindingObjectFor(in nsIAtom aVar); michael@0: michael@0: /** michael@0: * Indicate that a particular rule of a query has matched and that output michael@0: * will be generated for it. Both the query as compiled by the query michael@0: * processor's compileQuery method and the XUL element are supplied. michael@0: * The query must always be one that was compiled by the query processor michael@0: * that created this result. The element must always be a child of michael@0: * the element that was used to compile the query. michael@0: * michael@0: * @param aQuery the query that matched michael@0: * @param aRuleNode the rule node that matched michael@0: */ michael@0: void ruleMatched(in nsISupports aQuery, in nsIDOMNode aRuleNode); michael@0: michael@0: /** michael@0: * Indicate that the output for a result has beeen removed and that the michael@0: * result is no longer being used by the builder. michael@0: */ michael@0: void hasBeenRemoved(); michael@0: };