Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.swtbot.swt.finder.widgets
Class SWTBotTreeItem

    java.lang.Object
      org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot<TreeItem>
          org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem

    public class SWTBotTreeItem

extends AbstractSWTBot<TreeItem>

Version:
  $Id$
Author:
  Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>, Ketan Patel, 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
`SWTBotTreeItem(TreeItem treeItem)`
`SWTBotTreeItem(TreeItem treeItem, SelfDescribing description)`

Method Summary
`protected void` | `assertEnabled()` Check if the widget is enabled, throws if the widget is disabled.
`String` | `cell(int column)` Returns the text stored at the given column index in the receiver, or empty string if the text has not been set.
`String` | `cell(int row, int column)` Gets the cell data for the given row/column index.
`void` | `check()` Check the tree item.
`SWTBotTreeItem` | `click()` Clicks on this node.
`SWTBotTreeItem` | `click(int column)` Clicks on this node at the given column index.
`protected void` | `clickXY(int x, int y)` Click on the table at given coordinates
`SWTBotTreeItem` | `collapse()` Collapses the tree item to simulate click the plus sign.
`SWTBotTreeItem` | `collapseNode(String nodeText)` Collapses the node matching the given node text.
`SWTBotMenu` | `contextMenu(String text)` Gets the context menu matching the text.
`protected Event` | `createEvent()` Creates an event.
`SWTBotTreeItem` | `doubleClick()` Double clicks on this node.
`SWTBotTreeItem` | `expand()` Expands the tree item to simulate click the plus sign.
`SWTBotTreeItem` | `expandNode(String... nodes)` Expands the node matching the given node texts.
`SWTBotTreeItem[]` | `getItems()` Gets all the items in this tree node.
`SWTBotTreeItem` | `getNode(int row)` Gets the nodes at the given, zero-relative index in the receiver.
`SWTBotTreeItem` | `getNode(String nodeText)` Gets the first node found matching the given node text.
`SWTBotTreeItem` | `getNode(String nodeText, int index)` Gets the node matching the given node text and index.
`List<String>` | `getNodes()` Gets the nodes of the tree item.
`List<SWTBotTreeItem>` | `getNodes(String nodeText)` Gets all nodes matching the given node text.
`String` | `getText()` Gets the text of this object's widget.
`boolean` | `isChecked()` Gets if the checkbox button is checked.
`boolean` | `isEnabled()` Gets if the object's widget is enabled.
`boolean` | `isExpanded()` Gets if the item is expanded.
`boolean` | `isSelected()`
`TableRow` | `row()` Returns the table row representation of cell values
`int` | `rowCount()` Returns the number of items contained in the receiver that are direct item children of the receiver.
`SWTBotTreeItem` | `select()` Selects the current tree item.
`SWTBotTreeItem` | `select(String... items)` Selects the items matching the array provided.
`SWTBotTreeItem` | `select(String item)` Selects the item matching the given name.
`void` | `toggleCheck()` Toggle the tree item.
`void` | `uncheck()` Uncheck the tree item.

