Enum EventButton
- java.lang.Object
-
- java.lang.Enum<EventButton>
-
- org.pepstock.charba.client.dom.enums.EventButton
-
- All Implemented Interfaces:
Serializable
,Comparable<EventButton>
public enum EventButton extends Enum<EventButton>
Enumerates the property value of aNativeMouseEvent
to indicate which button was pressed on the mouse to trigger the event.
This property only guarantees to indicate which buttons are pressed during events caused by pressing or releasing one or multiple buttons.
As such, it is not reliable for events such asMouseEventType.MOUSE_ENTER
,MouseEventType.MOUSE_LEAVE
,MouseEventType.MOUSE_OVER
,MouseEventType.MOUSE_OUT
, orMouseEventType.MOUSE_MOVE
. It also manages which buttons are pressed on the mouse (or other input device) when a mouse event is triggered. Each button that can be pressed is represented by a given number (see below). If more than one button is pressed, the button values are added together to produce a new number. For example, if the secondary (2) and auxiliary (4) buttons are pressed simultaneously, the value is 6 (i.e., 2 + 4).- Author:
- Andrea "Stock" Stocchero
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AUXILIARY
The event is not being processed at this time.FIFTH
Fifth button, typically the Browser Forward button.FOURTH
Fourth button, typically the Browser Back button.MAIN
The event is not being processed at this time..SECONDARY
Secondary button pressed, usually the right button
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EventButton
mapToButton(int button)
Scans all items of enumeration to get the right button related to passed argument.
See NativeAstatic List<EventButton>
mapToButtons(int buttons)
Scans all items of enumeration to get the list of buttons related to passed argument.static int
parseToButtons(List<EventButton> buttons)
Returns thebuttons
value to use as it's managed in the DOM.static int
parseToButtons(EventButton... buttons)
Returns thebuttons
value to use as it's managed in the DOM.int
valueForButton()
Indicates which button was pressed on the mouse to trigger the event.int
valueForButtons()
Indicates which buttons are pressed on the mouse (or other input device) when a mouse event is triggered.static EventButton
valueOf(String name)
Returns the enum constant of this type with the specified name.static EventButton[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
MAIN
public static final EventButton MAIN
The event is not being processed at this time..
-
AUXILIARY
public static final EventButton AUXILIARY
The event is not being processed at this time.
-
SECONDARY
public static final EventButton SECONDARY
Secondary button pressed, usually the right button
-
FOURTH
public static final EventButton FOURTH
Fourth button, typically the Browser Back button.
-
FIFTH
public static final EventButton FIFTH
Fifth button, typically the Browser Forward button.
-
-
Method Detail
-
values
public static EventButton[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (EventButton c : EventButton.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static EventButton valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
valueForButton
public int valueForButton()
Indicates which button was pressed on the mouse to trigger the event.- Returns:
- indicates which button was pressed on the mouse to trigger the event.
-
valueForButtons
public int valueForButtons()
Indicates which buttons are pressed on the mouse (or other input device) when a mouse event is triggered.- Returns:
- Indicates which buttons are pressed on the mouse (or other input device) when a mouse event is triggered
-
mapToButton
public static final EventButton mapToButton(int button)
Scans all items of enumeration to get the right button related to passed argument.
See NativeA- Parameters:
button
- which button was pressed on the mouse to trigger the event- Returns:
- the related event button.
If not found, returns alwaysMAIN
.
-
mapToButtons
public static final List<EventButton> mapToButtons(int buttons)
Scans all items of enumeration to get the list of buttons related to passed argument.- Parameters:
buttons
- which button was pressed on the mouse to trigger the event- Returns:
- the related list of event buttons.
If not found, returns always an empty list.
-
parseToButtons
public static final int parseToButtons(List<EventButton> buttons)
Returns thebuttons
value to use as it's managed in the DOM.- Parameters:
buttons
- which button was pressed on the mouse to trigger the event- Returns:
- the number value which represents the DOM mouse event value
-
parseToButtons
public static final int parseToButtons(EventButton... buttons)
Returns thebuttons
value to use as it's managed in the DOM.- Parameters:
buttons
- which button was pressed on the mouse to trigger the event- Returns:
- the number value which represents the DOM mouse event value
-
-