What is GTInspector using to print UUID?

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

What is GTInspector using to print UUID?

Peter Uhnak
Hi,

how inspector decides what to print in the table/headings/etc?
Because for UUID it prints the bytes (I guess because it's child of ByteArray?), however that's rarely useful for UUID, as normally you want to see the #asString representation.



Can this be changed?

Thanks,
Peter

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

Re: [Pharo-dev] What is GTInspector using to print UUID?

Torsten Bergmann
Hi Peter,
 
It's done as a GT extension: see #gtInspectorItemsIn: in class SequencableCollection
and (as nothing is carved in stone in Pharo) for sure this can be changed (or overwritten) ;)
 
HTH
T.
 
Gesendet: Donnerstag, 16. Juni 2016 um 14:10 Uhr
Von: "Peter Uhnák" <[hidden email]>
An: "Pharo Development List" <[hidden email]>, "Moose-related development" <[hidden email]>
Betreff: [Pharo-dev] What is GTInspector using to print UUID?
Hi,
 
how inspector decides what to print in the table/headings/etc?
Because for UUID it prints the bytes (I guess because it's child of ByteArray?), however that's rarely useful for UUID, as normally you want to see the #asString representation.
 
 

Can this be changed?
 
Thanks,
Peter

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

Re: [Pharo-dev] What is GTInspector using to print UUID?

Tudor Girba-2
Hi,

More specifically, you can find this specific extension here:

SequenceableCollection>>gtInspectorItemsIn: composite
^ composite table
title: 'Items';
display: [ :aCollection | [(1 to: self size) collect: [ :index | index -> (self at: index) ]] on:Error do:[#()]];
beMultiple;
searchOn: [:text :each | 
Smalltalk compiler evaluate: ' | entity each | each := self. entity := each.', text for: each value logged: false];
column: 'Index' evaluated: [ :assoc | assoc key asString ] width: 50;
column: 'Item' evaluated: [ :assoc | GTObjectPrinter new asTruncatedTextFrom: assoc value ];
send: [ :result | 
result isNil
ifTrue: [ nil ]
ifFalse: [ result value size = 1 
ifTrue: [result anyOne value]  
ifFalse: [self species withAll: (result collect: [:each | each value])]]];
showOnly: 50;
helpMessage: 'Quick selection field. Given your INPUT, it executes: self select: [:each | INPUT ]'.

And then:

GTObjectPrinter>>asTruncatedTextFrom: anObject
^ [ Text fromString: (anObject gtDisplayString replaceAll: String cr with: String space) ]
on: Error
do: [ Text string: 'error printing' attribute: TextColor red ]


So, in the end, you want to override gtDisplayOn: in your class.

Cheers,
Doru



On Jun 16, 2016, at 2:19 PM, Torsten Bergmann <[hidden email]> wrote:

Hi Peter,
 
It's done as a GT extension: see #gtInspectorItemsIn: in class SequencableCollection
and (as nothing is carved in stone in Pharo) for sure this can be changed (or overwritten) ;)
 
HTH
T.
 
Gesendet: Donnerstag, 16. Juni 2016 um 14:10 Uhr
Von: "Peter Uhnák" <[hidden email]>
An: "Pharo Development List" <[hidden email]>, "Moose-related development" <[hidden email]>
Betreff: [Pharo-dev] What is GTInspector using to print UUID?
Hi,
 
how inspector decides what to print in the table/headings/etc?
Because for UUID it prints the bytes (I guess because it's child of ByteArray?), however that's rarely useful for UUID, as normally you want to see the #asString representation.
 
 
<Mail Attachment.png>

Can this be changed?
 
Thanks,
Peter
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev

--
www.tudorgirba.com
www.feenk.com

"Problem solving should be focused on describing
the problem in a way that makes the solution obvious."






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