check model to request the current selection
state.
The following screenshot shows the CheckListView with some sample data:
To create the CheckListView shown in the screenshot, simply do the following:
// create the data to show in the CheckListView
final ObservableList<String> strings = FXCollections.observableArrayList();
for (int i = 0; i <= 100; i++) {
strings.add("Item " + i);
}
// Create the CheckListView with the data
final CheckListView<String> checkListView = new CheckListView<>(strings);
// and listen to the relevant events (e.g. when the selected indices or
// selected items change).
checkListView.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() {
public void onChanged(ListChangeListener.Change<? extends String> c) {
System.out.println(checkListView.getCheckModel().getCheckedItems());
}
});
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private ObjectProperty | checkModel
Properties |
| private final Map | itemBooleanMap
Private fields |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CheckListView(ObservableList<T>
The items to display within the CheckListView. items)Creates a new CheckListView instance with the given items available as choices. |
| Modifier and Type | Method and Description |
|---|---|
| public final ObjectProperty | checkModelProperty()
The check model provides the API through which it is possible to check single or multiple items within a CheckListView, as well as inspect which items have been checked by the user. |
| public final IndexedCheckModel | |
| public BooleanProperty | getItemBooleanProperty(int index)
Returns the |
| public BooleanProperty | |
| public final void | setCheckModel(IndexedCheckModel<T> value)
Sets the 'check model' to be used in the CheckListView - this is the
code that is responsible for representing the selected state of each
|
| checkModel | back to summary |
|---|---|
| private ObjectProperty<IndexedCheckModel<T>> checkModel Properties | |
| itemBooleanMap | back to summary |
|---|---|
| private final Map<T, BooleanProperty> itemBooleanMap Private fields | |
| CheckListView | back to summary |
|---|---|
| public CheckListView() Creates a new CheckListView instance with an empty list of choices. | |
| CheckListView | back to summary |
|---|---|
| public CheckListView(ObservableList<T> items) Creates a new CheckListView instance with the given items available as choices.
| |
| checkModelProperty | back to summary |
|---|---|
| public final ObjectProperty The check model provides the API through which it is possible to check single or multiple items within a CheckListView, as well as inspect which items have been checked by the user. Note that it has a generic type that must match the type of the CheckListView itself. | |
| getCheckModel | back to summary |
|---|---|
| public final IndexedCheckModel Returns the currently installed check model. | |
| getItemBooleanProperty | back to summary |
|---|---|
| public BooleanProperty getItemBooleanProperty(int index) Returns the | |
| getItemBooleanProperty | back to summary |
|---|---|
| public BooleanProperty getItemBooleanProperty(T item) Returns the | |
| setCheckModel | back to summary |
|---|---|
| public final void setCheckModel(IndexedCheckModel<T> value) Sets the 'check model' to be used in the CheckListView - this is the
code that is responsible for representing the selected state of each
| |
| Modifier and Type | Field and Description |
|---|---|
| private final ObservableList | items
* Internal properties * * |
| Access | Constructor and Description |
|---|---|
| pack-priv | CheckListViewBitSetCheckModel(final ObservableList<T> items, final Map<T, BooleanProperty> itemBooleanMap)
* Constructors * * |
| Modifier and Type | Method and Description |
|---|---|
| public T | getItem(int index)
Implements abstract org. Implements org. * Implementing abstract API * * |
| public int | getItemCount()
Implements abstract org. Implements org. Returns the count of items in the control. |
| public int | getItemIndex(T item)
Implements abstract org. Implements org. Returns the index of the given item. |
| items | back to summary |
|---|---|
| private final ObservableList<T> items * Internal properties * * | |
| CheckListViewBitSetCheckModel | back to summary |
|---|---|
| pack-priv CheckListViewBitSetCheckModel(final ObservableList<T> items, final Map<T, BooleanProperty> itemBooleanMap) * Constructors * * | |
| getItem | back to summary |
|---|---|
| public T getItem(int index) Implements abstract org. Implements org. * Implementing abstract API * *
| |
| getItemCount | back to summary |
|---|---|
| public int getItemCount() Implements abstract org. Implements org. Doc from org. Returns the count of items in the control.
| |
| getItemIndex | back to summary |
|---|---|
| public int getItemIndex(T item) Implements abstract org. Implements org. Doc from org. Returns the index of the given item.
| |