Class Dispatcher

The dispatcher widget can be used to map a sequence
of URL tokens to a widget corresponding to those tokens. It can be
used to implement any dispatch strategy of choice. Note, this
dispatcher class is not treated in a special way by the
framework. Similar dispatcher classes can be written without any
framework modifications. The dispatcher is only required to modify
*uri-tokens* as they're consumed, maintain *current-navigation-url*,
and set *uri-tokens-fully-consumed* to true if the tokens are fully
consumed.

Part of:

package weblocks, class selector, class widget

Direct Superclass

widgetBase class for all widget objects.

Direct Subclass

selectorA selector is a convinience widget based on the
dispatcher widget and selector-mixin interface....

Slot

cache
If a widget is generated dynamically via 'on-dispatch', and :no-cache isn't returned as the fourth value, the widget is cached in this slot. This is done to maintain the same instance of the generated widget accross non-ajax requests. This slot contains nil (if no widget is cached), or a cons pair with car containing a list of tokens used to generate the widget, and cdr contains the widget object.
Accessors:dispatcher-cache.
continuation
Stores the continuation object for widgets that were invoked via one of the do-* functions ('do-page', etc.). When 'answer' is called on a widget, this value is used to resume the computation.
Accessors:widget-continuation.
dom-class
The DOM class (CSS class) of an object. Set this to a string if you'd like to add an additional CSS class to the ones generated from the class hierarchy by default.
Initargs::dom-class; Accessors:dom-class.
dom-id
The DOM id of an object. Can be a symbol, a string or nil. When accessed through the 'dom-id' accessor, will always become a string. Use ensure-dom-id or widget-name (for widgets) to access its underlying implementation.
Initargs::dom-id.
on-dispatch
Must be bound to a function of two arguments - (the dispatcher object, and a list of url tokens). The function is expected to consume zero or more tokens, and return three values - a widget that represents a subset of the uri tokens, a list of consumed uri tokens, and a list of remaining uri tokens. If the widget cannot be instantiated, the function should return nil. Note, it is necessary to return both consumed and remaining tokens because the function may want to return 'implicitly' consumed tokens not present in the URL, (for example a url '/' may really indicate default url '/employees'). This is necessary to properly maintain *current-navigation-url* in nested dispatcher environments. Additionally, the function may return different remaining tokens to modify the URL on the fly. If the function returns a widget, the dispatcher uses the widget to present the URL. Otherwise, assummes the URL is invalid. This can be used for wiki-style URLs, or any kind of custom dispatching. Note, the returned widget will be cached in 'dynamic-pane-cache'. To turn off caching the widget, the function should return a fourth value :no-cache.
Initargs::on-dispatch; Accessors:dispatcher-on-dispatch.
propagate-dirty
A list of widget paths (see 'find-widget-by-path') or widgets each of which will be made dirty when this widget is made dirty via a POST request. This slot allows setting up dependencies between widgets that will make multiple widgets update automatically during AJAX requests.
Initargs::propagate-dirty; Accessors:widget-propagate-dirty.
renderedp
This slot holds a boolean flag indicating whether the widget has been rendered at least once. Because marking unrendered widgets as dirty may cause JS problems, 'mark-dirty' will use this flag to determine the status of a widget.
Accessors:widget-rendered-p.
widget-prefix-fn
A function called prior to rendering the widget body. The function should expect the widget as well as any additional arguments passed to the widget.
Initargs::widget-prefix-fn; Accessors:widget-prefix-fn.
widget-suffix-fn
A function called after rendering the widget body. The function should expect the widget as well as any additional arguments passed to the widget.
Initargs::widget-suffix-fn; Accessors:widget-suffix-fn.
widgets-ephemeral-p
Whether widgets should be considered to exist for certain only if in the `dispatcher-cache'. When non-nil (the default), `find-widget-by-path*' will only follow paths through the cached widget.
Initform:t, Initargs::widgets-ephemeral-p; Accessors:dispatcher-widgets-ephemeral-p.

Direct Method

find-widget-by-path*Returns a widget object located at 'path', where 'path' is a list
of widget names starting from r...
per-class-dependenciesReturn a list of dependencies for an object of a
particular class. For widgets, this method is ...
render-widget-bodyA generic function that renders a widget in its current state. In
order to actually render the wi...

Other Method

composite-widgets
dom-classesReturns a string that represents all applicable CSS
classes for an object (usually a widget). Nor...
dom-idProvides a consistent interface to identifying widgets
by their DOM id. Returns a string or nil i...
ensure-dom-idEnsure that the object has a 'dom-id' and return
it. 'dom-id' is lazily generated on first read...
mark-dirtyDefault implementation adds a widget to a list of dirty
widgets. Normally used during an AJAX req...
setfdom-id
setfwidget-name
setfwidget-parent
widget-nameAn interface to the DOM id of a widget. Provides
access to the underlying implementation, can r...