Hi Marcos
Try this, it's a start:
view nodes: self entities forEach: [:each | | builder |
view shape rectangle text: [:e | e name].
builder := MOFormsBuilder new.
builder column ; fill.
builder row; fill ; row ; fill.
builder x: 1 y: 1 add: (view node: each).
builder x: 1 y: 2 add: (self viewMethodsForClass: each onView: view).
view layout: builder asLayout.
].
The most important thing is that #x:y:add: expects a MONode as last argument, that is you
always have something like:
builder x:1 y: 1 add: (view node: each)
builder x:1 y: 1 add: (view nodes: nodes)
builder x:1 y: 1 add: (view node: each forIt: ....)
builder x:1 y: 1 add: (view nodes: each forEach: ...)
and not
builder x:1 y: 1 add: view shape rectangle....
MOFormsBuilder is a beast difficult to work with. Unfortunately it is often the solution
for more complex layout (the other is embedding nodes in horizontal/vertical layouts). If
someone comes with a better API, he is welcome.
You can take a look at MOMatrixRenderer, which uses a FormsBuilder but with a specialized
API for matrix. It shows how to work with FormsBuilder (and provide a better API for some
task :) )
On 5 janv. 2010, at 15:39, Marco D'Ambros wrote:
Hi all,
I am trying to understand how to use the MOForms builder in the following script in the
context of a FAMIXClassGroup
view shape rectangle
height: [ :cls | cls numberOfMethods ];
width: [ :cls | cls numberOfAttributes ];
].
view nodes: self entities forEach: [:each | | builder |
view shape rectangle.
builder := MOFormsBuilder new.
builder column ; fill.
builder row; fill ; row ; fill.
builder x: 1 y: 1 add: MORectangleShape new.
builder x: 1 y: 1 add: (MOLabelShape new text: [ :e | e name ]).
builder x: 1 y: 2 add: (self viewMethodsForClass: each onView: view).
view layout: builder asLayout.
].
view
edges: self entities
from: [ :cls | cls superclass ].
view treeLayout
where the method #viewMethodsForClass:onView: is as follows:
viewMethodsForClass: class onView: view
view shape rectangle.
^view node: class forIt: [
view shape rectangle.
view nodes: class methods.
view gridLayout.]
What I would like to get is, for each class, a composite figure with
- a label on top
- a composite figure where each subfigure represent a method
Ideally the label and the composite should also be centrally aligned.
However, with my script I get figure attached.
Thanks!<mondrianFig.jpg>
Marco
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
Simon