mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-26 10:20:51 +01:00
more
This commit is contained in:
parent
3d7b1fa7dd
commit
33afab4353
@ -55,6 +55,7 @@ public class InternalExtensionFormBuilder<L extends InternalExtensionFormLaunche
|
||||
extensionForm.extension = internalExtension;
|
||||
extensionForm.primaryStage = stage;
|
||||
|
||||
extensionForm.fieldsInitialized.fireEvent();
|
||||
GEarthExtension gEarthExtension = new InternalExtensionBuilder(internalExtension);
|
||||
observer.onExtensionProduced(gEarthExtension);
|
||||
|
||||
|
@ -27,13 +27,18 @@ public abstract class ThemedExtensionFormCreator extends ExtensionFormCreator {
|
||||
primaryStage.setResizable(false);
|
||||
primaryStage.sizeToScene();
|
||||
|
||||
DefaultTitleBarConfig config = new DefaultTitleBarConfig(primaryStage, ThemeFactory.getDefaultTheme()) {
|
||||
Theme defaultTheme = ThemeFactory.getDefaultTheme();
|
||||
DefaultTitleBarConfig config = new DefaultTitleBarConfig(primaryStage, defaultTheme) {
|
||||
@Override
|
||||
public boolean displayThemePicker() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
TitleBarController.create(primaryStage, config);
|
||||
Platform.runLater(() -> {
|
||||
primaryStage.getScene().getRoot().getStyleClass().add(defaultTheme.title().replace(" ", "-").toLowerCase());
|
||||
primaryStage.getScene().getRoot().getStyleClass().add(defaultTheme.isDark() ? "g-dark" : "g-light");
|
||||
});
|
||||
|
||||
ExtensionForm extensionForm = loader.getController();
|
||||
extensionForm.fieldsInitialized.addListener(() -> extensionForm.extension.observableHostInfo.addListener(hostInfo -> {
|
||||
@ -42,12 +47,18 @@ public abstract class ThemedExtensionFormCreator extends ExtensionFormCreator {
|
||||
Theme theme = ThemeFactory.themeForTitle(themeTitle);
|
||||
if (config.getCurrentTheme() != theme) {
|
||||
String styleClassOld = config.getCurrentTheme().title().replace(" ", "-").toLowerCase();
|
||||
String lightClassOld = config.getCurrentTheme().isDark() ? "g-dark" : "g-light";
|
||||
String styleClassNew = theme.title().replace(" ", "-").toLowerCase();
|
||||
String lightClassNew = theme.isDark() ? "g-dark" : "g-light";
|
||||
config.setTheme(theme);
|
||||
Parent currentRoot = primaryStage.getScene().getRoot();
|
||||
Platform.runLater(() -> {
|
||||
currentRoot.getStyleClass().remove(styleClassOld);
|
||||
currentRoot.getStyleClass().add(styleClassNew);
|
||||
if (!lightClassOld.equals(lightClassNew)) {
|
||||
currentRoot.getStyleClass().remove(lightClassOld);
|
||||
currentRoot.getStyleClass().add(lightClassNew);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,11 @@ public class DarkTheme implements Theme {
|
||||
return "G-Earth_Dark";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDark() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean overridesLogo() {
|
||||
return false;
|
||||
|
@ -11,6 +11,11 @@ public class LightTheme implements Theme {
|
||||
return "G-Earth";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDark() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean overridesLogo() {
|
||||
return true;
|
||||
|
@ -11,6 +11,11 @@ public class TanjiTheme implements Theme {
|
||||
return "Tanji";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDark() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean overridesLogo() {
|
||||
return false;
|
||||
|
@ -5,6 +5,7 @@ public interface Theme {
|
||||
String title();
|
||||
String internalName();
|
||||
|
||||
boolean isDark();
|
||||
boolean overridesLogo();
|
||||
boolean overridesTitle();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user