A Widget wraps an object, its model, for display. The model can be a
simple Python object (string, list, etc.) or it can be an instance of MVC.Model.
(The former case is for interface purposes, so that the rest of the code does
not have to treat simple objects differently from Model instances.)
If the model is a Model, there are two possibilities:
we are being called to enable an operation on the model
we are really being called to enable an operation on an attribute of the
model, which we will call the submodel
Methods
|
|
|
|
__getitem__
|
__getitem__ ( self, item )
|
|
__init__
|
__init__ (
self,
model,
submodel=None,
)
|
|
__setitem__
|
__setitem__ (
self,
item,
value,
)
|
|
add
|
add ( self, item )
|
|
cleanNode
|
cleanNode ( self, node )
|
|
generateDOM
|
generateDOM (
self,
request,
node,
)
|
|
getData
|
getData ( self )
I have a model; however since I am a widget I am only responsible
for a portion of that model. This method returns the portion I am
responsible for.
|
|
initialize
|
initialize ( self )
|
|
insert
|
insert (
self,
index,
item,
)
|
|
setError
|
setError ( self, message )
|
|
setId
|
setId ( self, id )
I use the ID to know which attribute in self.model I am responsible for
|
|
setNode
|
setNode ( self, node )
Set a node for this widget to use instead of creating one programatically.
Useful for looking up a node in a template and using that.
|
|
setSubmodel
|
setSubmodel ( self, submodel )
I use the submodel to know which attribute in self.model I am responsible for
|
|