Binding with config properties

0 views
Skip to first unread message

Pär Dahlberg

unread,
Oct 13, 2008, 6:14:12 PM10/13/08
to WidgetFX Developers
I'm trying to put together a bit more advanced configuration and
having some problems with that.
Since the onSave is executed right before the config is persisted I
expected to be able to do the final changes to a bound sequence here.
As you can see I've got a bind with reverse tied to the config and
before saving it's supposed to have it's value replaced with the value
from the dialog.

configuration: Configuration {
component: bind configPanel;
properties: [
StringSequenceProperty {
name: "{DISKSPACE}.path"
value: bind paths with inverse;
}
]
onLoad: loadConfig;
onSave: saveConfig;
}

private function saveConfig():Void {
System.out.println("paths={paths}");
for(p in paths where p == key) {
paths[indexof p] = selectedConfig.path; // New value from
dialog
}
System.out.println("paths={paths}");
}

I know the The println statements prints the correct values and the
config files timestamp is updated. But even so, the config file is not
updated when I save. However, the config file gets updated if I open
the dialog and save one more time.

/Pär

Stephen Chin

unread,
Oct 14, 2008, 5:18:49 AM10/14/08
to widget...@googlegroups.com
Pär,

Good catch. Right now the code persists first and then calls onSave,
but I agree with you that it should do those in the reverse order.
Please file a bug on this in the issue tracker.

A workaround which will allow you to save anytime is to set "autoSave"
to true on your property. This will force a disk write whenever the
value changes, which will make sure that when you update the value it
will get written to disk even if the explicit persist already occurred.

I hope this helps.

Cheers,
--Steve

Pär Dahlberg

unread,
Oct 14, 2008, 4:50:46 PM10/14/08
to widget...@googlegroups.com
Ok, thanks. I'll use the autosave in the mean time.

Issue added: http://code.google.com/p/widgetfx/issues/detail?id=31

/M v h Pär
Welcome to my blog, mostly about programming: http://www.pmdit.se/blog
Reply all
Reply to author
Forward
0 new messages