Dear Markus,
Agile Vis ebook is superb, copied following snippet,
know hopefully what it's doing, but want to make sure I understand how it works (in
terms of "plain" Pharo):
Thanks for your nice words.
1) @ RTPopup: Class name is enough, but it is
initiated under the hood?
Yes. You can particularize the popup. For example, consider the script:
-=-=-=-=-=-=-=-=-=
v := RTView new.
es := (RTEllipse new color: Color blue) elementsOn: Collection withAllSubclasses.
v addAll: es.
aPopup := RTPopup new
text: [ :aClass |
'Classname = ', aClass name, String cr,
'NbMethod=', aClass numberOfMethods asString, String cr,
'NbVariables=', aClass numberOfVariables asString ].
aPopup borderColor: Color black.
aPopup textColor: Color white.
aPopup backgroundColor: Color black.
es @ aPopup.
RTMetricNormalizer new
elements: es;
normalizeSize: #numberOfMethods min: 20 max: 50;
normalizeColor: #numberOfVariables.
RTGridLayout new on: es.
v
-=-=-=-=-=-=-=-=-=
2) RTMetricNormalizer new ...: There is no need to
keep reference to created object? Why? because messages sent to object (like
normalizeSize) have a "sideeffect" on es?
To RTMetricNormalizer, you can provide the Roassal elements or your objects (#(4 5 1 2 3
5) in your example).
What do you mean by side effect? The class RTMetricNormalizer needs some Roassal elements
to operates. Either you provide them directly, as in the example, or you can provide a
view and the objects (in this case, roassal elements are looked up).
The objects needs to answer to the messages indicated as argument to normalizeSize: and
normalizeColor:. In your example it is #yourself (all pharo objects understand this, which
returns the object itself). In the example I have just given, it is #numberOfMethods and
#numberOfVariables, which are understood by Pharo classes (used as objects).
3) RTMetricNormalizer connects to model via #yourself?
Is every symbol or code block. that is sent to RTMetricNormalizer as argument, executed
when finally "sent" to es?
#yourself in your example indicates where to get the number used for the size and color
normalization. In that case, represented objects (numerical values) are taken directly by
the normalizer. But it could be different as in my example. Classes are represented, and a
metric is used to obtain a numerical value.
Let us know if my answer make things clearer now. If no, then keep asking please :-)
Cheers,
Alexandre
BR Mike
v := RTView new.
es := (RTEllipse new color: Color blue) elementsOn: #(4 5 1 2 3 5).
v addAll: es.
es @ RTPopup.
RTMetricNormalizer new
elements: es;
alphaColor;
normalizeSize: #yourself min: 20 max: 50;
normalizeColor: #yourself.
RTHorizontalLineLayout new alignCenter; on: es.
es @ RTLabeled.
v
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.