public LogPane() {
super();
table = new TableView<>();
TableColumn<LogItem, StatusType> statusColumn = new TableColumn<>("Status");
statusColumn.setCellValueFactory(new PropertyValueFactory<>("status"));
statusColumn.prefWidthProperty().bind(Bindings.multiply(0.1, table.widthProperty()));
statusColumn.setCellFactory(col -> new StatusTypeCell());
TableColumn<LogItem, ActionType> actionColumn = new TableColumn<>("Action");
actionColumn.setCellValueFactory(new PropertyValueFactory<>("action"));
actionColumn.prefWidthProperty().bind(Bindings.multiply(0.1, table.widthProperty()));
actionColumn.setCellFactory(col -> new ActionTypeCell());
TableColumn<LogItem, LocalDateTime> timeColumn = new TableColumn<>("Time");
timeColumn.setCellValueFactory(new PropertyValueFactory<>("time"));
timeColumn.prefWidthProperty().bind(Bindings.multiply(0.2, table.widthProperty()));
timeColumn.setCellFactory(col -> new TimeCell());
TableColumn<LogItem, String> calendarColumn = new TableColumn<>("Calendar");
calendarColumn.setCellValueFactory(new PropertyValueFactory<>("calendar"));
calendarColumn.prefWidthProperty().bind(Bindings.multiply(0.2, table.widthProperty()));
TableColumn<LogItem, String> descriptionColumn = new TableColumn<>("Description");
descriptionColumn.setCellValueFactory(new PropertyValueFactory<>("description"));
descriptionColumn.prefWidthProperty().bind(Bindings.multiply(0.4, table.widthProperty()));
filteredData = new FilteredList<>(items);
SortedList<LogItem> sortedData = new SortedList<>(filteredData);
sortedData.comparatorProperty().bind(table.comparatorProperty());
table.getColumns().add(statusColumn);
table.getColumns().add(actionColumn);
table.getColumns().add(timeColumn);
table.getColumns().add(calendarColumn);
table.getColumns().add(descriptionColumn);
table.setTableMenuButtonVisible(true);
table.setItems(sortedData);
table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
LogPane.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:CalendarFX
作者:
评论列表
文章目录