Search in sources :

Example 1 with StringListCell

use of com.faforever.client.fx.StringListCell in project downlords-faf-client by FAForever.

the class SettingsController method configureLanguageSelection.

private void configureLanguageSelection(Preferences preferences) {
    languageComboBox.setButtonCell(new StringListCell<>(languageInfo -> i18n.get(languageInfo.getDisplayNameKey())));
    languageComboBox.setCellFactory(param -> new StringListCell<>(languageInfo -> i18n.get(languageInfo.getDisplayNameKey())));
    languageComboBox.setItems(FXCollections.observableArrayList(LanguageInfo.values()));
    LanguageInfo languageInfo = preferences.getLocalization().getLanguage();
    languageComboBox.getSelectionModel().select(languageInfo.ordinal());
}
Also used : UiService(com.faforever.client.theme.UiService) ChatColorMode(com.faforever.client.chat.ChatColorMode) ComboBox(javafx.scene.control.ComboBox) TextField(javafx.scene.control.TextField) UnitDataBaseType(com.faforever.client.preferences.Preferences.UnitDataBaseType) Theme(com.faforever.client.theme.Theme) Screen(javafx.stage.Screen) Platform(javafx.application.Platform) Objects(java.util.Objects) NumberStringConverter(javafx.util.converter.NumberStringConverter) Slf4j(lombok.extern.slf4j.Slf4j) Region(javafx.scene.layout.Region) ToggleButton(javafx.scene.control.ToggleButton) GameDirectoryChooseEvent(com.faforever.client.ui.preferences.event.GameDirectoryChooseEvent) Toggle(javafx.scene.control.Toggle) ToastPosition(com.faforever.client.preferences.ToastPosition) TimeInfo(com.faforever.client.preferences.TimeInfo) PreferencesService(com.faforever.client.preferences.PreferencesService) WeakChangeListener(javafx.beans.value.WeakChangeListener) FXCollections(javafx.collections.FXCollections) UserService(com.faforever.client.user.UserService) Bindings(javafx.beans.binding.Bindings) Scope(org.springframework.context.annotation.Scope) NumberFormat(java.text.NumberFormat) EventBus(com.google.common.eventbus.EventBus) Inject(javax.inject.Inject) NotificationService(com.faforever.client.notification.NotificationService) Preferences(com.faforever.client.preferences.Preferences) DEFAULT_THEME(com.faforever.client.theme.UiService.DEFAULT_THEME) StringListCell(com.faforever.client.fx.StringListCell) PasswordField(javafx.scene.control.PasswordField) Label(javafx.scene.control.Label) Controller(com.faforever.client.fx.Controller) Node(javafx.scene.Node) CheckBox(javafx.scene.control.CheckBox) Action(com.faforever.client.notification.Action) NotificationsPrefs(com.faforever.client.preferences.NotificationsPrefs) PersistentNotification(com.faforever.client.notification.PersistentNotification) PATH_STRING_CONVERTER(com.faforever.client.fx.JavaFxUtil.PATH_STRING_CONVERTER) ActionEvent(javafx.event.ActionEvent) ToggleGroup(javafx.scene.control.ToggleGroup) Component(org.springframework.stereotype.Component) LanguageInfo(com.faforever.client.preferences.LanguageInfo) Severity(com.faforever.client.notification.Severity) I18n(com.faforever.client.i18n.I18n) LocalizationPrefs(com.faforever.client.preferences.LocalizationPrefs) ChangeListener(javafx.beans.value.ChangeListener) ConfigurableBeanFactory(org.springframework.beans.factory.config.ConfigurableBeanFactory) Collections(java.util.Collections) LanguageInfo(com.faforever.client.preferences.LanguageInfo)

Example 2 with StringListCell

use of com.faforever.client.fx.StringListCell in project downlords-faf-client by FAForever.

the class CoopController method missionListCell.

private ListCell<CoopMission> missionListCell() {
    return new StringListCell<>(CoopMission::getName, mission -> {
        Text text = new Text();
        text.getStyleClass().add(UiService.CSS_CLASS_ICON);
        switch(mission.getCategory()) {
            case AEON:
                text.setText("\uE900");
                break;
            case CYBRAN:
                text.setText("\uE902");
                break;
            case UEF:
                text.setText("\uE904");
                break;
            default:
                return null;
        }
        return text;
    }, Pos.CENTER_LEFT, "coop-mission");
}
Also used : Text(javafx.scene.text.Text) StringListCell(com.faforever.client.fx.StringListCell)

Aggregations

StringListCell (com.faforever.client.fx.StringListCell)2 ChatColorMode (com.faforever.client.chat.ChatColorMode)1 Controller (com.faforever.client.fx.Controller)1 PATH_STRING_CONVERTER (com.faforever.client.fx.JavaFxUtil.PATH_STRING_CONVERTER)1 I18n (com.faforever.client.i18n.I18n)1 Action (com.faforever.client.notification.Action)1 NotificationService (com.faforever.client.notification.NotificationService)1 PersistentNotification (com.faforever.client.notification.PersistentNotification)1 Severity (com.faforever.client.notification.Severity)1 LanguageInfo (com.faforever.client.preferences.LanguageInfo)1 LocalizationPrefs (com.faforever.client.preferences.LocalizationPrefs)1 NotificationsPrefs (com.faforever.client.preferences.NotificationsPrefs)1 Preferences (com.faforever.client.preferences.Preferences)1 UnitDataBaseType (com.faforever.client.preferences.Preferences.UnitDataBaseType)1 PreferencesService (com.faforever.client.preferences.PreferencesService)1 TimeInfo (com.faforever.client.preferences.TimeInfo)1 ToastPosition (com.faforever.client.preferences.ToastPosition)1 Theme (com.faforever.client.theme.Theme)1 UiService (com.faforever.client.theme.UiService)1 DEFAULT_THEME (com.faforever.client.theme.UiService.DEFAULT_THEME)1