I am using the CharmListView
and just noticed that it doesn't have a SelectionModel
that the ListView has. I used to use listView.getSelectionModel().SelectedItemProperty().addListener()
to respond to an item selection event with a ListView
. How is that done with the CharmListView?
EDIT
The app flow is explained below:
The user selects a department of a school. This list is in a ListView
then a semester. This other list is in a CharmListView
:
The initialize
method of the SemesterPresenter
class:
public void initialize(URL url, ResourceBundle rb) {
loadSemesters();
semesterListView.setItems(semesters);
semesterListView.setHeadersFunction(Level::getLevel);
MobileApplication.getInstance().getView().showingProperty().addListener((obs,ov,nv)->{
System.out.println(semesterListView.getChildrenUnmodifiable());
});
}
The first call to getChildrenUnmodifiable() returns an empty array. It's the same scenario when using all the propositions in the posts below with null pointers returned.