Example usage for com.vaadin.shared MouseEventDetails setShiftKey

List of usage examples for com.vaadin.shared MouseEventDetails setShiftKey

Introduction

In this page you can find the example usage for com.vaadin.shared MouseEventDetails setShiftKey.

Prototype

public void setShiftKey(boolean shiftKey) 

Source Link

Usage

From source file:com.haulmont.cuba.web.widgets.addons.contextmenu.TableContextMenu.java

License:Apache License

private void useTableSpecificContextClickListener(final Table table) {
    table.addItemClickListener(new ItemClickListener() {

        @Override//from  w  ww  .j  a v  a 2  s .com
        public void itemClick(ItemClickEvent event) {
            if (event.getButton() == MouseButton.RIGHT) {
                MouseEventDetails mouseEventDetails = new MouseEventDetails();
                mouseEventDetails.setAltKey(event.isAltKey());
                mouseEventDetails.setButton(event.getButton());
                mouseEventDetails.setClientX(event.getClientX());
                mouseEventDetails.setClientY(event.getClientY());
                mouseEventDetails.setCtrlKey(event.isCtrlKey());
                mouseEventDetails.setMetaKey(event.isMetaKey());
                mouseEventDetails.setRelativeX(event.getRelativeX());
                mouseEventDetails.setRelativeY(event.getRelativeY());
                mouseEventDetails.setShiftKey(event.isShiftKey());
                if (event.isDoubleClick()) {
                    mouseEventDetails.setType(0x00002);
                } else {
                    mouseEventDetails.setType(0x00001);
                }

                getContextClickListener().contextClick(new ContextClickEvent(table, mouseEventDetails));
            }
        }
    });
}