public class MsgBlasterPeer extends java.lang.Object implements java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.WindowListener, WindowSizeMoveListener
Modifier and Type | Field and Description |
---|---|
private static int |
CUSTOM_WM_1
A custom event found in customer's code.
|
private int |
hWndTarget
The target window whose messages will be intercepted.
|
private long |
id
My id.
|
private java.util.Map<java.lang.Integer,java.lang.Integer> |
indexedMessages
The indexed list of messages.
|
private java.util.Map<java.lang.Integer,java.lang.Integer> |
indexedPass
The indexed list of passages.
|
private static java.util.Map<java.lang.Long,MsgBlasterPeer> |
instances
The registry of instances of this class.
|
static java.util.logging.Logger |
LOG
Logger
|
private java.util.Map<java.lang.Integer,java.lang.Integer> |
messages
The map of messages to their indexes.
|
private static int |
MK_CONTROL
The CTRL key is down.
|
private static int |
MK_LBUTTON
The left mouse button is down.
|
private static int |
MK_MBUTTON
The middle mouse button is down.
|
private static int |
MK_RBUTTON
The right mouse button is down.
|
private static int |
MK_SHIFT
The SHIFT key is down.
|
private static int |
SC_CONTEXTHELP
Context help pressed.
|
private static int |
SC_KEYMENU
Request to open window menu as with a keystroke
|
private int |
targetWinId
The id of target window.
|
private static int |
WA_ACTIVE
Window activated by some method other than a mouse click.
|
private static int |
WA_CLICKACTIVE
Window activated by a mouse click.
|
private static int |
WA_INACTIVE
Window deactivated.
|
private WidgetStateListener |
widgetStateListener
The widget state listener instance registered with the target widget
|
private static int |
WM_ACTIVATE
Sent to both the window being activated and the window being deactivated.
|
static int |
WM_EXITSIZEMOVE
Window move/size message.
|
private static int |
WM_LBUTTONDOWN
Left mouse button pressed event.
|
private static int |
WM_MENUCHAR
Sent when a menu is active and the user presses a key that does not correspond to any
mnemonic or accelerator key.
|
static int |
WM_MOUSEMOVE
Mouse moved event (regardless whether a mouse button is down = includes drag events).
|
static int |
WM_MOVE
Window move/size message.
|
private static int |
WM_RBUTTONDOWN
Right mouse button pressed event.
|
static int |
WM_SIZE
Window move/size message.
|
private static int |
WM_SYSCOMMAND
A command was chosen from the Windows menu or when the user chooses the maximize button,
minimize button, restore button, or close button.
|
Constructor and Description |
---|
MsgBlasterPeer() |
Modifier and Type | Method and Description |
---|---|
void |
addMessage(int index,
int message,
int pass)
Adds a new Windows message to be intercepted.
|
void |
clearMessages()
Clears all listening messages.
|
private static int |
convertModifiers(int modifiersEx)
Converts the modifiers from Java style to Win32 style.
|
static void |
dropInstance(long id)
Remove the
MsgBlasterPeer instance from the registry because its peer was destroyed
or inactivated. |
static MsgBlasterPeer |
getInstance(long id)
Obtain an instance with specified
id . |
int |
getTargetHwnd()
Obtain the id of the widget that this MessageBlaster is configured with.
|
private void |
install()
Installs the MsgBlaster instance with the target top level window and the target widget.
|
private void |
installTargetWindow()
Installs the MsgBlaster instance with the target top level window.
|
void |
keyPressed(java.awt.event.KeyEvent e) |
void |
keyReleased(java.awt.event.KeyEvent e) |
void |
keyTyped(java.awt.event.KeyEvent e) |
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e)
Intercepts mouse move events with a mouse button down on target window.
|
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e)
Intercepts mouse move events on target window.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Intercepts mouse click events on target window.
|
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
onWindowMoved(TopLevelWindow wnd)
Called when the supplied window is moved.
|
void |
onWindowResized(TopLevelWindow wnd)
Called when the supplied window is resized.
|
private int |
processCoordinates(java.awt.Point p)
Combines the coordinate of a mouse event in a single integer.
|
void |
setTargetHwnd(int hWndTarget)
Set the target widget.
|
private void |
uninstall()
Uninstalls msg blaster from its top level window and the target widget.
|
private void |
uninstallTargetWindow()
Uninstalls the MsgBlaster instance from the target top level window.
|
void |
windowActivated(java.awt.event.WindowEvent e) |
void |
windowClosed(java.awt.event.WindowEvent e) |
void |
windowClosing(java.awt.event.WindowEvent e) |
void |
windowDeactivated(java.awt.event.WindowEvent e) |
void |
windowDeiconified(java.awt.event.WindowEvent e) |
void |
windowIconified(java.awt.event.WindowEvent e) |
void |
windowOpened(java.awt.event.WindowEvent e) |
public static final java.util.logging.Logger LOG
public static final int WM_SIZE
More info on:
https://docs.microsoft.com/cs-cz/windows/win32/winmsg/wm-exitsizemove
public static final int WM_MOVE
More info on:
https://docs.microsoft.com/cs-cz/windows/win32/winmsg/wm-exitsizemove
public static final int WM_EXITSIZEMOVE
More info on:
https://docs.microsoft.com/cs-cz/windows/win32/winmsg/wm-exitsizemove
private static final int WM_ACTIVATE
More info on:
https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-activate
private static final int WM_SYSCOMMAND
More info on:
https://docs.microsoft.com/en-us/windows/desktop/menurc/wm-syscommand
private static final int WM_MENUCHAR
More info on:
https://docs.microsoft.com/en-us/windows/desktop/menurc/wm-menuchar
public static final int WM_MOUSEMOVE
More info on:
https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-mousemove
private static final int WM_LBUTTONDOWN
More info on:
https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-lbuttondown
private static final int WM_RBUTTONDOWN
More info on:
https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-rbuttondown
private static final int CUSTOM_WM_1
private static java.util.Map<java.lang.Long,MsgBlasterPeer> instances
private static final int MK_LBUTTON
private static final int MK_RBUTTON
private static final int MK_SHIFT
private static final int MK_CONTROL
private static final int MK_MBUTTON
private static final int SC_KEYMENU
private static final int SC_CONTEXTHELP
private static final int WA_INACTIVE
private static final int WA_ACTIVE
private static final int WA_CLICKACTIVE
private int hWndTarget
private int targetWinId
private long id
private final java.util.Map<java.lang.Integer,java.lang.Integer> indexedMessages
private final java.util.Map<java.lang.Integer,java.lang.Integer> indexedPass
private final java.util.Map<java.lang.Integer,java.lang.Integer> messages
private WidgetStateListener widgetStateListener
public static MsgBlasterPeer getInstance(long id)
id
. If it does not exist it is created and stored
before returning it.id
- The id of the MsgBlaster
public static void dropInstance(long id)
MsgBlasterPeer
instance from the registry because its peer was destroyed
or inactivated.id
- The id of the MsgBlasterPeer
to be removed.public void setTargetHwnd(int hWndTarget)
hWndTarget
- The hwnd of the target widget.public int getTargetHwnd()
public void addMessage(int index, int message, int pass)
message
- The id of the windows message to be intercepted.pass
- Passage mode. Possible values (extracted from comments in customer's code):
public void clearMessages()
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
MsgBlaster
.mousePressed
in interface java.awt.event.MouseListener
e
- The event that was generated by the mouse click gesture.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
MsgBlaster
.mouseDragged
in interface java.awt.event.MouseMotionListener
e
- The event that was generated by the mouse drag gesture.public void mouseMoved(java.awt.event.MouseEvent e)
MsgBlaster
.mouseMoved
in interface java.awt.event.MouseMotionListener
e
- The event that was generated by the mouse move gesture.public void windowOpened(java.awt.event.WindowEvent e)
windowOpened
in interface java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent e)
windowClosing
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent e)
windowClosed
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent e)
windowIconified
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent e)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent e)
windowActivated
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent e)
windowDeactivated
in interface java.awt.event.WindowListener
public void onWindowMoved(TopLevelWindow wnd)
onWindowMoved
in interface WindowSizeMoveListener
wnd
- The subjected window.public void onWindowResized(TopLevelWindow wnd)
onWindowResized
in interface WindowSizeMoveListener
wnd
- The subjected window.private int processCoordinates(java.awt.Point p)
p
- The point where the event took place.private void install()
private void uninstall()
private void installTargetWindow()
private void uninstallTargetWindow()
private static int convertModifiers(int modifiersEx)
modifiersEx
- The event modiers as capture by Java.