[Seaside] Using one component to render multiple views?

Keith Hodges keith_hodges at yahoo.co.uk
Fri Aug 11 01:27:26 UTC 2006


You can use the multiview component from a link... like so

html anchor callback: [ self call: (WAMultipleViewTest view: 'config') ] 
text: '(configuration demo)'.

This will render the multiple view component as a page showing the 
'Config View'. The rendering of this view includes link/buttons that can 
change the view.

html anchor callback: [ self setView: 'EditOrganisation' ] text: '(edit)'.

this will re-render the page but with an alternative view.

=====

You can also use the multiview component embedded in any other component 
using #render:

MyComponent>>renderContentOn: html

some html gen here

html render: configTestComponent

some more html gen here.

========
To do this the component needs to be registered as one of the children 
of the containing component.

i.e.
MyComponent>>initialize

super initialize
configTestComponent := WAMulipleViewTest view: 'config'.


MyComponent>>children

^ Array with: configTestComponent.

==========
hope this helps

Keith



















Rick Flower wrote:
> Keith Hodges wrote:
>> Dear Rick,
>>
>> It may not be necessary to have lots of different components, if you 
>> have ever looked at SUnit, there is one class, but each time you 
>> instanciate an instance you indicate which test case you want that 
>> instance to run. The test case is run according to its selector.
>>
>> This piece of smalltalk trickery is handled by Object>>#perform: 
>> aSelector
>>
>> I tried the attached code, in which callbacks are able to switch the 
>> viewSelector and it seemed to work quite well.
>
> Thanks Keith!  I'll check that out when I get home, but it looks like 
> what I was looking for.. That should keep me from having a bunch of 
> needless components lying around.. I'm constantly amazed at the 
> interesting things that Smalltalk can easily do, but which other 
> languages either are incapable of doing or not without some really 
> ugly hacks.. Thanks again!
>
> -- Rick
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


		
___________________________________________________________ 
All New Yahoo! Mail – Tired of Vi at gr@! come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html


More information about the Seaside mailing list