Umm, have you guys seen SwiXML?

http://swixml.org/

-warner

On Aug 8, 2004, at 12:29 AM, Dennis Sosnoski wrote:

That's interesting to see, they're taking an approach similar to something I've been planning. People have been trying for several years now to come up with XML GUI designs for Java, along the lines of Mozilla's XUL. I think that kind of approach is overkill for Java, though, and that rather than trying to put the whole GUI description (including actions and such) into an XML configuration, you'd be much better off to just put the layout information there. The layouts are about 90% of the pain in doing cross-platform GUIs anyway, at least in my experience. It looks like Intellij is going further than I'd take it, but that's typical of these visual layout tools. At least it's cleaner than generating the GridBag garbage in code with // {<@ AUTOGENERATED CODE - DO NOT MODIFY tags around it.

My idea is to just do the layouts in an XML configuration, and do it that way as a convenience to programmers who basically want to control things themselves rather than using a D&D-type tool (so you still create your active controls, only the passive containers and layouts go into the XML; that way you can easily tweak the layouts without recompiling, or even support multiple layouts depending on how something is being used). Maybe I'll have an example for SWT by September.

 - Dennis

Tim Colson wrote:

How do they actually handle the layouts, if they're not generating code?

Voodoo. :)

It's a black box... I visually created a .form in "XY space" (creates an XML
file but "do not edit the file"), then you slap a "grid" on the components,
bind the form to a class, add bindings for each component, create a Jframe
and add the Form contentPane, and then during compile, et voila -- magic
fairies create the UI bits.




Some kind of configuration file that gets interpreted at runtime?

I recall seeing at JavaOne2003 a demo... and I thought they were doing some
bytecode manipulation post-compile. But honestly, I'm ignorant of what is
happening under the covers.


Heres an example of a simple form, one label, one text field, one button,
some spacers, seems like they have a Grid layout, perhaps custom:


<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/"; version="1"
bind-to-class="com.cisco.hrit.Preferences">
<grid id="29ae7" row-count="3" column-count="3"
same-size-horizontally="false" same-size-vertically="false" hgap="-1"
vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="35" y="40" width="354" height="90"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3"
hsize-policy="3" anchor="0" fill="3"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="65ed1" class="javax.swing.JTextField"
binding="nametext">
<constraints>
<xy x="62" y="0" width="186" height="21"/>
<grid row="0" column="1" row-span="1" col-span="1"
vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="a0d38" class="javax.swing.JButton" binding="Apply">
<constraints>
<xy x="258" y="66" width="96" height="24"/>
<grid row="2" column="2" row-span="1" col-span="1"
vsize-policy="0" hsize-policy="3" anchor="0" fill="1"/>
</constraints>
<properties>
<text value="Apply"/>
</properties>
</component>
<component id="2e73" class="javax.swing.JLabel">
<constraints>
<xy x="0" y="3" width="52" height="14"/>
<grid row="0" column="0" row-span="1" col-span="1"
vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
</constraints>
<properties>
<text value="Item Name"/>
</properties>
</component>
<hspacer id="64a7c">
<constraints>
<xy x="258" y="5" width="96" height="11"/>
<grid row="0" column="2" row-span="1" col-span="1"
vsize-policy="1" hsize-policy="6" anchor="0" fill="1"/>
</constraints>
</hspacer>
<vspacer id="535de">
<constraints>
<xy x="300" y="26" width="11" height="40"/>
<grid row="1" column="2" row-span="1" col-span="1"
vsize-policy="6" hsize-policy="1" anchor="0" fill="2"/>
</constraints>
</vspacer>
</children>
</grid>
</form>



Cheers, Timo




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--
Dennis M. Sosnoski
Enterprise Java, XML, and Web Services
Training and Consulting
http://www.sosnoski.com
Redmond, WA  425.885.7197


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to