Hi!
Here is a short script excerpt I use.
view shape rectangle
size: 10;
fillColor: [ :aMethod | aMethod isCovered ifTrue: [ Color lightRed ]
ifFalse: [ Color white ]].
view nodes: (aClass methods sortedAs: #isCovered).
I feel the way the color is set is very verbose.
The following are equivalent
fillColor: { #isCovered -> #lightRed }
fillColor: { [:m | m isCovered] -> #lightRed }
fillColor: { #isCovered -> #lightRed . [:m | m isCovered not ] ->
#white}
The white color could be the default color is no color is picked up.
In the script above, I also use #sortedAs: to sort my elements. I find
this method quite handy. It is defined as an extension of Collection.
It is more flexible than Jannik's #sortedBy: and Moose's #sorted:.
#sortedAs operates on boolean as well.
Any opinion?
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.