Methods inherited from class org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot
`absoluteLocation, asyncExec, backgroundColor, click, contextMenu, createMouseEvent, createSelectionEvent, doubleClickXY, foregroundColor, getId, getToolTipText, hasStyle, isActive, 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

### SWTBotTreeItem

    public SWTBotTreeItem(TreeItem treeItem)
                   throws WidgetNotFoundException

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

### SWTBotTreeItem

    public SWTBotTreeItem(TreeItem treeItem,
                          SelfDescribing description)
                   throws WidgetNotFoundException

Parameters:
  `treeItem` - 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

### cell

    public String cell(int column)

  Returns the text stored at the given column index in the receiver, or empty string if the text has not been set. Throws an exception if the column is greater than the number of columns in the tree.

  Parameters:
    `column` - the column index.
  Returns:
    the cell at the location specified by the column

### row

    public TableRow row()

  Returns the table row representation of cell values

  Returns:
    the cell values for this item

### rowCount

    public int rowCount()

  Returns the number of items contained in the receiver that are direct item children of the receiver.

  Returns:
    the number of items

### getNode

    public SWTBotTreeItem getNode(int row)

  Gets the nodes at the given, zero-relative index in the receiver. Throws an exception if the index is out of range.

  Parameters:
    `row` - the index of the item to return
  Returns:
    the item at the given index

### cell

    public String cell(int row,
                       int column)

  Gets the cell data for the given row/column index.

  Parameters:
    `row` - the row index.
    `column` - the column index.
  Returns:
    the cell at the location specified by the row and column
  See Also:
    `getNode(int)`, `cell(int)`

### expand

    public SWTBotTreeItem expand()

  Expands the tree item to simulate click the plus sign.

  Returns:
    the tree item, after expanding it.

### collapse

    public SWTBotTreeItem collapse()

  Collapses the tree item to simulate click the plus sign.

  Returns:
    the tree item, after collapsing it.

### createEvent

    protected Event createEvent()

  Description copied from class: `AbstractSWTBot`
  Creates an event.

  Overrides:
    `createEvent` in class `AbstractSWTBot<TreeItem>`
  Returns:
    an event that encapsulates `AbstractSWTBot.widget` and `AbstractSWTBot.display`. Subclasses may override to set other event properties.

### getNodes

    public List<String> getNodes()

  Gets the nodes of the tree item.

  Returns:
    the list of nodes in the treeitem.

### expandNode

    public SWTBotTreeItem expandNode(String... nodes)

  Expands the node matching the given node texts.

  Parameters:
    `nodes` - the text on the node.
  Returns:
    the last tree node that was expanded or `null` if none exists.
  Throws:
    `WidgetNotFoundException` - if any of the nodes on the path do not exist

### collapseNode

    public SWTBotTreeItem collapseNode(String nodeText)

  Collapses the node matching the given node text.

  Parameters:
    `nodeText` - the text on the node.
  Returns:
    the node that was collapsed or `null` if not match exists.

### getNode

    public SWTBotTreeItem getNode(String nodeText,
                                  int index)

  Gets the node matching the given node text and index.

  Parameters:
    `nodeText` - the text on the node.
    `index` - the n'th node with the nodeText.
  Returns:
    the node with the specified text or `WidgetNotFoundException` if not match exists.
  Since:
    2.0

### getNodes

    public List<SWTBotTreeItem> getNodes(String nodeText)

  Gets all nodes matching the given node text.

  Parameters:
    `nodeText` - the text on the node.
  Returns:
    the nodes with the specified text or `WidgetNotFoundException` if not match exists.
  Since:
    2.0

### getNode

    public SWTBotTreeItem getNode(String nodeText)

  Gets the first node found matching the given node text.

  Parameters:
    `nodeText` - the text on the node.
  Returns:
    the first node with the specified text or `WidgetNotFoundException` if not match exists.
  Since:
    1.2

### select

    public SWTBotTreeItem select()

  Selects the current tree item.

  Returns:
    the current node.
  Since:
    1.0

### clickXY

    protected void clickXY(int x,
                           int y)

  Click on the table at given coordinates

  Overrides:
    `clickXY` in class `AbstractSWTBot<TreeItem>`
  Parameters:
    `x` - the x co-ordinate of the click
    `y` - the y co-ordinate of the click
  Since:
    1.2

### click

    public SWTBotTreeItem click()

  Clicks on this node.

  Overrides:
    `click` in class `AbstractSWTBot<TreeItem>`
  Returns:
    the current node.
  Since:
    1.2

### click

    public SWTBotTreeItem click(int column)

  Clicks on this node at the given column index.

  Returns:
    the current node.
  Since:
    2.0

### doubleClick

    public SWTBotTreeItem doubleClick()

  Double clicks on this node.

  Returns:
    the current node.
  Since:
    1.2

### select

    public SWTBotTreeItem select(String... items)

  Selects the items matching the array provided.

  Parameters:
    `items` - the items to select.
  Returns:
    the current node.
  Since:
    1.0

### select

    public SWTBotTreeItem select(String item)

  Selects the item matching the given name.

  Parameters:
    `item` - the items to select.
  Returns:
    the current node.
  Since:
    1.0

### getText

    public String getText()

  Description copied from class: `AbstractSWTBot`
  Gets the text of this object's widget.

  Overrides:
    `getText` in class `AbstractSWTBot<TreeItem>`
  Returns:
    the text on the widget.

### contextMenu

    public SWTBotMenu contextMenu(String text)

  Description copied from class: `AbstractSWTBot`
  Gets the context menu matching the text.

  Overrides:
    `contextMenu` in class `AbstractSWTBot<TreeItem>`
  Parameters:
    `text` - the text on the context menu.
  Returns:
    the menu that has the given text.

### toggleCheck

    public void toggleCheck()

  Toggle the tree item.

  Since:
    1.3

### check

    public void check()

  Check the tree item.

  Since:
    1.3

### uncheck

    public void uncheck()

  Uncheck the tree item.

  Since:
    1.3

### isChecked

    public boolean isChecked()

  Gets if the checkbox button is checked.

  Returns:
    `true` if the checkbox is checked. Otherwise `false`.
  Since:
    1.3

### assertEnabled

    protected void assertEnabled()

  Description copied from class: `AbstractSWTBot`
  Check if the widget is enabled, throws if the widget is disabled.

  Overrides:
    `assertEnabled` in class `AbstractSWTBot<TreeItem>`

### isSelected

    public boolean isSelected()

  Returns:
    `true` if the item is selected, `false` otherwise.
  Since:
    2.0

### isExpanded

    public boolean isExpanded()

  Gets if the item is expanded.

  Returns:
    `true` if the item is expanded, `false` otherwise.
  Since:
    2.0

### getItems

    public SWTBotTreeItem[] getItems()

  Gets all the items in this tree node.

  Returns:
    all the items in this tree node.

### isEnabled

    public boolean isEnabled()

  Description copied from class: `AbstractSWTBot`
  Gets if the object's widget is enabled.

  Overrides:
    `isEnabled` in class `AbstractSWTBot<TreeItem>`
  Returns:
    `true` if the widget is enabled.
  See Also:
    `Control.isEnabled()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD