Vaadin Grid middle mouse button


F43nd1r

I'm trying to simulate normal browser behavior in a vaadin grid, which includes middle-clicking to open in a new tab:

addItemClickListener(e -> {
            boolean newTab = e.getMouseEventDetails().getButton() == MouseEventDetails.MouseButton.MIDDLE || e.getMouseEventDetails().isCtrlKey();
            //open in window or new tab
        }); 

However, vaadin does not register the middle mouse button. How do I work?

Javier

This feature is already included in vaadin-grid (in Vaadin 10) and will not work in Vaadin 8.

For Vaadin 8, you can use some client-side extension to intercept events, or you can ComponentRendereradd a Panelto each component using a (this works, but is not ideal because it reduces performance ):

grid.addColumn(item->{
    Panel p = new Panel(item.getName());
    p.setStyleName(ValoTheme.PANEL_BORDERLESS);
    p.addClickListener(ev->{
        System.out.println(ev.getButtonName());             
    });
    return p;
}).setRenderer(new ComponentRenderer());

On the other hand, client-side extensions allow to listen to javascript events (for example MouseEvent) and fire server events in response . Creating an extension is a very complex topic (as it uses parts of the API that are usually hidden from the developer), but it allows direct access to the rendered DOM that would otherwise be impossible.

The following resources in the documentation may give you a starting point: Creating Component Extensions (describes only simple extensions using Java code) and Integrating JavaScript Components and Extensions (shows how to add native JavaScript code to extensions) .

Related


Vaadin Grid middle mouse button

F43nd1r I'm trying to simulate normal browser behavior in a vaadin grid, which includes middle-clicking to open in a new tab: addItemClickListener(e -> { boolean newTab = e.getMouseEventDetails().getButton() == MouseEventDetails.MouseButton.MIDDLE

Vaadin Grid middle mouse button

F43nd1r I'm trying to simulate normal browser behavior in a vaadin grid, which includes middle-clicking to open in a new tab: addItemClickListener(e -> { boolean newTab = e.getMouseEventDetails().getButton() == MouseEventDetails.MouseButton.MIDDLE

Which mouse button is in the middle?

Radu Murzea: I'm currently developing a program in Java where a specific event has to be fired only when the user clicks with the left and right mouse buttons at the same time. Since this is a bit unconventional, I decided to test it first. here is: import jav

Which mouse button is in the middle?

Radu Murzea: I'm currently developing a program in Java where a specific event has to be fired only when the user clicks with the left and right mouse buttons at the same time. Since this is a bit unconventional, I decided to test it first. here is: import jav

Disable middle mouse button

Tom Hamilton Stubber So I've tried going through various other questions, but they mostly focus on disabling middle mouse button paste. Basically, the middle mouse button on my Logitech G500s is broken and keeps "clicking" randomly, increasing any chance of do

Paste with the middle mouse button

Sriharsha Kalluru Are there any apps that use the middle button to paste the same text every time? I've seen tools to paste clipboard text, but I want the same text to be pasted every time I click the middle mouse button. Karan With AutoHotkey the following ca

Disable middle mouse button

Ethan Hunt I need a question to help you, how to disable middle mouse click on any link to open new tab in IE 7,8,9. I have tried many things like return false; e.cancelBubble = true;e.returnValue = false; But there is no way to stop IE's ability to open a Ne

Which mouse button is in the middle?

Radu Murzea: I'm currently developing a program in Java where a specific event has to be fired only when the user clicks with the left and right mouse buttons at the same time. Since this is a bit unconventional, I decided to test it first. here is: import jav

Paste with the middle mouse button

Sriharsha Kalluru Are there any apps that use the middle button to paste the same text every time? I've seen tools to paste clipboard text, but I want the same text to be pasted every time I click the middle mouse button. Karan With AutoHotkey the following ca

Back button to middle mouse button

Protect I want to map the "back" button (xev means "button 7") of a mouse (A4Tech X-7) as the middle mouse button. Is there a way to do this? I'm lost in Google and only find how to map buttons to keyboard shortcuts using xbindkeys etc. Operating system: Cento

Back button to middle mouse button

Protect I want to map the "back" button (xev means "button 7") of a mouse (A4Tech X-7) as the middle mouse button. Is there a way to do this? I'm lost in Google and only find how to map buttons to keyboard shortcuts using xbindkeys etc. Operating system: Cento

Back button to middle mouse button

Protect I want to map the "back" button (xev means "button 7") of a mouse (A4Tech X-7) as the middle mouse button. Is there a way to do this? I'm lost in Google and only find how to map buttons to keyboard shortcuts using xbindkeys etc. Operating system: Cento

How to handle the middle mouse button?

Gibbs I have an ember component that generates a set of user groups. When the user clicks on one of the list components, it calls the linkAction defined in that component and takes the user to the specific page associated with that list item. However, when the

Alternative hotkey for middle mouse button

some people A few days ago, my middle mouse button broke and could only scroll. The problem was that I used this button a lot and it was the reason he broke, so I searched for a way to "replace" his function and found out about AutoHotKey. I read many docs and

How to handle the middle mouse button?

Gibbs I have an ember component that generates a set of user groups. When the user clicks on one of the list components, it calls the linkAction defined in that component and takes the user to the specific page associated with that list item. However, when the

Alternative hotkey for middle mouse button

some people A few days ago, my middle mouse button broke and could only scroll. The problem was that I used this button a lot and it was the reason he broke, so I searched for a way to "replace" his function and found out about AutoHotKey. I read a lot of docs

Firefox middle mouse button scrolling

pixel developer How do I get the middle mouse button to work properly in Ubuntu? Clicking the middle button doesn't show the arrow, which allows me to scroll the page by moving the mouse. information: Firefox 3.6.8 Mouse: Microsoft Intellimouse Explorer 3.0 Is

Firefox middle mouse button scrolling

pixel developer How do I get the middle mouse button to work properly in Ubuntu? Clicking the middle button doesn't show the arrow, which allows me to scroll the page by moving the mouse. information: Firefox 3.6.8 Mouse: Microsoft Intellimouse Explorer 3.0 Is

Emulate middle mouse button with AutoHotKey

Buck I want to write a simple script (single line?) to map left shift + right mouse button to middle mouse button (I don't actually have middle mouse button because it's a trackpad). I tried this variation: #(LShift & RButton)::MButton or (LShift & RButton::M

Alternative hotkey for middle mouse button

some people A few days ago, my middle mouse button broke and could only scroll. The problem was that I used this button a lot and it was the reason he broke, so I searched for a way to "replace" his function and found out about AutoHotKey. I read a lot of docs

How to handle the middle mouse button?

Gibbs I have an ember component that generates a set of user groups. When the user clicks on one of the list components, it calls the linkAction defined in that component and takes the user to the specific page associated with that list item. However, when the

How to handle the middle mouse button?

Gibbs I have an ember component that generates a set of user groups. When the user clicks on one of the list components, it calls the linkAction defined in that component and takes the user to the specific page associated with that list item. However, when the

Alternative hotkey for middle mouse button

some people A few days ago, my middle mouse button broke and could only scroll. The problem was that I used this button a lot and it was the reason he broke, so I searched for a way to "replace" his function and found out about AutoHotKey. I read a lot of docs

Alternative hotkey for middle mouse button

some people A few days ago, my middle mouse button broke and could only scroll. The problem was that I used this button a lot and it was the reason he broke, so I searched for a way to "replace" his function and found out about AutoHotKey. I read a lot of docs

Alternative hotkey for middle mouse button

some people A few days ago, my middle mouse button broke and could only scroll. The problem was that I used this button a lot and it was the reason he broke, so I searched for a way to "replace" his function and found out about AutoHotKey. I read many docs and

"Middle Mouse Button" pastes where the mouse cursor is

Dennis Kuhn [EDIT] : The observed problem is misleading, as it turns out that it stems from the behavior of Google Doc. See the accepted answer. Is it possible to configure the "middle mouse button"-paste option to paste text not where the text cursor is, but

How to map the middle mouse button for double click?

Kira Ubuntu 18.04. When I click the middle mouse button, it should double click. thanks. Edit: Using the Unity desktop. unknown OS: Ubuntu 18:04 Required packages: xdotoolandxbindkeys you can install these packagessudo apt install xdotool xbindkeys gedit .xbin

tkinter: How to autoscroll with middle mouse button?

哈格(Haggar) Right now, I have an implementation that does two things with the middle mouse button: Scroll the wheel to zoom in and out Roll the wheel button to scroll (pan) left, right, top and bottom. But in this function, I keep pressing the scroll button to

TableView row selection click on middle mouse button

West Dandan Currently in TableView, row selection doesn't happen when we middle click. If we click the right or left mouse button, the row is selected. I'm trying to have a function to select a row when the middle button is clicked. I already know that includi