@Override public void changed( ObservableValue<? extends LocalFile> observable, LocalFile oldValue, LocalFile newValue) { if (newValue == null || oldValue == newValue) return; // if selected item in FileList is a directory, display contents if (newValue.isDirectory()) { detailsView.centerProperty().setValue(fileGrid); listFiles.clear(); newValue.getChildren().stream().forEach(listFiles::add); fileGrid.getItems().clear(); fileGrid.getItems().addAll(listFiles); } else { // set ListView as display main element detailsView.centerProperty().setValue(fileDetailsList); // clear existing data fileDetails.clear(); fileDetailsList.getItems().clear(); newValue.getFileInfoList().stream().forEach(fileDetails::add); // add list of file attributes to ListView fileDetailsList.getItems().addAll(fileDetails); } }
@Override protected final void updateItem(LocalFile item, boolean empty) { super.updateItem(item, empty); icon.set(null); title.setValue(""); if (!empty) { icon.set(item.getIcon()); title.setValue(item.getFileName()); } }