Porting JQTouch library support for Seaside to Pharo

Estou interessado em usar o JQTouch com o Seaside e por isso estou “portando” o Seaside JQTouch support para o Pharo. Copiei e colei as poucas classes necessárias. Fiz isso porque achei que seria melhor do que baixar do repositório do Cincom (me pareceu um tanto complicado mas vou fazer outra tentativa) e para conhecer melhor o código.

Library classes:

  •  JQTCanvasExtender (JQTouch-Core)
  •  JQTExampleDemos (JQTouch-Examples)
  •  JQTExampleForm (JQTouch-Examples)
  •  JQTExampleLogin (JQTouch-Examples)
  •   JQTExampleTapDrivenLoad (JQTouch-Examples)
  •  JQTLoadOnEvent (JQTouch-Core)
  •  JQTouchFileLibraryReference (JQTouch-Core)
  •  WAHtmlCanvas (Seaside-Canvas)
Veja os fontes na página de downloads.
Nota: O syntax highlighting nos file outs abaixo é o do Objective-C já que a linguagem Smalltalk não está incluida como opção.

file outs

WAHtmlCanvas (Seaside-Canvas):

WAHtmlCanvas-*JQTouch.st
'From Pharo1.2.2 of 15 May 2011 [Latest update: #12353] on 1 June 2011 at 9:31:29 pm'!

!WAHtmlCanvas methodsFor: '*JQTouch' stamp: 'FranciscoAryMartins 6/1/2011 21:02'!
jQTouch
  ^JQTCanvasExtender new htmlCanvas: self
! !

JQTouch-Core:

JQTouch-Core.st
Object subclass: #JQTCanvasExtender
	instanceVariableNames: 'htmlCanvas'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'JQTouch-Core'!

!JQTCanvasExtender methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/1/2011 21:10'!
htmlCanvas
	^ htmlCanvas! !

!JQTCanvasExtender methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/1/2011 21:10'!
htmlCanvas: anObject
	htmlCanvas := anObject! !

!JQTCanvasExtender methodsFor: 'tags-convenience' stamp: 'FranciscoAryMartins 6/1/2011 21:13'!
anchorGoback
  "Requires jQT variable availability; this is set by the library"

  ^htmlCanvas anchor onClick: (JSStream new nextPutAll:'jQT.goBack();') ;class: 'back'
! !

!JQTCanvasExtender methodsFor: 'tags-convenience' stamp: 'FranciscoAryMartins 6/1/2011 21:17'!
anchorGoto: divName usingAnimation: animation
  "Requires jQT variable availability; this is set by the library"

  ^htmlCanvas anchor onClick: (JSStream new nextPutAll:'jQT.goTo("#', divName, '","', animation, '");')
! !

!JQTCanvasExtender methodsFor: 'tags-convenience' stamp: 'FranciscoAryMartins 6/2/2011 08:50'!
back: content
	^ htmlCanvas anchor
		class: 'back';
		url: '#';
		with: content! !

!JQTCanvasExtender methodsFor: 'tags-convenience' stamp: 'FranciscoAryMartins 6/2/2011 13:36'!
home: content
	^ htmlCanvas anchor
		class: 'back';
		url: '#home';
		with: content! !

!JQTCanvasExtender methodsFor: 'tags-convenience' stamp: 'FranciscoAryMartins 6/3/2011 10:49'!
itemWithTextArea: twoArgBlockOrNil callback: valueBlock with: initialValue hint: aStringOrNil

  | item |
  (item := htmlCanvas listItem)
    with:
      [ | tag |
          tag := (htmlCanvas textArea)
            attributeAt: 'placeholder' put: aStringOrNil;
            yourself.
          tag callback: valueBlock.
          twoArgBlockOrNil isNil ifFalse: [
               twoArgBlockOrNil value: item value: tag
          ].
          tag with: initialValue
     ]! !

