FormatedTableCellFactory.java 文件源码

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

项目:marathonv5 作者:
@Override public TableCell<S,T> call(TableColumn<S,T> p) {
     TableCell<S,T> cell = new TableCell() {
        @Override public void updateItem(Object item, boolean empty) {
            if (item == getItem()) return;

            super.updateItem(item, empty);

            if (item == null) {
                super.setText(null);
                super.setGraphic(null);
            } else if (format != null) {
                super.setText(format.format(item));
            } else if (item instanceof Node) {
                super.setText(null);
                super.setGraphic((Node)item);
            } else {
                super.setText(item.toString());
                super.setGraphic(null);
            }
        }
    };
    cell.setTextAlignment(alignment);
    switch(alignment) {
        case CENTER:
            cell.setAlignment(Pos.CENTER);
            break;
        case RIGHT:
            cell.setAlignment(Pos.CENTER_RIGHT);
            break;
        default:
            cell.setAlignment(Pos.CENTER_LEFT);
            break;
    }
    return cell;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号