A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
tdk
- Posts: 19
- Joined: Mon Aug 29, 2005 3:17 pm
- Location: Germany
-
Contact:
Post
by tdk » Fri Mar 16, 2007 12:34 pm
Folks'es,
my users always want to look an application the same when they start it, as it looked the last time they had it running
this means i would like to save the plot properties a user might have configured via the popup. and of course i would like to reload it at the next start of the application.
is this already possible? if yes, how (couldn't find it)
if not, how about implementing it, for the next release.
thomas
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Fri Mar 16, 2007 4:11 pm
You could use serialization / deserialization for this, but you'll want to test it thoroughly, as there are still bugs in there.
-
tdk
- Posts: 19
- Joined: Mon Aug 29, 2005 3:17 pm
- Location: Germany
-
Contact:
Post
by tdk » Fri Mar 16, 2007 4:38 pm
using java.util.Properties.load() and store() are much easier and much less error prone. and it would save you a lot of code to get the necessary properties.
thomas
-
develop
- Posts: 296
- Joined: Wed Mar 23, 2005 10:01 pm
Post
by develop » Fri Mar 16, 2007 6:42 pm
I am also interested in getting a list of user modified properties and saving..
is this possible in new version ?
-
Kousu
- Posts: 63
- Joined: Wed Mar 07, 2007 10:40 pm
Post
by Kousu » Fri Mar 16, 2007 7:20 pm
Well, every single thing editable in the properties dialog is available to you (the properties dialog is not magic, it uses the same API you do). There's no good way to abstract this away, it will always have to be part of your code, since your code is responsible for setting these properties in the first place anyway. Just change where "setting in the first place" comes from. For example, instead of hard-coding the title, read it from a file (and provide a suitable default if you can't find/parse the file) and when the chart or program is closed do chart.getTitle().getText() and write it to the file. Do the same for everything else and you're set.
Or use serialization.