TableDialog.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:OneClient 作者:
@SuppressWarnings("unchecked")
public TableDialog(Collection<T> files) {
    dialogPane = getDialogPane();
    setResizable(true);
    this.table = new TableView<>(FXCollections.observableArrayList(files));
    this.table.setMaxWidth(Double.MAX_VALUE);

    GridPane.setHgrow(table, Priority.ALWAYS);
    GridPane.setFillWidth(table, true);

    label = createContentLabel(dialogPane.getContentText());
    label.setPrefWidth(Region.USE_COMPUTED_SIZE);
    label.textProperty().bind(dialogPane.contentTextProperty());

    this.grid = new GridPane();
    this.grid.setHgap(10);
    this.grid.setMaxWidth(Double.MAX_VALUE);
    this.grid.setAlignment(Pos.CENTER_LEFT);

    dialogPane.contentTextProperty().addListener(o -> updateGrid());
    updateGrid();

    setResultConverter((dialogButton) -> {
        ButtonBar.ButtonData data = dialogButton == null ? null : dialogButton.getButtonData();
        return data == ButtonBar.ButtonData.OK_DONE ? table.getSelectionModel().getSelectedItem() : null;
    });
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号