Home | Trees | Index | Help |
---|
Package twisted :: Package web :: Package woven :: Module widgets :: Class Widget |
|
Collection
--+ |Constrained
--+ |ConfigCollection
--+ |Resource
--+ |DOMTemplate
--+ |View
--+ | Widget
FormFillerWidget
,
RawText
,
Input
,
Span
,
Cell
,
Anchor
,
Bold
,
Link
,
List
,
Br
,
DefaultWidget
,
Error
,
Div
,
Text
,
Table
,
Row
,
FancyBox
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 model.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.)
Method Summary | |
---|---|
| |
Convenience syntax for getting an attribute from the resultant DOM Node of this widget. | |
Convenience syntax for adding attributes to the resultant DOM Node of this widget. | |
Add `item' to the children of the resultant DOM Node of this widget. | |
Add an event handler to this widget. | |
Add a method to this widget that will be called when the widget is being rendered. | |
Do your part, prevent infinite recursion! | |
Remove a static reference for 'name'. (inherited from Resource )
| |
Check a given result from handling a node and hand it to a process* method which will convert the result into a node and insert it into the DOM tree. (inherited from DOMTemplate )
| |
Deal with a callback from a deferred, dispatching the result and recursing children. (inherited from DOMTemplate )
| |
A method that determines whether an entity may be added to me. (inherited from ConfigCollection )
| |
Allow a view to be used like a widget. | |
Return a DOM Node to replace the Node in the template that this Widget handles. | |
Retrieve a 'child' resource from me. (inherited from Resource )
| |
(internal) Get a child of mine dependant on a particular request. (inherited from Resource )
| |
(internal) Retrieve a static or dynamically generated child resource from me. (inherited from Resource )
| |
I have a model; however since I am a widget I am only responsible for a portion of that model. | |
Subclass this to generate an entity on demand. (inherited from Resource )
| |
Retrieve an entity from me. (inherited from Collection )
| |
(inherited from ConfigCollection )
| |
(inherited from ConfigCollection )
| |
Get a controller object to handle this node. (inherited from View )
| |
Get the model object associated with this node. (inherited from View )
| |
(inherited from View )
| |
Get a named slot from the incoming template node. | |
Get an entity that was added to me using putEntity. (inherited from Resource )
| |
Get a sub-view from me. (inherited from View )
| |
Override this if you want to have your subclass look up its template using a different method. (inherited from DOMTemplate )
| |
(inherited from View )
| |
Handle the root node, and send the page if there are no outstanding callbacks when it returns. (inherited from DOMTemplate )
| |
(inherited from View )
| |
(inherited from View )
| |
(inherited from View )
| |
Handle a single node by looking up a method for it, calling the method and dispatching the result. (inherited from View )
| |
(inherited from View )
| |
Use this method instead of __init__ to initialize your Widget, so you don't have to deal with calling the __init__ of the superclass. | |
Insert `item' at `index' in the children list of the resultant DOM Node of this widget. | |
A list of all name, entity that I can generate on demand. (inherited from Resource )
| |
Retrieve a list of the names of entities that I store references to. (inherited from Resource )
| |
Retrieve a list of all name, entity pairs that I store references to. (inherited from Resource )
| |
Retrieve a list of the names of entities that I store references to. (inherited from Resource )
| |
Retrieve a list of all name, entity pairs that I store references to. (inherited from Resource )
| |
Retrieve a list of the names of entities that I store references to. (inherited from Resource )
| |
Use acquisition to look up the template named by self.templateFile, located anywhere above this object in the heirarchy, and use it as the template. (inherited from DOMTemplate )
| |
modelChanged(self,
payload)
| |
A method that determines whether an entity may be added to me with a given name. (inherited from Constrained )
| |
Dispatch a client-side event to an event handler that was registered using addEventHandler. | |
Register a child with me. (inherited from Resource )
| |
Store an entity if it meets both constraints. (inherited from Constrained )
| |
(inherited from Resource )
| |
If this node has children, handle them. (inherited from DOMTemplate )
| |
Remove an entity for 'name', based on the content of 'request'. (inherited from Collection )
| |
Render a given resource. (inherited from View )
| |
(inherited from DOMTemplate )
| |
Check to see if handlers recorded any errors before sending the page (inherited from View )
| |
(inherited from View )
| |
If the return value of getData is a Deferred, I am called when the
result of the Deferred is available. | |
setDataCallback(self,
result,
request,
node)
| |
Convenience method for allowing a Controller to report an error to the user. | |
Set a node for this widget to use instead of creating one programatically. | |
I use the submodel to know which attribute in self.model I am responsible for | |
(inherited from View )
| |
Override this method to set up your Widget prior to generateDOM. | |
(inherited from View )
| |
Store an entity for 'name', based on the content of 'request'. (inherited from Collection )
| |
(inherited from View )
|
Instance Variable Summary | |
---|---|
model
- If the current model is an model.Model , then the result of
model.getData(). |
Class Variable Summary | |
---|---|
int |
setupStacks
|
NoneType |
tagName
- The tag name of the element that this widget creates. |
wantsAllNotifications
- Indicate that this widget wants to recieve every change notification
from the main model, not just notifications that affect its model. |
Method Details |
---|
__init__(self,
model=None,
submodel=None,
setup=None,
controller=None,
viewStack=None,
*args,
**kwargs)
|
__getitem__(self,
item)
Convenience syntax for getting an attribute from the resultant DOM
Node of this widget.
|
__setitem__(self,
item,
value)
Convenience syntax for adding attributes to the resultant DOM Node
of this widget.
|
add(self, item)Add `item' to the children of the resultant DOM Node of this widget.
|
addEventHandler(self, eventName, handler, *args)Add an event handler to this widget. eventName is a string indicating which javascript event handler should cause this handler to fire. Handler is a callable that has the signature handler(request, widget, *args). |
addUpdateMethod(self, updateMethod)Add a method to this widget that will be called when the widget is being rendered. The signature for this method should be updateMethod(request, widget, data) where widget will be the instance you are calling addUpdateMethod on. |
cleanNode(self, node)Do your part, prevent infinite recursion! |
generate(self, request, node)Allow a view to be used like a widget. Will look up the template file and return it in place of the incoming node.
|
generateDOM(self, request, node) |
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. The return value of this may be a Deferred; if it is, thensetData will be called once the result is
available.
|
getPattern(self, name, default=Element('div', attributes={'style': 'border:&nb..., clone=1)Get a named slot from the incoming template node. Returns a copy of the node and all its children. If there was more than one node with the same slot identifier, they will be returned in a round-robin fashion. |
initialize(self, *args, **kwargs)Use this method instead of __init__ to initialize your Widget, so you don't have to deal with calling the __init__ of the superclass. |
insert(self, index, item)Insert `item' at `index' in the children list of the resultant DOM Node of this widget.
|
onEvent(self, request, eventName, *args)Dispatch a client-side event to an event handler that was registered using addEventHandler. |
setData(self, data)If the return value ofgetData is a Deferred, I am called when
the result of the Deferred is available.
|
setError(self, request, message)Convenience method for allowing a Controller to report an error to the user. When this is called, a Widget of class self.errorFactory is instanciated and set to self.become. When generate is subsequently called, self.become will be responsible for mutating the DOM instead of this widget. |
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(self, submodel)I use the submodel to know which attribute in self.model I am responsible for
|
setUp(self, request, node, data)Override this method to set up your Widget prior to generateDOM.
This is a good place to call methods like
|
Instance Variable Details |
---|
modelIf the current model is anmodel.Model , then the result of
model.getData(). Otherwise the original object itself.
|
Class Variable Details |
---|
setupStacks
|
tagNameThe tag name of the element that this widget creates. If this is None, then the original Node will be cloned.
|
wantsAllNotificationsIndicate that this widget wants to recieve every change notification from the main model, not just notifications that affect its model. |
Home | Trees | Index | Help |
---|
Generated by Epydoc 1.2 prerelease on Wed Jan 29 06:26:41 2003 | http://epydoc.sf.net |