1 (in-package :lisp-on-lines
)
5 #+nil
(define-layered-class
6 description
:in-layer dojo
()
7 ((dojo-type :accessor dojo-type
:initarg
:dojo-type
:initform nil
:special t
)))
9 (define-layered-function display-as-dojo-type
(type description object component
))
12 :in-layer dojo
:after
(description object
)
13 (when (dojo-type description
)
14 (display-as-dojo-type (dojo-type description
) description object self
)))
16 (defcomponent combo-results
()
19 (defmethod render ((self combo-results
))
20 (<:as-is
(js:js
* `(array
21 ,@(loop for r in
(results self
)
24 (with-output-to-string (s)
25 (yaclml:with-yaclml-stream s
26 (display self r
:type
'as-string
)))
30 (define-layered-method display-as-dojo-type
((type (eql 'combo-box
)) attribute object component
)
32 (let* ((search-function (search-function attribute
))
33 (select-function (select-function attribute
))
34 (select-callback (ucw::make-new-callback
36 (funcall select-function
37 (parse-integer x
))))))
38 "The combo box widget"
40 `(dojo.require
"dojo.*")
41 `(dojo.require
"dojo.widget.*")
42 `(dojo.require
"dojo.widget.html.ComboBox")
43 (js:with-unique-js-names
(element combo-box
)
47 (setf ,element
(dojo.by-id
,(id attribute
)))
49 (dojo.widget.from-script
52 :data-url
(+ , (lol::make-action-url
55 (context.window-component
*context
*)
56 (make-instance 'combo-results
58 (funcall search-function
59 (attribute-value object attribute
)))))
61 ,(escape-as-uri (callback attribute
))
65 ((slot-value ,combo-box
'set-value
) (slot-value ,element
'value
))
67 ,combo-box
"selectOption"
69 (setf (slot-value ,element
'value
)
70 (slot-value ,combo-box
'selected-result
))
73 :url
(+ ,(lol::make-action-url
77 ,(escape-as-uri (callback attribute
))
79 (slot-value ,combo-box
'selected-result
)
83 (slot-value ,combo-box
'combo-box-selection-value.value
))))))))))))