Transmit data from a custom presentation

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

Transmit data from a custom presentation

Guillaume Larcheveque
Hello,

Usman and I use glamour a lot to quickly create cool browsers.
To capitalize some recurrent parts of our browsers, we create subclasses to GLMCompositePresentation and then use it that way:

browser := GLMTabulator withStatusbar.
...structure definition...
browser transmit to: #selector; andShow: [ :a | a custom: (MyCustomPresentation new)].
 
then we just have to implement the #compose method and everything is fine.

But now i have to transmit data to something else (I want to create a filter that will receive a collection of entities and transmit only a subset of it to another presentation)

I am using some morphs in this custom presentation and on some events I send:
(self pane port: #filtered) value: self filter

In my browser i have a transmission like this: 
browser transmit from: #selector port: #filtered; to: #graph; andShow: [ :a | a list display: [ :list | list ] ]. 

It doesn't work because the pane obtained in my custom presentation is not the one defined in my browser but another one named 'root'.

Maybe i am not using it in the right way but i don't see another way to do it correctly (I would like to avoid to set the right pane in my presentation).

Thanks in advance for your help.

PS: I tried to look in the MooseBook but the server is down

--
Guillaume Larcheveque


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

Re: Transmit data from a custom presentation

Andrei Chis
Hi,

Do you have somewhere an entire example that shows the problem?

I tried the examples below and it worked as expected. There could be other issues related to composite presentations.
Are you using tabulators in your custom composite presentations?


browser := GLMTabulator withStatusbar.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)




browser := GLMTabulator withStatusbar.
innerBrowser := GLMTabulator new.
innerBrowser row: #r1.
innerBrowser transmit to: #r1; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
innerBrowser transmit from:#r1 port:#filtered; toOutsidePort: #filtered.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a custom: innerBrowser ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)

On Wed, Oct 8, 2014 at 1:13 PM, Guillaume Larcheveque <[hidden email]> wrote:
Hello,

Usman and I use glamour a lot to quickly create cool browsers.
To capitalize some recurrent parts of our browsers, we create subclasses to GLMCompositePresentation and then use it that way:

browser := GLMTabulator withStatusbar.
...structure definition...
browser transmit to: #selector; andShow: [ :a | a custom: (MyCustomPresentation new)].
 
then we just have to implement the #compose method and everything is fine.

But now i have to transmit data to something else (I want to create a filter that will receive a collection of entities and transmit only a subset of it to another presentation)

I am using some morphs in this custom presentation and on some events I send:
(self pane port: #filtered) value: self filter

In my browser i have a transmission like this: 
browser transmit from: #selector port: #filtered; to: #graph; andShow: [ :a | a list display: [ :list | list ] ]. 

It doesn't work because the pane obtained in my custom presentation is not the one defined in my browser but another one named 'root'.

Maybe i am not using it in the right way but i don't see another way to do it correctly (I would like to avoid to set the right pane in my presentation).

Thanks in advance for your help.

PS: I tried to look in the MooseBook but the server is down

--
Guillaume Larcheveque


_______________________________________________
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: Transmit data from a custom presentation

Guillaume Larcheveque
Here is a really short example

2014-10-08 14:06 GMT+02:00 Andrei Chis <[hidden email]>:
Hi,

Do you have somewhere an entire example that shows the problem?

I tried the examples below and it worked as expected. There could be other issues related to composite presentations.
Are you using tabulators in your custom composite presentations?


browser := GLMTabulator withStatusbar.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)




browser := GLMTabulator withStatusbar.
innerBrowser := GLMTabulator new.
innerBrowser row: #r1.
innerBrowser transmit to: #r1; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
innerBrowser transmit from:#r1 port:#filtered; toOutsidePort: #filtered.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a custom: innerBrowser ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)

On Wed, Oct 8, 2014 at 1:13 PM, Guillaume Larcheveque <[hidden email]> wrote:
Hello,

Usman and I use glamour a lot to quickly create cool browsers.
To capitalize some recurrent parts of our browsers, we create subclasses to GLMCompositePresentation and then use it that way:

browser := GLMTabulator withStatusbar.
...structure definition...
browser transmit to: #selector; andShow: [ :a | a custom: (MyCustomPresentation new)].
 
then we just have to implement the #compose method and everything is fine.

But now i have to transmit data to something else (I want to create a filter that will receive a collection of entities and transmit only a subset of it to another presentation)

