Hi devs,
I'd like to extend the set of property types available in the AWM
class editor (the field palette) and I'm not sure where is the best
place to do this: in the Java code (oldcore) or in the wiki. I prefer
the wiki. Let me explain.
We recently added two new property types in the oldcore: email and
page. If you look at these two you'll see that email is just a string
property with a default validation regexp and page is just a dblist
property.
The AWM class editor has a system that lets you define property
'templates' in the wiki. To define the email property type I could do
this:
* create AppWithinMinutes.Email xclass with a single String property
(the 'template')
* set the validation regexp to match an email address (but I can set
other meta properties as well with *default* values)
* add an object of type AppWithinMinutes.FormFieldClass to
AppWithinMinutes.Email to specify (among other things) the list of
meta properties that should be visible in the class editor. For
instance, I'd like to hide the validation regexp.
At this point the AWM class editor will detect the email property type
and list it in the field palette and you can add it to your class. The
only problem is that when editing the class back the editor doesn't
have yet a way to determine what was the template used to add the
property so it uses the default one, the one for the String property
in this case.
So my question is: do you think it's good to be able to define new
property types from the wiki (e.g. Image, Attachment, Color, etc.) or
should they all be written in Java? If the answer is Wiki, then I'll
think of a way to store the reference to the property template so that
the AWM class editor can edit back using the right template.
Note that it crossed my mind to define a property type component that
can be implemented both from Java and from the wiki but transforming
the oldcore code that handles objects/properties into components is
very difficult.
Thanks,
Marius