On 09/26/2012 03:09 PM, Ben Coman wrote:
Depending on Dennis' requirements, the
problem with using two
elements is that when node '1' is moved, node 'test' does not move
with it.
Guessing from what I can see of the Roassal architecture, it seems
shapes are meant for this purpose to remain in a fixed orientation
its element. The difficulty however with putting a label at the
bottom is that the height of the ChildrenShape is dynamic depending
on how you drag around the inner nodes.
With recent changes I had requested regarding shapes, I envisage
something like the following would work, and you can see the label
positioned correctly but the mouse interaction to drag 'inner2' is
not quite right yet, or I'm doing it wrong:
-----------------
| view outer inner1 inner2 childrenShape labelOffsetShape |
outer := ((ROElement spriteOn: 'outer') + ROLabel ).
inner1 := ((ROElement bare on: 'SN-TestData') @ RODraggable @
ROLightlyHighlightable ). "shapes defined later"
inner2 := ((ROElement spriteOn: 'inner2' ) + ROLabel @
ROLightlyHighlightable ).
childrenShape := ROChildrenShape new.
labelOffsetShape := ROTranslatingShape offset:
[ :el2 | | offset |
offset := 0 @ (childrenShape boundsFor: el2) extent y negated.
Transcript crShow: offset asString, ' ', el2 model asString.
offset
].
inner1 + ROBorder + childrenShape + labelOffsetShape + ROLabel.
view := (ROView new @ RODraggable) add: (outer add: (inner1 add:
inner2)).
view open.
------------------
_______________________________________________
Actually you can with something like this:
| view rawView nodes node label |
rawView := ROView new.
view := ROMondrianViewBuilder view: rawView.
view shape rectangle.
nodes := view node: 'example' forIt:[
view interaction forwarder.
view shape rectangle size: 100.
view node: 1.
view interaction forwarder.
view shape label.
view node: 'test'.
view verticalLineLayout.
].
view noLayout.
view open.
In which the interactions to the nodes are "forwarder" to the parent.
But yes, the solution with ROTranslatingShape seems nicer :)
Cheers,
Vanessa.
If you remove the outer border, then that may be just what is required.
Doing this layout at the element level like this seems easier, but not
so flexible as with shapes. Now for my additional benefit, how would
you do that raw Roassal. That is, by removing ROMondrianViewBuilder
from the example.
cheers -ben