[Seaside] Do not call #renderContentOn: directly (was: gotos with 2.3b?)

Derek Brans brans at nerdonawire.com
Thu Jun 5 19:09:37 CEST 2003


This was my response to Ragnar.

> The problem is you are calling a component's #renderContentOn: directly.
> You should never do this (this should be a private method) and I'll
explain
> why in a moment.  Instead, you need to say something like "html render:
> yourComponent" or "yourComponent renderOn: html"
>
> Doing it the latter way allows the seaside component system to choose to
> call the #renderContentOn: of a component, or that of the component's
> delegate. See WAController>>renderActiveControllerWithContext:
>
> Calling #renderContentOn: directly, as you do in Exodus>>renderContentOn:,
> forces Seaside to render that component, even if the component has a
> delegate.
>
> In Seaside, a delegate is a component that temporarily masks another
> component (ie the delegate is rendered in the place of the delegating
> component).  For example, when you say:
>
> "component1 call: component2"
>
> component2 is rendered in place of component1 for the duration of the call
> (component2 is the delegate).  #goto: is a more permanent delegation than
> #call:
>
> Let me know if that solves your problem.
>
> Derek Brans
> Nerd on a Wire
> Web design that's anything but square
> http://www.nerdonawire.com
> mailto: brans at nerdonawire.com
> phone: 604.874.6463
> toll-free: 1-877-NERD-ON-A-WIRE
> ----- Original Message -----
> From: "Ragnar Hojland Espinosa" <ragnar at linalco.com>
> To: "Derek Brans" <brans at nerdonawire.com>
> Sent: Thursday, June 05, 2003 2:12 AM
> Subject: Re: [Seaside] gotos with 2.3b?
>
>
> > On Wed, Jun 04, 2003 at 03:15:54PM -0700, Derek Brans wrote:
> > > If you have a simple example you can email it to me and I'll have a
look
> at
> > > it.
> >
> > I hope you can see something.. I'm pasting the changeset below.  It
> > goes from #Exodus -> #ExListCompanies -> #ExViewCompany
> >
> > Thanks,
> > --
> > Ragnar Hojland - Project Manager
> > Linalco "Especialistas Linux y en Software Libre"
> > http://www.linalco.com Tel: +34-91-5970074 Fax: +34-91-5970083
> >
> >
> > WAComponent subclass: #ExListCompanies
> > instanceVariableNames: 'companies '
> > classVariableNames: ''
> > poolDictionaries: ''
> > category: 'Exodus'!
> >
> > !ExListCompanies methodsFor: 'as yet unclassified' stamp: 'RHE 6/3/2003
> 20:01'!
> > addCompany! !
> >
> > !ExListCompanies methodsFor: 'as yet unclassified' stamp: 'RHE 6/3/2003
> 19:41'!
> > initialize
> > | db |
> > db _ ExDB current.
> > db beginTransaction.
> > companies _ (ReadQuery returningManyOf: ExCompany where: [:each | each
id
> = each id] ) executeIn: db.
> > db commitTransaction.
> > ! !
> >
> > !ExListCompanies methodsFor: 'as yet unclassified' stamp: 'RHE 6/5/2003
> 11:00'!
> > onCompany: anExCompany
> > self call: (ExViewCompany new company: anExCompany)! !
> >
> > !ExListCompanies methodsFor: 'as yet unclassified' stamp: 'RHE 6/3/2003
> 20:11'!
> > onPerson: anExPerson! !
> >
> > !ExListCompanies methodsFor: 'as yet unclassified' stamp: 'RHE 6/4/2003
> 11:22'!
> > renderContentOn: html
> >
> > html table: [
> > companies do: [ :each | html tableRow: [
> > html tableData: [ html anchorWithAction: [ self onCompany: each] text:
> each name ].
> > html tableData: [ html anchorWithAction: [ self onCompany: each] text:
> each pbxPhone ].
> > each interlocutorPerson ifNotNil: [
> > html tableData: [ html anchorWithAction: [self onPerson: each
> interlocutorPerson ] text: (each interlocutorPerson firstName, ' ', each
> interlocutorPerson lastName) ].
> > html tableData: [ html anchorWithAction: [ self onPerson: each
> interlocutorPerson ] text: each interlocutorPerson directPhone ]
> > ]
> > ] ].
> >
> > html tableRowWith: [ html anchorWithAction: [ self addCompany ] text:
> 'A/nadir' ]
> > ]
> >
> > ! !
> >
> > WAComponent subclass: #ExViewCompany
> > instanceVariableNames: 'company '
> > classVariableNames: ''
> > poolDictionaries: ''
> > category: 'Exodus'!
> >
> > !ExViewCompany methodsFor: 'as yet unclassified' stamp: 'RHE 6/4/2003
> 11:27'!
> > company: anExCompany
> > company _ anExCompany! !
> >
> > !ExViewCompany methodsFor: 'as yet unclassified' stamp: 'RHE 6/5/2003
> 11:03'!
> > renderContentOn: html
> > html table: [
> > html tableRow: [
> > html tableHeading: [ html text: 'Nombre' ].
> > html tableData: [ html text: company name ] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Direccion' ].
> > html tableData: [ html text: company address1 ] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Direccion' ].
> > html tableData: [ html text: company address2 ] ] .
> > html tableRow: [
> > html tableHeading: [ html text: 'Provincia' ].
> > html tableData: [ html text: company state ] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'CP' ].
> > html tableData: [ html text: company zip ] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Pais' ].
> > html tableData: [ html text: company country] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Web' ].
> > html tableData: [ html anchorWithUrl: company url ] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Centralita' ].
> > html tableData: [ html text: company pbxPhone] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Fax' ].
> > html tableData: [ html text: company faxPhone] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Interlocutor' ].
> > html tableData: [ company interlocutorPerson notNil ifTrue: [
> > html text: (company interlocutorPerson firstName, ' ', company
> interlocutorPerson lastName) ] ] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Pagador' ].
> > html tableData: [ company paymentPerson notNil ifTrue: [
> > html text: (company paymentPerson firstName, ' ', company paymentPerson
> lastName) ] ] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Modo de Pago' ].
> > html tableData: [ html text: company paymentMethod] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Plazo de Pago' ].
> > html tableData: [ html text: company paymentDelay] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'CIF' ].
> > html tableData: [ html text: company paymentCode] ].
> > html tableRow: [
> > html tableHeading: [ html text: 'Notas' ].
> > html tableData: [ html text: 'TODO'] ]
> > ].
> > ! !
> >
> > WAComponent subclass: #Exodus
> > instanceVariableNames: 'frame1 '
> > classVariableNames: ''
> > poolDictionaries: ''
> > category: 'Exodus'!
> >
> > !Exodus methodsFor: 'as yet unclassified' stamp: 'RHE 6/5/2003 10:57'!
> > initialize
> > frame1 _ ExListCompanies new.! !
> >
> > !Exodus methodsFor: 'as yet unclassified' stamp: 'RHE 6/5/2003 11:01'!
> > renderContentOn: html
> > html heading: Time now.
> > frame1 renderContentOn: html.
> > ! !
> >
> >
>




More information about the Seaside mailing list