Mouse events: MouseDown, MouseUp, KeyUp, ....

Hello,
I need to use event MouseDown in my vaadin application. In fact I need to implement a long clic (mouse pushed 3 seconds before display a contextual menu)
With ClickEvent of vaadin, I only have access to three types of events:

  • BUTTON_LEFT
  • BUTTON_MIDDLE
  • BUTTON_RIGHT

But I cannot use MouseDown, MouseUp, KeyUp which exist into GWT API.

Do you know if it exists a solution with vaadin ?

I have done some searches and I think I have 2 solutions:

  • Use an existing vaadin addon which implements these events
  • Create my own addon which uses these GWT events. In my vaadin project I will use this addon to use these events.

thank you very mutch for responses

C.B

You need to do some client side coding for this.

Why they are not sent is to reduce the network traffic, and also to some extent to raise the level of abstraction on the UI component level a little - sometimes you cannot get the same behavior on all browsers at the lowest levels of abstraction (e.g. MouseDown, MouseUp) etc, touch devices complicate this further etc.

Anyway, if you depend on timings, you should do this on the client side.

You might be able to use the
ContextMenu
add-on as a starting point with few modifications. It looks like opening the menu depends on com.google.gwt.event.dom.client.ContextMenuHandler, you might have to (partly?) bypass that and handle opening the menu yourself. Note that such events could also come from the context menu key on a keyboard, a long press on a touch device etc. so you might still want to support such.

Thanks for your response, I will try your solution and I will post my results