Re: Re: adding other layout managers

Frank Meissner <[email protected]> Wed, 15 Dec 2004 21:28:27 +0100
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <[email protected]>
Marcel Gleis wrote:
> Hello Frank,
> 
> 
>>as far as I see this, the change may be done without adding
>>to much complexity to the ConstraintsConverter class.
> 
> 
> That's right. I made changes the way you've mentioned some lines below
> ("else if (TableLayout.class.[...]"). It isn't a problem for me to change
> the source code but I think this "feature request" would be helpful to other
> SwixML _users_, too! The java built-in layout managers just suck. They are
> like swing: generic, and a lot of work is needed to get good results. And
> some layouts are just impossible to implement (look at the JGoodies forms
> white paper for a comparison between JGoodies forms and GridBagLayout).
> My code for integrating TableLayout consists of about just 50 lines of
> (prototype) code. It is sad that I needed to patch the SwixML code to
> integrate this very useful "extension".

Hm, I think swixml grew up a bit through different needs of different 
developers ;) There where some discussions about additional layout 
managers but nobody had the urge to implement it in a nice, clean way. 
If I did overlook some mails and my remarks step on someones toes, have 
mercy with me -- I'm neither fulltime swixml developer nor do I get paid 
for this ;)

> 
> 
>>I assume you would like to change the somewhat static
>>code in the convert method to a more dynamic one,
>>like introducing a BorderLayoutConstraintsConverter and
>>CardLayoutConstraintsConverter to replace the current
>>code in convert with the iteration you mentioned?
> 
> 
> You're right. The iteration isn't needed. Instead the implementation should
> use a Map as in ConverterLibrary and SwingTagLibrary.

Agreed, you are correct.

> 
> 
>>Your code has another
>>"else if (TableLayout.class.equals(type)) {"
>>in it, correct?
> 
> 
> Sadly correct :-)
> 
> 
>>Of course, this may be changed
>>to a list-iteration-approach and the list should as well
>>be exposed to users of the API. Wolf, what do you
>>think?
> 
> 
> There shouldn't be a list-iteration-approach but a Map where additional
> converters could be registered. (addConverter(Class class1, Converter
> converter));
> 
> 
> If a change like this will be made to the code I could provide my
> "TableLayout extension pack (1 or 2 classes ;-))". I don't want to set up a
> sourceforge project for this. Maybe it could be integrated into SwixML core?
> Or better it could be commited to CVS under org.swixml.ext.tablelayout...
> and make an extra jar of it in the build process so that it isn't uncluded
> in the core jar file...?

You may send me the code and I will have a look at it at this weekend 
(got some sparetime because I'm "Strohwitwer" ;)). I would like to 
integrate it because your approach is possible without breaking existing 
code. Even without your converter your recommended changes to 
ConstraintsConverter do sound sensible to me ;)

> 
> If this is of interest for Wolf I could post some patches that show what I
> mean. Sometimes code says more than words :-)

If you want, send wolf the patches and me as well ;)

Greetings from Berlin,

Frank

> 
> 
> 
> Marcel
> http://www.netz-profis.de
> 
> 
> 
> 
> _______________________________________________
> Forum mailing list
> [email protected]
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>