com.jniwrapper.win32.hook
Class EventsFilter

java.lang.Object
  extended bycom.jniwrapper.win32.hook.EventsFilter

public class EventsFilter
extends java.lang.Object

Provides the functionality for configuring and filtering hook events.


Nested Class Summary
static class EventsFilter.Range
          Defines range of events.
static class EventsFilter.WindowRecord
          Defines window events.
 
Field Summary
static int MAX_RANGES
           
static int MAX_WINDOWS
           
 
Constructor Summary
EventsFilter()
          Constructs a default events filter, does not listen to any window and events.
 
Method Summary
 EventsFilter addEvent(int eventID)
          Adds an individual event ID to this filer.
 EventsFilter addEvents(int[] eventIDs)
          Adds the set of individual event IDs to this filter.
 EventsFilter addEventsRange(int lowerBound, int upperBound)
          Adds the range of event IDs.
 EventsFilter addKeyboardEventsRange()
          Add the range of keyboard events [WM_KEYFIRST..WM_KEYLAST]
 EventsFilter addMouseEventsRange()
          Add the range of mouse events [WM_MOUSEFIRST..WM_MOUSELAST]
 EventsFilter addWindow(Wnd wnd)
          Add a window handle.
 EventsFilter addWindow(Wnd wnd, boolean listenAllChildWindows)
          Add a window handle.
 boolean getAllowAllWindows()
          Returns true if this filter is configured to allow events from all windows.
 java.util.List getRanges()
          Returns the list of spacified ranges.
 java.util.List getWindows()
          Returns the list of specified windows.
 boolean isAllowAllEvents()
          Returns true if this filter is configured to allow all events.
 EventsFilter removeAllEvents()
          Removes all previously added events from this filter.
 EventsFilter removeAllWindows()
          Removes all previously added windows from this filter.
 EventsFilter removeEvent(int eventID)
          Removes the specified event ID from this filer.
 EventsFilter removeEvents(int[] eventIDs)
          Removes the set of specified event IDs from this filer.
 EventsFilter removeEventsRange(int lowerBound, int upperBound)
          Removes the range of events from this filer.
 EventsFilter removeKeyboardEventsRange()
          Removes the range of keyboard events [WM_KEYFIRST..WM_KEYLAST]
 EventsFilter removeMouseEventsRange()
          Removes the range of mouse events [WM_MOUSEFIRST..WM_MOUSELAST]
 EventsFilter removeWindow(Wnd wnd)
          Removes a window handle from this filter.
 void setAllowAllEvents(boolean value)
          Specifies whether or not this filter allows all events.
 void setAllowAllWindows(boolean value)
          Specifies whether or not this filter allows events from all windows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_RANGES

public static final int MAX_RANGES
See Also:
Constant Field Values

MAX_WINDOWS

public static final int MAX_WINDOWS
See Also:
Constant Field Values
Constructor Detail

EventsFilter

public EventsFilter()
Constructs a default events filter, does not listen to any window and events.

Method Detail

addEvent

public EventsFilter addEvent(int eventID)
Adds an individual event ID to this filer.

Parameters:
eventID - specifies an individual event ID
Returns:
this filter

removeEvent

public EventsFilter removeEvent(int eventID)
Removes the specified event ID from this filer.

Parameters:
eventID - specifies an individual event ID to remove
Returns:
this filter

addEvents

public EventsFilter addEvents(int[] eventIDs)
Adds the set of individual event IDs to this filter.

Parameters:
eventIDs - array of event IDs
Returns:
this filter

removeEvents

public EventsFilter removeEvents(int[] eventIDs)
Removes the set of specified event IDs from this filer.

Parameters:
eventIDs - specifies the set of event IDs to remove
Returns:
this filter

addEventsRange

public EventsFilter addEventsRange(int lowerBound,
                                   int upperBound)
Adds the range of event IDs.

Parameters:
lowerBound - lower event ID value
upperBound - upper event ID value
Returns:
this filter

removeEventsRange

public EventsFilter removeEventsRange(int lowerBound,
                                      int upperBound)
Removes the range of events from this filer.

Parameters:
lowerBound - lower event ID value
upperBound - upper event ID value
Returns:
this filter

addKeyboardEventsRange

public EventsFilter addKeyboardEventsRange()
Add the range of keyboard events [WM_KEYFIRST..WM_KEYLAST]

Returns:
this filter

removeKeyboardEventsRange

public EventsFilter removeKeyboardEventsRange()
Removes the range of keyboard events [WM_KEYFIRST..WM_KEYLAST]

Returns:
this filter

addMouseEventsRange

public EventsFilter addMouseEventsRange()
Add the range of mouse events [WM_MOUSEFIRST..WM_MOUSELAST]

Returns:
this filter

removeMouseEventsRange

public EventsFilter removeMouseEventsRange()
Removes the range of mouse events [WM_MOUSEFIRST..WM_MOUSELAST]

Returns:
this filter

addWindow

public EventsFilter addWindow(Wnd wnd)
Add a window handle.

Parameters:
wnd - specifies a window handle to add
Returns:
this filter

addWindow

public EventsFilter addWindow(Wnd wnd,
                              boolean listenAllChildWindows)
Add a window handle.

Parameters:
wnd - specifies a window handle
listenAllChildWindows - specifies whether or not filter should include all child windows as well
Returns:
this filter

removeWindow

public EventsFilter removeWindow(Wnd wnd)
Removes a window handle from this filter.

Parameters:
wnd - specifies a window handle to remove
Returns:
this filter

getRanges

public java.util.List getRanges()
Returns the list of spacified ranges.

Returns:
list of EventsFilter.Range objects

getWindows

public java.util.List getWindows()
Returns the list of specified windows.

Returns:
list of EventsFilter.WindowRecord objects

setAllowAllWindows

public void setAllowAllWindows(boolean value)
Specifies whether or not this filter allows events from all windows.

Parameters:
value - if true filter allows events from all windows; otherwise - events from all windows are being suppressed.

getAllowAllWindows

public boolean getAllowAllWindows()
Returns true if this filter is configured to allow events from all windows.

Returns:
true if this filter is configured to allow events from all windows, false otherwise

setAllowAllEvents

public void setAllowAllEvents(boolean value)
Specifies whether or not this filter allows all events.

Parameters:
value - if true filter allows all events; otherwise - all events are being suppressed.

isAllowAllEvents

public boolean isAllowAllEvents()
Returns true if this filter is configured to allow all events.

Returns:
true if this filter is configured to allow all events, false otherwise

removeAllWindows

public EventsFilter removeAllWindows()
Removes all previously added windows from this filter.

Returns:
this events filter

removeAllEvents

public EventsFilter removeAllEvents()
Removes all previously added events from this filter.

Returns:
this events filter