This seemed like a good test case for F3 reflection and for its query operators, so I decided to try to see how hard it would be to do the same kind of thing in F3.
Below is a (partial) F3 equivalent of this Exhibit example [3].
The above demo also displays the F3 source code.
This is actually a plain Swing program (the F3 Canvas isn't used), but demonstrates the use of HTML templating with F3.
All of the filtering and sorting is actually done in 3 lines of code (take a look at DB.f3 and AttributeValueAssertion.f3).
Some things to note:
Attribute is an F3 reflection class analagous to java.lang.reflect.Field[] operator with an operand of type Attribute, e.g.
var bar = foo.class.Attributes[Name == 'bar'];
foo[bar] = 2;
// The above is analogous to the following Java code
// Field bar = foo.getClass().getField("bar");
// bar.set(foo, 2);
is the reflective equivalent of
foo.bar = 2;
order by operator is a binary operator. The left-hand side is any list of objects. The right-hand side is an expression that must return a list of comparable objects. The right-hand expression is evaluated in the context of each element of the left hand side. The current element can be accessed with the . (dot) operator (as in XPath).
For example,
[1, 2, 3] order by -.
yields
[3, 2, 1]
Links:
[1] http://www.betaversion.org/~stefano/linotype/
[2] http://simile.mit.edu/exhibit/
[3] http://simile.mit.edu/exhibit/examples/cereals/cereal-characters.html
[4] http://blogs.sun.com/chrisoliver/resource/cereal.jnlp