@SuppressWarnings("unchecked")
public void initFromDirectory(final boolean updateOnly) {
checkChangedNote();
// scan directory
myFileManager.initOwnNotePath(ownCloudPath.textProperty().getValue());
// add new table entries & disable & enable accordingly
notesList = myFileManager.getNotesList();
// http://code.makery.ch/blog/javafx-8-tableview-sorting-filtering/
// 1. Wrap the ObservableList in a FilteredList (initially display all data).
filteredData = new FilteredList<>(notesList, p -> true);
// re-apply filter predicate when already set
final String curGroupName = (String) notesTable.getTableView().getUserData();
if (curGroupName != null) {
setFilterPredicate(curGroupName);
}
// 2. Set the filter Predicate whenever the filter changes.
// done in TabPane and TableView controls
// 3. Wrap the FilteredList in a SortedList.
SortedList<Map<String, String>> sortedData = new SortedList<Map<String, String>>(filteredData);
// 4. Bind the SortedList comparator to the TableView comparator.
sortedData.comparatorProperty().bind(notesTable.comparatorProperty());
// 5. Add sorted (and filtered) data to the table.
notesTable.setNotes(sortedData);
ObservableList<Map<String, String>> groupsList = myFileManager.getGroupsList();
myGroupList.setGroups(groupsList, updateOnly);
// and now store group names (real ones!) for later use
initGroupNames();
}
OwnNoteEditor.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:ownNoteEditor
作者:
评论列表
文章目录