passing Glamour list selection to Roassal view

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

passing Glamour list selection to Roassal view

Ben Coman
With Glamour, to enable targeting the focus of a Roassal View based on
the list selection in another pane, I hacked up the following Workspace
script. Is there a more elegant way to achieve this?  In particular, one
that avoids the need to for the 'viewHack' variable?
-------------
    | browser viewHack |
    browser := GLMTabulator new.
    browser column: #list; column: #drawing.

    browser transmit
        to: #list;
        andShow: [ :a | a list ].
    browser transmit
        to: #drawing;
        andShow: [ :a | a roassal painting:
            [     :moview :collection |
                collection do: [ :x | moview view add: (ROElement
spriteOn: x) + ROLabel + ROBox white ].
                ROVerticalLineLayout on: moview view elements.
                viewHack := moview view.
            ] ].
    browser transmit
        from: #list port:#selection;
        to: #drawing;
        transformed:
        [     :x |  | foundElements |
            viewHack elements do: [ :el | ROUnhighlightElement on: el ].
            targetElement := viewHack elements at: x.
            ROFocusView on: targetElement.
            ROHighlightElement on: targetElement color: Color red.
            viewHack signalUpdate
        ].
    browser openOn: #(1 2 3 4 5 6).
--------------------
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: passing Glamour list selection to Roassal view

Ben Coman
I should add, the underlying requirement for this is so the user can
drag the the ROElements to different positions and using ROFocusView
retains the user layout, whereas putting the ROFocusView inside
#andShow: wipes out the user's layout.

Ben Coman wrote:

> With Glamour, to enable targeting the focus of a Roassal View based on
> the list selection in another pane, I hacked up the following
> Workspace script. Is there a more elegant way to achieve this?  In
> particular, one that avoids the need to for the 'viewHack' variable?
> -------------
>    | browser viewHack |
>    browser := GLMTabulator new.
>    browser column: #list; column: #drawing.
>
>    browser transmit
>        to: #list;
>        andShow: [ :a | a list ].
>    browser transmit
>        to: #drawing;
>        andShow: [ :a | a roassal painting:
>            [     :moview :collection |
>                collection do: [ :x | moview view add: (ROElement
> spriteOn: x) + ROLabel + ROBox white ].
>                ROVerticalLineLayout on: moview view elements.
>                viewHack := moview view.
>            ] ].
>    browser transmit
>        from: #list port:#selection;
>        to: #drawing;
>        transformed:
>        [     :x |  | foundElements |
>            viewHack elements do: [ :el | ROUnhighlightElement on: el ].
>            targetElement := viewHack elements at: x.
>            ROFocusView on: targetElement.
>            ROHighlightElement on: targetElement color: Color red.
>            viewHack signalUpdate
>        ].
>    browser openOn: #(1 2 3 4 5 6).
> --------------------
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: passing Glamour list selection to Roassal view

abergel
I have added a second blink when the view focuses on an element.
Maybe just once is enough, let me know if the current behavior does not work for you.

Cheers,
Alexandre


On Dec 1, 2012, at 5:08 PM, Ben Coman <[hidden email]> wrote:

> I should add, the underlying requirement for this is so the user can drag the the ROElements to different positions and using ROFocusView retains the user layout, whereas putting the ROFocusView inside #andShow: wipes out the user's layout.
>
> Ben Coman wrote:
>> With Glamour, to enable targeting the focus of a Roassal View based on the list selection in another pane, I hacked up the following Workspace script. Is there a more elegant way to achieve this?  In particular, one that avoids the need to for the 'viewHack' variable?
>> -------------
>>   | browser viewHack |
>>   browser := GLMTabulator new.
>>   browser column: #list; column: #drawing.
>>
>>   browser transmit
>>       to: #list;
>>       andShow: [ :a | a list ].
>>   browser transmit
>>       to: #drawing;
>>       andShow: [ :a | a roassal painting:
>>           [     :moview :collection |
>>               collection do: [ :x | moview view add: (ROElement spriteOn: x) + ROLabel + ROBox white ].
>>               ROVerticalLineLayout on: moview view elements.
>>               viewHack := moview view.
>>           ] ].
>>   browser transmit
>>       from: #list port:#selection;
>>       to: #drawing;
>>       transformed:
>>       [     :x |  | foundElements |
>>           viewHack elements do: [ :el | ROUnhighlightElement on: el ].
>>           targetElement := viewHack elements at: x.
>>           ROFocusView on: targetElement.
>>           ROHighlightElement on: targetElement color: Color red.
>>           viewHack signalUpdate
>>       ].
>>   browser openOn: #(1 2 3 4 5 6).
>> --------------------
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: passing Glamour list selection to Roassal view

Tudor Girba-2
In reply to this post by Ben Coman
Hi Ben,

This is a good question.

I have been struggling with how to solve this for a while now, but did not yet come to a suitable solution. I opened a ticket:
http://code.google.com/p/moose-technology/issues/detail?id=884

One possibility would be to allow the Roassal presentation react when a certain port changes:
a roassal
   painting: [:view :entity | ... ]
   on: #customPort do: [ :view :customValue | ... ]

Cheers,
Doru


On 1 Dec 2012, at 17:08, Ben Coman <[hidden email]> wrote:

> I should add, the underlying requirement for this is so the user can drag the the ROElements to different positions and using ROFocusView retains the user layout, whereas putting the ROFocusView inside #andShow: wipes out the user's layout.
>
> Ben Coman wrote:
>> With Glamour, to enable targeting the focus of a Roassal View based on the list selection in another pane, I hacked up the following Workspace script. Is there a more elegant way to achieve this?  In particular, one that avoids the need to for the 'viewHack' variable?
>> -------------
>>   | browser viewHack |
>>   browser := GLMTabulator new.
>>   browser column: #list; column: #drawing.
>>
>>   browser transmit
>>       to: #list;
>>       andShow: [ :a | a list ].
>>   browser transmit
>>       to: #drawing;
>>       andShow: [ :a | a roassal painting:
>>           [     :moview :collection |
>>               collection do: [ :x | moview view add: (ROElement spriteOn: x) + ROLabel + ROBox white ].
>>               ROVerticalLineLayout on: moview view elements.
>>               viewHack := moview view.
>>           ] ].
>>   browser transmit
>>       from: #list port:#selection;
>>       to: #drawing;
>>       transformed:
>>       [     :x |  | foundElements |
>>           viewHack elements do: [ :el | ROUnhighlightElement on: el ].
>>           targetElement := viewHack elements at: x.
>>           ROFocusView on: targetElement.
>>           ROHighlightElement on: targetElement color: Color red.
>>           viewHack signalUpdate
>>       ].
>>   browser openOn: #(1 2 3 4 5 6).
>> --------------------
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"Innovation comes in the least expected form.
That is, if it is expected, it already happened."


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: passing Glamour list selection to Roassal view

abergel
There is no event generation related to the port?

Alexandre


On Dec 1, 2012, at 8:46 PM, Tudor Girba <[hidden email]> wrote:

