From: Timothy W. <tw...@us...> - 2015-02-26 10:51:39
|
Forwarding to the abbot-users list > Begin forwarded message: > > Date: February 26, 2015 at 3:39:41 AM EST > From: mir...@us... > Subject: Abbot Framework Contributions > To: tw...@us... > Reply-To: mir...@us... > > REPLY at http://sourceforge.net/u/miroslav-a/profile/send_message <http://sourceforge.net/u/miroslav-a/profile/send_message> > Hello, dear mr.Wall. > > Thank you very much for the Abbot Framework, it is a very handy thing. > > My user experience suggests that default recorder method actionKeyString() is not convenient for the following two reasons: > 1) it is sensitive to the keyboard layout at the time of script execution (it is a perceptibly trouble for not English users); > 2) it works not fast and visibly extends the testing execution time. > > So I replaced actionKeyString() to call my custom method contains just JTextComponent.setText(). > Then for convenience I added it to my Robot.java and my ComponentTester.java. > > If you think that it is acceptable practice, then you or I could add the similar code to Abbot Project: > > 1) abbot/tester/ComponentTester.java > > /** Directly set the given text to the given component. > * Used for rapid repeat the same actions. > * Also that method not depends on the keyboard layout > * unlike {@link #actionKeyString(Component, String)} > */ > public void actionSetText(Component c, String string) { > actionFocus(c); > setText(string); > waitForIdle(); > } > 2) abbot/tester/Robot.java > > import javax.swing.text.JTextComponent; > > (...) > > /** Directly sets the given string. */ > public void setText(String str) { > Component focus = findFocusOwner(); > if (focus == null) { > Log.warn("No component has focus, setText discarded", > Log.FULL_STACK); > return; > } > try { > ((JTextComponent) focus).setText(str); > } catch (Exception e) { > Log.warn("Component can not be cast to JTextComponent", > Log.FULL_STACK); > } > } > Thank you very much for Abbot. > > This message was sent to you via the SourceForge web mail form. > Replying to this email will not work, please send a message to Miroslav at http://sourceforge.net/u/miroslav-a/profile/send_message <http://sourceforge.net/u/miroslav-a/profile/send_message> |