[Seaside] New Example

Markus Fritsche Fritsche.Markus at gmx.net
Sat Oct 25 23:44:49 CEST 2003


Hi!

Here is a new example for #registerForBacktracking: as discussed on #squeak.

Regards, Markus
-------------- next part --------------
'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!


More information about the Seaside mailing list