;;; -*- mode: Lisp; Syntax: Common-Lisp; -*-
;;;
;;; Copyright (c) 2009 by the authors.
;;;
;;; See LICENCE for details.
(in-package :hu.dwim.presentation)
;;;;;;
;;; primitive/inspector
(def (component e) primitive/inspector (primitive/presentation t/inspector)
()
(:documentation "A PRIMITIVE/INSPECTOR displays or edits existing values of primitive TYPEs."))
(def render-xhtml :before primitive/inspector
(when (edited-component? -self-)
(ensure-client-state-sink -self-)))
;;;;;;
;;; unbound/inspector
(def (component e) unbound/inspector (unbound/presentation primitive/inspector)
())
;;;;;;
;;; null/inspector
(def (component e) null/inspector (null/presentation primitive/inspector)
())
(def subtype-mapper *inspector-type-mapping* null null/inspector)
;;;;;;
;;; boolean/inspector
(def (component e) boolean/inspector (boolean/presentation primitive/inspector)
())
(def subtype-mapper *inspector-type-mapping* boolean boolean/inspector)
(def render-xhtml boolean/inspector
(render-boolean-inspector -self-))
(def function render-boolean-inspector (component &key (component-value-transformer #'identity))
(bind (((:read-only-slots component-value-type edited-component client-state-sink) component)
(has-component-value? (slot-boundp component 'component-value))
(component-value (funcall component-value-transformer
(when has-component-value?
(component-value-of component)))))