You are not logged in Log in Join
You are here: Home » Members » Martijn Faassen's Page » DomWidgetsDemo » info » View Document

Log in
Name

Password

 

info

This is a proof of concept demo of how a DOM could be layered on top of XMLWidgets. It's also a clean demo of the basic philosophy of XMLWidgets; it may be easier to understand the operation of XMLWidgets by first examining the source of this demo.

The basic structure of this demo is as follows:

DomCore
a set of very simple classes. Instances are persistent in Zope and support acquisition. They contain DOM data, but don't support any DOM methods.
Widget
the widgets can wrap themselves around instances of the DomCore clases, to supply them with DOM methods (or any other methods you'd like). Because the wrapping occurs at runtime, the mapping can be made very dynamic.
WidgetDomTest
a Zope object containing a simple DOM-like tree built from DomCore nodes. Used for testing from Zope.

The DOM tree that's in WidgetDomTest does not store any widgets. Widgets in this demo are not persistent at all. They're simply wrapper objects that wrap around DOM nodes whenever you talk to them from Zope.

In the XMLWidgets system, you can actually define widgets from inside Zope (similar to ZClasses). So in that sense, Widgets can be persistently stored in Zope. Still, they're not directly associated with XMLDocuments at all; any association of widgets with nodes happens at runtime.

While it may eventually not turn out to be desirable to implement the DOM on top of widgets, it would be very nice if the system at least included some hooks to make the ability to plug in widgets a lot easier than it is now. Association of widgets or classes with nodes can be a lot more powerful and flexible than a mapping of nodes to Zope classes during construction time.