From 4644082451f92f7a060e47be6b9967acf8412c7f Mon Sep 17 00:00:00 2001 From: drewc Date: Tue, 10 Feb 2009 17:41:32 -0800 Subject: [PATCH] minor updates to work with released ucw-core darcs-hash:20090211014132-39164-045377afa026ab6214332a167905410cf541a897.gz --- lisp-on-lines-ucw.asd | 2 +- src/display.lisp | 2 + src/standard-descriptions/list.lisp | 20 +++- src/standard-descriptions/t.lisp | 26 ++++- src/standard-descriptions/validate.lisp | 22 +++-- src/ucw/html-description.lisp | 13 +-- src/ucw/lol-components.lisp | 5 +- src/ucw/packages.lisp | 125 +++++------------------- src/ucw/standard-components.lisp | 77 +++++++-------- 9 files changed, 124 insertions(+), 168 deletions(-) rewrite src/ucw/packages.lisp (78%) diff --git a/lisp-on-lines-ucw.asd b/lisp-on-lines-ucw.asd index 92d4d78..0764921 100644 --- a/lisp-on-lines-ucw.asd +++ b/lisp-on-lines-ucw.asd @@ -11,7 +11,7 @@ :components ((:module :ucw :components ((:file "packages") - (:file "lol-tags") + (:file "standard-components") (:file "contextl-components") (:file "html-description") diff --git a/src/display.lisp b/src/display.lisp index a0be611..7de1c63 100644 --- a/src/display.lisp +++ b/src/display.lisp @@ -22,6 +22,7 @@ (defun display (display object &rest args &key deactivate activate &allow-other-keys) + (funcall-with-layer-context (modify-layer-context (current-layer-context) :activate activate @@ -32,6 +33,7 @@ (define-layered-method display-using-description :around (description display object &rest args) (declare (ignorable args)) +#+nil (break "Entering DISPLAY for ~A on ~A using ~A" object display description) (let ((*display* display)) (apply #'funcall-with-described-object (lambda () diff --git a/src/standard-descriptions/list.lisp b/src/standard-descriptions/list.lisp index 133ee69..1d5737d 100644 --- a/src/standard-descriptions/list.lisp +++ b/src/standard-descriptions/list.lisp @@ -6,8 +6,24 @@ (define-layered-method display-attribute-value ((attribute list-attribute)) - (arnesi:dolist* (item (attribute-value attribute)) - (apply #'display *display* item (slot-value attribute 'item-args)))) + (generic-format *display* "(") + (let ((list (attribute-value attribute))) + + (loop + :for cons :on list + :do (let ((item (first cons +))) + (break "Display T ~A" item) + (dletf (((attribute-object attribute) item)) + (apply #'display *display* item (slot-value attribute 'item-args)) + (unless (endp (cdr cons)) + (generic-format *display* " ")))))) + (generic-format *display* ")")) + + + + + (define-description list () ((list :attribute-class list-attribute diff --git a/src/standard-descriptions/t.lisp b/src/standard-descriptions/t.lisp index 2f77c47..5baf369 100644 --- a/src/standard-descriptions/t.lisp +++ b/src/standard-descriptions/t.lisp @@ -52,14 +52,25 @@ :activate (attribute-active-descriptions attribute) :deactivate (attribute-inactive-descriptions attribute) args))) - + + (let ((val (attribute-value attribute))) +#+nil (break "display Attribute value: ~A with object ~A ~% Description ~A att-d ~A ~% VALUE ~A display on ~A" + attribute + (attribute-object attribute) + *description* + (attribute-description attribute) + val + *display* + ) (if (and (not (slot-boundp attribute 'active-attributes)) - (eql val (attribute-object attribute))) - (generic-format *display* (funcall (attribute-value-formatter attribute) val)) + (equal val (attribute-object attribute))) + (progn (generic-format *display* "~A"(funcall (attribute-value-formatter attribute) val)) + #+nil(break "using generic format because val is object and there is no active attributes.")) + (with-active-descriptions (inline) (cond ((slot-value attribute 'value-formatter) - (generic-format *display* (funcall (attribute-value-formatter attribute) val))) + (generic-format *display* "~A"(funcall (attribute-value-formatter attribute) val))) ((slot-boundp attribute 'active-attributes) (disp val :attributes (slot-value attribute 'active-attributes))) (t @@ -83,7 +94,12 @@ (define-layered-method display-attribute :before ((attribute standard-attribute)) -) +#+nil (break "Attribute : ~A with object ~A ~% Description ~A att-d ~A" + attribute + (attribute-object attribute) + *description* + (attribute-description attribute) +)) (define-display ((description t)) (let ((attributes (attributes description))) diff --git a/src/standard-descriptions/validate.lisp b/src/standard-descriptions/validate.lisp index d98a787..5a5fb62 100644 --- a/src/standard-descriptions/validate.lisp +++ b/src/standard-descriptions/validate.lisp @@ -50,7 +50,7 @@ (setf (gethash name *validators*) fn)) (defun find-validator (name) - (gethash name *validators*)) + (gethash name *validators*)) (register-validator 'boundp (lambda (a v) @@ -63,22 +63,24 @@ :object (attribute-object a)))) t))) -(defun validp (object) + +(defun validp (object) (with-described-object (object nil) (every #'identity (mapcar (lambda (attribute) - (validate-attribute-value attribute (attribute-value attribute))) - (attributes (description-of object)))))) + (validate-attribute-value attribute (attribute-value attribute))) + (attributes (description-of object)))))) (define-layered-method lol::display-attribute-editor :in-layer #.(defining-description 'validate) :after (attribute) - (let ((conditions (remove-if-not (lambda (a) - (eq a attribute)) - (gethash - (attribute-object attribute) - lol::*invalid-objects*) - :key #'car))) + (let ((conditions (remove-if-not + (lambda (a) + (eq a attribute)) + (gethash + (attribute-object attribute) + lol::*invalid-objects*) + :key #'car))) (dolist (c conditions) (<:div :style "color:red" (<:as-html diff --git a/src/ucw/html-description.lisp b/src/ucw/html-description.lisp index 1bc264b..83847ed 100644 --- a/src/ucw/html-description.lisp +++ b/src/ucw/html-description.lisp @@ -4,11 +4,10 @@ (defvar *escape-html* t) -(defmethod generic-format ((display lol-ucw:component) string &rest args) +(defmethod generic-format ((display ucw-core:component) string &rest args) (<:as-html (with-output-to-string (stream) (apply #'call-next-method stream string args)))) - (define-description html-description () ()) @@ -115,7 +114,7 @@ val))) (defmethod display-html-attribute-editor (attribute editor) - (