Status: New Owner: tu...@tudorgirba.com CC: chisvasi...@gmail.com Labels: Type-Defect Priority-Medium Component-Glamour
New issue 884 by tu...@tudorgirba.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
The current implementation of the Roassal presentation relies only on the original entity. However, given that Roassal can handle various animations, we would benefit from an extra ability of the presentation to react to other ports.
For example, the list presentation reacts to #selection. Similarly, Roassal should be able to react to it or others as well. Only, given that Roassal is generic, the reaction should be customisable, too.
Perhaps something like this: a roassal painting: [:view :entity | ... ] on: #customPort do: [ :view :customValue | ... ]
Comment #1 on issue 884 by alexandr...@gmail.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
Events cannot be used for that purpose?
Comment #2 on issue 884 by tu...@tudorgirba.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
What events?
Comment #3 on issue 884 by alexandr...@gmail.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
I do not know. If Glamour generates event, then Roassal can listen at them.
Comment #4 on issue 884 by tu...@tudorgirba.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
Announcements then :). Of course, they can be used. The question is only how to do it nicely.
Essentially, we should be able to do now as follows:
browser := GLMTabulator new . browser with: [:tabulator | tabulator column: #index; column: #visualization. tabulator transmit to: #index; andShow: [:a | a list ]. tabulator transmit to: #visualization; andShow:[ :a | a roassal painting: [:view :collection | view nodes: collection ]; on: GLMContextChanged do: [:ann | ann property = #highlight ifTrue: [ ROHighlightElement on: ann presentation view raw elements first color: Color blue ]]]. tabulator transmit from: #index; to: #visualization port: #highlight. ]; openOn: #( 1 2 3 ).
However, the problem is that in practice, the announcement does not get triggered now because when we copy the presentation during the transmission, the announcements do not get copied properly.
Comment #5 on issue 884 by tu...@tudorgirba.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
Ok.
Here is a working version for now: browser := GLMTabulator new . browser with: [:tabulator | tabulator column: #index; column: #visualization. tabulator transmit to: #index; andShow: [:a | a list ]. tabulator transmit to: #visualization; andShowIfNone:[ :a | a roassal painting: [:view :collection :roassal | view shape label. view nodes: collection. view gridLayout. roassal on: GLMContextChanged do: [:ann | ann property = #highlight ifTrue: [ ann oldValue ifNotNil: [ ROUnhighlightElement on: (ann presentation view raw elementFromModel: ann oldValue)]. ROHighlightElement on: (ann presentation view raw elementFromModel: ann value) color: Color red ]]]]. tabulator transmit from: #index; to: #visualization port: #highlight ]; openOn: ( 1 to: 20).
Comment #6 on issue 884 by benjamin...@gmail.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
I had been considering something like a #andSelect: operation similiar to #andShow:, but your first example "on: #customPort do: [ :view :customValue | ... ]" would work better, tying it more closely to a particular view.
Your example in Comment 5 works fine here and will do for now to integrate into my application. thanks.
Comment #7 on issue 884 by tu...@tudorgirba.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
Great.
Here is a slightly extended version in which we deal with bidirectional updates between the list and roassal: | browser | browser := GLMTabulator new . browser with: [:tabulator | tabulator column: #index; column: #visualization. tabulator transmit to: #index; andShow: [:a | a list ]. tabulator transmit to: #visualization; andShowIfNone:[ :a | a roassal painting: [:view :collection :roassal | view shape label. view interaction on: ROMouseLeftClick do: [:ann | (roassal pane port: #selection) value: ann element model ]. view nodes: collection. view gridLayout. roassal on: GLMContextChanged do: [:ann | ann property = #selection ifTrue: [ ann oldValue ifNotNil: [ ROUnhighlightElement on: (ann presentation view raw elementFromModel: ann oldValue)]. ROHighlightElement on: (ann presentation view raw elementFromModel: ann value) color: Color red ]]]]. tabulator transmit from: #index; to: #visualization port: #selection. tabulator transmit from: #visualization port: #selection; to: #index port: #selection. ].
I think it's pretty cool that we can easily accommodate such a scenario without worrying about possible infinite loops.
Comment #8 on issue 884 by benjamin...@gmail.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
Just a minor tweak... when clicking on the #index pane background, 'ann value' is nil, so need to wrap ROHighlightElement...
ann value ifNotNil: [ ROHighlightElement on: (ann presentation view raw elementFromModel: ann value) color: Color red ]]]]]].
Comment #9 on issue 884 by benjamin...@gmail.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
One thing I haven't been able to work out is when clicking on the #visualization background I need the element to deselect and also deselect the element in the list.
I observe that when clicking in the #visualization pane, hightlighted-selection still works when the following lines are commented out. + view interaction on: ROMouseLeftClick do: [:ann | (roassal pane port: #selection) value: ann element model ]. + tabulator transmit from: #index; to: #visualization port: #selection. + tabulator transmit from: #visualization port: #selection; to: #index port: #selection.
Also I see that adding a break here.... roassal on: GLMContextChanged do: [:ann | self halt.
shows this is invoked three times when clicking on an element in the #visualization pane but not invoked when clicking on the background on the #visualization pane.
I am unable to find my way any deeper than that. Any ideas?
Comment #10 on issue 884 by benjamin...@gmail.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
btw, not sure if the following simplifies or adds complication, but if you load ROSelectionAndExample.2.cs from Issue 894, then you can do the following... -------------- | browser activeSelection | activeSelection := ROSelection new onInclusion: [ :element | ROHighlightElement on: element color: Color red ]; onExclusion: [ :element | ROUnhighlightElement on: element ].
browser := GLMTabulator new . browser with: [ :tabulator | tabulator column: #index; column: #visualization. tabulator transmit to: #index; andShow: [:a | a list ]. tabulator transmit to: #visualization; andShowIfNone: [ :a | a roassal painting: [ :view :collection :roassal | view shape label. view interaction on: ROMouseLeftClick do: [:ann | (roassal pane port: #selection) value: ann element model ]. view nodes: collection. view gridLayout. roassal on: GLMContextChanged do: [ :ann | ann property = #selection ifTrue: [ activeSelection clear. activeSelection add: (ann presentation view raw elementFromModel: ann value) . ]. ]. ]. ]. tabulator transmit from: #index; to: #visualization port: #selection. tabulator transmit from: #visualization port: #selection; to: #index port: #selection. ]. browser openOn: #(1 2 3 4 5). -------------
Updates: Status: Started
Comment #11 on issue 884 by alexandr...@gmail.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
What about this issue? Is there something to do? Here is a new version of Ben's script (ROHighlightElement and ROUnhighlightElement) have been changed into ROBlink :
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | browser activeSelection | activeSelection := ROSelection new onInclusion: [ :element | ROBlink highlight: element color: Color red ]; onExclusion: [ :element | ROBlink unhighlight: element ].
browser := GLMTabulator new . browser with: [ :tabulator | tabulator column: #index; column: #visualization. tabulator transmit to: #index; andShow: [:a | a list ]. tabulator transmit to: #visualization; andShowIfNone: [ :a | a roassal painting: [ :view :collection :roassal | view shape label. view interaction on: ROMouseLeftClick do: [:ann | (roassal pane port: #selection) value: ann element model ]. view nodes: collection. view gridLayout. roassal on: GLMContextChanged do: [ :ann | ann property = #selection ifTrue: [ activeSelection clear. activeSelection add: (ann presentation view raw elementFromModel: ann value) . ]. ]. ]. ]. tabulator transmit from: #index; to: #visualization port: #selection. tabulator transmit from: #visualization port: #selection; to: #index port: #selection. ]. browser openOn: #(1 2 3 4 5). -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Everything seems to work as expected. Shall I close the issue?
Comment #12 on issue 884 by benjamin...@gmail.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
Looks good. Its only missing one thing. In the List Pane after you click a number to select it, you can click on the background to deselect it. You should be able to the same in the Roassal Pane, but clicking on the background does not deselect. But maybe that is separate from the title of this Issue.
Comment #13 on issue 884 by alexandr...@gmail.com: The Roassal presentation should react to custom ports http://code.google.com/p/moose-technology/issues/detail?id=884
Is there an event, sorry, an announcement, about deselection?
by the way, why do we still use the word "Announcement" whereas the whole World calls an event event?