Here is a version of the same code in which the
“v addAll: …” is done __after__ using RTLabelled.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| v e1 e2 l |
v := RTView new.
e1 := (RTEllipse new size: 20) elementOn: 'hello'.
e2 := (RTEllipse new size: 20) elementOn: 'world'.
e1 @ RTDraggable.
e2 @ RTDraggable.
l := RTEdge from: e1 to: e2.
l + (RTLine new color: Color red).
l + (RTArrow new color: Color red).
e2 translateBy: 60 @ 80.
e1 @ (RTLabelled new view: v).
e2 @ (RTLabelled new view: v).
"Note that the RTLabelled interaction has to be set after having added the element
in the view"
l @ (RTLabelled new text: 'lining up!'; view: v).
v addAll: { e1 . e2 . l }.
v open.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Apr 21, 2014, at 5:34 PM, Alexandre Bergel <alexandre.bergel(a)me.com> wrote:
It was not implemented.
You need to update Roassal.
-=-=-=-=-=-=-=-=-=-=
| v e1 e2 l |
v := RTView new.
e1 := (RTEllipse new size: 20) elementOn: 'hello'.
e2 := (RTEllipse new size: 20) elementOn: 'world'.
e1 @ RTDraggable.
e2 @ RTDraggable.
l := RTEdge from: e1 to: e2.
l + (RTLine new color: Color red).
l + (RTArrow new color: Color red).
e2 translateBy: 60 @ 80.
v addAll: { e1 . e2 . l }.
e1 @ RTLabelled.
e2 @ RTLabelled.
"Note that the RTLabelled interaction has to be set after having added the element
in the view"
l @ (RTLabelled new text: 'lining up!').
v open.
-=-=-=-=-=-=-=-=-=-=
<Screen Shot 2014-04-21 at 5.32.52 PM.png>
There is a subtlety: you need to tell the RTLabelled what is the view to insert the label
into. A bit cumbersome, but I have nothing better for now.
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Apr 21, 2014, at 4:03 PM, Johan Fabry <jfabry(a)dcc.uchile.cl> wrote:
> I have a related question: how do I add a label to an edge? If I do the following it
does not have any effect
>
> ((RTEdge from: efrom to: eto) + (RTLine new color: color) + (RTArrow new color:
color)) @ RTLabelled.
>
> Thanks in advance,
>
> On Apr 20, 2014, at 10:25 PM, Alexandre Bergel <alexandre.bergel(a)me.com>
wrote:
>
>> On any element.
>>
>> Try this:
>>
>> -=-=-=-=-=-=-=-=-=-=-=-=
>> | v es |
>> v := RTView new.
>> v @ RTDraggableView.
>> es := (RTEllipse new size: #numberOfMethods) elementsOn: RTObject
withAllSubclasses.
>> v addAll: es.
>>
>> es @ RTPopup @ RTLabelled @ RTDraggable.
>> RTFlowLayout new maxWidth: 900; gapSize: 50; on: es.
>>
>> v open
>> -=-=-=-=-=-=-=-=-=-=-=-=
>>
>> <Screen Shot 2014-04-20 at 10.23.14 PM.png>
>>
>> Alexandre
>>
>>
>> On Apr 20, 2014, at 9:06 PM, Leo Perard <leo.perard(a)gmail.com> wrote:
>>
>>> Looks pretty cool !
>>> Can we use on any RTShape or only RTBox ?
>>>
>>>
>>> On Sun, Apr 20, 2014 at 11:40 PM, Alexandre Bergel
<alexandre.bergel(a)me.com> wrote:
>>> Roassal Tip #2: Labeling bar with GraphET.
>>> You can use @RTLabelled for each bar elements. Consider the following
example:
>>>
>>> -=-=-=-=-=-=-=-=-=
>>> | diagram |
>>> diagram := GET2DiagramBuilder new.
>>> diagram horizontalBarDiagram
>>> models: #(10 12 13 200 150 -13 149 -151);
>>> regularAxis.
>>> diagram build.
>>>
>>> "Pick the horizontal bars and add a label"
>>> diagram view elements do: [ :e |
>>> (e shape class == RTBox)
>>> ifTrue: [ e @ RTLabelled new right ]
>>> ].
>>> diagram view open
>>> -=-=-=-=-=-=-=-=-=
>>> <10168048_620580701361864_1868405001679336135_n.png>
>>>
>>>
https://www.facebook.com/ObjectProfile/photos/a.341189379300999.82969.34054…
>>>
>>> Cheers,
>>> Alexandre
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel
http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> Moose-dev(a)iam.unibe.ch
>>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>>
>>>
>>>
>>> --
>>> Leo Perard
>>> _______________________________________________
>>> Moose-dev mailing list
>>> Moose-dev(a)iam.unibe.ch
>>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel
http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> Moose-dev(a)iam.unibe.ch
>>
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
>
> ---> Save our in-boxes!
http://emailcharter.org <---
>
> Johan Fabry -
http://pleiad.cl/~jfabry
> PLEIAD lab - Computer Science Department (DCC) - University of Chile
>
>
> _______________________________________________
> 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