The Artima Developer Community
Sponsored Link

Java Answers Forum
How to omit component's coordinates in xml serialisation

1 reply on 1 page. Most recent reply: Feb 25, 2004 6:56 AM by Martin Motovsky

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Martin Motovsky

Posts: 2
Nickname: mmotovsk
Registered: Feb, 2004

How to omit component's coordinates in xml serialisation Posted: Feb 16, 2004 7:14 AM
Reply to this message Reply
Advertisement
Hi colleagues,
my application uses XMLEncoder for serialisation. I would like to told to XMLEncoder not to save coordinates of my JPanel.
I found out an excellent article at http://access1.sun.com/SRDs/srd_repository/1.4_javabeans.pdf.
I followed up its idea and I was able to set up transient some properties of the standard awt or swing classes. E.g "name" property of the JPanel. But some properties I was not successful to set up transient . E.g. width, height of the JPanel.
Any ideas, how to proceed?

Thank for help.


Martin Motovsky

Posts: 2
Nickname: mmotovsk
Registered: Feb, 2004

Re: How to omit component's coordinates in xml serialisation Posted: Feb 25, 2004 6:56 AM
Reply to this message Reply
I receive an advice, which help me to solve the problem:

"There is a skeleton (or two) in the closet of the XMLEncoder - one of them is on bounds of a Component. All of the internal trickery is in a file called MetaData.java in the beans package. If you look in that file you'll see the hardcoded hacks for the bounds, size and location properties in the persistence delegate for a component. You can subvert this by replacing this delegate with one of your own."

I.e. something like this:
XMLEncoder e = new XMLEncoder(...);
e.setPersistenceDelegate(Component.class,new Myjava_awt_Component_PersistenceDelegate());

Flat View: This topic has 1 reply on 1 page
Topic: How to set Java HotSpot Server VM for Linux Previous Topic   Next Topic Topic: Halting the current working system from a java program

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use