classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about createUI() method?


From: Thomas Zander
Subject: Re: Question about createUI() method?
Date: Sat, 17 Sep 2005 16:33:43 +0200
User-agent: KMail/1.8.91

On Wednesday 7 September 2005 12:17, Roman Kennke wrote:
> That was introduced by me. Honestly I don't remember myself why I found
> this important. I think I might have been mislead of the API docs in
> ComponentUI.createUI(): 'If the UI delegate is stateful, then it should
> return a new instance per component.'
>
> I think it would be ok to change this to simply return a new instance
> on each call without storing them in the hashtables.

Based on my long time usage of those classes in the 'other' jvm;

Keeping the UI delegate instance makes sense if you can reuse it for all 
classes.
If at all possible; the delegates should be written without statics (save 
for one 'instance' static) and don't use members at all.  If you can 
adhere to this then one delegate in the entrire JVM is cheapest.
This approuch is possible only if the SUN API did not define protected 
members that disable that approuch, naturally. (Sun really did a bad job 
designing those for reuse :( )

Note that the HashMap idea is really broken due to the fact that you 
retain both the component and the delegagte-instance, which means that 
all widgets instanciated will never be garbage collected.

-- 
Thomas Zander

Attachment: pgpxCLO2u9Gvj.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]