com.vaadin.event.
Class MouseEvents.ClickEvent
java.lang.Object
java.util.EventObject
com.vaadin.ui.Component.Event
com.vaadin.event.MouseEvents.ClickEvent
All Implemented Interfaces:
Direct Known Subclasses:
AbstractSplitPanel.SplitterClickEvent, ItemClickEvent, LayoutEvents.LayoutClickEvent, Table.FooterClickEvent, Table.HeaderClickEvent
Enclosing interface:
- extends Component.Event
public static class MouseEvents.ClickEvent
Class for holding information about a mouse click event. A
MouseEvents.ClickEvent
is fired when the user clicks on a
Component
.
The information available for click events are terminal dependent.
Correct values for all event details cannot be guaranteed.
Since:
6.2
Version:
6.8.18
Author:
Vaadin Ltd.
See Also:
Field Summary | |
---|---|
static int |
BUTTON_LEFT
|
static int |
BUTTON_MIDDLE
|
static int |
BUTTON_RIGHT
|
Fields inherited from class java.util.EventObject |
---|
source |
Constructor Summary | |
---|---|
MouseEvents.ClickEvent(Component source,
MouseEventDetails mouseEventDetails)
|
Method Summary | |
---|---|
int |
getButton()
Returns an identifier describing which mouse button the user pushed. |
String |
getButtonName()
Returns a human readable string representing which button has been pushed. |
int |
getClientX()
Returns the mouse position (x coordinate) when the click took place. |
int |
getClientY()
Returns the mouse position (y coordinate) when the click took place. |
int |
getRelativeX()
Returns the relative mouse position (x coordinate) when the click took place. |
int |
getRelativeY()
Returns the relative mouse position (y coordinate) when the click took place. |
boolean |
isAltKey()
Checks if the Alt key was down when the mouse event took place. |
boolean |
isCtrlKey()
Checks if the Ctrl key was down when the mouse event took place. |
boolean |
isDoubleClick()
Checks if the event is a double click event. |
boolean |
isMetaKey()
Checks if the Meta key was down when the mouse event took place. |
boolean |
isShiftKey()
Checks if the Shift key was down when the mouse event took place. |
Methods inherited from class com.vaadin.ui.Component.Event |
---|
getComponent |
Methods inherited from class java.util.EventObject |
---|
getSource, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
BUTTON_LEFT
public static final int BUTTON_LEFT
See Also:
BUTTON_MIDDLE
public static final int BUTTON_MIDDLE
See Also:
BUTTON_RIGHT
public static final int BUTTON_RIGHT
See Also:
Constructor Detail |
---|
MouseEvents.ClickEvent
public MouseEvents.ClickEvent(Component source,
MouseEventDetails mouseEventDetails)
Method Detail |
---|
getButton
public int getButton()
- Returns:
- one of
BUTTON_LEFT
,BUTTON_MIDDLE
,BUTTON_RIGHT
.
Returns an identifier describing which mouse button the user pushed.
Compare with BUTTON_LEFT
,BUTTON_MIDDLE
,
BUTTON_RIGHT
to find out which butten it is.
getClientX
public int getClientX()
- Returns:
- The mouse cursor x position
Returns the mouse position (x coordinate) when the click took place. The position is relative to the browser client area.
getClientY
public int getClientY()
- Returns:
- The mouse cursor y position
Returns the mouse position (y coordinate) when the click took place. The position is relative to the browser client area.
getRelativeX
public int getRelativeX()
- Returns:
- The mouse cursor x position relative to the clicked layout component or -1 if no x coordinate available
Returns the relative mouse position (x coordinate) when the click took place. The position is relative to the clicked component.
getRelativeY
public int getRelativeY()
- Returns:
- The mouse cursor y position relative to the clicked layout component or -1 if no y coordinate available
Returns the relative mouse position (y coordinate) when the click took place. The position is relative to the clicked component.
isDoubleClick
public boolean isDoubleClick()
- Returns:
- true if the event is a double click event, false otherwise
Checks if the event is a double click event.
isAltKey
public boolean isAltKey()
- Returns:
- true if Alt was down when the event occured, false otherwise
Checks if the Alt key was down when the mouse event took place.
isCtrlKey
public boolean isCtrlKey()
- Returns:
- true if Ctrl was pressed when the event occured, false otherwise
Checks if the Ctrl key was down when the mouse event took place.
isMetaKey
public boolean isMetaKey()
- Returns:
- true if Meta was pressed when the event occured, false otherwise
Checks if the Meta key was down when the mouse event took place.
isShiftKey
public boolean isShiftKey()
- Returns:
- true if Shift was pressed when the event occured, false otherwise
Checks if the Shift key was down when the mouse event took place.
getButtonName
public String getButtonName()
- Returns:
- A string representation of which button was pushed.
- Since:
- 6.3
Returns a human readable string representing which button has been
pushed. This is meant for debug purposes only and the string returned
could change. Use getButton()
to check which button was
pressed.