2

我在 Pharo 2.0 的 Glamour 浏览器中使用 Roassal 绘制了一个动态调用图。

默认情况下,不仅节点是可点击的,边缘也是可点击的。

由于我没有更多信息可显示边缘,我希望它们不可点击。如何删除“可点击性”?

这就是我从 Glamour 浏览器中绘制调用图的方式:

methodsUnderTestAsCallGraphIn: constructor
    constructor roassal
        painting: [ :view :testFailure | 
                    view shape rectangle
                        size: 30;
                        fillColor: ThreeColorLinearNormalizer new.
                    view nodes: (tests methodsUnderTest: testFailure).
                    view shape arrowedLine.
                    view edges: (tests methodsUnderTest: testFailure) from: #yourself toAll: #outgoingCalls.
                    view treeLayout ];
        title: 'Callgraph of methods under test'

我认为 GLMRoassalPresentation>>renderOn: 负责添加“可点击性”:

[...]

    self shouldPopulateSelection ifTrue: [   
        aView raw allElementsDo: [:each | 
            each on: ROMouseClick do: [:event | self selection: each model ]] ].

[...]

我想为节点保留这种行为,而不是边缘。

4

3 回答 3

2

不幸的是,目前这是不可能的,因为单击是在 GLMRoassalPresentation 中硬编码的。但是,您是对的,我们应该找到解决方案,所以我打开了一个问题: http ://code.google.com/p/moose-technology/issues/detail?id=981

于 2013-09-18T05:39:19.343 回答
2

有一个自包含的示例来阐明您想要的行为会有所帮助,因此我重新构建了您的问题。

有了两条注释掉的行,我想这是你不想要的行为。取消注释这两行是否提供了您想要的行为?

browser := GLMTabulator new.
browser column: #myRoassal ; column: #mySelection.
browser transmit 
    to: #myRoassal ;
    andShow: 
    [   : aGLMPresentation |
        aGLMPresentation roassal
            painting:
            [   : view : numbers |  |edges|
                view shape rectangle ; withText ; size: 30.
                view nodes: numbers.
                view interaction noPopup.
                view edges: numbers from:  [ :x | x / 2] to: [ :x | x ].
"               view edges do: [ :edge | edge model:#doNotSelectMe ]."
                view treeLayout.
            ].
    ].
browser transmit 
    to: #mySelection ;
    from: #myRoassal ;
"   when: [ :selection | selection ~= #doNotSelectMe ] ;"
    andShow: 
    [   : aGLMPresentation |
        aGLMPresentation text
            display: [ : selectedItem | selectedItem asString ]
    ].
browser openOn: (1 to: 10).
于 2013-09-18T03:02:16.590 回答
0

我不确定您所说的“可点击性”是什么意思。您没有定义交互,因此默认交互是一个简单的弹出窗口。如果要删除弹出窗口,则只需插入“查看交互 noPopup”。在新的 Roassal 画架上试试这个:

view shape rectangle size: 40.
view nodes: #(1 2).

view interaction noPopup.
view edgesFrom: 1 to: 2.
于 2013-09-17T15:13:36.930 回答