> Hi Ben,
>
> This is a good question.
>
> I have been struggling with how to solve this for a while now, but did not yet come to a suitable solution. I opened a ticket:
> http://code.google.com/p/moose-technology/issues/detail?id=884
>
> One possibility would be to allow the Roassal presentation react when a certain port changes:
> a roassal
>   painting: [:view :entity | ... ]
>   on: #customPort do: [ :view :customValue | ... ]
>
> Cheers,
> Doru
>
>
> On 1 Dec 2012, at 17:08, Ben Coman <[hidden email]> wrote:
>
>> I should add, the underlying requirement for this is so the user can drag the the ROElements to different positions and using ROFocusView retains the user layout, whereas putting the ROFocusView inside #andShow: wipes out the user's layout.
>>
>> Ben Coman wrote:
>>> With Glamour, to enable targeting the focus of a Roassal View based on the list selection in another pane, I hacked up the following Workspace script. Is there a more elegant way to achieve this?  In particular, one that avoids the need to for the 'viewHack' variable?
>>> -------------
>>>  | browser viewHack |
>>>  browser := GLMTabulator new.
>>>  browser column: #list; column: #drawing.
>>>
>>>  browser transmit
>>>      to: #list;
>>>      andShow: [ :a | a list ].
>>>  browser transmit
>>>      to: #drawing;
>>>      andShow: [ :a | a roassal painting:
>>>          [     :moview :collection |
>>>              collection do: [ :x | moview view add: (ROElement spriteOn: x) + ROLabel + ROBox white ].
>>>              ROVerticalLineLayout on: moview view elements.
>>>              viewHack := moview view.
>>>          ] ].
>>>  browser transmit
>>>      from: #list port:#selection;
>>>      to: #drawing;
>>>      transformed:
>>>      [     :x |  | foundElements |
>>>          viewHack elements do: [ :el | ROUnhighlightElement on: el ].
>>>          targetElement := viewHack elements at: x.
>>>          ROFocusView on: targetElement.
>>>          ROHighlightElement on: targetElement color: Color red.
>>>          viewHack signalUpdate
>>>      ].
>>>  browser openOn: #(1 2 3 4 5 6).
>>> --------------------
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> www.tudorgirba.com
>
> "Innovation comes in the least expected form.
> That is, if it is expected, it already happened."
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: passing Glamour list selection to Roassal view

Tudor Girba-2
In reply to this post by Tudor Girba-2
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).

Cheers,
Doru


On 1 Dec 2012, at 20:46, Tudor Girba <[hidden email]> wrote:

> Hi Ben,
>
> This is a good question.
>
> I have been struggling with how to solve this for a while now, but did not yet come to a suitable solution. I opened a ticket:
> http://code.google.com/p/moose-technology/issues/detail?id=884
>
> One possibility would be to allow the Roassal presentation react when a certain port changes:
> a roassal
>   painting: [:view :entity | ... ]
>   on: #customPort do: [ :view :customValue | ... ]
>
> Cheers,
> Doru
>
>
> On 1 Dec 2012, at 17:08, Ben Coman <[hidden email]> wrote:
>
>> I should add, the underlying requirement for this is so the user can drag the the ROElements to different positions and using ROFocusView retains the user layout, whereas putting the ROFocusView inside #andShow: wipes out the user's layout.
>>
>> Ben Coman wrote:
>>> With Glamour, to enable targeting the focus of a Roassal View based on the list selection in another pane, I hacked up the following Workspace script. Is there a more elegant way to achieve this?  In particular, one that avoids the need to for the 'viewHack' variable?
>>> -------------
>>>  | browser viewHack |
>>>  browser := GLMTabulator new.
>>>  browser column: #list; column: #drawing.
>>>
>>>  browser transmit
>>>      to: #list;
>>>      andShow: [ :a | a list ].
>>>  browser transmit
>>>      to: #drawing;
>>>      andShow: [ :a | a roassal painting:
>>>          [     :moview :collection |
>>>              collection do: [ :x | moview view add: (ROElement spriteOn: x) + ROLabel + ROBox white ].
>>>              ROVerticalLineLayout on: moview view elements.
>>>              viewHack := moview view.
>>>          ] ].
>>>  browser transmit
>>>      from: #list port:#selection;
>>>      to: #drawing;
>>>      transformed:
>>>      [     :x |  | foundElements |
>>>          viewHack elements do: [ :el | ROUnhighlightElement on: el ].
>>>          targetElement := viewHack elements at: x.
>>>          ROFocusView on: targetElement.
>>>          ROHighlightElement on: targetElement color: Color red.
>>>          viewHack signalUpdate
>>>      ].
>>>  browser openOn: #(1 2 3 4 5 6).
>>> --------------------
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> www.tudorgirba.com
>
> "Innovation comes in the least expected form.
> That is, if it is expected, it already happened."
>

--
www.tudorgirba.com

"Quality cannot be an afterthought."


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev