[Seaside] WAComponent callbacks, continuations and #children

John Thornborrow john at pinesoft.co.uk
Thu Jun 7 13:43:30 UTC 2007


Attached is an example (MyStuff.st - fileout format)

In order to reproduce the callback error..

1. Open the page
2. Click the "A Link" url in the top left.
3. Click your back button.
4. Click the "link" in the pink box.

Many thanks in advance for any assistance.

John.
www.pinesoft.co.uk



John Thornborrow wrote:
> Lukas Renggli wrote:
>   
>>> Other issue (1. on the list) is the maintenance of the instances, I'm
>>> not happy with using singletons as this could (and probably will)
>>> generate cross-session changes.
>>>       
>> There is something fundamentally wrong with your code. Using
>> singletons certainly won't work. A component encapsulates the state
>> private to a single session, they must not be shared among different
>> sessions.
>>
>> If you could provide a file-out or Monticello package then we could
>> certainly help to solve your problem. With the current information it
>> is rather difficult to help.
>>
>> Lukas
>>
>>     
> I shall make a file-out shortly, however I have been asked to work on
> something else for now.
>
> On the note of singeltons, the reason for this is because if I created a
> new component object, I would receive the callback error because it is
> not the same instance as the previous callback state had.
>
> Once I get round to generating the file out, hopefully my problem will
> be more clear.
>
> John.
>
> www.pinesoft.co.uk
>
>
> Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>
>
>
> This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>  
>
>   

-------------- next part --------------
WAComponent subclass: #BrokenExample
	instanceVariableNames: 'menu content registry'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'MyStuff'!

!BrokenExample methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 14:32'!
children
	^Array with: menu with: (registry at: 'content')! !

!BrokenExample methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 14:33'!
initialize
	menu _ MenuContainer new root: self.
	registry _ (Dictionary new
		at: 'content' put: (ContentContainer new root: self);
		yourself)! !

!BrokenExample methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 14:38'!
registry
	^registry! !

!BrokenExample methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 14:31'!
renderContentOn: html
	html render: menu.
	html render: (registry at: 'content')! !

!BrokenExample methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 10:28'!
style
	^'
div.content, div.menu, div.banner {
	position: absolute;
}
div.menu  {
	left: 50px;
	top: 150px;
	width: 190px;
	background-color: #7ff;
	border: 1px solid #000;
}
ul.menu  {
	color: #fff;
}
div.content {
	left: 290px;
	top: 100px;
	height: 400px;
	width: 250px;
	background-color: #f7f;
	border: 1px solid #ccc;
}
p.content {
	text-decoration: underline;
}
div.banner {
	width: 500px;
	height: 75px;
	top: 5px;
	left: 100px;
	background-color: #ff7;
	border: 1px solid #000;	
}
p.banner {
	size: 20px;
	color: #000;
}'! !

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

BrokenExample class
	instanceVariableNames: ''!

!BrokenExample class methodsFor: 'as yet unclassified' stamp: 'JMT 6/6/2007 17:44'!
canBeRoot
	^true! !


WAComponent subclass: #ContentContainer
	instanceVariableNames: 'uid content root'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'MyStuff'!

!ContentContainer methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 12:28'!
content: aString
	content _ aString! !

!ContentContainer methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 14:35'!
renderContentOn: html
	html div class: 'content'; with: [
		html paragraph class: 'content'; with: [html anchor callback: [| a | a _ 'b']; with: 'link'].
		html paragraph with: (content ifNil: ['foo'])]! !

!ContentContainer methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 14:33'!
root: aComponent
	root _ aComponent! !


WAComponent subclass: #MenuContainer
	instanceVariableNames: 'root'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'MyStuff'!

!MenuContainer methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 14:36'!
renderContentOn: html
	html anchor callback: [root registry at: 'content' put: (ContentContainer new content: 'bar'; root: root)]; with: 'A Link'! !

!MenuContainer methodsFor: 'as yet unclassified' stamp: 'JMT 6/7/2007 12:37'!
root: aComponent
	root _ aComponent! !


More information about the Seaside mailing list