Search in sources :

Example 1 with MapPreviewTableCell

use of com.faforever.client.game.MapPreviewTableCell in project downlords-faf-client by FAForever.

the class LiveReplayController method initializeGameTable.

private void initializeGameTable(ObservableList<Game> games) {
    SortedList<Game> sortedList = new SortedList<>(games);
    sortedList.comparatorProperty().bind(liveReplayControllerRoot.comparatorProperty());
    mapPreviewColumn.setCellFactory(param -> new MapPreviewTableCell(uiService));
    mapPreviewColumn.setCellValueFactory(param -> Bindings.createObjectBinding(() -> mapService.loadPreview(param.getValue().getMapFolderName(), PreviewSize.SMALL), param.getValue().mapFolderNameProperty()));
    gameTitleColumn.setCellValueFactory(param -> param.getValue().titleProperty());
    gameTitleColumn.setCellFactory(param -> new StringCell<>(title -> title));
    playersColumn.setCellValueFactory(param -> param.getValue().numPlayersProperty());
    playersColumn.setCellFactory(param -> new StringCell<>(number -> i18n.number(number.intValue())));
    hostColumn.setCellValueFactory(param -> param.getValue().hostProperty());
    hostColumn.setCellFactory(param -> new StringCell<>(String::toString));
    modsColumn.setCellValueFactory(this::modCell);
    modsColumn.setCellFactory(param -> new StringCell<>(String::toString));
    watchColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue()));
    watchColumn.setCellFactory(param -> new NodeTableCell<>(this::watchReplayButton));
    liveReplayControllerRoot.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> Platform.runLater(() -> selectedGame.set(newValue)));
    liveReplayControllerRoot.setItems(games);
}
Also used : GameService(com.faforever.client.game.GameService) UiService(com.faforever.client.theme.UiService) MapPreviewTableCell(com.faforever.client.game.MapPreviewTableCell) PreviewSize(com.faforever.client.map.MapServiceImpl.PreviewSize) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Bindings(javafx.beans.binding.Bindings) Scope(org.springframework.context.annotation.Scope) TableColumn(javafx.scene.control.TableColumn) Inject(javax.inject.Inject) GameStatus(com.faforever.client.remote.domain.GameStatus) TableView(javafx.scene.control.TableView) SortedList(javafx.collections.transformation.SortedList) StringCell(com.faforever.client.fx.StringCell) ObjectProperty(javafx.beans.property.ObjectProperty) Node(javafx.scene.Node) AbstractViewController(com.faforever.client.fx.AbstractViewController) ObservableMap(javafx.collections.ObservableMap) Collectors(java.util.stream.Collectors) CellDataFeatures(javafx.scene.control.TableColumn.CellDataFeatures) Platform(javafx.application.Platform) Component(org.springframework.stereotype.Component) List(java.util.List) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Entry(java.util.Map.Entry) ObservableValue(javafx.beans.value.ObservableValue) ObservableList(javafx.collections.ObservableList) I18n(com.faforever.client.i18n.I18n) MapService(com.faforever.client.map.MapService) NotNull(org.jetbrains.annotations.NotNull) ConfigurableBeanFactory(org.springframework.beans.factory.config.ConfigurableBeanFactory) Image(javafx.scene.image.Image) Game(com.faforever.client.game.Game) NodeTableCell(com.faforever.client.fx.NodeTableCell) Joiner(com.google.common.base.Joiner) MapPreviewTableCell(com.faforever.client.game.MapPreviewTableCell) Game(com.faforever.client.game.Game) SortedList(javafx.collections.transformation.SortedList)

Aggregations

AbstractViewController (com.faforever.client.fx.AbstractViewController)1 NodeTableCell (com.faforever.client.fx.NodeTableCell)1 StringCell (com.faforever.client.fx.StringCell)1 Game (com.faforever.client.game.Game)1 GameService (com.faforever.client.game.GameService)1 MapPreviewTableCell (com.faforever.client.game.MapPreviewTableCell)1 I18n (com.faforever.client.i18n.I18n)1 MapService (com.faforever.client.map.MapService)1 PreviewSize (com.faforever.client.map.MapServiceImpl.PreviewSize)1 GameStatus (com.faforever.client.remote.domain.GameStatus)1 UiService (com.faforever.client.theme.UiService)1 Joiner (com.google.common.base.Joiner)1 List (java.util.List)1 Entry (java.util.Map.Entry)1 Collectors (java.util.stream.Collectors)1 Platform (javafx.application.Platform)1 Bindings (javafx.beans.binding.Bindings)1 ObjectProperty (javafx.beans.property.ObjectProperty)1 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)1