|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.mtp.gui.WindowWatcher
Class that begins observing Window events as soon as it is created. Allows developer to retrieve windows and also control which will be observed.
| Field Summary | |
static long |
DEFAULT_WAIT_TIMEOUT
Default timeout for waitTillWindowPresent(), waitTillWindowNotPresent() and other future wait functions. |
protected boolean |
filterAllWindows
Whether to ignore all incoming windows. |
protected HashMap |
filteredHashCodes
Ignore Window's with these hash codes. |
protected HashMap |
filteredNames
Ignore Window's with these names. |
protected Integer |
id
Next index to be used. |
protected boolean |
removeWindows
Whether to remove Window's when removeWindow() is called. |
protected long |
waitTimeout
Time in milliseconds for wait functions. |
protected HashMap |
windows
HashMap of Window to Integer. |
| Constructor Summary | |
WindowWatcher()
Default constructor. |
|
| Method Summary | |
protected void |
addWindow(Window w)
Hashes given Window at current id and increments current id by 1. |
protected void |
clearWindows()
Clears windows HashMap with synchronization. |
boolean |
containsWindow(int id)
Returns true if given Window id is being watched. |
boolean |
containsWindow(Window w)
Returns true if given Window is being watched. |
HashMap |
copyWindows()
Returns a new copy of the windows HashMap. |
void |
disconnect(boolean dispose)
Removes as listener for window events and dispose()'s all windows if requested. |
void |
disposeWindows()
Call dispose() on all windows then clear the HashMap. |
void |
eventDispatched(AWTEvent e)
Update 'windows' based on WindowEvent. |
protected boolean |
filtered(Window w)
Returns true if given Window should not be watched. |
void |
filterWindow(int hashCode)
Filter Window's with this hash code. |
void |
filterWindow(String name)
Don't let Window's with this name be added. |
boolean |
getFilterAllWindows()
|
boolean |
getRemoveWindows()
Return whether Window's are removed from our map as they disappear. |
Window |
getWindowByID(int id)
Returns Window with given id or null if it's not present. |
Window |
getWindowByName(String name)
Return Window with given name or null if none exists. |
Window |
getWindowByTitle(String title)
Return Window with given title or null if none exists. |
int |
getWindowCount()
Returns number of windows being watched. |
int |
getWindowID(Window w)
Returns id of given Window and throws NoSuchElementException if not found. |
Collection |
getWindows()
Returns a new collection of the Window's being watched. |
protected void |
removeFilteredWindows()
Go through all Window's and remove any that are filtered. |
protected void |
removeWindow(Window w)
Remove given window. |
void |
setFilterAllWindows(boolean b)
If true, ignore all new windows that appear. |
void |
setRemoveWindows(boolean whether)
Set whether Window's should be removed from our map as they disappear. |
void |
setWaitTimeout(long time)
Set the amount of time to before a waitTillSomething() command fails. |
void |
updateUIs()
Tells all windows I'm watching to update their UI. |
void |
waitTillWindowNotPresent(Window w)
Uses waitTimeout varaible as timeout. |
void |
waitTillWindowNotPresent(Window w,
long timeout)
This method returns after the given Window has been closed or the timeout is reached. |
void |
waitTillWindowPresent(Window w)
Uses waitTimeout varaible as timeout. |
void |
waitTillWindowPresent(Window w,
long timeout)
This method returns after the given Window has been added or the timeout is reached. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static long DEFAULT_WAIT_TIMEOUT
protected Integer id
protected HashMap windows
protected HashMap filteredNames
protected HashMap filteredHashCodes
protected volatile long waitTimeout
protected volatile boolean filterAllWindows
protected volatile boolean removeWindows
| Constructor Detail |
public WindowWatcher()
| Method Detail |
public Collection getWindows()
public void setWaitTimeout(long time)
public void setRemoveWindows(boolean whether)
public boolean getRemoveWindows()
public void setFilterAllWindows(boolean b)
public boolean getFilterAllWindows()
public void updateUIs()
public int getWindowCount()
public HashMap copyWindows()
protected void clearWindows()
public void disposeWindows()
public void disconnect(boolean dispose)
public Window getWindowByName(String name)
public Window getWindowByTitle(String title)
public int getWindowID(Window w)
public Window getWindowByID(int id)
public void waitTillWindowPresent(Window w)
throws InterruptedException,
TimeLimitExceededException
InterruptedException
TimeLimitExceededException
public void waitTillWindowNotPresent(Window w)
throws InterruptedException,
TimeLimitExceededException
InterruptedException
TimeLimitExceededException
public void waitTillWindowPresent(Window w,
long timeout)
throws InterruptedException,
TimeLimitExceededException
InterruptedException
TimeLimitExceededException
public void waitTillWindowNotPresent(Window w,
long timeout)
throws InterruptedException,
TimeLimitExceededException
InterruptedException
TimeLimitExceededExceptionpublic boolean containsWindow(Window w)
public boolean containsWindow(int id)
protected boolean filtered(Window w)
public void filterWindow(String name)
public void filterWindow(int hashCode)
protected void removeFilteredWindows()
protected void addWindow(Window w)
protected void removeWindow(Window w)
public void eventDispatched(AWTEvent e)
eventDispatched in interface AWTEventListener
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||