Re: solutions to hidden setters?
[email protected] Sun, 24 Jul 2005 01:21:43 +0000 (UTC)
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Message-ID | <[email protected]> |
> > public void setListData(Object[] listData)
> > public void setListData(Vector listData)
> >
> > Is there any way to use the second setter?
>
> Hm, I could only imagine something like this: inherit JList and provide
> a method like setVListData(Vector
> listData). The problem lies in the fact Swixml only looks for one method
> setlistdata without taking into
> account the real return value type of the converter.
I actually created two convertors, one with convertTo() of Vector
and one of Object[] .. but it didn't work. As you suggested, I
subclassed the JList and made a custom setter fn.
> IMHO this is'nt worth the hassle because the SwingEngine itself
> does not take up much memory itself. If you
> render large xml files, the idMap may be a problem, though. But then,
> if you do not need the map, clean it. Or
> null the swingengine if she is a field, it will sooner or later
> be gc'ed, along with the idmap...
I see. So SwingEngine's do get GC'd [*] .. yes, they are fields and
I will null them after I'm done. The IdMap actually we do store in
another object, because it's quite useful ;-)
Still the SwixML code looks clean enough that adding a fn like:
void setClient(Object o) {
this.client=o;
idmap.clear();
}
would be easy.
-- Nandan
<apologies if formatting of mail is bad -- using gmane>
[*] (ie nowhere else are refs stored to them -- I was worried
that maybe some javax.swing.X objs store refs, but now I think
they only store refs to the javax.swing.Action objects)