Port & transmission in Mondrian

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

Port & transmission in Mondrian

Alexandre Bergel
Dear List,

Yesterday evening I found the time between two ground shakes to have a  
chat with Doru about porting some of the Glamour ideas in Mondrian.
I would like to have a better support for interaction, useful for  
animation.
In Glamour, the essential idea for interaction rely on 4 notions:  
Pane, Presentation, Port and Transmission. (Please, correct me if I am  
wrong).
The Mondrian equivalent of Pane and Presentation are MOGraphElement  
and MOShape, respectively. Port and Transmission are left to be  
implemented. You can find them in the version 384.

Here is a short test I wrote (all the test methods given here may be  
found in MOInteractionTest).

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
testSimpleTransmission
        | node1 node2 transmission |
        node1 := MONode on: 'test1'.
        node2 := MONode on: 'test2'.
        transmission := (MOTransmission new)
                origin: (node1 interaction port: #output);
                destination: (node2 interaction port: #input);
                yourself.
        (node1 interaction port: #output) value: 42.
        self assert: (node1 interaction port: #output) value = 42.
        self assert: (node2 interaction port: #input) value = nil.
        transmission transmit.
        self assert: (node1 interaction port: #output) value = 42.
        self assert: (node2 interaction port: #input) value = 42
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Then, I can write:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
testEmittingOnAPort2
        | view transmission nodeSet1 nodeSet2 globalVariable node1 node2  
interaction1 |

        view := MOViewRenderer new.
        interaction1 :=
                view interaction
                        on: MOMouseEnter do: [:ann | ann transmit: 42 onPort: #output ];
                        yourself.
        nodeSet1 := view nodes: (1 to: 20).
        node1 := nodeSet1 first.
       
        view interaction
                from: interaction1 port: #output do: [:ann | globalVariable := ann  
value ].
        nodeSet2 := view nodes: (21 to: 40).
        node2 := nodeSet2 first.
                       
        window := view open.
       
        self assert: (globalVariable isNil).
        node1 announce: (MOMouseEnter new).
        self assert: (globalVariable = 42).
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

But there is something wrong. In the second script, interaction1  
should not be necessary, shouldn't it? Else it defeats the whole  
purpose of having port and transmission.

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
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: Port & transmission in Mondrian

Tudor Girba
Hi Alex,

> Yesterday evening I found the time between two ground shakes to have  
> a chat with Doru about porting some of the Glamour ideas in Mondrian.
> I would like to have a better support for interaction, useful for  
> animation.
> In Glamour, the essential idea for interaction rely on 4 notions:  
> Pane, Presentation, Port and Transmission. (Please, correct me if I  
> am wrong).
> The Mondrian equivalent of Pane and Presentation are MOGraphElement  
> and MOShape, respectively. Port and Transmission are left to be  
> implemented.

Yes.

> You can find them in the version 384.

Well, kind of :) in the sense that Ports do not belong to the  
GraphElement which should be the case.

> Here is a short test I wrote (all the test methods given here may be  
> found in MOInteractionTest).
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> testSimpleTransmission
> | node1 node2 transmission |
> node1 := MONode on: 'test1'.
> node2 := MONode on: 'test2'.
> transmission := (MOTransmission new)
> origin: (node1 interaction port: #output);
> destination: (node2 interaction port: #input);
> yourself.
> (node1 interaction port: #output) value: 42.
> self assert: (node1 interaction port: #output) value = 42.
> self assert: (node2 interaction port: #input) value = nil.
> transmission transmit.
> self assert: (node1 interaction port: #output) value = 42.
> self assert: (node2 interaction port: #input) value = 42
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> Then, I can write:
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> testEmittingOnAPort2
> | view transmission nodeSet1 nodeSet2 globalVariable node1 node2  
> interaction1 |
>
> view := MOViewRenderer new.
> interaction1 :=
> view interaction
> on: MOMouseEnter do: [:ann | ann transmit: 42 onPort: #output ];
> yourself.
> nodeSet1 := view nodes: (1 to: 20).
> node1 := nodeSet1 first.
>
> view interaction
> from: interaction1 port: #output do: [:ann | globalVariable :=  
> ann  value ].
> nodeSet2 := view nodes: (21 to: 40).
> node2 := nodeSet2 first.
>
> window := view open.
>
> self assert: (globalVariable isNil).
> node1 announce: (MOMouseEnter new).
> self assert: (globalVariable = 42).
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> But there is something wrong. In the second script, interaction1  
> should not be necessary, shouldn't it? Else it defeats the whole  
> purpose of having port and transmission.

Not really. You need two things:
- populate a port
- define a transmission from it to another port

What we did in Glamour was to attach to each Presentation a kind of  
default interaction. In your example, I would make #mouseEnter,  
#mouseClick ... default ports that are populated when the  
corresponding interactions happen on a graph element.

Then of course, these ports will belong to graph elements. Like this  
transmissions are created between the ports of a graph element.  
Perhaps there will also be a need to identify graph elements by name  
so that you can refer to them from outside the context of a script.

Also, in Glamour, a Browser encapsulates everything. So, if you want  
to access something from inside, you have to explicitly transmit from  
inside to the outside and then use it from there. Like this you do not  
have problems with nesting and naming which can be brittle when you  
embed an arbitrary number of browsers. I would do the same here.

Cheers,
Doru


> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"What we can governs what we wish."



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

Re: Port & transmission in Mondrian

Alexandre Bergel
> What we did in Glamour was to attach to each Presentation a kind of  
> default interaction. In your example, I would make #mouseEnter,  
> #mouseClick ... default ports that are populated when the  
> corresponding interactions happen on a graph element.
>
> Then of course, these ports will belong to graph elements. Like this  
> transmissions are created between the ports of a graph element.  
> Perhaps there will also be a need to identify graph elements by name  
> so that you can refer to them from outside the context of a script.

Why not having ports that belong to an interaction instead? Consider  
the following script:
view nodes: (1 to: 1000).

Figure selection will imply a transmission between the root and each  
of these nodes. It could be a single transmission between 'root  
interaction' and the unique interaction of the nodes?

Alexandre

>
>> Cheers,
>> Alexandre
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> www.tudorgirba.com
>
> "What we can governs what we wish."
>
>
>
> _______________________________________________
> 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: Port & transmission in Mondrian

Tudor Girba
Hi Alex,

>> What we did in Glamour was to attach to each Presentation a kind of  
>> default interaction. In your example, I would make #mouseEnter,  
>> #mouseClick ... default ports that are populated when the  
>> corresponding interactions happen on a graph element.
>>
>> Then of course, these ports will belong to graph elements. Like  
>> this transmissions are created between the ports of a graph  
>> element. Perhaps there will also be a need to identify graph  
>> elements by name so that you can refer to them from outside the  
>> context of a script.
>
> Why not having ports that belong to an interaction instead? Consider  
> the following script:
> view nodes: (1 to: 1000).
>
> Figure selection will imply a transmission between the root and each  
> of these nodes. It could be a single transmission between 'root  
> interaction' and the unique interaction of the nodes?

At least two reasons. First, the ports are not just for transmitting  
information, but ports also allow you to store arbitrary values that  
model the graph element, and thus you can model the state of a  
visualization (including side-effects). Second, using ports you will  
be able to let the shape populate ports by default without writing any  
explicit interaction (only write transmission when you want to deal  
with them).

Now, about we can be smart about transmissions and do what we do for  
shapes: we share the object between multiple graph elements. For this,  
we will just need a lookup of the origins instead of hardcoding them.  
Actually in Glamour, we have:

GLMTransmission>>originatesAt: aPort

and thus, you can have a smart transmission that performs a more  
complex check by checking if the port is part of any elements from a  
collection. Like this you will have only one the transmission object.  
You could write:

view nodes: #(1 2 3) labeled: #interestingNodes.
view nodes: #(5 6 7) labeled: #otherNodes.
view transmitTo: #otherNodes fromAny: #interestingNodes port:  
#selection.

Cheers,
Doru


> Alexandre
>
>>
>>> Cheers,
>>> Alexandre
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> www.tudorgirba.com
>>
>> "What we can governs what we wish."
>>
>>
>>
>> _______________________________________________
>> 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

--
www.tudorgirba.com

"Presenting is storytelling."

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