Victor Mote wrote:
Jeremias Maerki wrote:


I'm currently looking at implementing text-decoration. ATM it's specified as an EnumProperty but should be more like a set of enums with certain validation rules applied. I'm unsure about the approach. If anyone already has an idea how it should look like I'd appreciate any insight.

My first idea was to implement a special property class
(TextDecorationProperty) that handles the conversion of a ListProperty of NCNames to an internal set of variables while at the same time validating the enum combinations. I think my approach would work even if it look a bit awkward. But I wanted to check first so I didn't implement something really ugly.


I think you are on the right track, and it is a curiosity to me why the
standard writers did not create a separate datatype for this. The FOray
implementation uses a pseudo datatype to handle text decoration, handled the
same general way that keeps and spaces are:
http://cvs.sourceforge.net/viewcvs.py/foray/foray/foray-fotree/src/java/org/
foray/fotree/value/DtTextDeco.java?view=markup

The class that creates and uses the datatype is here:
http://cvs.sourceforge.net/viewcvs.py/foray/foray/foray-fotree/src/java/org/
foray/fotree/fo/prop/TextDecoration.java?view=markup

After taking this approach (i.e. allowing all of the variations to be stored
together), text decoration was implemented properly. IOW, all of the other
pieces were already in place, all I had to do was get the data stored and
retrieved correctly. Caveat: FOray stores and retrieves properties using a
late- or no-binding scheme, so the timing will be different, but I would
think the general principle would be the same.

And of course, alt-design had a solution for this, oh, a long, long time ago. It can be found in the usual place, and was even mentioned on the list. That's two solutions so far, and counting.


Peter

Reply via email to