From astalla at common-lisp.net Tue Mar 2 18:59:56 2010 From: astalla at common-lisp.net (Alessio Stalla) Date: Tue, 02 Mar 2010 13:59:56 -0500 Subject: [snow-cvs] r66 - in trunk: . examples/swixml src/lisp/snow Message-ID: Author: astalla Date: Tue Mar 2 13:59:55 2010 New Revision: 66 Log: Added :label pseudo-property for all widgets Added: trunk/CHANGELOG - copied unchanged from r64, /trunk/changelog trunk/TODO Removed: trunk/changelog Modified: trunk/examples/swixml/helloworld.lisp trunk/examples/swixml/helloworld_j.lisp trunk/src/lisp/snow/snow.lisp trunk/src/lisp/snow/widgets.lisp Added: trunk/TODO ============================================================================== --- (empty file) +++ trunk/TODO Tue Mar 2 13:59:55 2010 @@ -0,0 +1,2 @@ +* improve error handling and reporting +* validation (JGoodies?) Modified: trunk/examples/swixml/helloworld.lisp ============================================================================== --- trunk/examples/swixml/helloworld.lisp (original) +++ trunk/examples/swixml/helloworld.lisp Tue Mar 2 13:59:55 2010 @@ -8,9 +8,11 @@ (with-gui () (frame (:size #C(640 280) :title "Hello Snow World" :on-close :exit) (panel (:layout "grow, wrap") - (label :text "Hello World!" :font (font "Georgia" 12 :bold) - :foreground :blue) ;;labelfor="tf" - (text-field :id tf :text "Snow");;columns="20" + ;;labelfor="tf" + (text-field :id tf :text "Snow" + :label (label :text "Hello World!" + :font (font "Georgia" 12 :bold) + :foreground :blue));;columns="20" (button :text "Click Here" :on-action #'submit)) (panel (:layout "dock south") (label :text "Clicks:" :font (font "Georgia" 36 :bold)) Modified: trunk/examples/swixml/helloworld_j.lisp ============================================================================== --- trunk/examples/swixml/helloworld_j.lisp (original) +++ trunk/examples/swixml/helloworld_j.lisp Tue Mar 2 13:59:55 2010 @@ -4,9 +4,10 @@ (with-gui () (frame (:size #C(640 280) :title "Hello Snow World" :on-close :exit) (panel (:layout "grow, wrap") - (label :text "Hello World!" :font (font "Georgia" 12 :bold) - :foreground :blue) ;;labelfor="tf" - (text-field :id tf :text "Snow");;columns="20" + (text-field :id tf :text "Snow" + :label (label :text "Hello World!" + :font (font "Georgia" 12 :bold) + :foreground :blue));;columns="20" (button :text "Click Here" :on-action "submit")) (panel (:layout "dock south") (label :text "Clicks:" :font (font "Georgia" 36 :bold)) Modified: trunk/src/lisp/snow/snow.lisp ============================================================================== --- trunk/src/lisp/snow/snow.lisp (original) +++ trunk/src/lisp/snow/snow.lisp Tue Mar 2 13:59:55 2010 @@ -151,7 +151,7 @@ (eval-when (:compile-toplevel :load-toplevel :execute) (defun common-widget-args () '(id layout binding (enabled-p t) (visible-p t) location size border font - background foreground + background foreground label on-mouse-click on-mouse-press on-mouse-release on-mouse-enter on-mouse-exit on-mouse-drag on-mouse-move)) @@ -174,6 +174,7 @@ (defun setup-widget (self &key layout binding (enabled-p t) (visible-p t) location size border font background foreground + label ;;mouse event handling on-mouse-click on-mouse-press on-mouse-release on-mouse-enter on-mouse-exit @@ -213,7 +214,9 @@ (setf (widget-foreground self) (color foreground)) (setf (widget-foreground self) foreground))) (when border - (setf (widget-border self) border)))) + (setf (widget-border self) border)) + (when label + (setf (label-for label) self)))) #+emacs (put 'define-widget-macro 'lisp-indent-function 3) #+emacs (put 'define-widget 'lisp-indent-function 3) Modified: trunk/src/lisp/snow/widgets.lisp ============================================================================== --- trunk/src/lisp/snow/widgets.lisp (original) +++ trunk/src/lisp/snow/widgets.lisp Tue Mar 2 13:59:55 2010 @@ -208,6 +208,12 @@ (defwidget label text) +(defun (setf label-for) (component label) + (setf (widget-property label "labelFor") component)) + +(defun label-for (label) + (widget-property label "labelFor")) + (defun make-text-field (&key text &allow-other-keys) (let ((field (new "javax.swing.JTextField"))) (when text From astalla at common-lisp.net Mon Mar 8 18:25:35 2010 From: astalla at common-lisp.net (Alessio Stalla) Date: Mon, 08 Mar 2010 13:25:35 -0500 Subject: [snow-cvs] r67 - trunk/examples/swixml Message-ID: Author: astalla Date: Mon Mar 8 13:25:34 2010 New Revision: 67 Log: Removed wrong comment from example. Modified: trunk/examples/swixml/helloworld_j.lisp Modified: trunk/examples/swixml/helloworld_j.lisp ============================================================================== --- trunk/examples/swixml/helloworld_j.lisp (original) +++ trunk/examples/swixml/helloworld_j.lisp Mon Mar 8 13:25:34 2010 @@ -13,34 +13,3 @@ (label :text "Clicks:" :font (font "Georgia" 36 :bold)) (label :id cnt :font (font "Georgia" 36 :bold))) (show self))) - -#|| -The original example used the SwiXml idiom of coding a Java class to handle -the events; an instance of this class gets injected the components with an -ID into its JavaBean properties. -The Snow version does not rely on a Java class; instead it handles events in -Lisp and uses data binding to update the GUI. It is of course possible to -handle the events in Java, but Snow does not currently support automatic -injection of widgets into the properties of a Java object. -||# - -#|| Original example: - - - - - -