!JQTCanvasExtender methodsFor: 'tags-convenience' stamp: 'FranciscoAryMartins 6/3/2011 13:27'!
itemWithTextInput: twoArgBlockOrNil callback: valueBlock with: initialValue hint: aStringOrNil
	| item |
	(item := htmlCanvas  listItem)
 		with: [ | tag |
	 		tag := (htmlCanvas textInput)
			attributeAt: 'placeholder' put: aStringOrNil;
			yourself.

tag
 callback:
valueBlock
.

twoArgBlockOrNil
 isNil ifFalse: [
twoArgBlockOrNil
 value:
item
 value:
tag
].

tag
 with:
initialValue
]! !

!JQTCanvasExtender methodsFor: 'tags-convenience' stamp: 'FranciscoAryMartins 6/3/2011 13:30'!
load: canvasBlock into: containerId when: eventName on: anchorId
	^ htmlCanvas  render: (JQTLoadOnEvent  onEvent: eventName from: anchorId load: canvasBlock into: containerId)! !

!JQTCanvasExtender methodsFor: 'tags-convenience' stamp: 'FranciscoAryMartins 6/3/2011 13:33'!
toolbar: content
	^htmlCanvas
		div
			class: 'toolbar';
			with: content! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

JQTCanvasExtender class
	instanceVariableNames: ''!

Object subclass: #JQTouchFileLibraryReference
	instanceVariableNames: 'theme uriPath jQueryVersion useMinified'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'JQTouch-Core'!
!JQTouchFileLibraryReference commentStamp: 'FranciscoAryMartins 6/3/2011 20:39' prior: 0!
JQTouchFileLibraryReference can be used to setup an application that uses the JQTouch Library.

Note: this library does not contain the scripts, images or stylesheets. You have to setup a webserver config to serve those files.

Usage

YourMainComponent>>updateRoot: root
	| reference |
	(reference := JQTouchFileLibraryReference new)
		theme: 'jqt'
		; uriPath: '/files/jqtouch-1/'   "this is where the Webserver will look for library files"
		; jQueryVersion: '1.3.2'.  "skip this if you already included the jQuery library"
	reference updateRoot: root.
	super updateRoot: root

Instance Variables
	theme           apple | jqt | ...
	uriPath         server path to installation of jqtouch , e.g. "/files/jqtouch-1/'
	jQueryVersion   version name of jquery ; if set then include its load script  (must be >= 1.3.2)
	useMinified    tell the library to include a reference to the minified version of the scripts and css, default is true

Apache virtual host example

	ServerName dev.company.com
	DocumentRoot /path/to/location/of/files

	ProxyPass /files/jqtouch-1.0-beta-2-r109/ !!
	ProxyPass /favicon.ico !!
	ProxyPass / http://localhost:7777/
	ProxyPassReverse / http://localhost:7777/
!

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:28'!
cssExtension
	^self useMinified
		ifTrue:['min.css']
		ifFalse:['css']! !

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:49'!
jQueryVersion
	"If not nil then append the load scripts to the head"

	"JQTouchFileLibrary default jqueryVersion: '1.3.2'"

	^jQueryVersion! !

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:26'!
jQueryVersion: anObject
	jQueryVersion := anObject! !

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:47'!
jsExtension

	^self useMinified
		ifTrue:['min.js']
		ifFalse:['js']! !

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:48'!
theme

	"apple"
	^theme ifNil:['jqt']! !

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:51'!
theme: aString
  "JQTouch.JQTouchFileLibrary default theme: 'jqt'"
  theme := aString! !

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:26'!
uriPath
	^ uriPath! !

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:55'!
uriPath: aString
  "aString must with the OS file separator"
  uriPath := aString! !

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:57'!
useMinified
  ^useMinified ~~ false! !

!JQTouchFileLibraryReference methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 20:26'!
useMinified: anObject
	useMinified := anObject! !

!JQTouchFileLibraryReference methodsFor: 'processing' stamp: 'FranciscoAryMartins 6/3/2011 20:53'!
updateRoot: root
  self jQueryVersion notNil
    ifTrue:
      [root javascript url: 'http://www.google.com/jsapi'.
      root script with: 'google.load("jquery","', self jQueryVersion ,'");'].
  (root script url: self uriPath , ('jqtouch/jqtouch.' expandMacrosWith: self jsExtension))
    type: 'application/x-javascript'
    ;charset: 'utf-8'.
  root link type: 'text/css' ;media: 'screen' ;with: ('@import url("jqtouch/jqtouch.css");' expandMacrosWith: self uriPath).
  root link type: 'text/css' ;media: 'screen' ;with: ('@import url("themes//theme.");' expandMacrosWith: self uriPath with: self theme with: self cssExtension).
  root javascript charset:'utf-8' ;with:
('    var jQT = new $.jQTouch({
        icon: "jqtouch.png",
        statusBar: "black-translucent",
        preloadImages: [
            "themes//img/chevron_white.png",
            "themes//img/bg_row_select.gif",
            "themes//img/back_button_clicked.png",
            "themes//img/button_clicked.png"
            ]
    });' expandMacrosWith: self uriPath with: self theme)! !

Object subclass: #JQTLoadOnEvent
	instanceVariableNames: 'eventSourceId containerId eventName loadBlock'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'JQTouch-Core'!

!JQTLoadOnEvent methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 13:35'!
containerId
	^ containerId! !

!JQTLoadOnEvent methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 13:35'!
containerId: anObject
	containerId := anObject! !

!JQTLoadOnEvent methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 13:35'!
eventName
	^ eventName! !

!JQTLoadOnEvent methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 13:35'!
eventName: anObject
	eventName := anObject! !

!JQTLoadOnEvent methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 13:35'!
eventSourceId
	^ eventSourceId! !

!JQTLoadOnEvent methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 13:35'!
eventSourceId: anObject
	eventSourceId := anObject! !

!JQTLoadOnEvent methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 13:35'!
loadBlock
	^ loadBlock! !

!JQTLoadOnEvent methodsFor: 'accessing' stamp: 'FranciscoAryMartins 6/3/2011 13:35'!
loadBlock: anObject
	loadBlock := anObject! !

!JQTLoadOnEvent methodsFor: '*seaside-core' stamp: 'FranciscoAryMartins 6/3/2011 13:44'!
renderOn: html
	| js |
	js := JSFunction new.
	js arguments: #(#event #info).
	js add: ((html jQuery id: self containerId) load html: self loadBlock).
	html document addLoadScript: ((html jQuery id: self eventSourceId) call: 'bind' with: self eventName with: js).! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

JQTLoadOnEvent class
	instanceVariableNames: ''!

!JQTLoadOnEvent class methodsFor: 'instance creation' stamp: 'FranciscoAryMartins 6/3/2011 19:24'!
onEvent:   eventName from: anchorId load: canvasBlock into:  containerId
	^ self new
		eventSourceId: anchorId;
		containerId: containerId;
		loadBlock: canvasBlock;
		eventName: 'click'! !

JQTouch-Examples:

JQTouch-Examples.st

WAComponent subclass: #JQTExampleDemos
	instanceVariableNames: ''
	classVariableNames: 'FileReference'
	poolDictionaries: ''
	category: 'JQTouch-Examples'!

!JQTExampleDemos methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 08:00'!
renderContentOn: html
  html div id: 'home' ;class: 'current' ;with:[
    html div class: 'toolbar' ;with: [
      html heading level: 1 ;with: 'Seaside JQTouch'].

    html unorderedList class:'rounded' ;with:[
      html listItem class: 'arrow' ;with: [ html anchor url:'#forms' ;with: 'Forms'].
      html listItem class: 'arrow' ;with: [ html anchor url:'#animations' ;with: 'Animations'].
      html listItem class: 'arrow' ;with: [ html anchor url:'#edge' ;with: 'Edge'].
      html listItem with: [ html anchor onClick:(html jQuery ajax script: [:s|FileReference theme:'jqt'. s refresh]) ;with: 'JQT Theme'].
      html listItem with: [ html anchor onClick:(html jQuery ajax script: [:s|FileReference theme:'apple'. s refresh]) ;with: 'Apple Theme'].
  ]].
  self renderPageFormsOn: html.
  self renderPageAnimationsOn: html.
  self renderPageAnimationDemoOn: html.
  self renderPageEdgeOn: html! !

!JQTExampleDemos methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 08:05'!
renderPageAnimationDemoOn: html
  html div id:'animdemo' ;with:[
    html anchor class:'whiteButton goback' ;url: '#' ;style:'margin: 0pt 10px; color: rgba(0, 0, 0, 0.9);' ;with: 'Back'.
    html div style:'margin: 160px 0pt; font-size: 1.5em; text-align: center; font-family: Marker felt;' ;with:'Smooth?' ].
! !

!JQTExampleDemos methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 08:19'!
renderPageAnimationsOn:  html
  html div id:'animations' ;with:[
    html div class: 'toolbar' ;with: [
        html heading level: 1 ;with: 'Animations'.
        html anchor class:'back' ;url:'#' ;with: 'back'].
    html form with:[
      html unorderedList class:'rounded' ;with:[
        html listItem with:[html anchor class:'slideup' ;url:'#animdemo';with:'Slideup'].
        html listItem with:[html anchor class:'dissolve' ;url:'#animdemo';with:'Dissolve'].
        html listItem with:[html anchor class:'fade' ;url:'#animdemo';with:'Fade'].
        html listItem with:[html anchor class:'flip' ;url:'#animdemo';with:'Flip'].
        html listItem with:[html anchor class:'pop' ;url:'#animdemo';with:'Pop'].
        html listItem with:[html anchor class:'swap' ;url:'#animdemo';with:'Swap'].
        html listItem with:[html anchor class:'cube' ;url:'#animdemo';with:'Cube'].
    ]]].! !

!JQTExampleDemos methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 09:21'!
renderPageEdgeOn: html
  html div id:'edge' ;with:[
    html div class: 'toolbar' ;with: [
        html heading level: 1 ;with: 'Edge'.
        html anchor class:'back' ;url:'#' ;with: 'back'].
    html form with:[
      html unorderedList class:'edgetoedge' ;with:[
        html listItem class: 'sep'.
        html listItem with:[html anchor url:'#' ;with:[html text:'Smalltalk '. html emphasis with:'Sounds']].
        html listItem class: 'sep' ;with: 'and'.
        html listItem with:[html anchor url:'#' ;with:[html text:'Ruby '. html emphasis with:'Rocks']].
        html listItem class: 'sep' ;with: 'or'.
        html listItem with:[html anchor url:'#' ;with:[html text:'Java '. html emphasis with:'Joy']].
    ]]].
! !

