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!
Marco
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@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Hi,
It's incorrect to say that x:y:add: expects an MONode.
FormsBuilder is supposed to be a generic algorithm for placing elements that have size in a grid that can be scaled both horizontally and vertically.
In Mondrian it has two applications:
1. for building a complex shape. In this case x:y:add: accepts a Shape. You can see an example in UMLClassDiagram>>umlShape. You obtain the shape from the builder by sending #shape.
2. for laying out the nodes in a graph. This is achieved by passing MONodes in x:y:add: and by sending asLayout to the FormsBuilder and as you see in the MOMatrixRenderer.
It appears to me that Marco wants the first solution.
Cheers, Doru
On 5 Jan 2010, at 16:36, Simon Denier wrote:
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@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"Some battles are better lost than fought."
OK then it should be described in the class comment, because I never remember and end up using the form I already used (the second).
On 5 janv. 2010, at 16:48, Tudor Girba wrote:
Hi,
It's incorrect to say that x:y:add: expects an MONode.
FormsBuilder is supposed to be a generic algorithm for placing elements that have size in a grid that can be scaled both horizontally and vertically.
In Mondrian it has two applications:
for building a complex shape. In this case x:y:add: accepts a Shape. You can see an example in UMLClassDiagram>>umlShape. You obtain the shape from the builder by sending #shape.
for laying out the nodes in a graph. This is achieved by passing MONodes in x:y:add: and by sending asLayout to the FormsBuilder and as you see in the MOMatrixRenderer.
It appears to me that Marco wants the first solution.
Cheers, Doru
On 5 Jan 2010, at 16:36, Simon Denier wrote:
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@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"Some battles are better lost than fought."
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Ok, I updated the comment.
Cheers, Doru
On 5 Jan 2010, at 17:04, Simon Denier wrote:
OK then it should be described in the class comment, because I never remember and end up using the form I already used (the second).
On 5 janv. 2010, at 16:48, Tudor Girba wrote:
Hi,
It's incorrect to say that x:y:add: expects an MONode.
FormsBuilder is supposed to be a generic algorithm for placing elements that have size in a grid that can be scaled both horizontally and vertically.
In Mondrian it has two applications:
- for building a complex shape. In this case x:y:add: accepts a
Shape. You can see an example in UMLClassDiagram>>umlShape. You obtain the shape from the builder by sending #shape.
- for laying out the nodes in a graph. This is achieved by passing
MONodes in x:y:add: and by sending asLayout to the FormsBuilder and as you see in the MOMatrixRenderer.
It appears to me that Marco wants the first solution.
Cheers, Doru
On 5 Jan 2010, at 16:36, Simon Denier wrote:
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@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"Some battles are better lost than fought."
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"We are all great at making mistakes."
Hi,
On Jan 5, 2010, at 4:48 PM, Tudor Girba wrote:
Hi,
It's incorrect to say that x:y:add: expects an MONode.
FormsBuilder is supposed to be a generic algorithm for placing elements that have size in a grid that can be scaled both horizontally and vertically.
In Mondrian it has two applications:
- for building a complex shape. In this case x:y:add: accepts a
Shape. You can see an example in UMLClassDiagram>>umlShape. You obtain the shape from the builder by sending #shape.
- for laying out the nodes in a graph. This is achieved by passing
MONodes in x:y:add: and by sending asLayout to the FormsBuilder and as you see in the MOMatrixRenderer.
It appears to me that Marco wants the first solution.
Yes, I was trying to create a complex shape and indeed I took inspiration from #umlShape ;)
Cheers, Marco
Cheers, Doru
On 5 Jan 2010, at 16:36, Simon Denier wrote:
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@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"Some battles are better lost than fought."
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Hi,
Do you still have problems?
Cheers, Doru
On 5 Jan 2010, at 23:46, Marco D'Ambros wrote:
Hi,
On Jan 5, 2010, at 4:48 PM, Tudor Girba wrote:
Hi,
It's incorrect to say that x:y:add: expects an MONode.
FormsBuilder is supposed to be a generic algorithm for placing elements that have size in a grid that can be scaled both horizontally and vertically.
In Mondrian it has two applications:
- for building a complex shape. In this case x:y:add: accepts a
Shape. You can see an example in UMLClassDiagram>>umlShape. You obtain the shape from the builder by sending #shape.
- for laying out the nodes in a graph. This is achieved by passing
MONodes in x:y:add: and by sending asLayout to the FormsBuilder and as you see in the MOMatrixRenderer.
It appears to me that Marco wants the first solution.
Yes, I was trying to create a complex shape and indeed I took inspiration from #umlShape ;)
Cheers, Marco
Cheers, Doru
On 5 Jan 2010, at 16:36, Simon Denier wrote:
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@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"Some battles are better lost than fought."
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"The coherence of a trip is given by the clearness of the goal."