Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sapphire-dev] More on default value

You’d need to use a custom XML binding at higher level (list or element property) to make sure that when a new XML element is created, it has certain sub-elements pre-populated. This is usually sufficient and fairly transparent for the user. The new element is simply created with some set of properties pre-entered, but you aren’t re-defining XML value binding semantics in a way that could confuse users.

 

> So I tried with a custom binding and force the default value to be written to the xml file when the passed in value is null.

 

If you do decide that you need this too, make sure that you maintain read/write symmetry. A write(null) followed by read() should produce null, not some value “xyz”.

 

- Konstantin

 

 

From: sapphire-dev-bounces@xxxxxxxxxxx [mailto:sapphire-dev-bounces@xxxxxxxxxxx] On Behalf Of Shenxue Zhou
Sent: Wednesday, July 27, 2011 10:41 AM
To: Sapphire project
Subject: [sapphire-dev] More on default value

 

There has been some discussions on the UI default value vs. xml value in this thread : http://dev.eclipse.org/mhonarc/lists/sapphire-dev/msg00364.html

 

So I tried with a custom binding and force the default value to be written to the xml file when the passed in value is null. But when a new element is created through the UI, the custom binding's write() method is not called. So I still ended up with no default value in the xml file and thus an xml validation error.

 

I could think of adding a listener on one of its property to force the setting of the default value on property with the default value. Is there a better way to achieve the same goal?

 

Thanks,

 

Shenxue


Back to the top