Package com.vaadin.event
Class MouseEvents.ClickEvent
- java.lang.Object
-
- java.util.EventObject
-
- com.vaadin.event.ConnectorEvent
-
- com.vaadin.ui.Component.Event
-
- com.vaadin.event.MouseEvents.ClickEvent
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AbstractSplitPanel.SplitterClickEvent,ClickableRenderer.RendererClickEvent,ContextClickEvent,ItemClickEvent,LayoutEvents.LayoutClickEvent,Table.FooterClickEvent,Table.HeaderClickEvent
- Enclosing interface:
- MouseEvents
public static class MouseEvents.ClickEvent extends Component.Event
Class for holding information about a mouse click event. AMouseEvents.ClickEventis fired when the user clicks on aComponent. The information available for click events are terminal dependent. Correct values for all event details cannot be guaranteed.- Since:
- 6.2
- Author:
- Vaadin Ltd.
- See Also:
MouseEvents.ClickListener, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static MouseEventDetails.MouseButtonBUTTON_LEFTDeprecated.As of 7.0, useButton#LEFTinstead.static MouseEventDetails.MouseButtonBUTTON_MIDDLEDeprecated.As of 7.0, useButton#MIDDLEinstead.static MouseEventDetails.MouseButtonBUTTON_RIGHTDeprecated.As of 7.0, useButton#RIGHTinstead.-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description ClickEvent(Component source, MouseEventDetails mouseEventDetails)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MouseEventDetails.MouseButtongetButton()Returns an identifier describing which mouse button the user pushed.StringgetButtonName()Returns a human readable string representing which button has been pushed.intgetClientX()Returns the mouse position (x coordinate) when the click took place.intgetClientY()Returns the mouse position (y coordinate) when the click took place.intgetRelativeX()Returns the relative mouse position (x coordinate) when the click took place.intgetRelativeY()Returns the relative mouse position (y coordinate) when the click took place.booleanisAltKey()Checks if the Alt key was down when the mouse event took place.booleanisCtrlKey()Checks if the Ctrl key was down when the mouse event took place.booleanisDoubleClick()Checks if the event is a double click event.booleanisMetaKey()Checks if the Meta key was down when the mouse event took place.booleanisShiftKey()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 com.vaadin.event.ConnectorEvent
getConnector
-
Methods inherited from class java.util.EventObject
getSource, toString
-
-
-
-
Field Detail
-
BUTTON_LEFT
@Deprecated public static final MouseEventDetails.MouseButton BUTTON_LEFT
Deprecated.As of 7.0, useButton#LEFTinstead.
-
BUTTON_MIDDLE
@Deprecated public static final MouseEventDetails.MouseButton BUTTON_MIDDLE
Deprecated.As of 7.0, useButton#MIDDLEinstead.
-
BUTTON_RIGHT
@Deprecated public static final MouseEventDetails.MouseButton BUTTON_RIGHT
Deprecated.As of 7.0, useButton#RIGHTinstead.
-
-
Constructor Detail
-
ClickEvent
public ClickEvent(Component source, MouseEventDetails mouseEventDetails)
-
-
Method Detail
-
getButton
public MouseEventDetails.MouseButton getButton()
Returns an identifier describing which mouse button the user pushed. Compare withMouseEventDetails.MouseButton.LEFT,MouseEventDetails.MouseButton.MIDDLE,Button#RIGHTto find out which button it is.
-
getClientX
public int getClientX()
Returns the mouse position (x coordinate) when the click took place. The position is relative to the browser client area.- Returns:
- The mouse cursor x position
-
getClientY
public int getClientY()
Returns the mouse position (y coordinate) when the click took place. The position is relative to the browser client area.- Returns:
- The mouse cursor y position
-
getRelativeX
public int getRelativeX()
Returns the relative mouse position (x coordinate) when the click took place. The position is relative to the clicked component.- Returns:
- The mouse cursor x position relative to the clicked layout component or -1 if no x coordinate available
-
getRelativeY
public int getRelativeY()
Returns the relative mouse position (y coordinate) when the click took place. The position is relative to the clicked component.- Returns:
- The mouse cursor y position relative to the clicked layout component or -1 if no y coordinate available
-
isDoubleClick
public boolean isDoubleClick()
Checks if the event is a double click event.- Returns:
- true if the event is a double click event, false otherwise
-
isAltKey
public boolean isAltKey()
Checks if the Alt key was down when the mouse event took place.- Returns:
- true if Alt was down when the event occured, false otherwise
-
isCtrlKey
public boolean isCtrlKey()
Checks if the Ctrl key was down when the mouse event took place.- Returns:
- true if Ctrl was pressed when the event occured, false otherwise
-
isMetaKey
public boolean isMetaKey()
Checks if the Meta key was down when the mouse event took place.- Returns:
- true if Meta was pressed when the event occured, false otherwise
-
isShiftKey
public boolean isShiftKey()
Checks if the Shift key was down when the mouse event took place.- Returns:
- true if Shift was pressed when the event occured, false otherwise
-
getButtonName
public String getButtonName()
Returns a human readable string representing which button has been pushed. This is meant for debug purposes only and the string returned could change. UsegetButton()to check which button was pressed.- Returns:
- A string representation of which button was pushed.
- Since:
- 6.3
-
-