Swing built from XML ..... concerns!!! PLEASE HELP!!

Hi,

I just had an interview for a Swing position, where EVERYTHING they do in Swing, including the outer JFrame is declared through XML files.

Now, when you first think about it, it seems like an OK idea. If you have some type of form then you can represent that in XML, get it sent from the backend and have some Swing engine, build up the Swing components for the user to see, have some nice textfields, buttons etc.

But..... the more I think about it the more I think that having EVERYTHING represented in XML is, well, a tad ridiculous and kills off the flexibility of Swing.

If I have a form with a few fields and a button, then OK, the XML is going to be pretty straight forward.

But.... if say I wanted a table, with custom rendering, custom editing, calendar pop-up for date editing, row adding, deleting, table sorting etc etc.. my XML file is going to look absolutely ridiculous. How do you code the logic for component listeners? what about drag and drop? event thread issues?

I'm sure there is some cripplingly painful way of doing all this in XML, but what's wrong with just coding it in Java? You lose compile time errors, rafactoring and all the nice things you get out of a good IDE.

I think it's pointless. But that's just me.

Any thoughts?

~O.

[1326 byte] By [oliver_watkinsa] at [2007-10-3 4:18:30]
# 1

Hm, I've looked a little into this and tested a few XUL engines - I think I have a similar view to you: It has its place but I wouldn't build a full application out of it.

It's very good for things like customisable forms - editing different types of documents, for instance, which may themselves be defined by XML, so with a bit of XSLT you can make a Swing interface. The XSLT bit is a nice thing which in the right situation saves a lot of work :o)

There are a lot of engines out there, though, each with their own limitations, though there are a handful which are good enough to be commercially usable. I've also seen proprietary formats used as well.

So, I think in the right situation - where you have heavy configuration or tailoring of a 'template' application, and/or where there's a lot of different XML flavours already floating around - then it can be very useful.

For a bog standard Swing application, though, I'd agree it doesn't usually seem suitable at all. Though I do think it needs a bit of a mindshift to adopt, and I don't think I've found the means or the justification to make that shift yet.

Horses for courses, another feather in the hat and all that :o)

itchyscratchya at 2007-7-14 22:20:13 > top of Java-index,Desktop,Core GUI APIs...
# 2
But what horse would want a course like that?
oliver_watkinsa at 2007-7-14 22:20:13 > top of Java-index,Desktop,Core GUI APIs...
# 3
A horse that's described by an XML document.
itchyscratchya at 2007-7-14 22:20:13 > top of Java-index,Desktop,Core GUI APIs...
# 4

Hi,

I recently read that NetBeans will have something like this in version 6 right build into the Form Editor Matisse:

"Declarative UI

In close cooperation w/ the JDK team, Matisse will provide support to a standard declarative GUI (Swing) format that will allow treating Java GUIs as a resource fully separated from the code."

http://form.netbeans.org/roadmap.html

Sounds interesting! :-)

-Puce

Pucea at 2007-7-14 22:20:13 > top of Java-index,Desktop,Core GUI APIs...