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 ].
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 Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
This is fixed in Roassal 1.152.
Well spotted Ben, once more :-)
cheers, Alexandre
On Sep 30, 2012, at 9:52 AM, Ben Coman btc@openInWorld.com wrote:
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 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
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 btc@openInWorld.com 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 Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
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 btc@openInWorld.com 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
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