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

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot<T>
      extended by org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl<List>
          extended by org.eclipse.swtbot.swt.finder.widgets.SWTBotList

public class SWTBotList
extends AbstractSWTBotControl<List>

Version:
$Id$
Author:
Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>, Joshua Gosse <jlgosse [at] ca [dot] ibm [dot] com>

Field Summary
 
Fields inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot
description, display, log, widget
 
Constructor Summary
SWTBotList(List list)
          Constructs an isntance of this with the given list widget.
SWTBotList(List list, SelfDescribing description)
          Constructs an isntance of this with the given list widget.
 
Method Summary
 String[] getItems()
          Gets the array of Strings from the List
 int indexOf(String item)
          Gets the index of the given item.
 String itemAt(int index)
          Gets the item at the given index.
 int itemCount()
          Gets the item count in the list
protected  void notifySelect()
          Notifies of a selection.
 void select(int... indices)
          Selects the indexes provided.
 void select(int index)
          Selects the given index.
 void select(String... items)
          Sets the selection to the given list of items.
 void select(String item)
          Selects the item matching the given text.
 String[] selection()
          Gets the arrray of selected items.
 int selectionCount()
          Gets the selection count.
 void unselect()
          Unselects everything.
 
Methods inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl
absoluteLocation, click, moveMouseToWidget, rightClick
 
Methods inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot
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

SWTBotList

public SWTBotList(List list)
           throws WidgetNotFoundException
Constructs an isntance of this with the given list widget.

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

SWTBotList

public SWTBotList(List list,
                  SelfDescribing description)
           throws WidgetNotFoundException
Constructs an isntance of this with the given list widget.

Parameters:
list - the list.
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

select

public void select(String item)
Selects the item matching the given text.

Parameters:
item - the item to select in the list.

select

public void select(int index)
Selects the given index.

Parameters:
index - the selection index.

itemCount

public int itemCount()
Gets the item count in the list

Returns:
the number of items in the list.

selectionCount

public int selectionCount()
Gets the selection count.

Returns:
the number of selected items in the list.

selection

public String[] selection()
Gets the arrray of selected items.

Returns:
the selected items in the list.

select

public void select(int... indices)
Selects the indexes provided.

Parameters:
indices - the indices to select in the list.

select

public void select(String... items)
Sets the selection to the given list of items.

Parameters:
items - the items to select in the list.

notifySelect

protected void notifySelect()
Notifies of a selection.


unselect

public void unselect()
Unselects everything.


indexOf

public int indexOf(String item)
Gets the index of the given item.

Parameters:
item - the search item.
Returns:
the index of the item, or -1 if the item does not exist.

itemAt

public String itemAt(int index)
Gets the item at the given index.

Parameters:
index - the zero based index.
Returns:
the item at the specified index.

getItems

public String[] getItems()
Gets the array of Strings from the List

Returns:
an array of Strings