Sunday, November 14, 2004

Scriptable MyXaml with NVelocity

I'm very impressed by MyXaml at first sight. Creating GUI with its declarative programming style is very useful for me. My idea is to generate .NET GUI of Hibernate's Beans via reflection (see last post). After surveying some template generators, I've found CodeSmith, TahoGen, and NVelocity. I've selected NVelocity because it's under Apache license. CodeSmith cannot be distributed with MyXaml (because of it's GPLed). Alternatively, you can wait for TahoGen. But now I have a working .NET UserControl of MyXaml that dynamic. :)

Here is a screenshot(click to enlarge):




Code snippet:


<GroupBox def:Name="grpNavBar" Text="test"
Location="8,8" Size="150,150">
<Controls>
#foreach ( $item in [1..3] )
#set( $loc = $item * 25)
<LinkLabel def:Name="lnkTest${item}"
Text="test" Location="8, $loc"
Tag="Test" />
#end
</Controls>
</GroupBox>

1 comment:

Anonymous said...

Confused a bit... You way you want to use delclarative programming, but the snippet uses a for loop, and a set -- that is not declarative.

Frank Hileman
http://weblogs.asp.net/frank_hileman