I am using some morphs in this custom presentation and on some events I send:
(self pane port: #filtered) value: self filter

In my browser i have a transmission like this: 
browser transmit from: #selector port: #filtered; to: #graph; andShow: [ :a | a list display: [ :list | list ] ]. 

It doesn't work because the pane obtained in my custom presentation is not the one defined in my browser but another one named 'root'.

Maybe i am not using it in the right way but i don't see another way to do it correctly (I would like to avoid to set the right pane in my presentation).

Thanks in advance for your help.

PS: I tried to look in the MooseBook but the server is down

--
Guillaume Larcheveque


_______________________________________________
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




--
Guillaume Larcheveque


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

GLMExample.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Transmit data from a custom presentation

Andrei Chis
Using (morphPresentation pane port: 'filtered') or (aPresentation pane port: 'filtered') instead of (self pane port: 'filtered')  should give you the desired behavior.
Not sure exactly why using self does not work, but is surely has to do something with the the fact that glamour copies presentations a lot.

Cheers,
Andrei



On Wed, Oct 8, 2014 at 2:33 PM, Guillaume Larcheveque <[hidden email]> wrote:
Here is a really short example

2014-10-08 14:06 GMT+02:00 Andrei Chis <[hidden email]>:
Hi,

Do you have somewhere an entire example that shows the problem?

I tried the examples below and it worked as expected. There could be other issues related to composite presentations.
Are you using tabulators in your custom composite presentations?


browser := GLMTabulator withStatusbar.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)




browser := GLMTabulator withStatusbar.
innerBrowser := GLMTabulator new.
innerBrowser row: #r1.
innerBrowser transmit to: #r1; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
innerBrowser transmit from:#r1 port:#filtered; toOutsidePort: #filtered.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a custom: innerBrowser ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)

On Wed, Oct 8, 2014 at 1:13 PM, Guillaume Larcheveque <[hidden email]> wrote:
Hello,

Usman and I use glamour a lot to quickly create cool browsers.
To capitalize some recurrent parts of our browsers, we create subclasses to GLMCompositePresentation and then use it that way:

browser := GLMTabulator withStatusbar.
...structure definition...
browser transmit to: #selector; andShow: [ :a | a custom: (MyCustomPresentation new)].
 
then we just have to implement the #compose method and everything is fine.

But now i have to transmit data to something else (I want to create a filter that will receive a collection of entities and transmit only a subset of it to another presentation)

I am using some morphs in this custom presentation and on some events I send:
(self pane port: #filtered) value: self filter

In my browser i have a transmission like this: 
browser transmit from: #selector port: #filtered; to: #graph; andShow: [ :a | a list display: [ :list | list ] ]. 

It doesn't work because the pane obtained in my custom presentation is not the one defined in my browser but another one named 'root'.

Maybe i am not using it in the right way but i don't see another way to do it correctly (I would like to avoid to set the right pane in my presentation).

Thanks in advance for your help.

PS: I tried to look in the MooseBook but the server is down

--
Guillaume Larcheveque


_______________________________________________
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




--
Guillaume Larcheveque


_______________________________________________
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: Transmit data from a custom presentation

Guillaume Larcheveque
Yes it works!

Thank you very much Andrei.

GLMCompositePresentation implements a defensive strategy on the #pane getter and is surely not set correctly

2014-10-08 15:11 GMT+02:00 Andrei Chis <[hidden email]>:
Using (morphPresentation pane port: 'filtered') or (aPresentation pane port: 'filtered') instead of (self pane port: 'filtered')  should give you the desired behavior.
Not sure exactly why using self does not work, but is surely has to do something with the the fact that glamour copies presentations a lot.

Cheers,
Andrei



On Wed, Oct 8, 2014 at 2:33 PM, Guillaume Larcheveque <[hidden email]> wrote:
Here is a really short example

2014-10-08 14:06 GMT+02:00 Andrei Chis <[hidden email]>:
Hi,

Do you have somewhere an entire example that shows the problem?

I tried the examples below and it worked as expected. There could be other issues related to composite presentations.
Are you using tabulators in your custom composite presentations?


browser := GLMTabulator withStatusbar.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)




browser := GLMTabulator withStatusbar.
innerBrowser := GLMTabulator new.
innerBrowser row: #r1.
innerBrowser transmit to: #r1; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
innerBrowser transmit from:#r1 port:#filtered; toOutsidePort: #filtered.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a custom: innerBrowser ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)

On Wed, Oct 8, 2014 at 1:13 PM, Guillaume Larcheveque <[hidden email]> wrote:
Hello,

Usman and I use glamour a lot to quickly create cool browsers.
To capitalize some recurrent parts of our browsers, we create subclasses to GLMCompositePresentation and then use it that way:

