Right now, by default, a presentation constructor must be an annotated method which takes a composite (and optional context) as arguments, and configures a presentation.
For example:
gtInspectorStepsIn: composite <gtInspectorPresentationOrder: 10> composite list title: 'Steps'; display: [ self children ]
While this serves the basic purpose, I found myself continuously duplicating info which I had already described with Magritte, as in the description mirroring the above:
descriptionChildren <magritteDescription> ^ MAToManyRelationDescription new accessor: #children; label: 'Steps'; "..." yourself
So, playing around, I created the following general purpose hook to give more latitude in constructing presentations:
gtInspectorPresentationsIn: composite inContext: aGTInspector "..." eachPragma selector numArgs = 0 ifTrue: [ | configurationProvider | configurationProvider := self perform: eachPragma selector. configurationProvider gtPresentation cull: composite cull: aGTInspector cull: self ]. "..."
This enables you to get presentations almost for free by leaning on (in this case) Magritte. The Magritte description gets a slight upgrade:
descriptionChildren <magritteDescription> <gtInspectorPresentationOrder: 10> ^ MAToManyRelationDescription new accessor: #children; label: 'Steps'; "..." gtPresentation: [ :a | a list ]; yourself
#gtPresentation: sets default mappings, eliminating the original duplication:
gtPresentation: aBlock | wrapper | wrapper := [ :composite :context :subject | | presentation | presentation := aBlock cull: composite cull: context. presentation hasTitle ifFalse: [ presentation title: self label ]. presentation hasTransformation ifFalse: [ presentation display: (self accessor read: subject) ] ]. self propertyAt: #gtPresentation put: wrapper
----- Cheers, Sean -- View this message in context: http://forum.world.st/Request-Feedback-for-Issue-1130-Hook-for-Customized-Pr... Sent from the Moose mailing list archive at Nabble.com.
On 16 aug. 2015, at 14:33, Sean P. DeNigris sean@clipperadams.com wrote:
descriptionChildren
<magritteDescription> <gtInspectorPresentationOrder: 10> ^ MAToManyRelationDescription new accessor: #children; label: 'Steps'; "..." gtPresentation: [ :a | a list ]; yourself
Nice. This comes to mind:
1 Do you want the gtPresentation to be so direct, or would it be helpful to make some kind of builder/visitor responsible for creating the block?
2 To fit in the glamour style, also support gtPresentation: #list ? Not just a block, also a symbol.
Stephan
Stephan Eggermont wrote
Nice. This comes to mind...
Although it works, the API is a proof-of-concept because I don't know much about Glamour's design. Specific suggestions from an expert are welcome.
----- Cheers, Sean -- View this message in context: http://forum.world.st/Request-Feedback-for-Issue-1130-Hook-for-Customized-Pr... Sent from the Moose mailing list archive at Nabble.com.
Stephan Eggermont wrote
Do you want the gtPresentation to be so direct
I'm not sure I understand. Would you say more about that? My primary requirement was to get it up and running. I'm not attached to any particular approach. But, I'm be hesitant to re-implement what we can just pass to Glamour and get for free.
Stephan Eggermont wrote
2 To fit in the glamour style, also support gtPresentation: #list ? Not just a block, also a symbol.
Done.
Also, Magritte actions are now picked up and added to the context menu for the selection in e.g. list presentations. For example: http://forum.world.st/file/n4845077/Screenshot_2015-08-22_18.png
N.B. gtPresentation: is now glmPresentation: because it really has nothing to do with GT specifically. It creates a pane suitable for any Glamour browser.
Thus, you can splice them together into a full browser like: browser := GLMTabulator new. browser column: #one; column: #two; column: #three. "..." (browser transmit) to: #two; from: #one; andShow: [ :a :model | model gtInspectorMagritteIn: a ].
----- Cheers, Sean -- View this message in context: http://forum.world.st/Request-Feedback-for-Issue-1130-Hook-for-Customized-Pr... Sent from the Moose mailing list archive at Nabble.com.