本文整理汇总了Java中javafx.collections.transformation.SortedList.setComparator方法的典型用法代码示例。如果您正苦于以下问题:Java SortedList.setComparator方法的具体用法?Java SortedList.setComparator怎么用?Java SortedList.setComparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.transformation.SortedList
的用法示例。
在下文中一共展示了SortedList.setComparator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveNews
import javafx.collections.transformation.SortedList; //导入方法依赖的package包/类
@Override
public ReadOnlyListProperty<News> retrieveNews() {
if (news == null) {
GluonObservableList<News> gluonNews = DataProvider.retrieveList(cloudGluonClient.createListDataReader("activityFeed", News.class, SyncFlag.LIST_READ_THROUGH));
SortedList<News> sortedNews = new SortedList<>(gluonNews);
sortedNews.setComparator((n1, n2) -> n1.getCreationDate() == n2.getCreationDate() ? n1.getUuid().compareTo(n2.getUuid()) : Long.compare(n1.getCreationDate(), n2.getCreationDate()) * -1);
news = new ReadOnlyListWrapper<>(sortedNews);
}
return news.getReadOnlyProperty();
}
示例2: createModuleTreeItem
import javafx.collections.transformation.SortedList; //导入方法依赖的package包/类
private void createModuleTreeItem(OtpErlangTuple tuple) {
boolean isExported;
OtpErlangAtom moduleNameAtom = (OtpErlangAtom) tuple.elementAt(0);
OtpErlangList exportedFuncs = (OtpErlangList) tuple.elementAt(1);
OtpErlangList localFuncs = (OtpErlangList) tuple.elementAt(2);
TreeItem<ModFunc> moduleItem;
ModFunc module = ModFunc.toModule(moduleNameAtom);
moduleItem = new TreeItem<ModFunc>(module);
moduleItem.setGraphic(treeIcon(AwesomeIcon.CUBE));
ObservableList<TreeItem<ModFunc>> modFuncs = FXCollections.observableArrayList();
SortedList<TreeItem<ModFunc>> sortedFuncs = new SortedList<TreeItem<ModFunc>>(modFuncs);
FilteredList<TreeItem<ModFunc>> filteredFuncs = new FilteredList<TreeItem<ModFunc>>(sortedFuncs);
sortedFuncs.setComparator(treeItemModFuncComparator());
isExported = true;
addTreeItems(toModFuncs(moduleNameAtom, exportedFuncs, isExported), modFuncs);
isExported = false;
addTreeItems(toModFuncs(moduleNameAtom, localFuncs, isExported), modFuncs);
functionLists.put(module, filteredFuncs);
Bindings.bindContentBidirectional(moduleItem.getChildren(), filteredFuncs);
ArrayList<TreeItem<ModFunc>> treeModulesCopy = new ArrayList<>(treeModules);
for (TreeItem<ModFunc> treeItem : treeModulesCopy) {
if(treeItem.getValue().equals(module)) {
treeModules.remove(treeItem);
}
}
treeModules.add(moduleItem);
}
示例3: setupGrid
import javafx.collections.transformation.SortedList; //导入方法依赖的package包/类
private void setupGrid() {
grid = new ChannelGrid();
grid.setBorder(Border.EMPTY);
grid.setPadding(Insets.EMPTY);
grid.setCellFactory(gridView -> new ChannelGridCell(grid, this));
grid.cellHeightProperty().bind(scalingGridCellHeight);
grid.cellWidthProperty().bind(scalingGridCellWidth);
grid.setHorizontalCellSpacing(5);
grid.setVerticalCellSpacing(5);
filteredChannelListGrid = new FilteredList<>(channelStore.getChannels());
final SortedList<Channel> sortedChannelListGrid = new SortedList<>(filteredChannelListGrid);
sortedChannelListGrid.setComparator((channel1, channel2) -> Long.compare(channel2.getViewer(), channel1.getViewer()));
grid.setItems(sortedChannelListGrid);
}
示例4: sortedTableItems
import javafx.collections.transformation.SortedList; //导入方法依赖的package包/类
/**
* @return Inhalt der TableView als sortierte Liste gemäß den aktuell in der
* TableView eingestellten Sortierkriterien.
*/
private SortedList<ObservableList<String>> sortedTableItems() {
final SortedList<ObservableList<String>> sorted = new SortedList<>(tableView.getItems());
sorted.setComparator(tableView.getComparator());
return sorted;
}