Part of twisted.web.woven.widgets View Source View In Hierarchy
Known subclasses: twisted.web.woven.form.FormFillerWidget, twisted.web.woven.widgets.Anchor, twisted.web.woven.widgets.Attributes, twisted.web.woven.widgets.Bold, twisted.web.woven.widgets.Br, twisted.web.woven.widgets.Break, twisted.web.woven.widgets.Cell, twisted.web.woven.widgets.ColumnList, twisted.web.woven.widgets.DefaultWidget, twisted.web.woven.widgets.DeferredWidget, twisted.web.woven.widgets.Div, twisted.web.woven.widgets.Error, twisted.web.woven.widgets.ExpandMacro, twisted.web.woven.widgets.Image, twisted.web.woven.widgets.Input, twisted.web.woven.widgets.Link, twisted.web.woven.widgets.List, twisted.web.woven.widgets.Option, twisted.web.woven.widgets.ParagraphText, twisted.web.woven.widgets.RawText, twisted.web.woven.widgets.Row, twisted.web.woven.widgets.Span, twisted.web.woven.widgets.Table, twisted.web.woven.widgets.Text
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.)
| Instance Variables | model | If the current model is an model.Model,
then the result of model.getData(). Otherwise the original object
itself.
|
| Class Variables | tagName | The tag name of the element that this widget creates. If this is None, then the original Node will be cloned. |
| wantsAllNotifications | Indicate that this widget wants to recieve every change notification from the main model, not just notifications that affect its model. |
| Method | __init__ | |
| Method | initialize | Use this method instead of __init__ to initialize your Widget, so you |
| Method | setSubmodel | I use the submodel to know which attribute in self.model I am responsible for |
| Method | getData | I have a model; however since I am a widget I am only responsible |
| Method | setData | If the return value of getData
is a Deferred, I am called
|
| Method | add | Add `item' to the children of the resultant DOM Node of this widget. |
| Method | appendChild | Add `item' to the children of the resultant DOM Node of this widget. |
| Method | insert | Insert `item' at `index' in the children list of the resultant DOM Node |
| Method | setNode | Set a node for this widget to use instead of creating one programatically. |
| Method | cleanNode | Do your part, prevent infinite recursion! |
| Method | generate | Allow a view to be used like a widget. Will look up the template |
| Method | setDataCallback | Undocumented |
| Method | setUp | Override this method to set up your Widget prior to generateDOM. This |
| Method | generateDOM | |
| Method | modelChanged | Rerender this view, because our model has changed. |
| Method | __setitem__ | Convenience syntax for adding attributes to the resultant DOM Node of |
| Method | __getitem__ | Convenience syntax for getting an attribute from the resultant DOM Node |
| Method | setError | Convenience method for allowing a Controller to report an error to the |
| Method | getTopModel | Get a reference to this page's top model object. |
| Method | getAllPatterns | Get all nodes below this one which have a matching pattern attribute. |
| Method | getPattern | Get a named slot from the incoming template node. Returns a copy |
| Method | addUpdateMethod | Add a method to this widget that will be called when the widget |
| Method | addEventHandler | Add an event handler to this widget. eventName is a string |
| Method | onEvent | Dispatch a client-side event to an event handler that was |
| Method | _reset | Undocumented |
| Method | _regenerate | Undocumented |
Inherited from View:
| Method | getChild | Undocumented |
| Method | getChildWithDefault | Return a child with the given name for the given request. |
| Method | setupAllStacks | Undocumented |
| Method | setupViewStack | Undocumented |
| Method | importViewLibrary | Import the given object or module into this View's view namespace |
| Method | render | Render a request. This is called on the leaf resource for |
| Method | getTemplate | Override this if you want to have your subclass look up its template |
| Method | lookupTemplate | Use acquisition to look up the template named by self.templateFile, |
| Method | handleDocument | Handle the root node, and send the page if there are no |
| Method | handleOutstanding | Undocumented |
| Method | recurseChildren | If this node has children, handle them. |
| Method | dispatchResult | Check a given result from handling a node and look up a NodeMutator |
| Method | setController | Set the controller that this view is related to. |
| Method | getNodeModel | Get the model object associated with this node. If this node has a |
| Method | getNodeController | Get a controller object to handle this node. If the node has no |
| Method | getSubview | Get a sub-view from me. |
| Method | getNodeView | Undocumented |
| Method | handleNode | Undocumented |
| Method | handleControllerResults | Handle a deferred from a controller. |
| Method | handleNewNode | Undocumented |
| Method | sendPage | Check to see if handlers recorded any errors before sending the page |
| Method | setSubviewFactory | Set the callable "factory", which takes a model and should |
| Method | unlinkViews | Undocumented |
| Method | dispatchResultCallback | Deal with a callback from a deferred, checking to see if it is |
| Method | renderFailure | Undocumented |
| Parameters | model | (type: interfaces.IModel
) |
| submodel | see Widget.setSubmodel
(type: String
) | |
| setup | (type: Callable ) |
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.
getData
is a Deferred, I am called when the result of the Deferred is
available.
| Parameters | item | (type: A DOM node or Widget.
) |
| Parameters | item | (type: A DOM node or Widget.
) |
| Parameters | item | (type: A DOM node or Widget.
) |
Override this method to set up your Widget prior to generateDOM. This
is a good place to call methods like add, insert,
__setitem__
and __getitem__.
| Parameters | request | (type: twisted.web.server.Request.
) |
| node | The DOM node which this Widget is operating on. | |
| data | The Model data this Widget is meant to operate upon. |
| Returns | A DOM Node to replace the Node in the template that this Widget
handles. This Node is created based on tagName,
children, and attributes (You should populate
these in setUp,
probably).
| |