My guess is that the table model has a reference to the table, which is why
it is getting serialised along with the model. Most likely candidate is that
the AbstractTableModel is holding a reference to the table because the table
is a listener.
Try overriding addTableModelListener() on your subclass of
AbstractTableModel and put some debug info in there to determine what
classes are adding themselves as listeners - you will need to remove them
all before serialising your model.
A quick and dirty way around this might be to maintain a reference to the
model you wish to serialise and then set a new model on the JTable which is
looking at your custom model - JTable will have to remove itself as a
listener to the old model before it listens to the new model.
Alternatively you could implement clone() on your AbstractTableModel
subclass to just copy your private data (and not the listeners) and then
serialise.
Lots of things to try.
Tim
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
J.Ganesan
Sent: 03 March 2001 06:36
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: AbstractTableModel serialization problem
Hi all,
I have a class X , which extends AbstractTableModel. When I save an
object of X, the JTable whose TableModel is the object of X, is also
serialized and saved. I am interseted ONLY in the private data of X.
Besides, the file size becomes unacceptably big.
Any suggestions to solve this problem ?
Thanks.
ganesan
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing