I have seen similar things a long time ago when I used to work with Swing interfaces. In java you call this serialization to XML.
http://java.sun.com/products/jfc/tsc/articles/persistence/index.html http://java.sun.com/products/jfc/tsc/articles/persistence2/ In an ideal world you could describe your form with XML, the structure is easy to describe but the behaviour can be tricky specially if your form has elements that are not serializables (for instance threads, or db connections). In these case you should manually decide how you are going to handle these cases. Mozilla has something similar: https://developer.mozilla.org/En/XUL A couple of other initiatives: http://en.wikipedia.org/wiki/XForms http://ajaxforms.sourceforge.net/docs/index.html Cheers, Diego On 2:59 PM, Koen Deforche wrote: > Hey Omer, > > 2010/6/2 omer katz <[email protected]>: > >> Hello, >> I had been thinking about a way to automate even more the process of >> creating user interfaces in Wt. >> If we could define widgets on the XML file like this for example: >> >>> <Widget type=TextEdit" name="foo" value="bar" /> >>> >> It would make development of user interfaces much easier and even cheaper as >> regular web developers could just do it themselves. >> It will also allow us to create the Wt Creator much more easily. >> > Aside from conerns with syntax, I cannot but agree with the idea. This > syntax is in fact the initial syntax I used for WTemplate, but mixing > XHTML tags with new invented tags makes it hard to easily spot the > variables in a template -- and this is why I changed from <WWidget ... > >> to ${ } syntax. >> > Still, the XML approach may be more appropriate in this case, > especially if you consider that a widget may contain other widgets. > > >> How to achieve this? >> >> By creating a compile time tool that will generate the necessary functions >> from the xml file. >> By replacing the Widget node with a placeholder like replacing the widget >> node with {$foo} in our example and generating a production use xml file. >> Using a small set of macros >> Using the RapidXML parser that wt already uses >> > Here though, I believe there are many better options. I recommend to > use a an approach inspired by the factory design using type lists, > described in "Modern C++ Design: Generic Programming and Design > Patterns Applied" by Andrei Alexandrescu (see > http://erdani.com/book/main.html) > > Properties for a particular class should be described using a traits class. > > Something special should be done to handle nested contents, whose > support for a particular class (like WContainerWidget) is also > described in the traits class. Layout managers may require some > hard-wired support, or could perhaps also be handled by a factory. > > All this together would avoid the need for code generation, would > avoid code bloat when particular widgets are not used (by excluding > them from the type-list), and offers great flexibility over all. Code > generation has no place in modern C++. > > >> The system shall allow to bind JavaScript or C++ code to events like this: >> >>> <Widget type=Silder" name="foo" value="bar"> >>> >>> <Event name=alueChanged" language="JavaScript"> >>> >>> function handler(value) { alert (value); } >>> >>> </Event> >>> >>> </Widget> >>> > Event handling using C++ code is indeed hard to describe in my system, > but at the same time C++ code should be in a C++ file so that you can > edit it with an editor that understands it. > > Regards, > koen > > > -- Diego Cantor-Rivera mailto:[email protected] -------------------------------------------------------------------- p.s. Internet Privacy -------------------------------------------------------------------- My PGP public key is attached to this message. If you want to know how to use my key please let me know. Ma cle publique PGP est attachee a ce message. Si tu veux savoir comment l'utiliser, demande-moi pour renseignements. Mi llave publica PGP se encuentra anexada a este correo. Si quieres saber como usar mi llave, preguntame. -------------------------------------------------------------------- ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