browser := GLMTabulator withStatusbar.
...structure definition...
browser transmit to: #selector; andShow: [ :a | a custom: (MyCustomPresentation new)].
 
then we just have to implement the #compose method and everything is fine.

But now i have to transmit data to something else (I want to create a filter that will receive a collection of entities and transmit only a subset of it to another presentation)

I am using some morphs in this custom presentation and on some events I send:
(self pane port: #filtered) value: self filter

In my browser i have a transmission like this: 
browser transmit from: #selector port: #filtered; to: #graph; andShow: [ :a | a list display: [ :list | list ] ]. 

It doesn't work because the pane obtained in my custom presentation is not the one defined in my browser but another one named 'root'.

Maybe i am not using it in the right way but i don't see another way to do it correctly (I would like to avoid to set the right pane in my presentation).

Thanks in advance for your help.

PS: I tried to look in the MooseBook but the server is down

--
Guillaume Larcheveque


_______________________________________________
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




--
Guillaume Larcheveque


_______________________________________________
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




--
Guillaume Larcheveque


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

Re: Transmit data from a custom presentation

Andrei Chis


On Wed, Oct 8, 2014 at 4:00 PM, Guillaume Larcheveque <[hidden email]> wrote:
Yes it works!

Thank you very much Andrei.

GLMCompositePresentation implements a defensive strategy on the #pane getter and is surely not set correctly

I do not think this is the problem.

More or less when you call #compose in the block closure self gets bound to the current MyCustomPresentation object.
But then Glamour copies that presentation a few times and sets the correct pane on a copy of that object.
When the block is executed self still refers to the initial MyCustomPresentation object and not the current one that has the correct pane.

So do not use self inside blocks to populate port values unless you are in the main browser (the one that you call openOn: on)

 

2014-10-08 15:11 GMT+02:00 Andrei Chis <[hidden email]>:
Using (morphPresentation pane port: 'filtered') or (aPresentation pane port: 'filtered') instead of (self pane port: 'filtered')  should give you the desired behavior.
Not sure exactly why using self does not work, but is surely has to do something with the the fact that glamour copies presentations a lot.

Cheers,
Andrei



On Wed, Oct 8, 2014 at 2:33 PM, Guillaume Larcheveque <[hidden email]> wrote:
Here is a really short example

2014-10-08 14:06 GMT+02:00 Andrei Chis <[hidden email]>:
Hi,

Do you have somewhere an entire example that shows the problem?

I tried the examples below and it worked as expected. There could be other issues related to composite presentations.
Are you using tabulators in your custom composite presentations?


browser := GLMTabulator withStatusbar.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)




browser := GLMTabulator withStatusbar.
innerBrowser := GLMTabulator new.
innerBrowser row: #r1.
innerBrowser transmit to: #r1; andShow: [ :a | 
a list
act: [ :presentation | (presentation pane port: #filtered) value: 10 ] 
 entitled: 'populate' ].
innerBrowser transmit from:#r1 port:#filtered; toOutsidePort: #filtered.
browser 
row: #selector; 
row: #graph.
browser transmit to: #selector; andShow: [ :a | 
a custom: innerBrowser ].
browser transmit 
from: #selector port: #filtered; 
to: #graph; 
andShow: [ :a | 
a text display: [ :x | x ] ].
browser openOn: (1to:9)

On Wed, Oct 8, 2014 at 1:13 PM, Guillaume Larcheveque <[hidden email]> wrote:
Hello,

Usman and I use glamour a lot to quickly create cool browsers.
To capitalize some recurrent parts of our browsers, we create subclasses to GLMCompositePresentation and then use it that way:

browser := GLMTabulator withStatusbar.
...structure definition...
browser transmit to: #selector; andShow: [ :a | a custom: (MyCustomPresentation new)].
 
then we just have to implement the #compose method and everything is fine.

But now i have to transmit data to something else (I want to create a filter that will receive a collection of entities and transmit only a subset of it to another presentation)

I am using some morphs in this custom presentation and on some events I send:
(self pane port: #filtered) value: self filter

In my browser i have a transmission like this: 
browser transmit from: #selector port: #filtered; to: #graph; andShow: [ :a | a list display: [ :list | list ] ]. 

It doesn't work because the pane obtained in my custom presentation is not the one defined in my browser but another one named 'root'.

Maybe i am not using it in the right way but i don't see another way to do it correctly (I would like to avoid to set the right pane in my presentation).

Thanks in advance for your help.

PS: I tried to look in the MooseBook but the server is down

--
Guillaume Larcheveque


_______________________________________________
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




--
Guillaume Larcheveque


_______________________________________________
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




--
Guillaume Larcheveque


_______________________________________________
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