!JQTExampleDemos methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 11:55'!
renderPageFormsOn: html
  html div id:'forms' ;with:[
    html div class: 'toolbar' ;with: [
        html heading level: 1 ;with: 'Forms'.
        html anchor class:'back' ;url:'#' ;with: 'back'].
    html form with:[
      html unorderedList class:'edit rounded' ;with:[
        html listItem with:[html textInput attributeAt: 'placeholder' put: 'Text'].
        html listItem with:[html textArea attributeAt: 'placeholder' put: 'TextArea' ;with: 'Area of Text'].
        html listItem with:[html text: 'Toggle'. html span class:'toggle' ;with: [ html checkbox with:''].
        html listItem with:[html select id:'lol' ;with:[
          html optionGroup label: 'Cars' ;with:[
            html option with: 'Toyota'.
            html option with: 'Audi'.
            html option with: 'BMW'.
          ].
          html optionGroup label: 'Bikes' ;with:[
            html option with: 'Ducati'.
            html option with: 'Yamaha'.
            html option with: 'Honda'.
          ]]].
        html listItem with:[html passwordInput with: 'secret'].
        html listItem with:[html radioButton with: '> 100 PK'].
        html listItem with:[html radioButton with: '
  super updateRoot: root.
! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

JQTExampleDemos class
	instanceVariableNames: ''!

!JQTExampleDemos class methodsFor: 'shared setup' stamp: 'FranciscoAryMartins 6/4/2011 11:58'!
addLibraryReferenceForDemoTo: root

  FileReference isNil
    ifTrue:[(FileReference := JQTouchFileLibraryReference new)
    theme: 'jqt'
    ; uriPath: '/files/jqtouch-1.0-beta-2-r109/'
    ; useMinified: false "debugging"
    ; jQueryVersion: '1.3.2'.  "skip this if you already included the jQuery library"].
  FileReference updateRoot: root.
! !

!JQTExampleDemos class methodsFor: 'class initialization' stamp: 'FranciscoAryMartins 6/4/2011 11:59'!
initialize
  self registerAsApplication: 'jqtouch/demos'
! !

WAComponent subclass: #JQTExampleForm
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'JQTouch-Examples'!

!JQTExampleForm methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 18:58'!
renderContentOn: html
  (html div)
      id: 'home'
    ; class: 'current'
    ; with: [self renderFormOn: html]
! !

!JQTExampleForm methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 18:59'!
renderFormOn: html

  html form class: 'form' ;with:[
    html unorderedList with:[
      html jQTouch
        itemWithTextInput: nil
        callback: [:value | Transcript cr; show:  self class name , ' nickname:' , value]
        with: nil
        hint: 'Nickname'].
    html anchor
      style:'margin:0 10px;color:rgba(0,0,0,.9)'
      ;class:'whiteButton'
      ;onClick: ((html jQuery ajax) serializeForm script:[ :s | Transcript cr; show: 'Submitting'  ])
      ;with: 'Submit'.
  ]
! !

!JQTExampleForm methodsFor: 'updating' stamp: 'FranciscoAryMartins 6/4/2011 19:01'!
updateRoot: root

  JQTExampleDemos addLibraryReferenceForDemoTo: root.

  root title: 'JQTouch - Form'.

  super updateRoot: root.! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

JQTExampleForm class
	instanceVariableNames: ''!

!JQTExampleForm class methodsFor: 'class initialization' stamp: 'FranciscoAryMartins 6/4/2011 19:02'!
initialize
  self registerAsApplication: 'jqtouch/form'.! !

WAComponent subclass: #JQTExampleLogin
	instanceVariableNames: 'email password'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'JQTouch-Examples'!

!JQTExampleLogin methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 19:09'!
handleLogin: jsScript
  (email isNil or:[email isEmpty])
    ifTrue:[jsScript << ((jsScript jQuery id: 'loginError') html: 'Access Denied')]
    ifFalse:[jsScript refresh]! !

!JQTExampleLogin methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 19:10'!
renderContentOn: html
  (html div)
      id: 'home'
    ; class: 'current'
    ; with:
        [self requiresLogin
          ifTrue:
            [html jQTouch toolbar: [html heading level:1 ;with: 'Login'].
            self renderLoginFormOn: html]
          ifFalse:
            [html jQTouch toolbar: [html heading level:1 ;with: 'Welcome'].
            self renderWelcomeOn: html]]
! !

!JQTExampleLogin methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 19:11'!
renderLoginFormOn: html

  html form class:'form' ;with:[
      html div id:'loginError' ;style:'text-align:center' ;with: ''.
      html unorderedList class:'edit rounded' ;with:[
        html jQTouch
          itemWithTextInput: [:item :ti | ti onFocus: ((html jQuery id: 'loginError') html: '')]
          callback:[:value| Transcript cr;show: 'email callback:', value . email := value]
          with: nil
          hint: 'Email'.
        html jQTouch
          itemWithTextInput: [:item :ti | ti type: 'password' ;onFocus: ((html jQuery id: 'loginError') html: '')]
          callback:[:value| Transcript cr;show: 'password callback:', value]
          with: nil
          hint: 'Password'.
      ].
    html anchor
      style:'margin:0 10px;color:rgba(0,0,0,.9)'
      ;class:'whiteButton'
      ;onClick: ((html jQuery ajax) serializeForm script:[ :s | self handleLogin: s.  ])
      ;with: 'Login'.
    ].! !

!JQTExampleLogin methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 19:12'!
renderWelcomeOn: html

  html heading level: 3 ;with: email.

  html anchor
    class: 'whiteButton'
    ;style:'margin:0 10px;color:rgba(0,0,0,.9)'
    ;callback:[ email := nil ]
    ;with: 'Logout'! !

!JQTExampleLogin methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 19:13'!
requiresLogin
  ^email isNil or:[email isEmpty]
! !

!JQTExampleLogin methodsFor: 'updating' stamp: 'FranciscoAryMartins 6/4/2011 19:14'!
updateRoot: root

  JQTExampleDemos addLibraryReferenceForDemoTo: root.

  root title: 'JQTouch - Login'.

  super updateRoot: root.! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

JQTExampleLogin class
	instanceVariableNames: ''!

!JQTExampleLogin class methodsFor: 'class initialization' stamp: 'FranciscoAryMartins 6/4/2011 19:15'!
initialize
  self registerAsApplication: 'jqtouch/login'! !

WAComponent subclass: #JQTExampleTapDrivenLoad
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'JQTouch-Examples'!

!JQTExampleTapDrivenLoad methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 19:21'!
renderContentOn: html
  html div id: 'home' ;class: 'current' ;with:[
    html div class: 'toolbar' ;with: [
      html heading level: 1 ;with: 'Load on Tap'].

    html unorderedList class:'rounded' ;with:[
      html listItem class: 'arrow' ;with: [ html anchor id: 'anchorNow' ;url:'#now' ;with: 'Now'].
      html listItem class: 'arrow' ;with: [ html anchor id: 'anchorToday' ;url:'#today' ;with: 'Today'].
    ]
  ].
  self renderCurrentTimeOn: html.
  self renderCurrentDayOn: html.! !

!JQTExampleTapDrivenLoad methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 19:22'!
renderCurrentDayOn: html

  html div id:'today' ;with:[
    html div class: 'toolbar' ;with: [
        html heading level: 1 ;with: 'Today'.
        html anchor class:'back' ;url:'#' ;with: 'back'].

    html jQTouch
      load: [ :h | h heading level:1 ;with: Time now printString ]
      into: 'dateHolder'
      when: 'click'
      on: 'anchorToday'.

    html div id: 'dateHolder' ;with: 'Please wait a moment...'
  ]! !

!JQTExampleTapDrivenLoad methodsFor: 'rendering' stamp: 'FranciscoAryMartins 6/4/2011 19:22'!
renderCurrentTimeOn: html

  html div id:'now' ;with:[
    html div class: 'toolbar' ;with: [
        html heading level: 1 ;with: 'Time'.
        html anchor class:'back' ;url:'#' ;with: 'back'].

    html jQTouch
      load: [ :h | h heading level:1 ;with: Time now printString ]
      into: 'timeHolder'
      when: 'click'
      on: 'anchorNow'.

    html div id: 'timeHolder' ;with: 'Please wait a moment...'
  ]
! !

!JQTExampleTapDrivenLoad methodsFor: 'updating' stamp: 'FranciscoAryMartins 6/4/2011 19:23'!
updateRoot: root

  JQTExampleDemos addLibraryReferenceForDemoTo: root.

  root title: 'JQTouch - TapLoad'.

  super updateRoot: root.! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

JQTExampleTapDrivenLoad class
	instanceVariableNames: ''!

!JQTExampleTapDrivenLoad class methodsFor: 'class initialization' stamp: 'FranciscoAryMartins 6/4/2011 19:24'!
initialize
  self registerAsApplication: 'jqtouch/tapload'! !

JQTExampleDemos initialize!
JQTExampleForm initialize!
JQTExampleLogin initialize!
JQTExampleTapDrivenLoad initialize!
Anúncios

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s