org.eclipse.swtbot.swt.finder.keyboard
Class KeyboardFactory

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory

public class KeyboardFactory
extends Object

Creates a keyboard using the specified strategy.

Version:
$Id$
Author:
Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>

Constructor Summary
KeyboardFactory(Class<?> strategyClass)
           
KeyboardFactory(String strategyClass)
           
 
Method Summary
static Keyboard getAWTKeyboard()
          Creates a keyboard that uses AWT Robot to press keys.
static Keyboard getDefaultKeyboard(Widget widget, SelfDescribing description)
           
static Keyboard getMockKeyboard(Widget widget, SelfDescribing description)
          Creates a keyboard that creates mock events directly pumped to the widget.
static Keyboard getSWTKeyboard()
          Creates a keyboard that uses Display.post(Event) to press keys.
 Keyboard keyboard(Widget widget, SelfDescribing description)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyboardFactory

public KeyboardFactory(String strategyClass)
                throws Exception
Parameters:
strategyClass - the name of the class that is an instance of KeyboardStrategy.
Throws:
Exception - if the class cannot be instantiated.

KeyboardFactory

public KeyboardFactory(Class<?> strategyClass)
                throws Exception
Parameters:
strategyClass - the class representing an instance of KeyboardStrategy.
Throws:
Exception - if the class cannot be instantiated.
Method Detail

keyboard

public Keyboard keyboard(Widget widget,
                         SelfDescribing description)
Parameters:
widget - the widget on which the mock events are typed.
description - the description of the widget.
Returns:
the keyboard configured with the specified strategy.

getDefaultKeyboard

public static Keyboard getDefaultKeyboard(Widget widget,
                                          SelfDescribing description)
Parameters:
widget - the widget on which the mock events are typed.
description - the description of the widget.
Returns:
the default keyboard as defined by SWTBotPreferences.KEYBOARD_STRATEGY.

getMockKeyboard

public static Keyboard getMockKeyboard(Widget widget,
                                       SelfDescribing description)
Creates a keyboard that creates mock events directly pumped to the widget.

Parameters:
widget - the widget on which the mock events are typed.
description - the description of the widget.
Returns:
a keyboard

getAWTKeyboard

public static Keyboard getAWTKeyboard()
Creates a keyboard that uses AWT Robot to press keys.

Returns:
a keyboard.

getSWTKeyboard

public static Keyboard getSWTKeyboard()
Creates a keyboard that uses Display.post(Event) to press keys.

Returns:
a keyboard.