X-Git-Url: https://git.hcoop.net/clinton/lisp-on-lines.git/blobdiff_plain/14a7e1bc1292858dce5ac75038f660c2e52898a5..fdeed55df38cdfc1d202f425ef6be3e2af2c1f96:/src/standard-display.lisp diff --git a/src/standard-display.lisp b/src/standard-display.lisp index c9f8fcb..cc0b897 100644 --- a/src/standard-display.lisp +++ b/src/standard-display.lisp @@ -25,17 +25,29 @@ (apply #'display ,component thing args))) ,@body))) -(defmacro call-display (object &rest args) - `(call-component self (make-instance 'standard-display-component + +(define-layered-function find-display-type (object)) + +(define-layered-method find-display-type (object) + 'viewer) + +(define-layered-function find-display-layers (object)) + +(define-layered-method find-display-layers (object) + "layered function" + nil) + +(defmacro call-display (component object &rest args) + `(call-component ,component (make-instance 'standard-display-component :display #'(lambda (component) (with-component (component) - (<:as-html ,object) - (display ,object ,@args)))))) + (display ,component ,object ,@args)))))) (defmethod find-plist (object) (list)) -` + (defmethod find-plist ((attribute standard-attribute)) + (warn "atttributre plist ~A" (attribute.plist attribute)) (attribute.plist attribute)) (defmacro with-plist ((plist-form &optional prefix) &body body) @@ -103,7 +115,7 @@ default action is to FUNCALL-WITH-LAYERS the DISPLAY-USING-DESCRIPTION method.")) (define-layered-method display - ((component t) (object standard-object) &rest args &key layers (type 'viewer) &allow-other-keys) + ((component t) (object standard-object) &rest args &key layers (type 'viewer) &allow-other-keys) (let* ((occurence (find-occurence object)) (plist (attribute.plist (find-attribute occurence (intern (format nil "~A" type) :KEYWORD)))) @@ -117,7 +129,7 @@ (define-layered-method display - ((component t) (object t) &rest args &key (layers '(+ viewer)) &allow-other-keys) + ((component t) (object t) &rest args &key layers (type 'viewer) &allow-other-keys) (funcall-with-layers layers #'display-using-description t component object args)) @@ -140,18 +152,22 @@ (loop for att in (or (o-getp :attributes) (list-slots object)) do (let* ((att (ensure-list att)) (attribute (find-attribute occurence (first att)))) - (warn "trying to render ~A in ~A" attribute object) (with-plist ((plist-union (rest att) (find-plist attribute))) (<:p :class "attribute" - (<:span :class "label" (<:as-html (getp :label) " ")) + (and (o-getp :show-labels-p) + (<:span :class "label" (<:as-html (or (getp :label) "") " "))) (display-using-description attribute component object (rest att)))))))) + + + ;;;; ** One line (defdisplay (:in-layer one-line) + "The one line presentation just displays the attributes with a #\Space between them" (do-attributes (attribute occurence (or (getp :attributes) (list-slots object))) (display-using-description attribute component object (attribute-properties)) @@ -196,7 +212,6 @@ (