Class Selector

A selector is a convinience widget based on the
dispatcher widget and selector-mixin interface. It allows setting a
list of widgets declaratively. Every time the selector is rendered,
it dispatches to one of these widgets based on the URL. When the
list of widgets is known, selector makes implementing 'on-dispatch'
unnecessary. Note that the panes are searched in the order in which
they were declared. If there are panes with multiple tokens and
panes with single tokens that share the first token name, be sure to
place panes with multiple tokens first.

Part of:

package weblocks, class navigation, class selector-mixin, class dispatcher

Direct Superclass

dispatcherThe dispatcher widget can be used to map a sequence
of URL tokens to a widget corresponding to ...
selector-mixinA mixin for selectors that allows specifying a list
of panes which comprise of pane names and c...

Direct Subclass

navigationThe navigation widget can act as a menu controls, a
tabbed control, etc. It is a convenience co...

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.
current-pane-name
A name that identifies currently selected entry. The selector widget should set this slot every time a new widget is selected by the user.
Initargs::current-pane-name; Accessors:selector-mixin-current-pane-name.
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.
panes
An association list of pane names (or pane-info structures) and widgets. When a particular name is selected, the corresponding widget should be rendered by the selector widget.
Initargs::panes; Accessors:selector-mixin-panes.
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 ...
selector-on-dispatchThis function implements dispatcher's 'on-dispatch'
for the selector. It selects from one of th...

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...
render-widget-bodyA generic function that renders a widget in its current state. In
order to actually render the wi...
selector-mixin-current-paneReturns a default pane to select in case no uri
tokens are specified. Default implementation retu...
selector-mixin-current-pane-widgetReturns a default pane to select in case no uri
tokens are specified. Default implementation retu...
selector-mixin-default-paneReturns a default pane to select in case no uri
tokens are specified. Default implementation retu...
setfdom-id
setfwidget-name
setfwidget-parent
widget-nameAn interface to the DOM id of a widget. Provides
access to the underlying implementation, can r...