Re: adding other layout managers
Gareth Farrington <[email protected]> Wed, 15 Dec 2004 13:40:08 -0500
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Message-ID | <[email protected]> |
I would like to express my interest in having access to FormLayout and
the JGoodies stuff in SwixML. I think this would be great!
Cheers
-- Gareth (http://waves.ky)
Marcel Gleis wrote:
> Hi developers,
>
> we currently use our own xul-like motor in our web start applications and
> have made very good experiences with this idea. We use the swing built-in
> layout managers and take especially GridBagLayout to its limits. It's hard
> to say, but GridBagLayout just can't handle all scenarios we would like to
> implement. AND sometimes GridBagLayout is just broken and doesn't do what
> the USER wants to. Therefore we were thinking of throwing away our special
> case xul motor and go back with simple Java code and _good_ layout managers
> like TableLayout [1] and JGoodies Forms [2]. I suppose that everyone is
> knowing them ;-). But coding the layout code in Java again is one step back.
> Today I found SwixML and I was suppressed by its simplicity on the one hand
> and its extensive swing support on the other hand. Furthermore it looked
> like it is very easy to extend. So I've downloaded it and...
>
> back to the subject: adding other layout managers
>
> I wanted to use TableLayout manager (in a second step JGoodies Forms), made
> some thoughts, looked at the SwixML source code and started hacking. After 2
> hours of work I had finished a running _prototype_!
>
> I've encountered ONE problem and that is the reason for writing this post. I
> needed to extend the functionality of
> org.swixml.converters.ConstraintsConverter.convert(Class class1, Attribute
> attribute) - method. But this is impossible because it is used statically!
> So in the current source code there is only the possibility to use
> BorderLayout and CardLayout.
>
> Couldn't the developer team change the functionality of this class? I need a
> mechanism to add my own Constraints-Handler. I suggest something like:
>
> ConstraintsConverter.addConverter(new TableLayoutConverter());
>
> ...and then change the method like this:
>
> public static Object convert(Class class1, Attribute attribute) {
> Object obj = null;
> "iterate over converters" {
> obj = converter.convert(class1, attribute);
> if (obj != null) return obj;
> }
> return obj;
> }
>
> Because this wasn't possible I just patched the ConstraintsConverter class
> so that it can handle TableLayout.
>
>
> Now This is an example XML. I can post the needed java files if you wish...
>
> <!-- First.xml -->
> <?xml version="1.0" encoding="UTF-8"?>
> <frame title="TableLayout Demo"
> DefaultCloseOperation="JFrame.EXIT_ON_CLOSE">
> <panel layout="TableLayout({p,5,f},{p,5,pref,5,preferred,10,p})">
> <label constraints="0,0,r,c" LabelFor="tf" text="Salutation:"/>
> <textfield constraints="2,0" Columns="20"/>
> <label constraints="0,2,r,c" text="Last Name:"/>
> <textfield constraints="2,2" Columns="20"/>
> <label constraints="0,4,r,c" text="First Name:"/>
> <textfield constraints="2,4" Columns="20"/>
> <button constraints="2,6,r,b" Text="Save"/>
> </panel>
> </frame>
>
>
>
> [1] http://www.clearthought.info/software/TableLayout/
> [2] http://www.jgoodies.com/freeware/formsdemo/index.html
>
>
>
>
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>