On Thu, Apr 21, 2011 at 8:33 PM, Tudor Girba <tudor.girba(a)gmail.com> wrote:
Hi,
There seem to be two mismatches between what you want and what we gave you.
1. We started from the group of all classes that you want to visualize, and
relied on the name of the special class. You opened the Easel on the class.
2. Our visualization scripts indeed showed all methods from the class. All
you have to do is select those methods that are of interest to you.
So, try this:
- select your class and open it in Mondrian Easel
- execute:
view interaction menu: #mooseMenu.
view nodes: class mooseModel allModelClasses forEach: [:eachClass |
view shape rectangle height: [:method | (method invokedMethods
select: [:m | m belongsTo = class]) size].
view interaction menu: #mooseMenu.
view nodes: (eachClass methods select: [:m | m invokedMethods
anySatisfy: [:invMethod | invMethod belongsTo = class ]]).
view gridLayout gapSize: 2].
view edgesFrom: #superclass.
view treeLayout
Thanks Doru. With your snippet I have some empty (class) squares. So it
seems the thing that I want is:
|dependentClasses|
dependentClasses := (class mooseModel allModelClasses select: [:aClass|
aClass methods anySatisfy: [:aMethod|
aMethod invokedMethods anySatisfy: [:invMethod | invMethod belongsTo = class
]]]).
view interaction menu: #mooseMenu.
view nodes: dependentClasses forEach: [:eachClass |
view shape rectangle height: [:method | (method invokedMethods
select: [:m | m belongsTo = class]) size].
view interaction menu: #mooseMenu.
view nodes: (eachClass methods select: [:m | m invokedMethods
anySatisfy: [:invMethod | invMethod belongsTo = class ]]).
view gridLayout gapSize: 2].
view edgesFrom: #superclass.
view treeLayout
The first line looks ugly so maybe there's some methods that do this for
free (also there's code duplication with the "view nodes: (eachClass methods
...." line).
Now let's go a little further ;)
This script useful for me. So I would like an entry in the Moose code
browser menu so when I right-click on a class I can choose "Show users in
Mondrian".
OK, I promise to record a screencast on Moose ;)
Laurent
Cheers,
Doru
On 21 Apr 2011, at 09:34, laurent laffont wrote:
Thanks for your help but I'm a little lost
:)
I think I should rephrase my needs.
I have the class Bibacarte (this name is real). I open the Moose Code
Browser,
select this class, right-click Open in Mondrian Easel.
So now I have Mondrian opened on class->Bibacarte.
class class => FAMIXClass
class asString => 'Bibacarte in net::sa::afi::home (Type)'
class queryAllIncomingInvocations a MooseIncomingQueryResult(creerAbonne
->
#Bibacarte() (Invocation) compare -> #getId() (Invocation) chargerCarte
-> #getId() (Invocation) controlerCodeBarre -> #getId() (Invocation)
getHistoCarte -> #getId() (Invocation) equals -> #getId() (Invocation)
.......
class queryAllIncomingInvocations size => 103
It seems #queryAllIncomingInvocations is the right method that returns
all
methods that reference Bibacarte
I want to group all these invocations per class, and in the visualization
the
higher the number of invocations is, the bigger is the rectangle.
In the class rectangle I want to see the methods that invoke a method on
Bibacarte
(a rectangle by method - I don't want to see methods that don't
invoke a method on Bibacarte). Now the more a method invoke a Bibacarte
method, the bigger (or darker) the rectangle is.
I'm searching / learning in Moose but that's not a tiny platform :)
Laurent.
On Wed, Apr 20, 2011 at 11:49 PM, Simon Denier <simon.denier(a)gmail.com>
wrote:
On 20 avr. 2011, at 20:45, Tudor Girba wrote:
> Hi,
>
> On 20 Apr 2011, at 20:19, Simon Denier wrote:
>
>>
>> On 20 avr. 2011, at 17:42, laurent laffont wrote:
>>
>>> On Wed, Apr 20, 2011 at 5:27 PM, Tudor Girba <tudor.girba(a)gmail.com>
wrote:
>>> Hi Laurent,
>>>
>>> You are getting in the right mode :).
>>>
>>> - Select the group of classes you want to visualize
>>> - Right click and select Open in Mondrian Easel
>>> - Add and generate view:
>>>
>>> view shape rectangle height: [:each | each invokingClasses size].
>>> view nodes: classGroup.
>>> view edgesFrom: #superclass.
>>> view treeLayout
>>>
>>>
>>> hehe, start to look interesting ;)
>>>
>>> But now in each rectangle (that is a class) I want a rectangle per
method which height is also dependent on the number of references on the
class Zork.
>>>
>>> Then I should be able to right-click a method => browse source.
>>
>>
>> view shape rectangle height: [:each | each invokingClasses size].
>> view nodes: classGroup forEach: [ :cls |
>> view shape rectangle height: [ :m | m invokingClasses size ].
>> view interaction item: 'browse' action: #browseSource.
>> view nodes: cls methods ].
>> view edgesFrom: #superclass.
>> view treeLayout
>
> I think Laurent wanted only specific references to count. Here is a
possible
script:
>
> | targetMethods |
> targetMethods := classGroup flatCollect: #methods.
> view interaction menu: #mooseMenu.
> view nodes: classGroup forEach: [:each |
> view shape rectangle
> linearFillColor: [:method |
> (method invokingMethods select: [:m | m belongsTo
name
= 'Zork']) size]
method queryIncomingInvocations opposites withinClass: (model
entityNamed:
'Zork')
http://www.moosetechnology.org/docs/famix/MooseChef
;)
Just need to rewrite
FAMIXMethod>>invokingMethods
^ self queryIncomingInvocations opposites
And you can do
zorkClass := model entityNamed: 'Zork'.
(...)
method invokingMethods withinClass: zorkClass
> within: targetMethods.
> view interaction menu: #mooseMenu.
> view nodes: each methods.
> view gridLayout gapSize: 2].
> view edgesFrom: #superclass.
> view treeLayout
>
> Cheers,
> Doru
>
>
>>
>> But soon you will discover that it's better to use other property
(like a linear gradient in fill color) to distinguish some entities
>>
>>
>>>
>>> Laurent.
>>>
>>>
>>>
>>> Cheers,
>>> Doru
>>>
>>>
>>> On 20 Apr 2011, at 17:03, laurent laffont wrote:
>>>
>>>> Hi,
>>>>
>>>> In a Java project I have a class - let's call it Zork.
>>>>
>>>> I want to build a visualization which show which classes and methods
use the most this class (for example the bigger the square is the more the
method / class uses it).
>>
>> I'm sure it's possible but I'm a Moose newbie :)
>>
>> How can I do it ?
>>
>>
>> Laurent Laffont - @lolgzs
>>
>> Pharo Smalltalk Screencasts:
http://www.pharocasts.com/
>> Blog:
http://magaloma.blogspot.com/
>> Developer group:
http://cara74.seasidehosting.st
>>
>> _______________________________________________
>> Moose-dev mailing list
>> Moose-dev(a)iam.unibe.ch
>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
>
www.tudorgirba.com
>
> "No matter how many recipes we know, we still value a chef."
>
>
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> Moose-dev(a)iam.unibe.ch
>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> _______________________________________________
> Moose-dev mailing list
> Moose-dev(a)iam.unibe.ch
>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
Simon Denier
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
www.tudorgirba.com
"Don't give to get. Just give."
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
Simon Denier
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
www.tudorgirba.com
"Reasonable is what we are accustomed with."
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev