[Bese-devel] AJAX teaser
henrik hjelte
henrik at evahjelte.com
Tue Jan 24 09:45:24 UTC 2006
> I'd like to have a UCW
> component/tag for each of Dojos widgets, and nice lispy functions and
> macros for dealing with it in general.
I have started to assemble some dojo tags in a dojo package, so you can
use the dojo attributes like this:
(<dojo:split-pane :orientation "horizontal"
:widgetId "splitter"
:sizerWidth "5"
:activeSizing "0" ...
It is very adhoc now, I have just picked the dojo widgets I have needed
so far and made tags out of them. Here are some thoughts:
One problem is that dojo changes frequently and widgets get added all
the time, so it will be difficult to keep a lisp library like this in
sync. Maybe one could parse the dojo javascript objects and extract the
attributes?
The dojo library parses the html code on the client to extract the
dojo-tags. My impression is that this is really slow. An alternative
could be to have the dojo tags generate some javascript code on the top
of the page that defines the widgets instead. It could look just as nice
in the Lisp code. I will try this soon (in some weeks).
> As it is, I think UCW is getting
> too big, so i'm of the opinion that it should be a seperate library,
> especially if i/you/we plan on including Dojo itself with the code.
An advantage with this is that maybe other Lisp markup users can use at
least some of the code.
I have great hopes for the combination ucw + dojo + parenscript and
would be glad to help with a nice dojo library.
/Henrik Hjelte
-------------- next part --------------
(in-package :it.bese.yaclml)
(defmacro def-dojo-tag (name html-tag base-attributes &rest attributes)
;; Don't know why, but <div></div> and <div/>
;; is NOT THE Same in dojo, so emit-empty tag was dropped
(let ((effective-attributes (arnesi:with-collector (attrs)
(dolist (attr attributes)
(case attr
(:core (attrs 'class 'id 'style 'title))
(:i18n (attrs 'dir 'lang))
(:event (attrs 'onclick 'ondblclick
'onkeydown 'onkeypress
'onkeyup 'onmousedown
'onmousemove 'onmouseout
'onmouseover 'onmouseup))
(t (attrs attr))))
(attrs))))
`(deftag ,name (&attribute , at effective-attributes &body body)
(emit-open-tag ,(string-downcase (symbol-name html-tag))
(list ,base-attributes
,@(mapcar (lambda (attr)
`(cons ,(string-downcase (symbol-name attr)) ,attr))
effective-attributes)))
(when body
(emit-body body))
(emit-close-tag ,(string-downcase (symbol-name html-tag))))))
;------ Layout
(def-dojo-tag <dojo:layout-pane :div (cons "dojoType" "LayoutPane")
:core :event :i18n
layoutAlign
layoutChildPriority
cssPath
url
extractContent
parseContent
handler
minWidth
minHeight
)
(def-dojo-tag <dojo:split-pane :div (cons "dojoType" "SplitPane")
:core :event :i18n
widgetid
orientation
sizerWidth
activeSizing
debugName
;; Inherited from dojo.widget.HtmlLayoutPane
layoutAlign
layoutChildPriority
cssPath
url
extractContent
parseContent
minWidth
minHeight
)
(def-dojo-tag <dojo:split-pane-panel :div (cons "dojoType" "SplitPanePanel")
:core :event :i18n
sizeMin
sizeShare
;; Inherited from dojo.widget.HtmlLayoutPane
layoutAlign
layoutChildPriority
cssPath
url
extractContent
parseContent
minWidth
minHeight
)
;;--------------- Tree -------------
(def-dojo-tag <dojo:tree :div (cons "dojoType" "Tree")
:core :event :i18n
templatePath
templateCssPath
publishSelectionTopic
publishExpandedTopic
publishCollapsedTopic
preChildIcon
nestedChildIcon
snarfChildDomOutput
)
(def-dojo-tag <dojo:tree-node :div (cons "dojoType" "TreeNode")
:core :event :i18n
templatePath
templateCssPath
snarfChildDomOutput
;; the last node and with no children
lastNodeLeafImgSrc
;; not the last node and with no children
notLastNodeLeafImgSrc
;; the last node and with children
lastNodeParentImgSrc
;; not the last node and with children
notLastNodeParentImgSrc
lastNodeParentToggleImgSrc
notLastNodeParentToggleImgSrc
childIcon
childIconSrc
;; the DOM node that holds the title and open / close controls
nodeTitle
;; the DOM text node with the title in it
titleText
;; the node which controls opening and closing the children (only exists when children are added)
toggleControl
;; the node which holds the toggle image.
toggleImage
;; the outer tree containing this node
tree
;; flag to hold whether this is the last node in the branch.
isLastNode
isExpanded
isParent
open
)
(def-dojo-tag <dojo:tabset :div (cons "dojoType" "TabSet")
:core :event :i18n
labelPosition
templateCssPath
selectedTab
;; Inherited from dojo.widget.HtmlLayoutPane
layoutAlign
layoutChildPriority
cssPath
url
extractContent
parseContent
minWidth
minHeight
)
(def-dojo-tag <dojo:tab :div (cons "dojoType" "Tab")
:core :event :i18n
label
;; Is also inherited ;;url
handler
selected
;; Inherited from dojo.widget.HtmlLayoutPane
layoutAlign
layoutChildPriority
cssPath
url
extractContent
parseContent
minWidth
minHeight
)
(def-dojo-tag <dojo:resize-handle :div (cons "dojoType" "ResizeHandle")
:core :event :i18n
targetElmId
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: packages.lisp
Type: text/x-emacs-lisp
Size: 317 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/bese-devel/attachments/20060124/d674893b/attachment.bin>
-------------- next part --------------
(in-package #:cl-user)
(defpackage #:dojo-system
(:use #:cl #:asdf))
(in-package #:dojo-system)
(defsystem "dojo"
:description "Yaclml tags for the Dojo Javascript framework, see dojotoolkit.org"
:version "0.1"
:author "Henrik Hjelte <henrik at evahjelte.com>"
:licence "LLGPL"
:components ((:file "packages")
(:file "dojo" :depends-on ("packages")))
:depends-on (:yaclml))
More information about the bese-devel
mailing list