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 |
|---|---|
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 CentralLogger |
LOG
Logger
|
private java.util.Map<java.lang.Integer,java.lang.Integer> |
messages
The map of messages to their indexes.
|
static int |
MK_CONTROL
The CTRL key is down.
|
static int |
MK_LBUTTON
The left mouse button is down.
|
static int |
MK_MBUTTON
The middle mouse button is down.
|
static int |
MK_RBUTTON
The right mouse button is down.
|
static int |
MK_SHIFT
The SHIFT key is down.
|
static int |
SC_CONTEXTHELP
Context help pressed.
|
static int |
SC_KEYMENU
Request to open window menu as with a keystroke
|
private int |
targetWinId
The id of target window.
|
static int |
WA_ACTIVE
Window activated by some method other than a mouse click.
|
static int |
WA_CLICKACTIVE
Window activated by a mouse click.
|
static int |
WA_INACTIVE
Window deactivated.
|
private WidgetStateListener |
widgetStateListener
The widget state listener instance registered with the target widget
|
static int |
WM_ACTIVATE
Sent to both the window being activated and the window being deactivated.
|
static int |
WM_EXITSIZEMOVE
Window move/size message.
|
static int |
WM_LBUTTONDOWN
Left mouse button pressed event.
|
static int |
WM_LBUTTONUP
Left mouse button released event.
|
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.
|
static int |
WM_RBUTTONDOWN
Right mouse button pressed event.
|
static int |
WM_RBUTTONUP
Right mouse button released event.
|
static int |
WM_SIZE
Window move/size message.
|
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 CentralLogger 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
public static final int WM_ACTIVATE
More info on:
https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-activate
public static final int WM_SYSCOMMAND
More info on:
https://docs.microsoft.com/en-us/windows/desktop/menurc/wm-syscommand
public 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
public static final int WM_LBUTTONDOWN
More info on:
https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-lbuttondown
public static final int WM_LBUTTONUP
More info on:
https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-lbuttonup
public static final int WM_RBUTTONDOWN
More info on:
https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-rbuttondown
public static final int WM_RBUTTONUP
More info on:
https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-rbuttonup
public static final int CUSTOM_WM_1
public static final int MK_LBUTTON
public static final int MK_RBUTTON
public static final int MK_SHIFT
public static final int MK_CONTROL
public static final int MK_MBUTTON
public static final int SC_KEYMENU
public static final int SC_CONTEXTHELP
public static final int WA_INACTIVE
public static final int WA_ACTIVE
public static final int WA_CLICKACTIVE
private static java.util.Map<java.lang.Long,MsgBlasterPeer> instances
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 MsgBlasterpublic 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.KeyListenerpublic void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
MsgBlaster.mousePressed in interface java.awt.event.MouseListenere - The event that was generated by the mouse click gesture.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
MsgBlaster.mouseDragged in interface java.awt.event.MouseMotionListenere - 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.MouseMotionListenere - The event that was generated by the mouse move gesture.public void windowOpened(java.awt.event.WindowEvent e)
windowOpened in interface java.awt.event.WindowListenerpublic void windowClosing(java.awt.event.WindowEvent e)
windowClosing in interface java.awt.event.WindowListenerpublic void windowClosed(java.awt.event.WindowEvent e)
windowClosed in interface java.awt.event.WindowListenerpublic void windowIconified(java.awt.event.WindowEvent e)
windowIconified in interface java.awt.event.WindowListenerpublic void windowDeiconified(java.awt.event.WindowEvent e)
windowDeiconified in interface java.awt.event.WindowListenerpublic void windowActivated(java.awt.event.WindowEvent e)
windowActivated in interface java.awt.event.WindowListenerpublic void windowDeactivated(java.awt.event.WindowEvent e)
windowDeactivated in interface java.awt.event.WindowListenerpublic void onWindowMoved(TopLevelWindow wnd)
onWindowMoved in interface WindowSizeMoveListenerwnd - The subjected window.public void onWindowResized(TopLevelWindow wnd)
onWindowResized in interface WindowSizeMoveListenerwnd - 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.