mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-24 02:50:41 -08:00
start of clog-data load panels from plists
This commit is contained in:
parent
5419653027
commit
77cbfc020d
3 changed files with 44 additions and 1 deletions
1
clog.asd
1
clog.asd
|
|
@ -32,6 +32,7 @@
|
|||
(:file "clog-system")
|
||||
(:file "clog-panel")
|
||||
(:file "clog-presentations")
|
||||
(:file "clog-data")
|
||||
(:file "clog-gui")
|
||||
(:file "clog-web")
|
||||
(:file "clog-helpers")))
|
||||
|
|
|
|||
37
source/clog-data.lisp
Normal file
37
source/clog-data.lisp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;; CLOG - The Common Lisp Omnificent GUI ;;;;
|
||||
;;;; (c) 2020-2022 David Botton ;;;;
|
||||
;;;; License BSD 3 Clause ;;;;
|
||||
;;;; ;;;;
|
||||
;;;; clog-data.lisp ;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(cl:in-package :clog)
|
||||
|
||||
;;; Various functions for binding data
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Implementation - data binding
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun data-load-plist (obj plist &key (upcase-key t))
|
||||
"A plist where key is name of slot and value is data to load on panel.
|
||||
The key is coverted to a string and upper cased before attempting to
|
||||
match it to a slot if :UPCASE-KEY t. If slot is a clog-element
|
||||
TEXT-VALUE is set, if not the slot is set to the value. If key is not
|
||||
the name of a slot it is ignored."
|
||||
(loop for (key value) on plist by #'cddr while value
|
||||
do
|
||||
(let* ((slot-str (format nil "~A" key))
|
||||
(slot-name (if upcase-key
|
||||
(string-upcase slot-str)
|
||||
slot-str)))
|
||||
(when (find-symbol slot-name)
|
||||
(let ((slot-sym (intern slot-name)))
|
||||
(when (slot-exists-p obj slot-sym)
|
||||
(if (and (slot-boundp obj slot-sym)
|
||||
(typep (slot-value obj slot-sym) 'clog:clog-element))
|
||||
(setf (text-value (slot-value obj slot-sym)) value)
|
||||
(setf (slot-value obj slot-sym) value))))))))
|
||||
|
||||
|
||||
|
|
@ -38,6 +38,7 @@ embedded in a native template application.)"
|
|||
(@clog-element section)
|
||||
(@clog-element-common section)
|
||||
(@clog-presentations section)
|
||||
(@clog-data section)
|
||||
(@clog-panels section)
|
||||
(@clog-style-block section)
|
||||
(@clog-form section)
|
||||
|
|
@ -511,7 +512,7 @@ embedded in a native template application.)"
|
|||
(create-table-column-group-item generic-function))
|
||||
|
||||
(defsection @clog-presentations (:title "CLOG Presentations")
|
||||
"CLOG-Presentations - CLOG Presentations"
|
||||
"CLOG-Presentations - CLOG bindings to Lisp Objects"
|
||||
(link-slot-and-form-element macro)
|
||||
(link-slot-and-element macro)
|
||||
(link-form-element-to-slot macro)
|
||||
|
|
@ -521,6 +522,10 @@ embedded in a native template application.)"
|
|||
(link-slot-to-element macro)
|
||||
(link-slot-to-place macro))
|
||||
|
||||
(defsection @clog-data (:title "CLOG Data")
|
||||
"CLOG-Data - CLOG Data Binding"
|
||||
(data-load-plist function))
|
||||
|
||||
(defsection @clog-panels (:title "CLOG Panels")
|
||||
"CLOG-Panel - CLOG Panels"
|
||||
(clog-panel class)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue