mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 10:40:45 -08:00
bidirectonal links
This commit is contained in:
parent
95b22e46f0
commit
523af33dbd
3 changed files with 39 additions and 7 deletions
|
|
@ -8,12 +8,44 @@
|
|||
|
||||
(cl:in-package :clog)
|
||||
|
||||
;;; clog-presentations - link Lisp classes to CLOG objects
|
||||
;;; clog-presentations - link Lisp objects and CLOG objects
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Implementation - clog-presentations
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; link-slot-and-form-element ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defmacro link-slot-and-form-element (object accessor clog-obj
|
||||
&key (set-event #'set-on-change)
|
||||
transform-to-lisp
|
||||
transform-to-element)
|
||||
"Biderectional link slot (ACCESSOR OBJECT) <> clog-form-element (CLOG-OBJ)"
|
||||
`(progn
|
||||
(link-form-element-to-slot ,clog-obj ,object ,accessor
|
||||
:set-event ,set-event
|
||||
:transform ,transform-to-lisp)
|
||||
(link-slot-to-form-element ,object ,accessor ,clog-obj
|
||||
:transform ,transform-to-element)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; link-slot-and-element ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defmacro link-slot-and-element (object accessor clog-obj
|
||||
&key (set-event #'set-on-change)
|
||||
transform-to-lisp
|
||||
transform-to-element)
|
||||
"Biderectional link slot (ACCESSOR OBJECT) <> clog-element (CLOG-OBJ)"
|
||||
`(progn
|
||||
(link-element-to-slot ,clog-obj ,object ,accessor
|
||||
:set-event ,set-event
|
||||
:transform ,transform-to-lisp)
|
||||
(link-slot-to-element ,object ,accessor ,clog-obj
|
||||
:transform ,transform-to-element)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; link-form-element-to-slot ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
|
|||
|
|
@ -495,6 +495,8 @@ embedded in a native template application.)"
|
|||
|
||||
(defsection @clog-presentations (:title "CLOG Presentations")
|
||||
"CLOG-Presentations - CLOG Presentations"
|
||||
(link-slot-and-form-element macro)
|
||||
(link-slot-and-element macro)
|
||||
(link-form-element-to-slot macro)
|
||||
(link-element-to-slot macro)
|
||||
(link-element-to-place macro)
|
||||
|
|
|
|||
|
|
@ -25,12 +25,10 @@
|
|||
:label (create-label body :content "Change my-count:"))))
|
||||
(declare (ignore tmp))
|
||||
;; We set up direct relationships between lisp objects and clog objects
|
||||
;; any change to i1 will change my-slot
|
||||
(link-form-element-to-slot i1 lisp-obj my-slot)
|
||||
;; any change to my-slot will change i1 after transforming
|
||||
;; my-slot to upercase
|
||||
(link-slot-to-form-element lisp-obj my-slot i1
|
||||
:transform #'string-upcase)
|
||||
;; any change to i1 will change my-slot and any change to my-slot
|
||||
;; will change i1.
|
||||
(link-slot-and-form-element lisp-obj my-slot i1
|
||||
:transform-to-element #'string-upcase)
|
||||
;; any change to my-count will change t1
|
||||
(link-slot-to-element lisp-obj my-count t1)
|
||||
;; any change to i3 will change my-count
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue