Hi!
Here is a new example for #registerForBacktracking: as discussed on #squeak.
Regards, Markus
'From Squeak3.6 of ''6 October 2003'' [latest update: #5424] on 25 October 2003 at 11:43:25 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! !
!WAStateExample class methodsFor: 'as yet unclassified' stamp: 'mfrit 10/25/2003 23:27'! initialize (self registerAsApplication: 'counter') ! !
WAStateExample initialize!
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
'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! !
Markus Fritsche wrote:
Argh! That small but buggy!
And, rethinking it, it should not read "stateful" and "stateless" but "with and w/o stateholder", shouldn't it?
Therefore I think
renderContentOn: html html h1: 'With stateholder '; br; h1: countHolder contents; h1: 'Without stateholder '; br; h1: count contents. html anchorWithAction: [self increment] text: '++'. html space. html anchorWithAction: [self decrement] text: '--'
would be better.
seaside@lists.squeakfoundation.org