# ComponentSelectorHandle

Import: `import com.install4j.api.test.formcomponents.ComponentSelectorHandle;`

```java
interface ComponentSelectorHandle extends FormComponentHandle
```

Handle for the "Installation components selector" form component. The Swing widget is a `JTree`.

Reach this handle via [`ScreenHandle.componentSelector`](../ui/ScreenHandle.md#componentselector).

## Inherited from

- [FormComponentHandle](FormComponentHandle.md) — 7 methods

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`getSelectedComponentIds()`](#getselectedcomponentids) | `List<String>` | The ids of the components currently marked for installation. |
| [`isSelected(String)`](#isselected-string) | `boolean` | Whether the component with the given id is currently selected for installation. |
| [`isComponentVisible(String)`](#iscomponentvisible-string) | `boolean` | Whether the component with the given id is visible in the tree, that is, not hidden via [`InstallationComponentSetup.isHidden`](../../context/InstallationComponentSetup.md#ishidden). |
| [`isChangeable(String)`](#ischangeable-string) | `boolean` | Whether the user can toggle the component's selection state. |
| [`setSelected(String, boolean)`](#setselected-string-boolean) | `ComponentSelectorHandle` | Toggle a component's selection state. |
| [`selectOnly(String[])`](#selectonly-string) | `ComponentSelectorHandle` | Set only the listed components selected. |
| [`assertEnabled()`](#assertenabled) | `ComponentSelectorHandle` |  |
| [`assertDisabled()`](#assertdisabled) | `ComponentSelectorHandle` |  |
| [`assertVisible()`](#assertvisible) | `ComponentSelectorHandle` |  |
| [`assertInvisible()`](#assertinvisible) | `ComponentSelectorHandle` |  |

### getSelectedComponentIds()

```java
List<String> getSelectedComponentIds()
```

The ids of the components currently marked for installation.

### isSelected(String)

```java
boolean isSelected(String componentId)
```

Whether the component with the given id is currently selected for installation.

### isComponentVisible(String)

```java
boolean isComponentVisible(String componentId)
```

Whether the component with the given id is visible in the tree, that is, not hidden via
[`InstallationComponentSetup.isHidden`](../../context/InstallationComponentSetup.md#ishidden).

### isChangeable(String)

```java
boolean isChangeable(String componentId)
```

Whether the user can toggle the component's selection state. Components configured as
mandatory are not user-toggleable.

### setSelected(String, boolean)

```java
ComponentSelectorHandle setSelected(String componentId, boolean selected)
```

Toggle a component's selection state.

### selectOnly(String[])

```java
ComponentSelectorHandle selectOnly(String... componentIds)
```

Set only the listed components selected. Every other changeable component is deselected.
Mandatory components are left at their configured value.

### assertEnabled()

```java
ComponentSelectorHandle assertEnabled()
```

### assertDisabled()

```java
ComponentSelectorHandle assertDisabled()
```

### assertVisible()

```java
ComponentSelectorHandle assertVisible()
```

### assertInvisible()

```java
ComponentSelectorHandle assertInvisible()
```

