use of org.controlsfx.control.table.TableFilter in project Gargoyle by callakrsos.
the class FilterTableExample method start.
@Override
public void start(Stage primaryStage) throws Exception {
TableView<DataItem> tableView = new TableView<>();
FxUtil.installClipboardKeyEvent(tableView);
tableView.setItems(FXCollections.observableArrayList());
IntStream.range(0, 20000).mapToObj(i -> new DataItem()).forEach(d -> tableView.getItems().add(d));
TableColumn<DataItem, Integer> smallInt = new TableColumn<>("Small Int");
smallInt.setCellValueFactory(cb -> new ReadOnlyObjectWrapper<>(cb.getValue().getSmallIntValue()));
TableColumn<DataItem, Integer> largeInt = new TableColumn<>("Large Int");
largeInt.setCellValueFactory(cb -> new ReadOnlyObjectWrapper<>(cb.getValue().getLargeIntValue()));
TableColumn<DataItem, String> randomLetter = new TableColumn<>("Letter");
randomLetter.setCellValueFactory(cb -> new ReadOnlyObjectWrapper<>(cb.getValue().getRandomLetter()));
TableColumn<DataItem, String> randomString1 = new TableColumn<>("AlphaNum 1");
randomString1.setCellValueFactory(cb -> new ReadOnlyObjectWrapper<>(cb.getValue().getRandomStr1()));
TableColumn<DataItem, String> randomString2 = new TableColumn<>("AlphaNum 2");
randomString1.setCellValueFactory(cb -> new ReadOnlyObjectWrapper<>(cb.getValue().getRandomStr2()));
tableView.getColumns().addAll(smallInt, largeInt, randomLetter, randomString1, randomString2);
Platform.runLater(() -> new TableFilter<>(tableView));
GridPane grp = new GridPane();
GridPane.setFillHeight(tableView, true);
GridPane.setFillWidth(tableView, true);
GridPane.setHgrow(tableView, Priority.ALWAYS);
GridPane.setVgrow(tableView, Priority.ALWAYS);
grp.getChildren().add(tableView);
Scene scene = new Scene(grp);
primaryStage.setScene(scene);
primaryStage.show();
}
Aggregations