updating textual presentation contents

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

updating textual presentation contents

Usman Bhatti
Hi,

Sometimes we have to show large text files and Pharo takes some time to get their contents and display them. In a Glamour browser, for example, the user would click and then wait for a few seconds before he'll get the desired results. In such cases, it will be useful to show the user a certain text in the text presentation, and once the contents of the file are available, the presentation updates itself with it (something on the lines of Cursor>>showWhile:)

Conceptually, with Glamour this can be achieved in two ways: triggering two transmissions for the text display pane and updating the text presentation when file contents are available.

Triggering transmission (or placing values manually in entity/selection ports) means that if the pane contains multiple presentations, each one will get affected the "delayed" behaviour even when there is none.

Updating the text presentation is better suited. Something like:

| tab textDisplayBlock|
tab := GLMTabulator new.
tab title: 'Playing with huge text files'.
tab column: #list span: 0.5; column:[:c | c row: #code; row: #details].
textDisplayBlock := [ :each | 'Loading file ...' ].
tab transmit to:#list; andShow: [:a | 
a list display: #yourself].
tab transmit to:#code; from:#list; andShow: [:a | 
a rubricText 
display: textDisplayBlock.
a roassal2 painting: [ :view :entity | view add: (((RTBox new color: Color red) + RTLabel) elementOn: entity) ]
].
tab transmit to:#details; from:#list; andShow: [:a | 
a rubricText 
display: #yourself.
].
tab openOn: RubLipsumBasicExample selectors.
"I just displayed text presentation, you can provide me the alternate block"
textDisplayBlock:= [:each |  (RubLipsumBasicExample sourceCodeAt: each)].
tab update.


But this has to be done with Announcements not to introduce a specific delay each time and outside browser interpretation loop so that the pane is visible during the file reading operation. I haven't found so far how to change the display behaviour of a presentation from an announcement raised by an object outside the browser/presentation like:
on: FileContentsAvailable do: [block := textDisplayBlock:= [:each |  (RubLipsumBasicExample sourceCodeAt: each)]. browser update]

So my questions: am I trying achieve something glamour does not support (yet)? Can we add a generic showWhile: mechanism for Glamour textual presentations without too much effort? Or there is a simple way to achieve it that I don't see?

tx,
usman 

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

Re: updating textual presentation contents

Usman Bhatti
So, I could do it by changing rendering in rubric text and forking a new process for long text blocks.
Here are the packages that I changed, if someone is interested.

And this script should work with these changes.

| tab |
tab := GLMTabulator new.
tab title: 'Playing with huge text files'.
tab column: #list span: 0.5; column:[:c | c row: #code].
tab transmit to:#list; andShow: [:a | 
a list display: #yourself].
tab transmit from:#list; to: #code; andShow: [:a | 
a rubricText 
show: ['Loading text ... '] while: [:each | (RubLipsumBasicExample sourceCodeAt:each)].
].
tab openOn: RubLipsumBasicExample selectors.

Another option was to achieve it through "delayed transmission mechanism" but there are some concepts which lack clear documentation (e.g. Transmission context and strategy, and noting presentations)
regards,
usman


On Fri, Jul 18, 2014 at 10:34 AM, Usman Bhatti <[hidden email]> wrote:
Hi,

Sometimes we have to show large text files and Pharo takes some time to get their contents and display them. In a Glamour browser, for example, the user would click and then wait for a few seconds before he'll get the desired results. In such cases, it will be useful to show the user a certain text in the text presentation, and once the contents of the file are available, the presentation updates itself with it (something on the lines of Cursor>>showWhile:)

Conceptually, with Glamour this can be achieved in two ways: triggering two transmissions for the text display pane and updating the text presentation when file contents are available.

Triggering transmission (or placing values manually in entity/selection ports) means that if the pane contains multiple presentations, each one will get affected the "delayed" behaviour even when there is none.

Updating the text presentation is better suited. Something like:

| tab textDisplayBlock|
tab := GLMTabulator new.
tab title: 'Playing with huge text files'.
tab column: #list span: 0.5; column:[:c | c row: #code; row: #details].
textDisplayBlock := [ :each | 'Loading file ...' ].
tab transmit to:#list; andShow: [:a | 
a list display: #yourself].
tab transmit to:#code; from:#list; andShow: [:a | 
a rubricText 
display: textDisplayBlock.
a roassal2 painting: [ :view :entity | view add: (((RTBox new color: Color red) + RTLabel) elementOn: entity) ]
].
tab transmit to:#details; from:#list; andShow: [:a | 
a rubricText 
display: #yourself.
].
tab openOn: RubLipsumBasicExample selectors.
"I just displayed text presentation, you can provide me the alternate block"
textDisplayBlock:= [:each |  (RubLipsumBasicExample sourceCodeAt: each)].
tab update.


But this has to be done with Announcements not to introduce a specific delay each time and outside browser interpretation loop so that the pane is visible during the file reading operation. I haven't found so far how to change the display behaviour of a presentation from an announcement raised by an object outside the browser/presentation like:
on: FileContentsAvailable do: [block := textDisplayBlock:= [:each |  (RubLipsumBasicExample sourceCodeAt: each)]. browser update]

So my questions: am I trying achieve something glamour does not support (yet)? Can we add a generic showWhile: mechanism for Glamour textual presentations without too much effort? Or there is a simple way to achieve it that I don't see?

tx,
usman 


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

Glamour-Morphic-Renderer-usmanbhatti.262.mcz (80K) Download Attachment
Glamour-Rubric-Presentations-usmanbhatti.15.mcz (19K) Download Attachment