在Glamour浏览器中使Roassal可视化中的边缘不可点击

时间:2013-09-16 13:21:41

标签: smalltalk pharo moose-technology roassal

我在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 ]] ].

[...]

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

3 个答案:

答案 0 :(得分: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).

答案 1 :(得分:2)

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

答案 2 :(得分:0)

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

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

view interaction noPopup.
view edgesFrom: 1 to: 2.