capitol
New member
Hi
I have now done some real development instead of just cosmetic changes to the code
Here is a patch that improves the way that focus is handled on the tabbed chat, it moves focus to the input box every time that the window gains focus.
This makes it possible to tab to the chat and start typing directly, even if you somehow managed to move away focus from the input field when you tabbed away (something that I manage to do way to frequently).
I have also added a unit test for the StateListener, I noticed that there wasn't any unit tests to begin with, so I took the liberty to add some infrastructure in the build file for running them. What's also needed is to place the junit ( https://github.com/downloads/KentBeck/junit/junit4.10.zip ) and mockito ( http://code.google.com/p/mockito/downloads/detail?name=mockito-1.9.5-rc1.zip ) jars in a folder called util/test/ as these ain't included in the patch.
The reason i opted to place the ChatWindowStateListener as a public class instead of as an internal private one was to be able to easily write tests for it, the style otherwise seems to be to place such classes as private internal ones, but that makes them hard to test.
the patch: http://frikod.se/~capitol/chatFocus.patch
and the commit on github: https://github.com/alexanderkjall/kolmafia/commit/7b3683f3c712c368d56975586fceff1a9cd44eaf
best regards
Alexander Kjäll
I have now done some real development instead of just cosmetic changes to the code

Here is a patch that improves the way that focus is handled on the tabbed chat, it moves focus to the input box every time that the window gains focus.
This makes it possible to tab to the chat and start typing directly, even if you somehow managed to move away focus from the input field when you tabbed away (something that I manage to do way to frequently).
I have also added a unit test for the StateListener, I noticed that there wasn't any unit tests to begin with, so I took the liberty to add some infrastructure in the build file for running them. What's also needed is to place the junit ( https://github.com/downloads/KentBeck/junit/junit4.10.zip ) and mockito ( http://code.google.com/p/mockito/downloads/detail?name=mockito-1.9.5-rc1.zip ) jars in a folder called util/test/ as these ain't included in the patch.
The reason i opted to place the ChatWindowStateListener as a public class instead of as an internal private one was to be able to easily write tests for it, the style otherwise seems to be to place such classes as private internal ones, but that makes them hard to test.
the patch: http://frikod.se/~capitol/chatFocus.patch
and the commit on github: https://github.com/alexanderkjall/kolmafia/commit/7b3683f3c712c368d56975586fceff1a9cd44eaf
best regards
Alexander Kjäll