JTree display "freeze" object values possible?

S

Sam

I have a JTree component in a GUI which displays the state of an
arbitrary object over time, i.e. as separate entries in the JTree for
each point in time I want to display. When you click on the object, it
uses java reflection to display the attributes of the class. What I
would like to do is "freeze" the object to display the attributes of
the object *at the time it was added to the JTree component*.
Otherwise, it will just show the current values for all entries in the
JTree.

Copying the object is not practical, since it is actually an object
tree and would entail some considerable work.

Is there anyway short of copying the object tree to handle this
requirement?

thanks,
Sam90
 
T

Thomas Weidenfeller

Sam said:
What I
would like to do is "freeze" the object to display the attributes of
the object *at the time it was added to the JTree component*.
Otherwise, it will just show the current values for all entries in the
JTree.

Copying the object is not practical, since it is actually an object
tree and would entail some considerable work.

You are asking for a miracle. Your situation is (t == time):

t0: Object contains data X
t1: Object was added to JTree
t2: Object's data is changed from X to Y. You refuse to store
the old X, so X is lost.
t3: You want Object(t1), but that state doesn't exist any more.

Either you remember the data, or you don't have it. It's that simple.

/Thomas

BTW: I hope you add the object to a TreeModel and not just to a JTree.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top