Re: JTree?

From: Knute Johnson (nospam_at_sagebrush.frazmtn.com)
Date: 01/29/04


Date: Thu, 29 Jan 2004 13:39:14 -0800

Christophe Vanfleteren wrote:
>>>Make classes Client, Project not non-static inner classes of TreeTest.
>>>
>>>That way you have a reference
>>>
>>>TreeModel -> TreeNode -> Client -> TreeTest -> JTree
>>>
>>>so you end up also serializating the JTree.
>>>
>>>I don't know exactly why the JTree doesn't de-serialize properly.
>>>
>>>
>>>
>>>Christian
>>
>>Christian:
>>
>>That fixed it. Thanks very much. I don't understand why having Client
>>and Project as inner classes should make a difference. I thought a
>>class was a class.
>>
>>Thanks again,
>>
> Yes and no: non static inner classes actually contain a (implicit) reference
> to their outer class (since you can't have an inner class without an
> instance of it's outer class).
> As Christian said, when you serialize a Client instance, you'll also
> serialise the entire TreeTest class. This doesn't happen when Client is a
> regular public class.
>

That makes sense. I did try making TreeTest Serializable but it didn't
work. I may try playing with it some more for fun.

Thanks,

-- 
Knute Johnson
email s/nospam/knute/
Molon labe...


Relevant Pages

  • Re: Serialization, RMI and deep copy
    ... However you don't have to *explicitly* serialize anything at all, RMI ... > vs what the store now contains). ... > a client of the store and can insert configuration changes. ...
    (comp.lang.java.programmer)
  • Re: Serializing XmlDocument to SerializationInfo
    ... Are you worried about the size of data being transmitted to/from a remoting client? ... If you are using binary serialization over Tcp that will help to decrease the size of messages transmitted to/from a remoting ... Just add the stream reference to the SerializationInfo with a custom key like, ... and serialize a path string. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: problem in InvalidCastException-Return argument has an invalid type
    ... DataSet is always serialized to XML. ... DataSet is not shared between the client and server. ... always serialized to XML, so you can just use WriteXml to serialize it ...
    (microsoft.public.dotnet.framework.remoting)
  • RE: Updating DB with large collections
    ... Large sub-objects –that is an object which is contained in the main object ... this seems like a complex solution to what I imagined should be quite common ... These entities are being sent to the client - where the user might ... I've tried to serialize my arraylists - both ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: problems returning ArrayList from webServices
    ... - Collections are always serialized as simple arrays. ... If you want to serialize as a specific collection class rather than just an ... On the client side, ... > instead of return an ArrayList object, ...
    (microsoft.public.dotnet.framework.aspnet.webservices)