Status: New Owner: ---- Labels: Type-Defect Priority-Medium
New issue 947 by chisvasi...@gmail.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
When creating a text presentation the user should be able to specify a selectionInterval:
GLMTextPresentation new selectionIntervalBlock: [ ... ]
Comment #1 on issue 947 by chisvasi...@gmail.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
Fixed, in the latest version
Comment #2 on issue 947 by tu...@tudorgirba.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
I am not convinced this is a good approach. I think it would be more interesting to have a block that initializes any port.
Something like: presentation initialize: [:pres | ... ]
Comment #3 on issue 947 by chisvasi...@gmail.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
Ok. We could have something like this:
presentation initialize: [:pres | pres initializePort: #portName with: aBlock ]
valueForPort: aSymbol ^ (self pane port: aSymbol) value isNil ifTrue: [(self initializationBlockForPort: aSymbol) value] ifFalse: [(self pane port: aSymbol) value]
Is this what you had in mind?
Comment #4 on issue 947 by tu...@tudorgirba.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
I am thinking of a mechanism in which the initialize: block gets executed at presentation creation time, not at port query time.
Comment #5 on issue 947 by chisvasi...@gmail.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
If the block gets executed at presentation creation time, the port values will be stored in the pane associated with the presentation. presentation initialize: [:pres | pres selectionInterva: (1 to: 3) ]
However, when the newly created presentation is added to another pane, the values from the ports are lost, as they are not copy from the old pane. So one solution might be to copy them, or every time a presentation is added to a port, run the initialization block.
Comment #6 on issue 947 by tu...@tudorgirba.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
By initialization-time, I meant installation-time :)
Comment #7 on issue 947 by chisvasi...@gmail.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
Ok. Now it's more clear :) I guess the best place to do it would be GLMPane>>presentations: aCompositePresentation self notingPresentationChangeDo: [ .... presentations initializePorts ].
Doing this in GLMPresentation>>pane: would be an overkill.
Comment #8 on issue 947 by tu...@tudorgirba.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
Yes.
Actually, now that presentations are dynamic, we should be able to directly set the port values like: andShow: [:a :x | a text selectionInterval: (1 to: x) ]
The only problem comes from the execution order that cannot be guaranteed.
Comment #9 on issue 947 by chisvasi...@gmail.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
I commited a solution that uses an initialization block, plus several tests for it.
Updates: Status: Fixed Labels: -Type-Defect Type-Enhancement Component-Glamour Milestone-4.8
Comment #10 on issue 947 by tu...@tudorgirba.com: TextPresentations should support setting the selectionInterval on creation http://code.google.com/p/moose-technology/issues/detail?id=947
(No comment was entered for this change.)