ROMenuActivable on raw graphic elements

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ROMenuActivable on raw graphic elements

Ben Coman
I have split this post into two parts since I think any follow up will
form two distinct threads.

As I am developing using Roassal, I find it useful to Explore the
graphic elements from a context menu.  To demonstrate I have adapted
ROExample>>linesOn:
"-------------"
"-------------"
    menu := (ROMenuActivable new)
        item: 'Explore graphic element' action: [ :model | (rawView
elementFromModel: model) explore ].

    node1 := ROLabel elementOn: 'node1'.
    node2 := ROLabel elementOn: 'node2'.
    node1 @ RODraggable @ menu.
    node2 @ RODraggable @ menu.
    "uncomment next three lines for Part Two
    edge := ROEdge lineFrom: node1 to: node2.
    edge + (ROLine red).
    rawView add: edge.
    "
    rawView add: node1; add: node2.
    ROHorizontalLineLayout on: (Array with: node1 with: node2).
"-------------"
"-------------"

Is there (or can there be added) a way to access the graphic element
more directly? Something like one of the following two lines...
    item: 'Explore graphic element' action: [ :model :element | element
explore ].
    item: 'Explore graphic element' rawAction: [ :element | element
explore ].

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

#elementFromModel broken with edges - was Re: ROMenuActivable on raw graphic elements

Ben Coman
The example from my previous post works fine if the three lines below
marked "for Part Two" are left commented - but uncomment them, then
execute and on node2 select 'Explore graphic element' from the context
menu, you get a MNU ROEdge>>elementFromModel:

This occurs since the instance variable 'elements' in ROView &
ROElement  holds both ROElement & ROEdge.

I know I'm poking around in the internals of Roassal where decent
applications should fear to tread ;) so I'm not sure if this is a
dormant bug waiting to bite someone, or has guards elsewhere that I've
bypassed.

cheers -ben

Ben Coman wrote:

> I have split this post into two parts since I think any follow up will
> form two distinct threads.
>
> As I am developing using Roassal, I find it useful to Explore the
> graphic elements from a context menu.  To demonstrate I have adapted
> ROExample>>linesOn:
> "-------------"
> "-------------"
>    menu := (ROMenuActivable new)
>        item: 'Explore graphic element' action: [ :model | (rawView
> elementFromModel: model) explore ].
>
>    node1 := ROLabel elementOn: 'node1'.
>    node2 := ROLabel elementOn: 'node2'.
>    node1 @ RODraggable @ menu.
>    node2 @ RODraggable @ menu.
>    "uncomment next three lines for Part Two
>    edge := ROEdge lineFrom: node1 to: node2.
>    edge + (ROLine red).
>    rawView add: edge.
>    "
>    rawView add: node1; add: node2.
>    ROHorizontalLineLayout on: (Array with: node1 with: node2).
> "-------------"
> "-------------"
>
> Is there (or can there be added) a way to access the graphic element
> more directly? Something like one of the following two lines...
>    item: 'Explore graphic element' action: [ :model :element | element
> explore ].
>    item: 'Explore graphic element' rawAction: [ :element | element
> explore ].
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: ROMenuActivable on raw graphic elements

Ben Coman
In reply to this post by Ben Coman
Thanks very much.  That makes some things much simpler.  However I was only thinking about Roassal and not Mondrian.  I had thought perhaps Mondrian might retain its current interaction - not just for backwards compatibility but also conceptually... I tend to think about Mondrian as "operating on nodes" at a higher level versus Roassal as "operating on elements" at the lower level.  Something like this:
view shape rectangle size: 15.
view interaction 
	item: 'inspect model' action: [ :model | inspect ];
	item: 'browse element class' action: [ :model | model browse ].
