com.alee.managers.hotkey
Class HotkeyData

java.lang.Object
  extended by com.alee.managers.hotkey.HotkeyData
All Implemented Interfaces:
java.io.Serializable

public class HotkeyData
extends java.lang.Object
implements java.io.Serializable

Single hotkey settings description class.

Author:
Mikle Garin
See Also:
Serialized Form

Constructor Summary
HotkeyData()
          Constructs empty hotkey data.
HotkeyData(boolean isCtrl, boolean isAlt, boolean isShift, java.lang.Integer keyCode)
          Constructs hotkey using specified modifiers and key code.
HotkeyData(java.lang.Integer keyCode)
          Constructs hotkey using specified key code without any modifiers.
HotkeyData(java.awt.event.KeyEvent keyEvent)
          Constructs hotkey using the specified KeyEvent.
HotkeyData(javax.swing.KeyStroke keyStroke)
          Constructs hotkey using the specified key stroke.
 
Method Summary
 boolean areControlsTriggered(java.awt.event.KeyEvent event)
          Returns whether hotkey controls are triggered by the key event or not.
 boolean equals(java.lang.Object obj)
          Indicates whether other hotkey is equal to this one.
 java.lang.Integer getKeyCode()
          Returns key code required for the hotkey activation.
 javax.swing.KeyStroke getKeyStroke()
          Returns key stroke for this hotkey.
 int getModifiers()
          Returns hotkey modifiers.
 int hashCode()
          Returns hotkey hash code.
 boolean isAlt()
          Returns whether hotkey activation requires ALT modifier or not.
 boolean isCtrl()
          Returns whether hotkey activation requires CTRL modifier or not.
 boolean isHotkeySet()
          Returns whether key code is set or not.
 boolean isKeyTriggered(java.awt.event.KeyEvent event)
          Returns whether key is triggered by the key event or not.
 boolean isShift()
          Returns whether hotkey activation requires SHIFT modifier or not.
 boolean isTriggered(java.awt.event.KeyEvent event)
          Returns whether hotkey is triggered by the key event or not.
 void setAlt(boolean alt)
          Sets whether hotkey activation should require ALT modifier or not.
 void setCtrl(boolean ctrl)
          Sets whether hotkey activation should require CTRL modifier or not.
 void setKeyCode(java.lang.Integer keyCode)
          Sets key code required for the hotkey activation.
 void setModifiers(int modifiers)
          Sets hotkey modifiers.
 void setShift(boolean shift)
          Sets whether hotkey activation should require SHIFT modifier or not.
 java.lang.String toString()
          Returns hotkey text representation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HotkeyData

public HotkeyData()
Constructs empty hotkey data.


HotkeyData

public HotkeyData(java.awt.event.KeyEvent keyEvent)
Constructs hotkey using the specified KeyEvent.

Parameters:
keyEvent - KeyEvent to convert

HotkeyData

public HotkeyData(java.lang.Integer keyCode)
Constructs hotkey using specified key code without any modifiers.

Parameters:
keyCode - key code required for the hotkey activation

HotkeyData

public HotkeyData(boolean isCtrl,
                  boolean isAlt,
                  boolean isShift,
                  java.lang.Integer keyCode)
Constructs hotkey using specified modifiers and key code.

Parameters:
isCtrl - whether hotkey activation requires CTRL modifier or not
isAlt - whether hotkey activation requires ALT modifier or not
isShift - whether hotkey activation requires SHIFT modifier or not
keyCode - key code required for the hotkey activation

HotkeyData

public HotkeyData(javax.swing.KeyStroke keyStroke)
Constructs hotkey using the specified key stroke.

Parameters:
keyStroke - key stroke
Method Detail

isCtrl

public boolean isCtrl()
Returns whether hotkey activation requires CTRL modifier or not.

Returns:
true if hotkey activation requires CTRL modifier, false otherwise

setCtrl

public void setCtrl(boolean ctrl)
Sets whether hotkey activation should require CTRL modifier or not.

Parameters:
ctrl - whether hotkey activation should require CTRL modifier or not

isAlt

public boolean isAlt()
Returns whether hotkey activation requires ALT modifier or not.

Returns:
true if hotkey activation requires ALT modifier, false otherwise

setAlt

public void setAlt(boolean alt)
Sets whether hotkey activation should require ALT modifier or not.

Parameters:
alt - whether hotkey activation should require ALT modifier or not

isShift

public boolean isShift()
Returns whether hotkey activation requires SHIFT modifier or not.

Returns:
true if hotkey activation requires SHIFT modifier, false otherwise

setShift

public void setShift(boolean shift)
Sets whether hotkey activation should require SHIFT modifier or not.

Parameters:
shift - whether hotkey activation should require SHIFT modifier or not

getKeyCode

public java.lang.Integer getKeyCode()
Returns key code required for the hotkey activation.

Returns:
key code required for the hotkey activation

setKeyCode

public void setKeyCode(java.lang.Integer keyCode)
Sets key code required for the hotkey activation.

Parameters:
keyCode - key code required for the hotkey activation

isHotkeySet

public boolean isHotkeySet()
Returns whether key code is set or not.

Returns:
true if key code is set, false otherwise

isTriggered

public boolean isTriggered(java.awt.event.KeyEvent event)
Returns whether hotkey is triggered by the key event or not.

Parameters:
event - processed key event
Returns:
true if hotkey is triggered by the key event, false otherwise

areControlsTriggered

public boolean areControlsTriggered(java.awt.event.KeyEvent event)
Returns whether hotkey controls are triggered by the key event or not.

Parameters:
event - processed key event
Returns:
true if hotkey controls are triggered by the key event, false otherwise

isKeyTriggered

public boolean isKeyTriggered(java.awt.event.KeyEvent event)
Returns whether key is triggered by the key event or not.

Parameters:
event - processed key event
Returns:
true if key is triggered by the key event, false otherwise

getKeyStroke

public javax.swing.KeyStroke getKeyStroke()
Returns key stroke for this hotkey.

Returns:
key stroke for this hotkey

getModifiers

public int getModifiers()
Returns hotkey modifiers.

Returns:
hotkey modifiers

setModifiers

public void setModifiers(int modifiers)
Sets hotkey modifiers.

Parameters:
modifiers -

equals

public boolean equals(java.lang.Object obj)
Indicates whether other hotkey is equal to this one.

Overrides:
equals in class java.lang.Object
Parameters:
obj - other hotkey
Returns:
true if other hotkey is equal to this one, false otherwise

toString

public java.lang.String toString()
Returns hotkey text representation.

Overrides:
toString in class java.lang.Object
Returns:
hotkey text representation

hashCode

public int hashCode()
Returns hotkey hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
hotkey hash code