Just sharing a cool result of some experimentation with Mondrian. I was pleasantly surprised with what I ended up with.
Contents of attached text file can be copied to Workspace. Also I've uploaded this for Mondrian Easel as Mondrian-Example-BenComan.44.
cheers -ben
| view b actionBlock makeMenu |
view := MOViewRenderer new.
"Define shape such that the MOLayout name is displayed above the subview children"
b := MOFormsBuilder new.
b column; fill; row; fill; row; fill .
b x:1 y:1 add:
( MORectangleShape new
text: [ :value | (view nodeForDomainValue: value) layout. ];
textAlignment: #center;
borderColor: Color white
) .
b x:1 y:2 add: ( MORectangleShape new ) .
b x:1 y:2 add: ( MOChildrenShape new ) .
view shape: b shape.
"Define menus for setting the layouts of subviews"
actionBlock :=
[ :selectedValue :newLayout |
| element position |
element := view nodeForDomainValue: selectedValue.
position := element bounds origin.
element layout: newLayout.
element applyLayout.
element resetFormCacheUpToTheRoot.
element translateBy: position.
view updateWindow.
].
makeMenu :=
[ :layout |
view interaction item: (layout class name asString) action: [ :selectedValue | actionBlock value: selectedValue value: layout ].
].
makeMenu value: (MOGridLayout new).
makeMenu value: (MOBottomFlowLayout new).
makeMenu value: (MOBulletTreeLayout new).
makeMenu value: (MOCircleLayout new scaleBy: 6).
makeMenu value: (MODominanceTreeLayout new).
makeMenu value: (MOFADELayout new).
makeMenu value: (MOFlowLayout new).
makeMenu value: (MOForceBasedLayout new).
makeMenu value: (MOHorizontalDominanceTreeLayout new).
makeMenu value: (MOFlowLayout new).
makeMenu value: (MODominanceTreeLayout new).
makeMenu value: (MOHorizontalLineLayout new).
makeMenu value: (MOHorizontalNarrowTreeLayout new).
makeMenu value: (MOHorizontalTreeLayout new).
makeMenu value: (MOMinimumGridLayout new).
makeMenu value: (MOVerticalNarrowTreeLayout new).
makeMenu value: (MORadialTreeLayout new).
makeMenu value: (MOSpringLayout new).
makeMenu value: (MOSugiyamaLayout new).
makeMenu value: (MOTreeLayout new).
makeMenu value: (MOVerticalLineLayout new).
"Define some nodes and edges"
view
nodes: (10 to: 70 by: 10)
forEach:
[
:each |
view shape rectangle size: 20; withText.
view nodes: ( each+1 to: each+9).
view edge: each+1 from: each+1 to: each+2.
view edge: each+1 from: each+1 to: each+3.
view edge: each+1 from: each+1 to: each+4.
view edge: each+2 from: each+2 to: each+5.
view edge: each+2 from: each+2 to: each+6.
view edge: each+2 from: each+2 to: each+7.
view edge: each+3 from: each+3 to: each+7.
view edge: each+3 from: each+3 to: each+8.
view edge: each+3 from: each+3 to: each+9.
view circleLayout scaleBy: 6.
].
view circleLayout scaleBy: 25.
view open_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.chhttps://www.iam.unibe.ch/mailman/listinfo/moose-dev