Class MouseEventInit
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.dom.events.EventInit
-
- org.pepstock.charba.client.dom.events.MouseEventInit
-
- Direct Known Subclasses:
PointerEventInit
public class MouseEventInit extends EventInit
Initialization object for aNativeMouseEvent
.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Constructor Description MouseEventInit()
Creates an empty objectMouseEventInit(double clientX, double clientY)
Creates an initialization object, setting the clientX and clientY values.MouseEventInit(double clientX, double clientY, double screenX, double screenY)
Creates an initialization object, setting the clientX, clientY, screenX and screenY values.MouseEventInit(NativeMouseEvent source)
Creates an initialization object, cloning all source event dataMouseEventInit(NativeMouseEvent source, BaseHtmlElement relatedTarget)
Creates an initialization object, cloning all source event data and new related target.
-
Method Summary
All Methods Instance Methods Concrete Methods Default Methods Modifier and Type Method Description EventButton
getButton()
Returns aEventButton
that describes which button is pressed during events related to the press or release of a button.List<EventButton>
getButtons()
Returns a list ofEventButton
that describes which buttons are pressed when the event is launched.double
getClientX()
Returns the horizontal position of the mouse event on the client window of user's screen; setting this value doesn't move the mouse pointer.double
getClientY()
Returns the vertical position of the mouse event on the client window of the user's screen; setting this value doesn't move the mouse pointer.int
getDetail()
When non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero.org.pepstock.charba.client.dom.events.ModifiersHandler
getModifiersHandler()
BaseEventTarget
getRelatedTarget()
Returns anBaseHtmlElement
, defaulting to null that is the element just left (in case of aMouseEventType.MOUSE_ENTER
orMouseEventType.MOUSE_OVER
) or is entering (in case of aMouseEventType.MOUSE_OUT
orMouseEventType.MOUSE_LEAVE
).double
getScreenX()
Returns the X coordinate of the mouse pointer in global (screen) coordinates.double
getScreenY()
Returns the Y coordinate of the mouse pointer in global (screen) coordinates.default boolean
isAltKey()
Returns true if the alt key was down when the mouse event was fired.default boolean
isCtrlKey()
Returns true if the control key was down when the mouse event was fired.default boolean
isMetaKey()
Returns true if the meta key was down when the mouse event was fired.default boolean
isShiftKey()
Returns true if the shift key was down when the mouse event was fired.default void
setAltKey(boolean alt)
Sets true if the alt key was down when the mouse event was fired.void
setButton(EventButton button)
Sets aEventButton
that describes which button is pressed during events related to the press or release of a button.void
setButtons(List<EventButton> buttons)
Sets a list ofEventButton
that describes which buttons are pressed when the event is launched.void
setButtons(EventButton... buttons)
Sets an array ofEventButton
that describes which buttons are pressed when the event is launched.void
setClientX(double clientX)
Sets the horizontal position of the mouse event on the client window of user's screen; setting this value doesn't move the mouse pointer.void
setClientY(double clientY)
Sets the vertical position of the mouse event on the client window of the user's screen; setting this value doesn't move the mouse pointer.default void
setCtrlKey(boolean ctrl)
Sets true if the control key was down when the mouse event was fired.void
setDetail(int detail)
Sets non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zerodefault void
setMetaKey(boolean meta)
Sets true if the meta key was down when the mouse event was fired.void
setRelatedTarget(BaseEventTarget relatedTarget)
Sets anBaseHtmlElement
, defaulting to null that is the element just left (in case of aMouseEventType.MOUSE_ENTER
orMouseEventType.MOUSE_OVER
) or is entering (in case of aMouseEventType.MOUSE_OUT
orMouseEventType.MOUSE_LEAVE
).void
setScreenX(double screenX)
Sets the X coordinate of the mouse pointer in global (screen) coordinates.void
setScreenY(double screenY)
Sets the Y coordinate of the mouse pointer in global (screen) coordinates.default void
setShiftKey(boolean shift)
Sets true if the shift key was down when the mouse event was fired.-
Methods inherited from class org.pepstock.charba.client.dom.events.EventInit
isBubbles, isCancelable, setBubbles, setCancelable
-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Constructor Detail
-
MouseEventInit
public MouseEventInit()
Creates an empty object
-
MouseEventInit
public MouseEventInit(double clientX, double clientY)
Creates an initialization object, setting the clientX and clientY values.- Parameters:
clientX
- clientX initialization property.clientY
- clientY initialization property.
-
MouseEventInit
public MouseEventInit(double clientX, double clientY, double screenX, double screenY)
Creates an initialization object, setting the clientX, clientY, screenX and screenY values.- Parameters:
clientX
- clientX initialization property.clientY
- clientY initialization property.screenX
- screenX initialization property.screenY
- screenY initialization property.
-
MouseEventInit
public MouseEventInit(NativeMouseEvent source)
Creates an initialization object, cloning all source event data- Parameters:
source
- source event to clone.
-
MouseEventInit
public MouseEventInit(NativeMouseEvent source, BaseHtmlElement relatedTarget)
Creates an initialization object, cloning all source event data and new related target.- Parameters:
source
- source event to clone.relatedTarget
- new target of the event
-
-
Method Detail
-
getModifiersHandler
public final org.pepstock.charba.client.dom.events.ModifiersHandler getModifiersHandler()
-
getButton
public final EventButton getButton()
Returns aEventButton
that describes which button is pressed during events related to the press or release of a button.- Returns:
- a
EventButton
that describes which button is pressed during events related to the press or release of a button
-
setButton
public final void setButton(EventButton button)
Sets aEventButton
that describes which button is pressed during events related to the press or release of a button.- Parameters:
button
- aEventButton
that describes which button is pressed during events related to the press or release of a button
-
getButtons
public final List<EventButton> getButtons()
Returns a list ofEventButton
that describes which buttons are pressed when the event is launched.- Returns:
- a list of
EventButton
that describes which buttons are pressed when the event is launched
-
setButtons
public final void setButtons(EventButton... buttons)
Sets an array ofEventButton
that describes which buttons are pressed when the event is launched.- Parameters:
buttons
- an array ofEventButton
that describes which buttons are pressed when the event is launched
-
setButtons
public final void setButtons(List<EventButton> buttons)
Sets a list ofEventButton
that describes which buttons are pressed when the event is launched.- Parameters:
buttons
- a list ofEventButton
that describes which buttons are pressed when the event is launched
-
getClientX
public final double getClientX()
Returns the horizontal position of the mouse event on the client window of user's screen; setting this value doesn't move the mouse pointer.- Returns:
- the horizontal position of the mouse event on the client window of user's screen
-
setClientX
public final void setClientX(double clientX)
Sets the horizontal position of the mouse event on the client window of user's screen; setting this value doesn't move the mouse pointer.- Parameters:
clientX
- the horizontal position of the mouse event on the client window of user's screen
-
getClientY
public final double getClientY()
Returns the vertical position of the mouse event on the client window of the user's screen; setting this value doesn't move the mouse pointer.- Returns:
- the vertical position of the mouse event on the client window of the user's screen
-
setClientY
public final void setClientY(double clientY)
Sets the vertical position of the mouse event on the client window of the user's screen; setting this value doesn't move the mouse pointer.- Parameters:
clientY
- the vertical position of the mouse event on the client window of the user's screen
-
getRelatedTarget
public final BaseEventTarget getRelatedTarget()
Returns anBaseHtmlElement
, defaulting to null that is the element just left (in case of aMouseEventType.MOUSE_ENTER
orMouseEventType.MOUSE_OVER
) or is entering (in case of aMouseEventType.MOUSE_OUT
orMouseEventType.MOUSE_LEAVE
).- Returns:
- an
BaseHtmlElement
, defaulting to null that is the element just left (in case of aMouseEventType.MOUSE_ENTER
orMouseEventType.MOUSE_OVER
) or is entering (in case of aMouseEventType.MOUSE_OUT
orMouseEventType.MOUSE_LEAVE
)
-
setRelatedTarget
public final void setRelatedTarget(BaseEventTarget relatedTarget)
Sets anBaseHtmlElement
, defaulting to null that is the element just left (in case of aMouseEventType.MOUSE_ENTER
orMouseEventType.MOUSE_OVER
) or is entering (in case of aMouseEventType.MOUSE_OUT
orMouseEventType.MOUSE_LEAVE
).- Parameters:
relatedTarget
- anBaseHtmlElement
, defaulting to null that is the element just left (in case of aMouseEventType.MOUSE_ENTER
orMouseEventType.MOUSE_OVER
) or is entering (in case of aMouseEventType.MOUSE_OUT
orMouseEventType.MOUSE_LEAVE
)
-
getScreenX
public final double getScreenX()
Returns the X coordinate of the mouse pointer in global (screen) coordinates.- Returns:
- the X coordinate of the mouse pointer in global (screen) coordinates
-
setScreenX
public final void setScreenX(double screenX)
Sets the X coordinate of the mouse pointer in global (screen) coordinates.- Parameters:
screenX
- the X coordinate of the mouse pointer in global (screen) coordinates
-
getScreenY
public final double getScreenY()
Returns the Y coordinate of the mouse pointer in global (screen) coordinates.- Returns:
- the Y coordinate of the mouse pointer in global (screen) coordinates
-
setScreenY
public final void setScreenY(double screenY)
Sets the Y coordinate of the mouse pointer in global (screen) coordinates.- Parameters:
screenY
- the Y coordinate of the mouse pointer in global (screen) coordinates
-
isAltKey
public default boolean isAltKey()
Returns true if the alt key was down when the mouse event was fired.- Returns:
- true if the alt key was down when the mouse event was fired
-
setAltKey
public default void setAltKey(boolean alt)
Sets true if the alt key was down when the mouse event was fired.- Parameters:
alt
- true if the alt key was down when the mouse event was fired
-
isCtrlKey
public default boolean isCtrlKey()
Returns true if the control key was down when the mouse event was fired.- Returns:
- true if the control key was down when the mouse event was fired
-
setCtrlKey
public default void setCtrlKey(boolean ctrl)
Sets true if the control key was down when the mouse event was fired.- Parameters:
ctrl
- true if the control key was down when the mouse event was fired
-
isMetaKey
public default boolean isMetaKey()
Returns true if the meta key was down when the mouse event was fired.- Returns:
- true if the meta key was down when the mouse event was fired
-
setMetaKey
public default void setMetaKey(boolean meta)
Sets true if the meta key was down when the mouse event was fired.- Parameters:
meta
- true if the meta key was down when the mouse event was fired
-
isShiftKey
public default boolean isShiftKey()
Returns true if the shift key was down when the mouse event was fired.- Returns:
- true if the shift key was down when the mouse event was fired
-
setShiftKey
public default void setShiftKey(boolean shift)
Sets true if the shift key was down when the mouse event was fired.- Parameters:
shift
- true if the shift key was down when the mouse event was fired
-
getDetail
public final int getDetail()
When non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero.- Returns:
- When non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero
-
setDetail
public final void setDetail(int detail)
Sets non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero- Parameters:
detail
- non-zero, provides the current (or next, depending on the event) click count.
For click events, is the current click count.
For mousedown or mouseup events, is 1 plus the current click count.
For all other, is always zero
-
-