org.eclipse.swtbot.swt.finder.widgets
Class SWTBotText

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot<Text>
      extended by org.eclipse.swtbot.swt.finder.widgets.SWTBotText

public class SWTBotText
extends AbstractSWTBot<Text>

This represents a Text widget.

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

Field Summary
 
Fields inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot
description, display, log, widget
 
Constructor Summary
SWTBotText(Text w)
          Constructs a new instance of this object.
SWTBotText(Text w, SelfDescribing description)
          Constructs a new instance of this object.
 
Method Summary
 void notifyKeyboardEvent(int modificationKeys, char c)
          Deprecated. use AbstractSWTBot.pressShortcut(int, char) instead. This api will be removed.
 void notifyKeyboardEvent(int modificationKeys, char c, int keyCode)
          Deprecated. use AbstractSWTBot.pressShortcut(int, int, char) instead. This api will be removed.
 SWTBotText selectAll()
          Select the contents of the entire widget.
 SWTBotText setText(String text)
          Sets the text of the widget.
 SWTBotText typeText(String text)
          Types the string in the text box.
 SWTBotText typeText(String text, int interval)
          Types the string in the text box.
 
Methods inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot
absoluteLocation, assertEnabled, asyncExec, backgroundColor, click, click, clickXY, contextMenu, contextMenu, createEvent, createMouseEvent, createSelectionEvent, doubleClickXY, foregroundColor, getId, getText, getToolTipText, hasStyle, isActive, isEnabled, isEnabledInternal, isVisible, keyboard, notify, notify, notify, pressShortcut, pressShortcut, pressShortcut, rightClick, rightClick, setFocus, sleep, syncExec, syncExec, syncExec, syncExec, syncExec, syncExec, syncExec, syncExec, toString, traverse, waitForEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SWTBotText

public SWTBotText(Text w)
           throws WidgetNotFoundException
Constructs a new instance of this object.

Parameters:
w - the widget.
Throws:
WidgetNotFoundException - if the widget is null or widget has been disposed.

SWTBotText

public SWTBotText(Text w,
                  SelfDescribing description)
           throws WidgetNotFoundException
Constructs a new instance of this object.

Parameters:
w - the widget.
description - the description of the widget, this will be reported by AbstractSWTBot.toString()
Throws:
WidgetNotFoundException - if the widget is null or widget has been disposed.
Method Detail

setText

public SWTBotText setText(String text)
Sets the text of the widget.

Parameters:
text - the text to be set.
Returns:
the same instance.

typeText

public SWTBotText typeText(String text)
Types the string in the text box.

Parameters:
text - the text to be typed.
Returns:
the same instance.
Since:
1.2

typeText

public SWTBotText typeText(String text,
                           int interval)
Types the string in the text box.

Parameters:
text - the text to be typed.
interval - the interval between consecutive key strokes.
Returns:
the same instance.
Since:
1.2

notifyKeyboardEvent

@Deprecated
public void notifyKeyboardEvent(int modificationKeys,
                                           char c)
Deprecated. use AbstractSWTBot.pressShortcut(int, char) instead. This api will be removed.

Notifies of the keyboard event.

FIXME need some work for CTRL|SHIFT + 1 the 1 is to be sent as '!' in this case.

Parameters:
modificationKeys - the modification keys.
c - the character.
See Also:
Event.character, Event.stateMask

notifyKeyboardEvent

@Deprecated
public void notifyKeyboardEvent(int modificationKeys,
                                           char c,
                                           int keyCode)
Deprecated. use AbstractSWTBot.pressShortcut(int, int, char) instead. This api will be removed.

Notifies of keyboard event.

Parameters:
modificationKeys - the modification key.
c - the character.
keyCode - any special keys (function keys, arrow or navigation keys etc.)
See Also:
Event.keyCode, Event.character, Event.stateMask

selectAll

public SWTBotText selectAll()
Select the contents of the entire widget.

Returns:
the same instance.