Hello folks!
I'm finally diving into Magritte and things are going quite well in general. I have one situation I can't quite figure out how to solve.... I have a Person class with in ivar that holds an Organization. I would like to present a drop down list of Organizations when editing the person. I have tried various permutations of MASingleOptionDescription and MAOneToManyDescription, but I am not groking how they should be used :) For example, I have tried an OrderedCollection of Organizations as the argument to MASingleOptionDescription>>options:, among a bunch of other things I tried, but no joy. Anyone have any suggestions for me? thanks! Brian _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
> I have a Person class with in ivar that holds an Organization. I
> would like to present a drop down list of Organizations when editing > the person. I have tried various permutations of > MASingleOptionDescription and MAOneToManyDescription, but I am not > groking how they should be used :) That sounds like a MASingleOptionDescription. Try something like (I just copied this example from Pier): descriptionAlign ^ MASingleOptionDescription new selectorAccessor: #align; label: 'Align'; options: #(nil #left #center #right ); yourself There is also #optionsAndLabels: if you need something special for the labels. So you could write: descriptionAlign ^ MASingleOptionDescription new selectorAccessor: #align; label: 'Align'; optionsAndLabels: { nil -> 'Undefined'. #left -> 'Left Align'. ... }; yourself Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
On May 10, 2007, at 7:45 AM, Lukas Renggli wrote: >> I have a Person class with in ivar that holds an Organization. I >> would like to present a drop down list of Organizations when editing >> the person. I have tried various permutations of >> MASingleOptionDescription and MAOneToManyDescription, but I am not >> groking how they should be used :) > > That sounds like a MASingleOptionDescription. > > Try something like (I just copied this example from Pier): > > descriptionAlign > ^ MASingleOptionDescription new > selectorAccessor: #align; > label: 'Align'; > options: #(nil #left #center #right ); > yourself Ok, thanks for helping. I've tried that and here is what I have: descriptionOrg ^ (MASingleOptionDescription new) selectorAccessor: #org; label: 'Organization'; options: ALStorage orgs; priority: 20; yourself ALStorage>>orgs returns an OrderedCollection. The error I get is: ALOrganization(Object)>>doesNotUnderstand: #do: Receiver: an ALOrganization Arguments and temporary variables: aMessage: do: [] in WriteStream(Stream)>>nextPutAll: {[:v | self nextPut: v]} Receiver's instance variables: fullName: 'AbleLink Technologies, Inc.' address: nil caregivers: nil clients: nil licenses: nil shortName: 'AbleLink' contactManager: an ALServiceContactManager forums: nil uuid: nil staff: an OrderedCollection(an ALStaffMember) customers: nil WriteStream(Stream)>>nextPutAll: Receiver: a WriteStream '' Arguments and temporary variables: aCollection: an ALOrganization v: nil Receiver's instance variables: collection: '' position: 0 readLimit: 0 writeLimit: 0 WriteStream>>nextPutAll: Receiver: a WriteStream '' Arguments and temporary variables: aCollection: an ALOrganization newEnd: nil Receiver's instance variables: collection: '' position: 0 readLimit: 0 writeLimit: 0 MAStringWriter>>visitStringDescription: Receiver: a MAStringWriter Arguments and temporary variables: aDescription: a MAStringDescription label: '' comment: nil Receiver's instance variables: stream: a WriteStream '' object: an ALOrganization --- The full stack --- ALOrganization(Object)>>doesNotUnderstand: #do: WriteStream(Stream)>>nextPutAll: WriteStream>>nextPutAll: MAStringWriter>>visitStringDescription: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MAStringDescription>>acceptMagritte: MAStringWriter(MAVisitor)>>visit: MAStringWriter(MAWriter)>>write:description:to: MAStringWriter>>write:description:to: MAStringWriter(MAWriter)>>write:description: MAStringWriter class(MAWriter class)>>write:description: MAStringDescription(MADescription)>>toString:writer: MAStringDescription(MADescription)>>toString: MASingleOptionDescription(MAOptionDescription)>>labelForOption: MASelectListComponent(MAOptionComponent)>>labelForOption: [] in MASelectListComponent>>renderEditorOn: {[:value | self labelForOption: value]} WASelectTag(WACollectionTag)>>labelForOption: [] in WASelectTag>>optionsOn: {[:each | brush := html option. (self isDisabled: each) ifTrue: [brush di...]} OrderedCollection>>do: WASelectTag>>optionsOn: [] in WASelectTag>>with: {[self optionsOn: canvas. aBlock value. self hasOther ifTrue: [canvas opt...]} BlockContext>>renderOn: WASelectTag(WATagBrush)>>within: [] in WASelectTag(WATagBrush)>>with: {[self within: aBlock]} BlockContext>>renderOn: WARenderCanvas(WACanvas)>>nest: WASelectTag(WABrush)>>with: WASelectTag(WATagBrush)>>with: WASelectTag>>with: WASelectTag(WABrush)>>close WARenderCanvas(WACanvas)>>flush WARenderCanvas>>close MASelectListComponent(WAPresenter)>>renderWithContext: [] in MASelectListComponent(WAComponent)>>renderOn: {[:each | each renderWithContext: aRenderer context]} MASelectListComponent(WAComponent)>>decorationChainDo: MASelectListComponent(WAComponent)>>renderOn: WARenderCanvas(WACanvas)>>render: MATableRenderer(MAComponentRenderer)>>renderControl: [] in MATableRenderer>>renderControl: {[super renderControl: aDescription]} BlockContext>>renderOn: WATableDataTag(WATagBrush)>>within: [] in WATableDataTag(WATagBrush)>>with: {[self within: aBlock]} BlockContext>>renderOn: WARenderCanvas(WACanvas)>>nest: WATableDataTag(WABrush)>>with: WATableDataTag(WATagBrush)>>with: MATableRenderer>>renderControl: MATableRenderer(MAComponentRenderer)>>renderElement: [] in MATableRenderer>>renderElement: {[super renderElement: aDescription]} BlockContext>>renderOn: WAGenericTag(WATagBrush)>>within: [] in WAGenericTag(WATagBrush)>>with: {[self within: aBlock]} BlockContext>>renderOn: WARenderCanvas(WACanvas)>>nest: WAGenericTag(WABrush)>>with: WAGenericTag(WATagBrush)>>with: WARenderCanvas(WAHtmlCanvas)>>tableRow: MATableRenderer>>renderElement: MATableRenderer(MAComponentRenderer)>>visitElementDescription: MATableRenderer(MAVisitor)>>visitReferenceDescription: MATableRenderer(MAVisitor)>>visitOptionDescription: ...etc... _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
>> Try something like (I just copied this example from Pier):
>> >> descriptionAlign >> ^ MASingleOptionDescription new >> selectorAccessor: #align; >> label: 'Align'; >> options: #(nil #left #center #right ); >> yourself > > Ok, thanks for helping. I've tried that and here is what I have: > > descriptionOrg > ^ (MASingleOptionDescription new) > selectorAccessor: #org; > label: 'Organization'; > options: ALStorage orgs; > priority: 20; > yourself > > > ALStorage>>orgs returns an OrderedCollection. The error I get is: You have to tell Magritte how to display the organization. By default it assumes an MAStringDescription as reference, however in your case this seems to be something else. Try: descriptionOrg ^ (MASingleOptionDescription new) selectorAccessor: #org; reference: ALOrganization description; label: 'Organization'; options: ALStorage orgs; priority: 20; yourself Cheers, Lukas > > > > ALOrganization(Object)>>doesNotUnderstand: #do: > Receiver: an ALOrganization > Arguments and temporary variables: > aMessage: do: [] in WriteStream(Stream)>>nextPutAll: {[:v | self > nextPut: v]} > Receiver's instance variables: > fullName: 'AbleLink Technologies, Inc.' > address: nil > caregivers: nil > clients: nil > licenses: nil > shortName: 'AbleLink' > contactManager: an ALServiceContactManager > forums: nil > uuid: nil > staff: an OrderedCollection(an ALStaffMember) > customers: nil > > WriteStream(Stream)>>nextPutAll: > Receiver: a WriteStream '' > Arguments and temporary variables: > aCollection: an ALOrganization > v: nil > Receiver's instance variables: > collection: '' > position: 0 > readLimit: 0 > writeLimit: 0 > > WriteStream>>nextPutAll: > Receiver: a WriteStream '' > Arguments and temporary variables: > aCollection: an ALOrganization > newEnd: nil > Receiver's instance variables: > collection: '' > position: 0 > readLimit: 0 > writeLimit: 0 > > MAStringWriter>>visitStringDescription: > Receiver: a MAStringWriter > Arguments and temporary variables: > aDescription: a MAStringDescription label: '' comment: nil > Receiver's instance variables: > stream: a WriteStream '' > object: an ALOrganization > > > --- The full stack --- > ALOrganization(Object)>>doesNotUnderstand: #do: > WriteStream(Stream)>>nextPutAll: > WriteStream>>nextPutAll: > MAStringWriter>>visitStringDescription: > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > MAStringDescription>>acceptMagritte: > MAStringWriter(MAVisitor)>>visit: > MAStringWriter(MAWriter)>>write:description:to: > MAStringWriter>>write:description:to: > MAStringWriter(MAWriter)>>write:description: > MAStringWriter class(MAWriter class)>>write:description: > MAStringDescription(MADescription)>>toString:writer: > MAStringDescription(MADescription)>>toString: > MASingleOptionDescription(MAOptionDescription)>>labelForOption: > MASelectListComponent(MAOptionComponent)>>labelForOption: > [] in MASelectListComponent>>renderEditorOn: {[:value | self > labelForOption: value]} > WASelectTag(WACollectionTag)>>labelForOption: > [] in WASelectTag>>optionsOn: {[:each | brush := html option. (self > isDisabled: each) ifTrue: [brush di...]} > OrderedCollection>>do: > WASelectTag>>optionsOn: > [] in WASelectTag>>with: {[self optionsOn: canvas. aBlock value. > self hasOther ifTrue: [canvas opt...]} > BlockContext>>renderOn: > WASelectTag(WATagBrush)>>within: > [] in WASelectTag(WATagBrush)>>with: {[self within: aBlock]} > BlockContext>>renderOn: > WARenderCanvas(WACanvas)>>nest: > WASelectTag(WABrush)>>with: > WASelectTag(WATagBrush)>>with: > WASelectTag>>with: > WASelectTag(WABrush)>>close > WARenderCanvas(WACanvas)>>flush > WARenderCanvas>>close > MASelectListComponent(WAPresenter)>>renderWithContext: > [] in MASelectListComponent(WAComponent)>>renderOn: {[:each | each > renderWithContext: aRenderer context]} > MASelectListComponent(WAComponent)>>decorationChainDo: > MASelectListComponent(WAComponent)>>renderOn: > WARenderCanvas(WACanvas)>>render: > MATableRenderer(MAComponentRenderer)>>renderControl: > [] in MATableRenderer>>renderControl: {[super renderControl: > aDescription]} > BlockContext>>renderOn: > WATableDataTag(WATagBrush)>>within: > [] in WATableDataTag(WATagBrush)>>with: {[self within: aBlock]} > BlockContext>>renderOn: > WARenderCanvas(WACanvas)>>nest: > WATableDataTag(WABrush)>>with: > WATableDataTag(WATagBrush)>>with: > MATableRenderer>>renderControl: > MATableRenderer(MAComponentRenderer)>>renderElement: > [] in MATableRenderer>>renderElement: {[super renderElement: > aDescription]} > BlockContext>>renderOn: > WAGenericTag(WATagBrush)>>within: > [] in WAGenericTag(WATagBrush)>>with: {[self within: aBlock]} > BlockContext>>renderOn: > WARenderCanvas(WACanvas)>>nest: > WAGenericTag(WABrush)>>with: > WAGenericTag(WATagBrush)>>with: > WARenderCanvas(WAHtmlCanvas)>>tableRow: > MATableRenderer>>renderElement: > MATableRenderer(MAComponentRenderer)>>visitElementDescription: > MATableRenderer(MAVisitor)>>visitReferenceDescription: > MATableRenderer(MAVisitor)>>visitOptionDescription: > ...etc... > > > > > > > > _______________________________________________ > SmallWiki, Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Danke Vielmals, Lukas! Alles Klar.
Brian On May 10, 2007, at 10:58 AM, Lukas Renggli wrote: >>> Try something like (I just copied this example from Pier): >>> >>> descriptionAlign >>> ^ MASingleOptionDescription new >>> selectorAccessor: #align; >>> label: 'Align'; >>> options: #(nil #left #center #right ); >>> yourself >> >> Ok, thanks for helping. I've tried that and here is what I have: >> >> descriptionOrg >> ^ (MASingleOptionDescription new) >> selectorAccessor: #org; >> label: 'Organization'; >> options: ALStorage orgs; >> priority: 20; >> yourself >> >> >> ALStorage>>orgs returns an OrderedCollection. The error I get is: > > You have to tell Magritte how to display the organization. By default > it assumes an MAStringDescription as reference, however in your case > this seems to be something else. Try: > > descriptionOrg > ^ (MASingleOptionDescription new) > selectorAccessor: #org; > reference: ALOrganization description; > label: 'Organization'; > options: ALStorage orgs; > priority: 20; > yourself > > Cheers, > Lukas > > >> >> >> >> ALOrganization(Object)>>doesNotUnderstand: #do: >> Receiver: an ALOrganization >> Arguments and temporary variables: >> aMessage: do: [] in WriteStream(Stream)>>nextPutAll: {[:v | self >> nextPut: v]} >> Receiver's instance variables: >> fullName: 'AbleLink Technologies, Inc.' >> address: nil >> caregivers: nil >> clients: nil >> licenses: nil >> shortName: 'AbleLink' >> contactManager: an ALServiceContactManager >> forums: nil >> uuid: nil >> staff: an OrderedCollection(an ALStaffMember) >> customers: nil >> >> WriteStream(Stream)>>nextPutAll: >> Receiver: a WriteStream '' >> Arguments and temporary variables: >> aCollection: an ALOrganization >> v: nil >> Receiver's instance variables: >> collection: '' >> position: 0 >> readLimit: 0 >> writeLimit: 0 >> >> WriteStream>>nextPutAll: >> Receiver: a WriteStream '' >> Arguments and temporary variables: >> aCollection: an ALOrganization >> newEnd: nil >> Receiver's instance variables: >> collection: '' >> position: 0 >> readLimit: 0 >> writeLimit: 0 >> >> MAStringWriter>>visitStringDescription: >> Receiver: a MAStringWriter >> Arguments and temporary variables: >> aDescription: a MAStringDescription label: '' comment: nil >> Receiver's instance variables: >> stream: a WriteStream '' >> object: an ALOrganization >> >> >> --- The full stack --- >> ALOrganization(Object)>>doesNotUnderstand: #do: >> WriteStream(Stream)>>nextPutAll: >> WriteStream>>nextPutAll: >> MAStringWriter>>visitStringDescription: >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >> MAStringDescription>>acceptMagritte: >> MAStringWriter(MAVisitor)>>visit: >> MAStringWriter(MAWriter)>>write:description:to: >> MAStringWriter>>write:description:to: >> MAStringWriter(MAWriter)>>write:description: >> MAStringWriter class(MAWriter class)>>write:description: >> MAStringDescription(MADescription)>>toString:writer: >> MAStringDescription(MADescription)>>toString: >> MASingleOptionDescription(MAOptionDescription)>>labelForOption: >> MASelectListComponent(MAOptionComponent)>>labelForOption: >> [] in MASelectListComponent>>renderEditorOn: {[:value | self >> labelForOption: value]} >> WASelectTag(WACollectionTag)>>labelForOption: >> [] in WASelectTag>>optionsOn: {[:each | brush := html option. (self >> isDisabled: each) ifTrue: [brush di...]} >> OrderedCollection>>do: >> WASelectTag>>optionsOn: >> [] in WASelectTag>>with: {[self optionsOn: canvas. aBlock value. >> self hasOther ifTrue: [canvas opt...]} >> BlockContext>>renderOn: >> WASelectTag(WATagBrush)>>within: >> [] in WASelectTag(WATagBrush)>>with: {[self within: aBlock]} >> BlockContext>>renderOn: >> WARenderCanvas(WACanvas)>>nest: >> WASelectTag(WABrush)>>with: >> WASelectTag(WATagBrush)>>with: >> WASelectTag>>with: >> WASelectTag(WABrush)>>close >> WARenderCanvas(WACanvas)>>flush >> WARenderCanvas>>close >> MASelectListComponent(WAPresenter)>>renderWithContext: >> [] in MASelectListComponent(WAComponent)>>renderOn: {[:each | each >> renderWithContext: aRenderer context]} >> MASelectListComponent(WAComponent)>>decorationChainDo: >> MASelectListComponent(WAComponent)>>renderOn: >> WARenderCanvas(WACanvas)>>render: >> MATableRenderer(MAComponentRenderer)>>renderControl: >> [] in MATableRenderer>>renderControl: {[super renderControl: >> aDescription]} >> BlockContext>>renderOn: >> WATableDataTag(WATagBrush)>>within: >> [] in WATableDataTag(WATagBrush)>>with: {[self within: aBlock]} >> BlockContext>>renderOn: >> WARenderCanvas(WACanvas)>>nest: >> WATableDataTag(WABrush)>>with: >> WATableDataTag(WATagBrush)>>with: >> MATableRenderer>>renderControl: >> MATableRenderer(MAComponentRenderer)>>renderElement: >> [] in MATableRenderer>>renderElement: {[super renderElement: >> aDescription]} >> BlockContext>>renderOn: >> WAGenericTag(WATagBrush)>>within: >> [] in WAGenericTag(WATagBrush)>>with: {[self within: aBlock]} >> BlockContext>>renderOn: >> WARenderCanvas(WACanvas)>>nest: >> WAGenericTag(WABrush)>>with: >> WAGenericTag(WATagBrush)>>with: >> WARenderCanvas(WAHtmlCanvas)>>tableRow: >> MATableRenderer>>renderElement: >> MATableRenderer(MAComponentRenderer)>>visitElementDescription: >> MATableRenderer(MAVisitor)>>visitReferenceDescription: >> MATableRenderer(MAVisitor)>>visitOptionDescription: >> ...etc... >> >> >> >> >> >> >> >> _______________________________________________ >> SmallWiki, Magritte, Pier and Related Tools ... >> https://www.iam.unibe.ch/mailman/listinfo/smallwiki > > -- > Lukas Renggli > http://www.lukas-renggli.ch > > > > _______________________________________________ > SmallWiki, Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |