Search in sources :

Example 1 with Theme

use of com.google.gerrit.extensions.client.Theme in project gerrit by GerritCodeReview.

the class EditPreferencesBox method onTheme.

@UiHandler("theme")
void onTheme(@SuppressWarnings("unused") ChangeEvent e) {
    final Theme newTheme = Theme.valueOf(theme.getValue(theme.getSelectedIndex()));
    prefs.theme(newTheme);
    if (view != null) {
        ThemeLoader.loadTheme(newTheme, new GerritCallback<Void>() {

            @Override
            public void onSuccess(Void result) {
                view.setTheme(newTheme);
            }
        });
    }
}
Also used : Theme(com.google.gerrit.extensions.client.Theme) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Example 2 with Theme

use of com.google.gerrit.extensions.client.Theme in project gerrit by GerritCodeReview.

the class PreferencesBox method onTheme.

@UiHandler("theme")
void onTheme(@SuppressWarnings("unused") ChangeEvent e) {
    Theme newTheme = getSelectedTheme();
    prefs.theme(newTheme);
    if (view != null) {
        ThemeLoader.loadTheme(newTheme, new GerritCallback<Void>() {

            @Override
            public void onSuccess(Void result) {
                view.operation(() -> {
                    if (getSelectedTheme() == newTheme && isAttached()) {
                        String t = newTheme.name().toLowerCase();
                        view.getCmFromSide(DisplaySide.A).setOption("theme", t);
                        view.getCmFromSide(DisplaySide.B).setOption("theme", t);
                        view.setThemeStyles(newTheme.isDark());
                    }
                });
            }
        });
    }
}
Also used : Theme(com.google.gerrit.extensions.client.Theme) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Aggregations

Theme (com.google.gerrit.extensions.client.Theme)2 UiHandler (com.google.gwt.uibinder.client.UiHandler)2