Search in sources :

Example 1 with MapPreviewTableCellController

use of com.faforever.client.vault.map.MapPreviewTableCellController in project downlords-faf-client by FAForever.

the class ReplayVaultController method mapCellFactory.

private TableCell<Replay, MapBean> mapCellFactory(TableColumn<Replay, MapBean> column) {
    MapPreviewTableCellController controller = uiService.loadFxml("theme/vault/map/map_preview_table_cell.fxml");
    final ImageView imageView = controller.getRoot();
    TableCell<Replay, MapBean> cell = new TableCell<Replay, MapBean>() {

        @Override
        protected void updateItem(MapBean map, boolean empty) {
            super.updateItem(map, empty);
            if (empty || map == null) {
                setText(null);
                setGraphic(null);
            } else {
                imageView.setImage(mapService.loadPreview(map.getFolderName(), PreviewSize.SMALL));
                setGraphic(imageView);
                setText(map.getDisplayName());
            }
        }
    };
    cell.setGraphic(imageView);
    return cell;
}
Also used : MapPreviewTableCellController(com.faforever.client.vault.map.MapPreviewTableCellController) MapBean(com.faforever.client.map.MapBean) TextFieldTableCell(javafx.scene.control.cell.TextFieldTableCell) TableCell(javafx.scene.control.TableCell) Replay(com.faforever.client.replay.Replay) ImageView(javafx.scene.image.ImageView)

Aggregations

MapBean (com.faforever.client.map.MapBean)1 Replay (com.faforever.client.replay.Replay)1 MapPreviewTableCellController (com.faforever.client.vault.map.MapPreviewTableCellController)1 TableCell (javafx.scene.control.TableCell)1 TextFieldTableCell (javafx.scene.control.cell.TextFieldTableCell)1 ImageView (javafx.scene.image.ImageView)1