I finished the implementation of
default
properties, and have posted a preview release of the compiler to
get some feedback:
http://code.google.com/p/visage/downloads/list
Instructions on overlaying this on top of a JavaFX 1.3.1 install are
here:
http://code.google.com/p/visage/wiki/InstallingPreviewBuilds
So why do default properties matter? It makes the trivial case for a
lot of objects much simpler, and greatly increases the readability of
your Visage code.
For example, the following JavaFX code:
Stage {
scene: Scene {
contents: Rectangle {
width: 100
height: 100
}
}
}
Simplifies to the following in Visage:
Stage {
Scene {
Rectangle {
width: 100
height: 100
}
}
}
Note: The JavaFX libraries lack default property declarations so you
would get some friendly compiler errors. However, if you created some
simple subclasses of the built-in classes and override the variables
declaring them as "default", then you could do this.
Please give this feature a try and let me know what you think. Also,
if you find any bugs or run into issues, please discuss them on the
mailing list or file an issue:
http://code.google.com/p/visage/issues/list
Just in case you are wondering, this particular change is binary
compatible with old JavaFX releases, and the generated class files will
work on the stock JavaFX 1.3.1 libraries so you are not introducing any
dependencies on Visage (yet). The only source incompatibility will be
if you use the keywords "default" or "cascade" in your program, which
have been added to the reserved words.
For more details about the exact syntax and semantics of this feature,
please see the wiki entry on default properties:
http://code.google.com/p/visage/wiki/DefaultProperties
Cheers,