XULSortService

Revision as of 00:57, 23 April 2006 by Enn (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

XUL Sort Service Improvements

The XUL Sort Service is used for sorting content built by a content template builder, although not a tree builder. It has two purposes, figure out where to insert a new generated item into a existing container, and change the sort key and/or direction of an existing container.

The code is large and complex, considering that the tree sorting built into the tree builder has about 90% of the same functionality, but with only 10% as much code.

The sort service also only works with RDF datasources.

Thus, some work will be done to improve the sort service.

1. Move the sort inserting code directly into the content builder. Eventually, it may be possible to sort results first and then insert them all sorted. 2. Make the sort inserting code and the container sort algorithms use the query processor for sorting such that they work on all datasources. 3. Make how one specifies the sort info consistent, as described below. 4. Simplify the sort code

Attributes

The following attributes will be involved in sorting:

sort="?key1 ?key2 ..."

Specifies the sort keys to be used. One or more may be specified. For template-built content, the keys are expected to be identifiers used in the template, either of the variable form such as ?name, or a predicate such as rdf:http://www.example.com/name. A query processor may also support other values. In the case of RDF, keys that are RDF predicates without the rdf: prefix may be used also.

sortResource=""

This is obsolete but is equivalent to specifing one sort key.

sortResource2=""

This is obsolete but is equivalent to specifing the second sort key. Thus, sortResource and sortResource2 are the same as sort="sortResource sortResource2".

sortDirection="ascending|descending|natural"

The direction of the sort.

sortSeparators="true|false"

Indicates if sorting is done separately between separators.

staticHint="integer"

Set automatically to determine how many static children there are. These static children are not sorted.

sortStaticsLast="true|false"

True if static content is placed after generated content, and false is static content should be placed before generated content. I don't think this actually works currently anyway, so no need to support it necessarily in the future.

Tree Content

There is some code to set attributes on columns for trees built with the content builder, it doesn't seem to have any real use as far as I can tell.