view raw @ (ROMenuAction item: 'inspect element' action: #inspect)
view nodes: (1 to: 5).

or....

view interaction 
	item: 'inspect element' rawAction: #inspect;


cheers -ben
Alexandre Bergel wrote:
That is actually a good point.
I think one mistake we did with Mondrian, is to completely hide the nodes in the interaction. As a consequence, you could not do any interesting interaction beside #inspect.

I've changed #item:action: now passes the element and not the model. You can have the following script for example:

	view shape rectangle size: 15.
	view interaction 
		item: 'inspect element' action: #inspect;
		item: 'inspect model' action: [ :el | el model inspect ];
		item: 'browse element class' action: [ :el | el model browse ].
	view nodes: (1 to: 5).

In Roassal 1.151

Cheers,
Alexandre


On Sep 30, 2012, at 9:30 AM, Ben Coman [hidden email] wrote:

  
I have split this post into two parts since I think any follow up will form two distinct threads.

As I am developing using Roassal, I find it useful to Explore the graphic elements from a context menu.  To demonstrate I have adapted ROExample>>linesOn:
"-------------"
"-------------"
  menu := (ROMenuActivable new)
      item: 'Explore graphic element' action: [ :model | (rawView elementFromModel: model) explore ].

  node1 := ROLabel elementOn: 'node1'.
  node2 := ROLabel elementOn: 'node2'.
  node1 @ RODraggable @ menu.
  node2 @ RODraggable @ menu.
  "uncomment next three lines for Part Two
  edge := ROEdge lineFrom: node1 to: node2.
  edge + (ROLine red).
  rawView add: edge.
  "
  rawView add: node1; add: node2.
  ROHorizontalLineLayout on: (Array with: node1 with: node2).
"-------------"
"-------------"

Is there (or can there be added) a way to access the graphic element more directly? Something like one of the following two lines...
  item: 'Explore graphic element' action: [ :model :element | element explore ].
  item: 'Explore graphic element' rawAction: [ :element | element explore ].

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
    

  


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: ROMenuActivable on raw graphic elements

abergel
> Thanks very much.  That makes some things much simpler.  However I was only thinking about Roassal and not Mondrian.  I had thought perhaps Mondrian might retain its current interaction - not just for backwards compatibility but also conceptually... I tend to think about Mondrian as "operating on nodes" at a higher level versus Roassal as "operating on elements" at the lower level.  

I agree with you. The Mondrian language operates directly on the object domain, rather than the graphical elements. However, I could not find any relevant action other than #inspect that strictly need the domain object.

> Something like this:
> view shape rectangle size: 15.
> view interaction
> item: 'inspect model' action: [ :model | inspect ];
> item: 'browse element class' action: [ :model | model browse ].
> view raw @ (ROMenuAction item: 'inspect element' action: #inspect)
> view nodes: (1 to: 5).
>
> or....
>
> view interaction
> item: 'inspect element' rawAction: #inspect;

I've made the change in Mondrian, let's see how it goes...

Alexandre


>
> Alexandre Bergel wrote:
>> That is actually a good point.
>> I think one mistake we did with Mondrian, is to completely hide the nodes in the interaction. As a consequence, you could not do any interesting interaction beside #inspect.
>>
>> I've changed #item:action: now passes the element and not the model. You can have the following script for example:
>>
>> view shape rectangle size: 15.
>> view interaction
>> item: 'inspect element' action: #inspect;
>> item: 'inspect model' action: [ :el | el model inspect ];
>> item: 'browse element class' action: [ :el | el model browse ].
>> view nodes: (1 to: 5).
>>
>> In Roassal 1.151
>>
>> Cheers,
>> Alexandre
>>
>>
>> On Sep 30, 2012, at 9:30 AM, Ben Coman
>> <[hidden email]>
>>  wrote:
>>
>>  
>>
>>> I have split this post into two parts since I think any follow up will form two distinct threads.
>>>
>>> As I am developing using Roassal, I find it useful to Explore the graphic elements from a context menu.  To demonstrate I have adapted ROExample>>linesOn:
>>> "-------------"
>>> "-------------"
>>>   menu := (ROMenuActivable new)
>>>       item: 'Explore graphic element' action: [ :model | (rawView elementFromModel: model) explore ].
>>>
>>>   node1 := ROLabel elementOn: 'node1'.
>>>   node2 := ROLabel elementOn: 'node2'.
>>>   node1 @ RODraggable @ menu.
>>>   node2 @ RODraggable @ menu.
>>>   "uncomment next three lines for Part Two
>>>   edge := ROEdge lineFrom: node1 to: node2.
>>>   edge + (ROLine red).
>>>   rawView add: edge.
>>>   "
>>>   rawView add: node1; add: node2.
>>>   ROHorizontalLineLayout on: (Array with: node1 with: node2).
>>> "-------------"
>>> "-------------"
>>>
>>> Is there (or can there be added) a way to access the graphic element more directly? Something like one of the following two lines...
>>>   item: 'Explore graphic element' action: [ :model :element | element explore ].
>>>   item: 'Explore graphic element' rawAction: [ :element | element explore ].
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>>
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>>    
>>>
>>
>>  
>>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev