I think that XML is fundamentally the wrong approach. I went and looked at what Joonas did, and it has a ways to go before its usable. Wiring up listeners is just one of the problems.
However, using the snakeyaml project, it should be possible to bootstrap building the basic structure of a Vaadin UI in under a day, because snakeyaml can already read/write arbitrary Java bean structures.
If some one is interested in trying this, I have some simple code for snakeyaml that avoids writing out default values of java beans (based on the null constructor) that I could hand off to you.
Why Yaml:
Yaml has a concept of aliasing, so you can setup a value of a java bean as matching something you've already defined. So you can tell the child that its parent is well, the parent. :
component: &parent1 { — the alias for our component is “parent1”
title: “Title”
children: [
parent: *parent1 — setParent(parent1) is going to get called on the child.
In XML, you'll have to go back after the fact in order to wire "parent", and you'll have to do that for each class.You can save/restore arbitrary structures of java bean objects in Yaml, which you can't do in XML. YAML files, if you use the "prettyFlow" stream that's in SnakeYaml 1.7 are also more human readable then XML.
Second, snakeyaml allows you to inject your own object resolvers, so you can wire listener methods up inside the layout. When I looked into how people made Vaadin UIs, there are lots and lots of inner classes. Which work great, until you're trying to split up the code from the layout. Snakeyaml would let you set the listener method using some pre-defined constructor:
!listenerMethod: saveClicked
!listenerClass: SaveClickerClass
The first would tell the loader to call “saveClicked” on the loading class, the second would know to make a new instance of SaveClickerClass (presumably an inner class).
This would be much better then ZKs approach because the code would be the code, and the layout the layout. That’s one of the things that I think sucks about ZUL.
If you use the Yaml approach, I suspect that someone could have a working declarative UI loader based on Yaml in a week. If someone wants to tackle this, let me know, and I can pass you some code to make things easier.