com.vaadin.shared.MouseEventDetails.MouseButton Java Examples

The following examples show how to use com.vaadin.shared.MouseEventDetails.MouseButton. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableContextMenu.java    From cuba with Apache License 2.0 5 votes vote down vote up
private void useTableSpecificContextClickListener(final Table table) {
    table.addItemClickListener(new ItemClickListener() {

        @Override
        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));
            }
        }
    });
}
 
Example #2
Source File: ContextMenuTreeTable.java    From context-menu with Apache License 2.0 5 votes vote down vote up
private void addItemClickListener(TreeTable table) {
    table.addItemClickListener(event -> {
        if (event.getButton() == MouseButton.RIGHT) {
            log(event, "context-click");
        } else if (event.isDoubleClick()) {
            log(event, "double-click");
        } else {
            log(event, "click!");
        }
    });
}
 
Example #3
Source File: TableContextMenu.java    From context-menu with Apache License 2.0 5 votes vote down vote up
private void useTableSpecificContextClickListener(final Table table) {
    table.addItemClickListener(new ItemClickListener() {

        @Override
        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));
            }
        }
    });
}