[RFE] way to determine build status of XUL template builder

RESOLVED INVALID

Status

()

Core
RDF
P3
enhancement
RESOLVED INVALID
18 years ago
15 years ago

People

(Reporter: myk, Assigned: Chris Waterson)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

18 years ago
I want to sort a tree after building it from a XUL template, but I can't sort
the tree until it has finished building, and nsIXULTemplateBuilder doesn't have
any public interfaces for determining the status of its asynchronous builds.

http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIXULTemplateBuilder.idl

MailNews accomplishes this task with nsIMsgViewNavigationService's
EnsureDocumentIsLoaded method, and Address Book does the same thing (tagged with
a "fix me" that says Address Book should not be reliant on this
MailNews-specific interface), so it isn't just an issue for my custom XUL-based
application.

http://lxr.mozilla.org/seamonkey/source/mailnews/addrbook/resources/content/abCommon.js#363

What I'd like is the equivalent of what nsIRDFXMLSink provides for
asynchronously loading datasources (observers for
begin/interrupt/resume/end/error events on the build) or perhaps more simply
just a boolean "built" property of the builder object that tells me whether the
build is complete or not (like the boolean "loaded" property of
nsIRDFRemoteDataSource).

http://lxr.mozilla.org/seamonkey/source/rdf/base/idl/nsIRDFRemoteDataSource.idl#35
(Assignee)

Comment 1

18 years ago
For asynchronously loading content, the builder doesn't know any more than you 
do. Only the datasource knows. Observe those datasource.
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → INVALID
(Reporter)

Comment 2

18 years ago
I *am* observing the datasource.  I don't do anything until the datasource is
completely loaded (per nsIRDFXMLSink), then I add the datasource to the tree
(per tree.database.AddDataSource), rebuild the tree (per tree.builder.rebuild),
and sort the tree (per nsIXULSortService's Sort method).

Doing this throws an exception, but if I wait a few seconds after building the
tree to sort it then it works, which leads me to believe the tree can't be
rebuilt and sorted simultaneously, and that's why I want to know the status of
the build.  Chris, your suggestion to watch the datasource makes it sound like
if the datasource is loaded the tree is built, but that doesn't make much sense
if the builder itself waits for the datasource to complete loading before
commencing the rebuilding process.

If the issue is that tree building and sorting should be able to take place at
the same time and it shouldn't be necessary to wait for the former to complete
before commencing the latter then perhaps I need to file a bug on the exception
being thrown?

(Assignee)

Comment 3

18 years ago
I'm not sure exactly what you're doing, so it's hard for me to comment.

I do know that the XUL template builder's "rebuild()" method is synchronous. It 
will not return until it's done building all the content that it can.

I also think that you can set the "sort" for the tree (or whatever) before you 
start putting content into it. The builder should obey your sort criteria. That 
might be easier (and faster) than building unsorted, then re-sorting.

Comment 4

15 years ago
tever is not RDF QA anymore
QA Contact: tever → nobody
You need to log in before you can comment on or make changes to this bug.