[daisy] Custom field type editors
Paul Focke
paul at outerthought.org
Tue Jan 8 04:12:36 CST 2008
Hi
As of late I've been investigating custom field type editors. We all
know that daisy has a way of allowing custom part editors. These custom
part editors can come in really handy. For example you might have a
certain xml format you wish to make editable. Simply confronting your
editors with a text editor might be a little, well, confronting. So what
you do is have a look on this page
http://cocoondev.org/daisydocs-2_1/374-cd/235-cd.html , checkout the
existing part editors, do a little coding and presto! happy editors.
Now suppose you wanted to do the same thing for fields then you would
run into a bit of wall. You could try changing the field editor xsls to
style your editor the way you want to but that just isn't enough at
times. Another way might be to make a custom part editor and then fill
up the field using a pre save hook, but that's just a bit of nasty hack
and since we're all coders with strong moral fiber here we don't do any
of that.
That's why I'm suggesting a similar mechanism as custom part editors.
This would mean :
* an xml file for a field type which configures the editor.
* a java class that drives the editor (loading, rendering, storing)
When starting up the editor a component would check if there is a custom
editor available (check for YourFieldType.xml in
<wikidata>/resources/fieldeditors ). In this file a factory class for
the editor would be retrieved so the editor can be created.
To make the creation of editor class as painless as possible a helper
class or abstract class will be made available that contains default
behaviour of loading/storing/rendering field values.
Field dependencies. I haven't given this much thought but right now
there is no such thing as field dependencies and I'm not sure if custom
field editors might open doors for such things. It won't allow
repository schema modeling of field dependencies but I guess it might be
possible to render dependencies (possibly validate in the front end) and
create an illusion that there is one.
So now that you know of my plans is there anybody out there that has any
thoughts on the matter?
Paul
More information about the daisy
mailing list