JAVA GWT单元格表控制点击动作

时间:2015-06-26 18:44:27

标签: java gwt listener gwt-celltable

我有一个由7列和23行复选框组成的celltable。我需要以某种方式添加处理程序,以便在控制单击一个单元格时,如果选中它们的框,则列中的所有单元格都将切换。我看过一些类似的帖子,但没有描述如何处理控制+点击。 (例如:Adding clickHandler to row in CellTable in GWT?)。这个方法的问题是它使用的BrowserEvents类没有匹配CTRL的东西。下面列出了我的小单位的一些相关代码:

// Restrain pos by actual joint angle; in case of collision
// a is only the smallest/unsigned angle, need signed angle to calculate differnce
//TODO: Been trying different ways to calculate angle, none ideal so far, please help
float a = getAngularPositionQuat(Inputs[i].JointObject, Inputs[i].Quant);   // Compensates for 'initial angle' too

//float a = Quaternion.Angle(getJointRotation(Inputs[i].JointObject), Inputs[i].Quant);

//float a = JointInput.DirectionalAngle( Inputs[i].JointObject.connectedBody.transform.up, 
//                                       Inputs[i].JointObject.transform.up, -Inputs[i].JointObject.connectedBody.transform.forward);


// Find direction of angle with consideration to parent/world rotations
        Vector3 dirr = Inputs[i].JointObject.connectedBody.transform.InverseTransformDirection( Inputs[i].JointObject.gameObject.transform.up);  //localPosition

1 个答案:

答案 0 :(得分:1)

您可以使用:

table.addCellPreviewHandler(new Handler<MyObject>() {
    @Override
    public void onCellPreview(CellPreviewEvent<MyObject> event) {
        if ("click".equals(event.getNativeEvent().getType())) {
            if (event.getNativeEvent().getCtrlKey()) {
                // CTRL button was pressed during the click
            }
        }
    }
});