[Seaside] New Example
Markus Fritsche
Fritsche.Markus at gmx.net
Sat Oct 25 23:52:51 CEST 2003
Markus Fritsche wrote:
> Hi!
>
> Here is a new example for #registerForBacktracking: as discussed on
> #squeak.
>
> Regards, Markus
Argh! That small but buggy! Indeed, there shall not be a WAStateExample
class>>#initialize like that! :-)
Regards Markus
-------------- next part --------------
'From Squeak3.6 of ''6 October 2003'' [latest update: #5424] on 25 October 2003 at 11:50:49 pm'!
WAComponent subclass: #WAStateExample
instanceVariableNames: 'count countHolder '
classVariableNames: ''
poolDictionaries: ''
category: 'Seaside/Examples-Test'!
!WAStateExample methodsFor: 'as yet unclassified' stamp: 'mfrit 10/25/2003 23:42'!
decrement
count contents: count contents - 1.
countHolder contents: countHolder contents - 1! !
!WAStateExample methodsFor: 'as yet unclassified' stamp: 'mfrit 10/25/2003 23:42'!
increment
count contents: count contents + 1.
countHolder contents: countHolder contents + 1! !
!WAStateExample methodsFor: 'as yet unclassified' stamp: 'mfrit 10/25/2003 23:42'!
initialize
countHolder _ ValueHolder new contents: 0.
self session registerObjectForBacktracking: countHolder.
count _ ValueHolder new contents: 0.
! !
!WAStateExample methodsFor: 'as yet unclassified' stamp: 'mfrit 10/25/2003 23:42'!
renderContentOn: html
html h1: 'Stateful: '; br; h1: countHolder contents; h1: 'Stateless'; br; h1: count contents.
html anchorWithAction: [self increment] text: '++'.
html space.
html anchorWithAction: [self decrement] text: '--'! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
WAStateExample class
instanceVariableNames: ''!
!WAStateExample class methodsFor: 'as yet unclassified' stamp: 'mfrit 10/25/2003 23:27'!
example
^ self new! !
More information about the Seaside
mailing list