Merge branch 'development'

This commit is contained in:
sirjonasxx 2022-02-17 01:03:41 +01:00
commit cc36cf39cc
96 changed files with 1282 additions and 680 deletions

View File

@ -3,67 +3,135 @@ package gearth;
import gearth.misc.AdminValidator;
import gearth.misc.Cacher;
import gearth.misc.UpdateChecker;
import gearth.misc.listenerpattern.Observable;
import gearth.misc.listenerpattern.ObservableObject;
import gearth.ui.GEarthController;
import gearth.ui.subforms.logger.loggerdisplays.PacketLogger;
import gearth.ui.themes.Theme;
import gearth.ui.themes.ThemeFactory;
import gearth.ui.titlebar.TitleBarConfig;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ToolBar;
import javafx.scene.image.Image;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import sun.misc.Cache;
import java.util.function.Consumer;
public class GEarth extends Application {
public static Application main;
public static GEarth main;
public static String version = "1.5.1";
public static String gitApi = "https://api.github.com/repos/sirjonasxx/G-Earth/releases/latest";
public static String theme = "G-Earth_Dark";
public static String[] themes = new String[] {"G-Earth", "Tanji", "G-Earth_Dark"};
public static ObservableObject<Theme> observableTheme;
private Stage stage;
private GEarthController controller;
static {
if (Cacher.getCacheContents().has("theme")) {
theme = Cacher.getCacheContents().getString("theme");
}
observableTheme = new ObservableObject<>(
Cacher.getCacheContents().has("theme") ?
ThemeFactory.themeForTitle(Cacher.getCacheContents().getString("theme")) :
ThemeFactory.getDefaultTheme()
);
}
@Override
public void start(Stage primaryStage) throws Exception{
main = this;
stage = primaryStage;
FXMLLoader loader = new FXMLLoader(getClass().getResource("/gearth/ui/G-Earth.fxml"));
Parent root = loader.load();
GEarthController companion = loader.getController();
companion.setStage(primaryStage);
primaryStage.initStyle(StageStyle.TRANSPARENT);
controller = loader.getController();
controller.setStage(primaryStage);
stage.initStyle(StageStyle.TRANSPARENT);
// https://stackoverflow.com/questions/20732100/javafx-why-does-stage-setresizablefalse-cause-additional-margins
// primaryStage.setScene(new Scene(root, 650, 295));
primaryStage.setScene(new Scene(root));
TitleBarController.create(primaryStage, new TitleBarConfig() {
@Override
public boolean displayThemePicker() {
return true;
}
@Override
public boolean displayMinimizeButton() {
return true;
}
// @Override
// public boolean allowResizing() {
// return false;
// }
@Override
public void onCloseClicked() {
closeGEarth();
}
@Override
public void onMinimizeClicked() {
stage.setIconified(true);
}
@Override
public void setTheme(Theme theme) {
setGearthTheme(theme);
}
@Override
public Theme getCurrentTheme() {
return observableTheme.getObject();
}
});
primaryStage.setResizable(false);
primaryStage.sizeToScene();
primaryStage.getScene().setFill(Color.TRANSPARENT);
companion.setTheme(theme);
setGearthTheme(observableTheme.getObject());
primaryStage.show();
primaryStage.setOnCloseRequest( event -> {
companion.exit();
Platform.exit();
// Platform.exit doesn't seem to be enough on Windows?
System.exit(0);
});
primaryStage.setOnCloseRequest(event -> closeGEarth());
AdminValidator.validate();
UpdateChecker.checkForUpdates();
}
private void closeGEarth() {
controller.exit();
Platform.exit();
System.exit(0);
}
private void setGearthTheme(Theme theme) {
Cacher.put("theme", theme.title());
observableTheme.setObject(theme);
Theme defaultTheme = ThemeFactory.getDefaultTheme();
// Platform.runLater(() -> {
stage.getScene().getStylesheets().clear();
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/ui/themes/%s/styling.css", theme.internalName())).toExternalForm());
stage.getIcons().clear();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/ui/themes/%s/logoSmall.png", theme.overridesLogo() ? theme.internalName() : defaultTheme.internalName()))));
stage.setTitle((theme.overridesTitle() ? theme.title() : defaultTheme.title()) + " " + GEarth.version);
controller.infoController.img_logo.setImage(new Image(GEarth.class.getResourceAsStream(
String.format(
"/gearth/ui/themes/%s/logo.png",
theme.overridesLogo() ? theme.internalName() : defaultTheme.internalName()
)
)));
controller.infoController.version.setText(stage.getTitle());
// });
}
public static String[] args;
public static void main(String[] args) {
@ -90,4 +158,12 @@ public class GEarth extends Application {
}
return null;
}
public static ObservableObject<Theme> getThemeObservable() {
return observableTheme;
}
public static Theme getTheme() {
return observableTheme.getObject();
}
}

View File

@ -1,5 +1,6 @@
package gearth.extensions;
import gearth.misc.HostInfo;
import gearth.services.packet_info.PacketInfoManager;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
@ -159,6 +160,8 @@ public abstract class Extension extends ExtensionBase {
}
else if (packet.headerId() == NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.INIT) {
delayed_init = packet.readBoolean();
HostInfo hostInfo = HostInfo.fromPacket(packet);
updateHostInfo(hostInfo);
if (!delayed_init) {
initExtension();
}
@ -177,7 +180,10 @@ public abstract class Extension extends ExtensionBase {
response.appendLongString(habboMessage.stringify());
writeToStream(response.toBytes());
}
else if (packet.headerId() == NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.UPDATEHOSTINFO) {
HostInfo hostInfo = HostInfo.fromPacket(packet);
updateHostInfo(hostInfo);
}
}

View File

@ -1,10 +1,13 @@
package gearth.extensions;
import gearth.misc.HostInfo;
import gearth.misc.listenerpattern.Observable;
import gearth.misc.listenerpattern.ObservableObject;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
import gearth.services.packet_info.PacketInfo;
import gearth.services.packet_info.PacketInfoManager;
import javafx.beans.property.ObjectProperty;
import org.reactfx.util.Lists;
import java.util.*;
@ -30,6 +33,11 @@ public abstract class ExtensionBase extends IExtension {
volatile PacketInfoManager packetInfoManager = PacketInfoManager.EMPTY;
ObservableObject<HostInfo> observableHostInfo = new ObservableObject<>(null);
void updateHostInfo(HostInfo hostInfo) {
observableHostInfo.setObject(hostInfo);
}
/**
* Register a listener on a specific packet Type
@ -187,4 +195,8 @@ public abstract class ExtensionBase extends IExtension {
public PacketInfoManager getPacketInfoManager() {
return packetInfoManager;
}
public HostInfo getHostInfo() {
return observableHostInfo.getObject();
}
}

View File

@ -1,12 +1,17 @@
package gearth.extensions;
import gearth.misc.HostInfo;
import gearth.misc.listenerpattern.Observable;
import gearth.services.packet_info.PacketInfoManager;
import javafx.application.HostServices;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.stage.Stage;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
import java.util.function.Consumer;
/**
* Created by Jonas on 22/09/18.
*/
@ -92,4 +97,10 @@ public abstract class ExtensionForm extends ExtensionBase {
public HostServices getHostServices() {
return hostServices;
}
public HostInfo getHostInfo() {
return extension.observableHostInfo.getObject();
}
Observable<Runnable> fieldsInitialized = new Observable<>(Runnable::run);
}

View File

@ -60,6 +60,7 @@ public class ExtensionFormLauncher extends Application {
extensionForm.extension = extension;
extensionForm.primaryStage = primaryStage;
extensionForm.fieldsInitialized.fireEvent();
Thread t = new Thread(() -> {
extension.run();
//when the extension has ended, close this process

View File

@ -1,6 +1,7 @@
package gearth.extensions;
import gearth.misc.HostInfo;
import gearth.services.packet_info.PacketInfoManager;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
@ -118,9 +119,11 @@ public class InternalExtensionBuilder extends GEarthExtension {
extension.onEndConnection();
}
@Override
public void init(boolean isConnected) {
public void init(boolean isConnected, HostInfo hostInfo) {
extension.initExtension();
extension.updateHostInfo(hostInfo);
} // not implementing isConnected, only relevant for g-python
@Override
@ -128,6 +131,11 @@ public class InternalExtensionBuilder extends GEarthExtension {
// no need in internal ext
}
@Override
public void updateHostInfo(HostInfo hostInfo) {
extension.updateHostInfo(hostInfo);
}
@Override
public void packetToStringResponse(String string, String expression) {
// no need in java ext

View File

@ -1,79 +0,0 @@
package gearth.extensions;
import gearth.GEarth;
import gearth.services.extension_handler.extensions.GEarthExtension;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
import javafx.application.Platform;
import javafx.stage.Stage;
public class InternalExtensionFormBuilder<L extends InternalExtensionFormLauncher<T>, T extends ExtensionForm> {
public T launch(L launcher, ExtensionProducerObserver observer) {
try {
Stage stage = new Stage();
T extensionForm = launcher.createForm(stage);
ExtensionInfo extInfo = extensionForm.getClass().getAnnotation(ExtensionInfo.class);
InternalExtension internalExtension = new InternalExtension() {
@Override
protected void initExtension() {
extensionForm.initExtension();
}
@Override
protected void onClick() {
extensionForm.onClick();
}
@Override
protected void onStartConnection() {
extensionForm.onStartConnection();
}
@Override
protected void onEndConnection() {
extensionForm.onEndConnection();
}
@Override
protected ExtensionInfo getInfoAnnotations() {
return extInfo;
}
@Override
protected boolean canLeave() {
return extensionForm.canLeave();
}
@Override
protected boolean canDelete() {
return extensionForm.canDelete();
}
};
extensionForm.hostServices = GEarth.main.getHostServices();
extensionForm.extension = internalExtension;
extensionForm.primaryStage = stage;
GEarthExtension gEarthExtension = new InternalExtensionBuilder(internalExtension);
observer.onExtensionProduced(gEarthExtension);
Platform.setImplicitExit(false);
stage.setOnCloseRequest(event -> {
event.consume();
Platform.runLater(() -> {
stage.hide();
extensionForm.onHide();
});
});
return extensionForm;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,10 @@
package gearth.extensions;
import javafx.stage.Stage;
public abstract class InternalExtensionFormCreator<T extends ExtensionForm> {
// creates an ExtensionForm object and initializes the JavaFX application
public abstract T createForm(Stage primaryStage) throws Exception;
}

View File

@ -1,10 +1,80 @@
package gearth.extensions;
import gearth.GEarth;
import gearth.services.extension_handler.extensions.GEarthExtension;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
import javafx.application.Platform;
import javafx.stage.Stage;
public abstract class InternalExtensionFormLauncher<T extends ExtensionForm> {
public class InternalExtensionFormLauncher<L extends InternalExtensionFormCreator<T>, T extends ExtensionForm> {
// creates an ExtensionForm object and initializes the JavaFX application
public abstract T createForm(Stage primaryStage) throws Exception;
public T launch(L launcher, ExtensionProducerObserver observer) {
try {
Stage stage = new Stage();
T extensionForm = launcher.createForm(stage);
ExtensionInfo extInfo = extensionForm.getClass().getAnnotation(ExtensionInfo.class);
InternalExtension internalExtension = new InternalExtension() {
@Override
protected void initExtension() {
extensionForm.initExtension();
}
@Override
protected void onClick() {
extensionForm.onClick();
}
@Override
protected void onStartConnection() {
extensionForm.onStartConnection();
}
@Override
protected void onEndConnection() {
extensionForm.onEndConnection();
}
@Override
protected ExtensionInfo getInfoAnnotations() {
return extInfo;
}
@Override
protected boolean canLeave() {
return extensionForm.canLeave();
}
@Override
protected boolean canDelete() {
return extensionForm.canDelete();
}
};
extensionForm.hostServices = GEarth.main.getHostServices();
extensionForm.extension = internalExtension;
extensionForm.primaryStage = stage;
extensionForm.fieldsInitialized.fireEvent();
GEarthExtension gEarthExtension = new InternalExtensionBuilder(internalExtension);
observer.onExtensionProduced(gEarthExtension);
Platform.setImplicitExit(false);
stage.setOnCloseRequest(event -> {
event.consume();
Platform.runLater(() -> {
stage.hide();
extensionForm.onHide();
});
});
return extensionForm;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,78 @@
package gearth.extensions;
import gearth.ui.themes.Theme;
import gearth.ui.themes.ThemeFactory;
import gearth.ui.titlebar.DefaultTitleBarConfig;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.net.URL;
public abstract class ThemedExtensionFormCreator extends ExtensionFormCreator {
@Override
protected ExtensionForm createForm(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader(getFormResource());
Parent root = loader.load();
primaryStage.setTitle(getTitle());
primaryStage.setScene(new Scene(root));
initialize(primaryStage);
primaryStage.setResizable(false);
primaryStage.sizeToScene();
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 -> {
if (hostInfo.getAttributes().containsKey("theme")) {
String themeTitle = hostInfo.getAttributes().get("theme");
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);
}
});
}
}
}));
return extensionForm;
}
protected abstract String getTitle();
protected abstract URL getFormResource();
// can be overridden for more settings
protected void initialize(Stage primaryStage) {
}
}

View File

@ -1,13 +1,13 @@
package gearth.misc;
import gearth.GEarth;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.image.Image;
import javafx.scene.control.Label;
import javafx.scene.layout.Region;
import javafx.stage.Stage;
import java.io.IOException;
import java.io.PrintStream;
import java.util.prefs.Preferences;
@ -46,13 +46,13 @@ public class AdminValidator {
new Thread(() -> {
if (!AdminValidator.isAdmin()) {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.WARNING, "G-Earth needs admin privileges in order to work on Flash, please restart G-Earth with admin permissions unless you're using Unity", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(false);
alert.show();
Alert alert = new Alert(Alert.AlertType.WARNING, "", ButtonType.OK);
alert.getDialogPane().setContent(new Label("G-Earth needs admin privileges in order to work on Flash,\nplease restart G-Earth with admin permissions unless\nyou're using Unity"));
try {
TitleBarController.create(alert).showAlert();
} catch (IOException e) {
e.printStackTrace();
}
});
}

View File

@ -26,9 +26,6 @@ public class ConfirmationDialog {
Alert alert = new Alert(type);
// Need to force the alert to layout in order to grab the graphic,
// as we are replacing the dialog pane with a custom pane
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
alert.getDialogPane().applyCss();
Node graphic = alert.getDialogPane().getGraphic();
// Create a new dialog pane that has a checkbox instead of the hide/show details button

View File

@ -0,0 +1,53 @@
package gearth.misc;
import gearth.protocol.HPacket;
import java.util.HashMap;
public class HostInfo {
private final String packetlogger;
private final String version;
private final HashMap<String, String> attributes;
public HostInfo(String packetlogger, String version, HashMap<String, String> attributes) {
this.packetlogger = packetlogger;
this.version = version;
this.attributes = attributes;
}
public static HostInfo fromPacket(HPacket packet) {
String packetlogger = packet.readString();
String version = packet.readString();
int attributeCount = packet.readInteger();
HashMap<String, String> attributes = new HashMap<>();
for (int i = 0; i < attributeCount; i++) {
String key = packet.readString();
String value = packet.readString();
attributes.put(key, value);
}
return new HostInfo(packetlogger, version, attributes);
}
public void appendToPacket(HPacket packet) {
packet.appendString(packetlogger);
packet.appendString(version);
packet.appendInt(attributes.size());
attributes.keySet().forEach(k -> {
packet.appendString(k);
packet.appendString(attributes.get(k));
});
}
public String getPacketlogger() {
return packetlogger;
}
public String getVersion() {
return version;
}
public HashMap<String, String> getAttributes() {
return attributes;
}
}

View File

@ -1,6 +1,7 @@
package gearth.misc;
import gearth.GEarth;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
@ -37,9 +38,6 @@ public class UpdateChecker {
boolean isForcedUpdate = body.contains("(!)");
Alert alert = new Alert(isForcedUpdate ? Alert.AlertType.ERROR : Alert.AlertType.INFORMATION, "G-Earth is outdated!", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
FlowPane fp = new FlowPane();
Label lbl = new Label("A new version of G-Earth has been found ("+gitv+")" + System.lineSeparator()+ System.lineSeparator() + "Update to the latest version:");
@ -62,7 +60,11 @@ public class UpdateChecker {
if (isForcedUpdate) {
alert.setOnCloseRequest(event -> System.exit(0));
}
alert.show();
try {
TitleBarController.create(alert).showAlert();
} catch (IOException e) {
e.printStackTrace();
}
});
}

View File

@ -0,0 +1,22 @@
package gearth.misc.listenerpattern;
import java.util.function.Consumer;
public class ObservableObject<T> extends Observable<Consumer<T>> {
private T object;
public ObservableObject(T object) {
super();
this.object = object;
}
public void setObject(T object) {
this.object = object;
fireEvent(c -> c.accept(object));
}
public T getObject() {
return object;
}
}

View File

@ -9,9 +9,11 @@ import gearth.protocol.connection.HStateSetter;
import gearth.protocol.connection.proxy.flash.NormalFlashProxyProvider;
import gearth.protocol.connection.proxy.flash.unix.LinuxRawIpFlashProxyProvider;
import gearth.protocol.connection.proxy.flash.windows.WindowsRawIpFlashProxyProvider;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.layout.Region;
import javafx.stage.Stage;
@ -105,15 +107,17 @@ public class ProxyProviderFactory {
}
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR, "G-Earth is already connected to this hotel. " +
Alert alert = new Alert(Alert.AlertType.ERROR, "", ButtonType.OK);
alert.getDialogPane().getChildren().add(new Label("G-Earth is already connected to this hotel.\n" +
"Due to current limitations you can only connect one session per hotel to G-Earth in Raw IP mode on Windows.\n\n" +
"You can bypass this by using a SOCKS proxy [Extra -> Advanced -> SOCKS]", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
"You can bypass this by using a SOCKS proxy [Extra -> Advanced -> SOCKS]"));
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(false);
alert.show();
try {
TitleBarController.create(alert).showAlert();
} catch (IOException e) {
e.printStackTrace();
}
});
return null;

View File

@ -11,9 +11,11 @@ import gearth.protocol.memory.Rc4Obtainer;
import gearth.protocol.packethandler.flash.IncomingFlashPacketHandler;
import gearth.protocol.packethandler.flash.OutgoingFlashPacketHandler;
import gearth.protocol.packethandler.flash.FlashPacketHandler;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.layout.Region;
import javafx.stage.Stage;
@ -123,13 +125,15 @@ public abstract class FlashProxyProvider implements ProxyProvider {
protected void showInvalidConnectionError() {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR, "You entered invalid connection information, G-Earth could not connect", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
Alert alert = new Alert(Alert.AlertType.ERROR, "", ButtonType.OK);
alert.getDialogPane().getChildren().add(new Label("You entered invalid connection information, G-Earth could not connect"));
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.setResizable(false);
alert.show();
try {
TitleBarController.create(alert).showAlert();
} catch (IOException e) {
e.printStackTrace();
}
});
}

View File

@ -10,6 +10,7 @@ import gearth.protocol.hostreplacer.hostsfile.HostReplacer;
import gearth.protocol.hostreplacer.hostsfile.HostReplacerFactory;
import gearth.protocol.portchecker.PortChecker;
import gearth.protocol.portchecker.PortCheckerFactory;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
@ -109,10 +110,11 @@ public class NormalFlashProxyProvider extends FlashProxyProvider {
Platform.runLater(() -> {
Alert a = new Alert(Alert.AlertType.ERROR, "The port is in use by " + processName,
ButtonType.OK);
Stage stage = (Stage) a.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
a.showAndWait();
try {
TitleBarController.create(a).showAlertAndWait();
} catch (IOException ex) {
ex.printStackTrace();
}
});
throw new IOException(e);
}

View File

@ -5,9 +5,11 @@ import gearth.misc.ConfirmationDialog;
import gearth.protocol.connection.proxy.nitro.NitroConstants;
import gearth.protocol.connection.proxy.nitro.os.NitroOsFunctions;
import gearth.protocol.connection.proxy.nitro.os.NitroOsFunctionsFactory;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import org.littleshoot.proxy.HttpProxyServer;
@ -16,6 +18,7 @@ import org.littleshoot.proxy.mitm.Authority;
import org.littleshoot.proxy.mitm.RootCertificateException;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicBoolean;
@ -51,16 +54,20 @@ public class NitroHttpProxy {
Platform.runLater(() -> {
Alert alert = ConfirmationDialog.createAlertWithOptOut(Alert.AlertType.WARNING, ADMIN_WARNING_KEY,
"Root certificate installation", null,
"G-Earth detected that you do not have the root certificate authority installed. " +
"This is required for Nitro to work, do you want to continue? " +
"G-Earth will ask you for Administrator permission if you do so.", "Remember my choice",
"", "Remember my choice",
ButtonType.YES, ButtonType.NO
);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
shouldInstall.set(alert.showAndWait().filter(t -> t == ButtonType.YES).isPresent());
alert.getDialogPane().setContent(new Label("G-Earth detected that you do not have the root certificate authority installed.\n" +
"This is required for Nitro to work, do you want to continue?\n" +
"G-Earth will ask you for Administrator permission if you do so."));
try {
shouldInstall.set(TitleBarController.create(alert).showAlertAndWait()
.filter(t -> t == ButtonType.YES).isPresent());
} catch (IOException e) {
e.printStackTrace();
}
waitForDialog.release();
});

View File

@ -10,6 +10,7 @@ import gearth.protocol.memory.habboclient.HabboClientFactory;
import gearth.protocol.packethandler.flash.BufferChangeListener;
import gearth.protocol.packethandler.flash.FlashPacketHandler;
import gearth.protocol.packethandler.PayloadBuffer;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
@ -18,9 +19,11 @@ import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
@ -82,9 +85,6 @@ public class Rc4Obtainer {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.WARNING, "Something went wrong!", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
FlowPane fp = new FlowPane();
Label lbl = new Label("G-Earth has experienced an issue" + System.lineSeparator()+ System.lineSeparator() + "Head over to our Troubleshooting page to solve the problem:");
@ -95,15 +95,16 @@ public class Rc4Obtainer {
event.consume();
});
WebView webView = new WebView();
webView.getEngine().loadContent("<html>G-Earth has experienced an issue<br><br>Head over to our Troubleshooting page to solve the problem:<br><a href=\"https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting\">https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting</a></html>");
webView.setPrefSize(500, 200);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.getDialogPane().setContent(fp);
alert.setOnCloseRequest(event -> {
GEarth.main.getHostServices().showDocument(link.getText());
});
alert.show();
try {
TitleBarController.create(alert).showAlert();
} catch (IOException e) {
e.printStackTrace();
}
});

View File

@ -1,6 +1,7 @@
package gearth.services.extension_handler;
import gearth.GEarth;
import gearth.misc.HostInfo;
import gearth.misc.listenerpattern.Observable;
import gearth.protocol.HConnection;
import gearth.protocol.HMessage;
@ -11,10 +12,12 @@ import gearth.services.extension_handler.extensions.GEarthExtension;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducer;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerFactory;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
import gearth.ui.themes.Theme;
import javafx.util.Pair;
import java.io.IOException;
import java.util.*;
import java.util.function.Consumer;
public class ExtensionHandler {
@ -44,6 +47,14 @@ public class ExtensionHandler {
}
private void initialize() {
GEarth.getThemeObservable().addListener(theme -> {
synchronized (gEarthExtensions) {
for (GEarthExtension extension : gEarthExtensions) {
extension.updateHostInfo(getHostInfo());
}
}
});
hConnection.getStateObservable().addListener((oldState, newState) -> {
if (newState == HState.CONNECTED) {
synchronized (gEarthExtensions) {
@ -241,7 +252,7 @@ public class ExtensionHandler {
extension.getClickedObservable().addListener(extension::doubleclick);
observable.fireEvent(l -> l.onExtensionConnect(extension));
extension.init(hConnection.getState() == HState.CONNECTED);
extension.init(hConnection.getState() == HState.CONNECTED, getHostInfo());
if (hConnection.getState() == HState.CONNECTED) {
extension.connectionStart(
hConnection.getDomain(),
@ -256,6 +267,16 @@ public class ExtensionHandler {
};
}
private HostInfo getHostInfo() {
HashMap<String, String> attributes = new HashMap<>();
attributes.put("theme", GEarth.getTheme().title());
return new HostInfo(
"G-Earth",
GEarth.version,
attributes
);
}
public List<ExtensionProducer> getExtensionProducers() {
return extensionProducers;
}

View File

@ -1,5 +1,6 @@
package gearth.services.extension_handler.extensions;
import gearth.misc.HostInfo;
import gearth.misc.listenerpattern.Observable;
import gearth.misc.listenerpattern.SynchronizedObservable;
import gearth.services.packet_info.PacketInfoManager;
@ -40,8 +41,9 @@ public abstract class GEarthExtension {
public abstract void provideFlags(String[] flags);
public abstract void connectionStart(String host, int port, String hotelVersion, String clientIdentifier, HClient clientType, PacketInfoManager packetInfoManager);
public abstract void connectionEnd();
public abstract void init(boolean isConnected);
public abstract void init(boolean isConnected, HostInfo hostInfo);
public abstract void close();
public abstract void updateHostInfo(HostInfo hostInfo);
public abstract void packetToStringResponse(String string, String expression);
public abstract void stringToPacketResponse(HPacket packet);
// ---------------------------------------------------------------

View File

@ -1,5 +1,6 @@
package gearth.services.extension_handler.extensions.implementations.network;
import gearth.misc.HostInfo;
import gearth.services.packet_info.PacketInfoManager;
import gearth.protocol.HMessage;
import gearth.protocol.connection.HClient;
@ -213,10 +214,12 @@ public class NetworkExtension extends GEarthExtension {
}
@Override
public void init(boolean isConnected) {
sendMessage(
new HPacket(NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.INIT, isConnected)
);
public void init(boolean isConnected, HostInfo hostInfo) {
HPacket initPacket = new HPacket(NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.INIT);
initPacket.appendBoolean(isConnected);
hostInfo.appendToPacket(initPacket);
sendMessage(initPacket);
}
@Override
@ -226,6 +229,13 @@ public class NetworkExtension extends GEarthExtension {
} catch (IOException ignored) { }
}
@Override
public void updateHostInfo(HostInfo hostInfo) {
HPacket packet = new HPacket(NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.UPDATEHOSTINFO);
hostInfo.appendToPacket(packet);
sendMessage(packet);
}
@Override
public void packetToStringResponse(String string, String expression) {
HPacket packet = new HPacket(NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.PACKETTOSTRING_RESPONSE);

View File

@ -88,6 +88,8 @@ public class NetworkExtensionInfo {
public static final int CONNECTIONEND = 6;
public static final int INIT = 7;
public static final int UPDATEHOSTINFO = 10;
public static final int PACKETTOSTRING_RESPONSE = 20;
public static final int STRINGTOPACKET_RESPONSE = 21;
}

View File

@ -2,10 +2,13 @@ package gearth.services.extension_handler.extensions.implementations.network.aut
import gearth.misc.ConfirmationDialog;
import gearth.services.extension_handler.extensions.implementations.network.NetworkExtension;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import java.io.IOException;
import java.util.*;
/**
@ -66,12 +69,20 @@ public class Authenticator {
Platform.runLater(() -> {
Alert alert = ConfirmationDialog.createAlertWithOptOut(Alert.AlertType.WARNING, connectExtensionKey
,"Confirmation Dialog", null,
"Extension \""+extension.getTitle()+"\" tries to connect but isn't known to G-Earth, accept this connection?", "Remember my choice",
"", "Remember my choice",
ButtonType.YES, ButtonType.NO
);
if (!(alert.showAndWait().filter(t -> t == ButtonType.YES).isPresent())) {
allowConnection[0] = false;
alert.getDialogPane().setContent(new Label("Extension \""+extension.getTitle()+"\" tries to connect but isn't known to G-Earth,\n" +
"accept this connection?"));
try {
if (!(TitleBarController.create(alert).showAlertAndWait()
.filter(t -> t == ButtonType.YES).isPresent())) {
allowConnection[0] = false;
}
} catch (IOException e) {
e.printStackTrace();
}
done[0] = true;
if (!ConfirmationDialog.showDialog(connectExtensionKey)) {

View File

@ -1,5 +1,6 @@
package gearth.services.extension_handler.extensions.implementations.simple;
import gearth.misc.HostInfo;
import gearth.services.packet_info.PacketInfoManager;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
@ -96,8 +97,9 @@ public class ExampleExtension extends GEarthExtension {
// the habbo connection has ended
}
@Override
public void init(boolean isConnected) {
public void init(boolean isConnected, HostInfo hostInfo) {
System.out.println("Example extension is connected to G-Earth");
// the extension is now connected with G-Earth
}
@ -110,7 +112,10 @@ public class ExampleExtension extends GEarthExtension {
hasClosed();
}
@Override
public void updateHostInfo(HostInfo hostInfo) {
}
// ignore these

View File

@ -1,10 +1,10 @@
package gearth.services.extension_handler.extensions.implementations.simple;
import gearth.extensions.InternalExtensionFormBuilder;
import gearth.extensions.InternalExtensionFormLauncher;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducer;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
import gearth.services.internal_extensions.extensionstore.GExtensionStore;
import gearth.services.internal_extensions.extensionstore.GExtensionStoreLauncher;
import gearth.services.internal_extensions.extensionstore.GExtensionStoreCreator;
public class SimpleExtensionProducer implements ExtensionProducer {
@ -14,8 +14,8 @@ public class SimpleExtensionProducer implements ExtensionProducer {
// uncomment the next line if you want to see an embedded example extension in G-Earth
// observer.onExtensionProduced(new ExampleExtension());
new InternalExtensionFormBuilder<GExtensionStoreLauncher, GExtensionStore>()
.launch(new GExtensionStoreLauncher(), observer);
new InternalExtensionFormLauncher<GExtensionStoreCreator, GExtensionStore>()
.launch(new GExtensionStoreCreator(), observer);
}
}

View File

@ -1,7 +1,8 @@
package gearth.services.g_python;
import gearth.GEarth;
import gearth.ui.extra.ExtraController;
import gearth.ui.subforms.extra.ExtraController;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
@ -170,9 +171,6 @@ public class GPythonShell {
private void showError() {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR, "G-Python error", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
alert.setTitle("G-Python error");
FlowPane fp = new FlowPane();
@ -188,7 +186,11 @@ public class GPythonShell {
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.getDialogPane().setContent(fp);
alert.show();
try {
TitleBarController.create(alert).showAlert();
} catch (IOException e) {
e.printStackTrace();
}
});
}

View File

@ -1,7 +1,7 @@
package gearth.services.internal_extensions.extensionstore;
import gearth.GEarth;
import gearth.extensions.InternalExtensionFormLauncher;
import gearth.extensions.InternalExtensionFormCreator;
import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController;
import gearth.ui.GEarthController;
import javafx.fxml.FXMLLoader;
@ -10,7 +10,7 @@ import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
public class GExtensionStoreLauncher extends InternalExtensionFormLauncher<GExtensionStore> {
public class GExtensionStoreCreator extends InternalExtensionFormCreator<GExtensionStore> {
@Override
public GExtensionStore createForm(Stage stage) throws Exception {
@ -26,8 +26,8 @@ public class GExtensionStoreLauncher extends InternalExtensionFormLauncher<GExte
stage.setHeight(530);
stage.setScene(new Scene(root));
stage.getScene().getStylesheets().add(GEarthController.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarthController.class.getResource("/gearth/ui/themes/G-Earth/styling.css").toExternalForm());
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream("/gearth/ui/themes/G-Earth/logoSmall.png")));
GExtensionStore gExtensionStore = new GExtensionStore();

View File

@ -11,12 +11,14 @@ import gearth.services.internal_extensions.extensionstore.repository.StoreReposi
import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension;
import gearth.services.internal_extensions.extensionstore.tools.InstalledExtension;
import gearth.services.internal_extensions.extensionstore.tools.StoreExtensionTools;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import org.apache.maven.artifact.versioning.ComparableVersion;
import org.w3c.dom.Element;
import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@ -114,7 +116,11 @@ public class StoreExtensionDetailsOverview extends HOverview {
alert.setHeaderText(header);
alert.setContentText(context);
alert.showAndWait();
try {
TitleBarController.create(alert).showAlertAndWait();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override

View File

@ -2,17 +2,10 @@ package gearth.services.internal_extensions.uilogger;
import gearth.extensions.ExtensionForm;
import gearth.extensions.ExtensionInfo;
import gearth.services.packet_info.PacketInfoManager;
import gearth.protocol.HConnection;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
import gearth.ui.logger.loggerdisplays.PacketLogger;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Modality;
import javafx.stage.Stage;
import gearth.ui.subforms.logger.loggerdisplays.PacketLogger;
@ExtensionInfo(
Title = "Packet Logger",

View File

@ -4,10 +4,9 @@ package gearth.services.internal_extensions.uilogger;
import gearth.misc.Cacher;
import gearth.services.internal_extensions.uilogger.hexdumper.Hexdump;
import gearth.services.packet_info.PacketInfo;
import gearth.services.packet_info.PacketInfoManager;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
import gearth.ui.logger.loggerdisplays.PacketLogger;
import gearth.ui.subforms.logger.loggerdisplays.PacketLogger;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.Initializable;
@ -18,7 +17,6 @@ import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
import org.fxmisc.flowless.VirtualizedScrollPane;
import org.fxmisc.richtext.StyleClassedTextArea;
import org.fxmisc.richtext.StyledTextArea;
import org.fxmisc.richtext.model.StyleSpansBuilder;
import java.io.BufferedWriter;

View File

@ -1,7 +1,6 @@
package gearth.services.internal_extensions.uilogger;
import gearth.GEarth;
import gearth.extensions.InternalExtensionFormLauncher;
import gearth.extensions.InternalExtensionFormCreator;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
@ -9,7 +8,7 @@ import javafx.scene.image.Image;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class UiLoggerLauncher extends InternalExtensionFormLauncher<UiLogger> {
public class UiLoggerCreator extends InternalExtensionFormCreator<UiLogger> {
@Override
public UiLogger createForm(Stage stage) throws Exception {
UiLogger uiLogger = new UiLogger();
@ -17,12 +16,12 @@ public class UiLoggerLauncher extends InternalExtensionFormLauncher<UiLogger> {
FXMLLoader loader = new FXMLLoader(UiLogger.class.getResource("UiLogger.fxml"));
Parent root = loader.load();
stage.setTitle(String.format("%s | Packet Logger", GEarth.theme));
stage.setTitle("G-Earth | Packet Logger");
stage.initModality(Modality.NONE);
stage.getIcons().add(new Image(getClass().getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/gearth/ui/themes/G-Earth/logoSmall.png")));
Scene scene = new Scene(root);
scene.getStylesheets().add(String.format("/gearth/themes/%s/styling.css", GEarth.theme));
scene.getStylesheets().add("/gearth/ui/themes/G-Earth/styling.css");
scene.getStylesheets().add("/gearth/services/internal_extensions/uilogger/logger.css");
UiLoggerController controller = loader.getController();
@ -30,6 +29,13 @@ public class UiLoggerLauncher extends InternalExtensionFormLauncher<UiLogger> {
controller.setStage(stage);
stage.setScene(scene);
// TitleBarController.create(stage, new DefaultTitleBarConfig(stage) {
// @Override
// public void onCloseClicked() {
// stage.hide();
//// uiLogger.onHide();
// }
// });
return uiLogger;
}
}

View File

@ -1,6 +1,6 @@
package gearth.services.scheduler;
import gearth.ui.scheduler.SchedulerController;
import gearth.ui.subforms.scheduler.SchedulerController;
/**
* Created by Jonas on 11/04/18.

View File

@ -2,6 +2,7 @@ package gearth.services.unity_tools;
import gearth.GEarth;
import gearth.misc.Cacher;
import gearth.ui.themes.ThemeFactory;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
@ -135,7 +136,7 @@ public class GUnityFileServer extends HttpServlet
private void getLogo(HttpServletResponse response) throws IOException {
OutputStream out = response.getOutputStream();
InputStream in = GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logo.png", GEarth.theme));
InputStream in = GEarth.class.getResourceAsStream(String.format("/gearth/ui/themes/%s/logo.png", ThemeFactory.getDefaultTheme().internalName()));
byte[] bytes = new byte[4096];
int bytesRead;

View File

@ -1,27 +1,22 @@
package gearth.ui;
import gearth.GEarth;
import gearth.protocol.connection.proxy.ProxyProviderFactory;
import gearth.protocol.connection.proxy.SocksConfiguration;
import gearth.ui.logger.loggerdisplays.PacketLoggerFactory;
import javafx.application.Platform;
import gearth.ui.subforms.logger.loggerdisplays.PacketLoggerFactory;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import gearth.protocol.HConnection;
import gearth.ui.connection.ConnectionController;
import gearth.ui.extensions.ExtensionsController;
import gearth.ui.info.InfoController;
import gearth.ui.injection.InjectionController;
import gearth.ui.logger.LoggerController;
import gearth.ui.scheduler.SchedulerController;
import gearth.ui.extra.ExtraController;
import gearth.ui.tools.ToolsController;
import gearth.ui.subforms.connection.ConnectionController;
import gearth.ui.subforms.extensions.ExtensionsController;
import gearth.ui.subforms.info.InfoController;
import gearth.ui.subforms.injection.InjectionController;
import gearth.ui.subforms.logger.LoggerController;
import gearth.ui.subforms.scheduler.SchedulerController;
import gearth.ui.subforms.extra.ExtraController;
import gearth.ui.subforms.tools.ToolsController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class GEarthController {
@ -43,9 +38,6 @@ public class GEarthController {
private List<SubForm> tabs = null;
public Pane titleBar;
public Label titleLabel;
public GEarthController() {
SocksConfiguration temporary_socks = new SocksConfiguration() {
public boolean useSocks() { return false; }
@ -123,54 +115,9 @@ public class GEarthController {
loggerController.miniLogText(color, text);
}
public void setTheme(String theme) {
GEarth.theme = theme;
getStage().getScene().getStylesheets().clear();
getStage().getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", theme)).toExternalForm());
getStage().getIcons().clear();
getStage().getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", theme))));
getStage().setTitle(theme.split("_")[0] + " " + GEarth.version);
titleLabel.setText(getStage().getTitle());
infoController.img_logo.setImage(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logo.png", theme))));
infoController.version.setText(getStage().getTitle());
}
public void exit() {
tabs.forEach(SubForm::exit);
hConnection.abort();
}
public void handleCloseAction(MouseEvent event) {
this.exit();
Platform.exit();
// Platform.exit doesn't seem to be enough on Windows?
System.exit(0);
}
public void handleMinimizeAction(MouseEvent event) {
getStage().setIconified(true);
}
private double xOffset, yOffset;
public void handleClickAction(MouseEvent event) {
xOffset = event.getSceneX();
yOffset = event.getSceneY();
}
public void handleMovementAction(MouseEvent event) {
getStage().setX(event.getScreenX() - xOffset);
getStage().setY(event.getScreenY() - yOffset);
}
public void toggleTheme(MouseEvent event) {
int themeIndex = Arrays.asList(GEarth.themes).indexOf(GEarth.theme);
setTheme(GEarth.themes[(themeIndex + 1) % GEarth.themes.length]);
}
}

View File

@ -1,4 +1,4 @@
package gearth.ui.connection;
package gearth.ui.subforms.connection;
import gearth.GEarth;
import gearth.misc.Cacher;

View File

@ -1,7 +1,8 @@
package gearth.ui.extensions;
package gearth.ui.subforms.extensions;
import gearth.services.extension_handler.extensions.ExtensionType;
import gearth.services.extension_handler.extensions.GEarthExtension;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
@ -9,7 +10,6 @@ import javafx.geometry.Pos;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.paint.Paint;
import javafx.scene.text.Font;
import gearth.misc.ConfirmationDialog;
import gearth.ui.buttons.*;
@ -18,6 +18,7 @@ import gearth.services.extension_handler.extensions.implementations.network.exec
import gearth.services.extension_handler.extensions.implementations.network.executer.ExtensionRunnerFactory;
import gearth.services.extension_handler.extensions.implementations.network.executer.NormalExtensionRunner;
import java.io.IOException;
import java.nio.file.Paths;
/**
@ -114,8 +115,13 @@ public class ExtensionItemContainer extends GridPane {
ButtonType.YES, ButtonType.NO
);
if (!(alert.showAndWait().filter(t -> t == ButtonType.YES).isPresent())) {
delet_dis = false;
try {
if (!(TitleBarController.create(alert).showAlertAndWait()
.filter(t -> t == ButtonType.YES).isPresent())) {
delet_dis = false;
}
} catch (IOException e) {
e.printStackTrace();
}
}
@ -143,9 +149,12 @@ public class ExtensionItemContainer extends GridPane {
parent.getChildren().add(this);
getStyleClass().clear();
getStyleClass().add("tableRowActive");
if (item.extensionType() == ExtensionType.INTERNAL) {
getStyleClass().clear();
getStyleClass().add("internalExtension");
getStyleClass().add("tableRowBlue");
}
@ -178,7 +187,7 @@ public class ExtensionItemContainer extends GridPane {
item.getDeletedObservable().addListener(() -> Platform.runLater(() -> {
if (item.isInstalledExtension()) {
getStyleClass().clear();
getStyleClass().add("disconnectedExtension");
getStyleClass().add("tableRowInactive");
getChildren().remove(buttonsBox);
add(additionalButtonBox, 4, 0);
reloadButton.setVisible(true);
@ -194,7 +203,7 @@ public class ExtensionItemContainer extends GridPane {
initExtension();
getStyleClass().clear();
getStyleClass().add("connectedExtension");
getStyleClass().add("tableRowActive");
getChildren().remove(additionalButtonBox);
if (buttonsBox != null) {
add(buttonsBox, 4, 0);

View File

@ -1,4 +1,4 @@
package gearth.ui.extensions;
package gearth.ui.subforms.extensions;
import gearth.services.extension_handler.extensions.GEarthExtension;
import javafx.scene.Node;

View File

@ -1,4 +1,4 @@
package gearth.ui.extensions;
package gearth.ui.subforms.extensions;
import gearth.services.extension_handler.ExtensionHandler;
import gearth.services.extension_handler.extensions.ExtensionListener;
@ -9,7 +9,7 @@ import gearth.services.extension_handler.extensions.implementations.network.exec
import gearth.services.extension_handler.extensions.implementations.network.executer.ExtensionRunnerFactory;
import gearth.services.g_python.GPythonShell;
import gearth.ui.SubForm;
import gearth.ui.extensions.logger.ExtensionLogger;
import gearth.ui.subforms.extensions.logger.ExtensionLogger;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.scene.control.*;

View File

@ -1,4 +1,4 @@
package gearth.ui.extensions.logger;
package gearth.ui.subforms.extensions.logger;
class Element {
final String text;

View File

@ -1,6 +1,9 @@
package gearth.ui.extensions.logger;
package gearth.ui.subforms.extensions.logger;
import gearth.GEarth;
import gearth.ui.titlebar.DefaultTitleBarConfig;
import gearth.ui.titlebar.GEarthThemedTitleBarConfig;
import gearth.ui.titlebar.TitleBarController;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
@ -21,7 +24,7 @@ public class ExtensionLogger {
volatile boolean isVisible = false;
public ExtensionLogger() {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/gearth/ui/extensions/logger/ExtensionLogger.fxml"));
FXMLLoader loader = new FXMLLoader(getClass().getResource("/gearth/ui/subforms/extensions/logger/ExtensionLogger.fxml"));
try {
Parent root = loader.load();
@ -35,26 +38,31 @@ public class ExtensionLogger {
stage = new Stage();
stage.setTitle(String.format("%s | Extension Console", GEarth.theme));
stage.setTitle("G-Earth | Extension Console");
stage.initModality(Modality.NONE);
stage.getIcons().add(new Image(getClass().getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.setAlwaysOnTop(true);
stage.setMinHeight(235);
stage.setMinWidth(370);
Scene scene = new Scene(root);
scene.getStylesheets().add(String.format("/gearth/themes/%s/styling.css", GEarth.theme));
scene.getStylesheets().add("/gearth/ui/extensions/logger/logger.css");
scene.getStylesheets().add("/gearth/ui/subforms/extensions/logger/logger.css");
ExtensionLoggerController controller = loader.getController();
controller.setStage(stage);
stage.setScene(scene);
// don't let the user close this window on their own
stage.setOnCloseRequest(windowEvent -> {
stage.hide();
isVisible = false;
TitleBarController.create(stage, new GEarthThemedTitleBarConfig(stage) {
@Override
public void onCloseClicked() {
stage.hide();
isVisible = false;
}
});
// // don't let the user close this window on their own
// stage.setOnCloseRequest(windowEvent -> {
// stage.hide();
// isVisible = false;
// });
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -1,8 +1,7 @@
package gearth.ui.extensions.logger;
package gearth.ui.subforms.extensions.logger;
import javafx.application.Platform;
import javafx.fxml.Initializable;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import org.fxmisc.flowless.VirtualizedScrollPane;
@ -25,12 +24,14 @@ public class ExtensionLoggerController implements Initializable {
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
area = new StyleClassedTextArea();
area.getStyleClass().add("white");
area.getStyleClass().add("themed-background");
area.setWrapText(true);
area.setEditable(false);
VirtualizedScrollPane<StyleClassedTextArea> vsPane = new VirtualizedScrollPane<>(area);
borderPane.setCenter(vsPane);
vsPane.getStyleClass().add("themed-background");
borderPane.getStyleClass().add("themed-background");
synchronized (appendOnLoad) {
initialized = true;
@ -74,7 +75,7 @@ public class ExtensionLoggerController implements Initializable {
text = s.substring(s.indexOf("]") + 1);
}
else {
classname = "black";
classname = "label";
text = s;
}
@ -82,7 +83,7 @@ public class ExtensionLoggerController implements Initializable {
int index = text.indexOf(" --> ") + 5;
String extensionAnnouncement = text.substring(0, index);
text = text.substring(index);
elements.add(new Element(extensionAnnouncement, "black"));
elements.add(new Element(extensionAnnouncement, "label"));
}
elements.add(new Element(text + "\n", classname.toLowerCase()));

View File

@ -1,4 +1,4 @@
package gearth.ui.extra;
package gearth.ui.subforms.extra;
import gearth.GEarth;
import gearth.misc.Cacher;
@ -9,7 +9,8 @@ import gearth.protocol.connection.proxy.SocksConfiguration;
import gearth.services.always_admin.AdminService;
import gearth.services.g_python.GPythonVersionUtils;
import gearth.ui.SubForm;
import gearth.ui.info.InfoController;
import gearth.ui.subforms.info.InfoController;
import gearth.ui.titlebar.TitleBarController;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.scene.control.*;
@ -20,6 +21,8 @@ import javafx.scene.layout.Region;
import javafx.stage.Stage;
import org.json.JSONObject;
import java.io.IOException;
/**
* Created by Jonas on 06/04/18.
*/
@ -175,9 +178,6 @@ public class ExtraController extends SubForm implements SocksConfiguration {
if (!GPythonVersionUtils.validInstallation()) {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.ERROR, "G-Python installation", ButtonType.OK);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/themes/%s/logoSmall.png", GEarth.theme))));
stage.getScene().getStylesheets().add(GEarth.class.getResource(String.format("/gearth/themes/%s/styling.css", GEarth.theme)).toExternalForm());
alert.setTitle("G-Python installation");
FlowPane fp = new FlowPane();
@ -192,7 +192,11 @@ public class ExtraController extends SubForm implements SocksConfiguration {
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.getDialogPane().setContent(fp);
alert.show();
try {
TitleBarController.create(alert).showAlert();
} catch (IOException e) {
e.printStackTrace();
}
cbx_gpython.setDisable(false);
});

View File

@ -1,14 +1,16 @@
package gearth.ui.info;
package gearth.ui.subforms.info;
import gearth.GEarth;
import gearth.ui.titlebar.TitleBarController;
import javafx.event.ActionEvent;
import javafx.scene.control.*;
import gearth.ui.SubForm;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import java.io.IOException;
/**
* Created by Jonas on 06/04/18.
@ -55,15 +57,20 @@ public class InfoController extends SubForm {
Alert alert = new Alert(Alert.AlertType.INFORMATION, "Donate Bitcoins", ButtonType.OK);
alert.setHeaderText("Donate Bitcoins");
WebView webView = new WebView();
webView.getEngine().loadContent("<html>Bitcoin public address:<br><br>" +
"<textarea>" + pubkey +"</textarea>" +
"</html>");
webView.setPrefSize(200, 100);
VBox test = new VBox();
test.getChildren().add(new Label("Bitcoin public address:"));
TextArea pubText = new TextArea(pubkey);
pubText.setPrefHeight(28);
pubText.setMaxWidth(250);
test.getChildren().add(pubText);
alert.setResizable(false);
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
alert.getDialogPane().setContent(webView);
alert.show();
alert.getDialogPane().setContent(test);
try {
TitleBarController.create(alert).showAlert();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -1,4 +1,4 @@
package gearth.ui.injection;
package gearth.ui.subforms.injection;
import gearth.misc.StringifyAble;
import gearth.protocol.HMessage;

View File

@ -1,4 +1,4 @@
package gearth.ui.injection;
package gearth.ui.subforms.injection;
import gearth.misc.Cacher;
import gearth.services.packet_info.PacketInfoManager;
@ -8,8 +8,6 @@ import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.scene.control.*;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.text.Text;
@ -20,7 +18,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class InjectionController extends SubForm {

View File

@ -1,4 +1,4 @@
package gearth.ui.logger;
package gearth.ui.subforms.logger;
import gearth.protocol.connection.HState;
import javafx.application.Platform;
@ -12,8 +12,8 @@ import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import gearth.protocol.HMessage;
import gearth.ui.SubForm;
import gearth.ui.logger.loggerdisplays.PacketLogger;
import gearth.ui.logger.loggerdisplays.PacketLoggerFactory;
import gearth.ui.subforms.logger.loggerdisplays.PacketLogger;
import gearth.ui.subforms.logger.loggerdisplays.PacketLoggerFactory;
import java.util.Calendar;

View File

@ -1,4 +1,4 @@
package gearth.ui.logger.loggerdisplays;
package gearth.ui.subforms.logger.loggerdisplays;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;

View File

@ -1,4 +1,4 @@
package gearth.ui.logger.loggerdisplays;
package gearth.ui.subforms.logger.loggerdisplays;
import gearth.protocol.HConnection;
import gearth.protocol.HMessage;

View File

@ -1,13 +1,13 @@
package gearth.ui.logger.loggerdisplays;
package gearth.ui.subforms.logger.loggerdisplays;
import gearth.GEarth;
import gearth.extensions.InternalExtensionFormBuilder;
import gearth.extensions.InternalExtensionFormLauncher;
import gearth.misc.OSValidator;
import gearth.services.extension_handler.ExtensionHandler;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducer;
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
import gearth.services.internal_extensions.uilogger.UiLogger;
import gearth.services.internal_extensions.uilogger.UiLoggerLauncher;
import gearth.services.internal_extensions.uilogger.UiLoggerCreator;
/**
* Created by Jonas on 04/04/18.
@ -40,8 +40,8 @@ public class PacketLoggerFactory implements ExtensionProducer {
@Override
public void startProducing(ExtensionProducerObserver observer) {
if (usesUIlogger()) {
uiLogger = new InternalExtensionFormBuilder<UiLoggerLauncher, UiLogger>()
.launch(new UiLoggerLauncher(), observer);
uiLogger = new InternalExtensionFormLauncher<UiLoggerCreator, UiLogger>()
.launch(new UiLoggerCreator(), observer);
}
}
}

View File

@ -1,4 +1,4 @@
package gearth.ui.logger.loggerdisplays;
package gearth.ui.subforms.logger.loggerdisplays;
import gearth.services.packet_info.PacketInfoManager;
import gearth.protocol.HConnection;

View File

@ -1,17 +1,14 @@
package gearth.ui.scheduler;
package gearth.ui.subforms.scheduler;
import gearth.misc.StringifyAble;
import gearth.misc.listenerpattern.Observable;
import gearth.protocol.HMessage;
import gearth.protocol.HPacket;
import gearth.services.scheduler.Interval;
import gearth.services.scheduler.ScheduleItem;
import gearth.services.scheduler.listeners.OnBeingUpdatedListener;
import gearth.services.scheduler.listeners.OnDeleteListener;
import gearth.services.scheduler.listeners.OnEditListener;
import gearth.services.scheduler.listeners.OnUpdatedListener;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
public class InteractableScheduleItem extends ScheduleItem implements StringifyAble {

View File

@ -1,6 +1,5 @@
package gearth.ui.scheduler;
package gearth.ui.subforms.scheduler;
import gearth.services.scheduler.ScheduleItem;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
@ -84,11 +83,21 @@ public class ScheduleItemContainer extends GridPane {
parent.getChildren().add(this);
getStyleClass().clear();
getStyleClass().add("tableRowActive");
GridPane this2 = this;
item.onDelete(() -> parent.getChildren().remove(this2));
item.onIsBeingUpdated(() -> setStyle("-fx-background-color: #faebcc;"));
item.onIsupdated(() -> setStyle("-fx-background-color: #ffffff;"));
item.onIsBeingUpdated(() -> {
getStyleClass().clear();
getStyleClass().add("tableRowBlue");
// setStyle("-fx-background-color: #faebcc;")
});
item.onIsupdated(() -> {
getStyleClass().clear();
getStyleClass().add("tableRowActive");
// setStyle("-fx-background-color: #ffffff;")
});
}
private Label initNewLabelColumn(String text) {

View File

@ -1,8 +1,7 @@
package gearth.ui.scheduler;
package gearth.ui.subforms.scheduler;
import com.tulskiy.keymaster.common.Provider;
import gearth.services.scheduler.Interval;
import gearth.services.scheduler.ScheduleItem;
import gearth.services.scheduler.Scheduler;
import javafx.application.Platform;
import javafx.event.ActionEvent;
@ -17,9 +16,7 @@ import gearth.ui.SubForm;
import javax.swing.*;
import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Created by Jonas on 06/04/18.

View File

@ -1,7 +1,6 @@
package gearth.ui.tools;
package gearth.ui.subforms.tools;
import gearth.services.packet_info.PacketInfoManager;
import gearth.protocol.HMessage;
import javafx.event.ActionEvent;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;

View File

@ -0,0 +1,7 @@
package gearth.ui.themes;
public class AnimeTheme {
// just kidding
}

View File

@ -0,0 +1,28 @@
package gearth.ui.themes;
public class DarkTheme implements Theme {
@Override
public String title() {
return "G-Earth Dark";
}
@Override
public String internalName() {
return "G-Earth_Dark";
}
@Override
public boolean isDark() {
return true;
}
@Override
public boolean overridesLogo() {
return false;
}
@Override
public boolean overridesTitle() {
return false;
}
}

View File

@ -0,0 +1,28 @@
package gearth.ui.themes;
public class LightTheme implements Theme {
@Override
public String title() {
return "G-Earth";
}
@Override
public String internalName() {
return "G-Earth";
}
@Override
public boolean isDark() {
return false;
}
@Override
public boolean overridesLogo() {
return true;
}
@Override
public boolean overridesTitle() {
return true;
}
}

View File

@ -0,0 +1,28 @@
package gearth.ui.themes;
public class TanjiTheme implements Theme {
@Override
public String title() {
return "Tanji";
}
@Override
public String internalName() {
return "Tanji";
}
@Override
public boolean isDark() {
return false;
}
@Override
public boolean overridesLogo() {
return false;
}
@Override
public boolean overridesTitle() {
return false;
}
}

View File

@ -0,0 +1,12 @@
package gearth.ui.themes;
public interface Theme {
String title();
String internalName();
boolean isDark();
boolean overridesLogo();
boolean overridesTitle();
}

View File

@ -0,0 +1,27 @@
package gearth.ui.themes;
import java.util.Arrays;
import java.util.List;
public class ThemeFactory {
private static List<Theme> themes = Arrays.asList(
new LightTheme(),
new TanjiTheme(),
new DarkTheme()
);
public static Theme getDefaultTheme() {
return themes.get(0);
}
public static List<Theme> allThemes() {
return themes;
}
// returns default theme if not found
public static Theme themeForTitle(String title) {
return allThemes().stream().filter(theme -> theme.title().equals(title)).findFirst().orElse(getDefaultTheme());
}
}

View File

@ -0,0 +1,74 @@
package gearth.ui.titlebar;
import gearth.GEarth;
import gearth.ui.themes.Theme;
import gearth.ui.themes.ThemeFactory;
import javafx.application.Platform;
import javafx.scene.image.Image;
import javafx.stage.Stage;
// a typical config to be used in all windows that is not the g-earth main window
public class DefaultTitleBarConfig implements TitleBarConfig {
protected Stage stage;
private String currentStylesheet = null;
private Theme currentTheme;
public DefaultTitleBarConfig(Stage stage) {
this(stage, ThemeFactory.getDefaultTheme());
}
public DefaultTitleBarConfig(Stage stage, Theme theme) {
this.stage = stage;
currentTheme = theme;
setTheme(theme);
}
@Override
public boolean displayThemePicker() {
return true;
}
@Override
public boolean displayMinimizeButton() {
return true;
}
// @Override
// public boolean allowResizing() {
// return false;
// }
@Override
public void onCloseClicked() {
stage.close();
}
@Override
public void onMinimizeClicked() {
stage.setIconified(true);
}
@Override
public void setTheme(Theme theme) {
currentTheme = theme;
Platform.runLater(() -> {
Theme defaultTheme = ThemeFactory.getDefaultTheme();
if (currentStylesheet != null) {
stage.getScene().getStylesheets().remove(currentStylesheet);
}
currentStylesheet = GEarth.class.getResource(String.format("/gearth/ui/themes/%s/styling.css", theme.internalName())).toExternalForm();
stage.getScene().getStylesheets().add(currentStylesheet);
stage.getIcons().clear();
stage.getIcons().add(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/ui/themes/%s/logoSmall.png", theme.overridesLogo() ? theme.internalName() : defaultTheme.internalName()))));
});
}
@Override
public Theme getCurrentTheme() {
return currentTheme;
}
}

View File

@ -0,0 +1,21 @@
package gearth.ui.titlebar;
import gearth.GEarth;
import gearth.ui.themes.Theme;
import javafx.stage.Stage;
import java.util.function.Consumer;
public class GEarthThemedTitleBarConfig extends DefaultTitleBarConfig {
public GEarthThemedTitleBarConfig(Stage stage) {
super(stage, GEarth.getTheme());
GEarth.getThemeObservable().addListener(this::setTheme);
}
@Override
public boolean displayThemePicker() {
return false;
}
}

View File

@ -0,0 +1,15 @@
package gearth.ui.titlebar;
import gearth.ui.themes.Theme;
public interface TitleBarConfig {
boolean displayThemePicker();
boolean displayMinimizeButton();
// boolean allowResizing();
void onCloseClicked();
void onMinimizeClicked();
void setTheme(Theme theme);
Theme getCurrentTheme();
}

View File

@ -0,0 +1,159 @@
package gearth.ui.titlebar;
import gearth.GEarth;
import gearth.ui.themes.ThemeFactory;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import java.io.IOException;
import java.util.Optional;
public class TitleBarController {
public Label titleLabel;
public Pane titleBar;
public ImageView titleIcon;
public ImageView themeBtn;
public ImageView minimizeBtn;
private Stage stage;
private TitleBarConfig config;
private Alert alert = null;
public static TitleBarController create(Stage stage, TitleBarConfig config) throws IOException {
FXMLLoader loader = new FXMLLoader(TitleBarController.class.getResource("Titlebar.fxml"));
Parent titleBar = loader.load();
TitleBarController controller = initNewController(loader, stage, config);
VBox newParent = new VBox(titleBar, stage.getScene().getRoot());
newParent.setId("titlebar-main-container");
stage.getScene().setRoot(newParent);
return controller;
}
public static TitleBarController create(Alert alert) throws IOException {
FXMLLoader loader = new FXMLLoader(TitleBarController.class.getResource("Titlebar.fxml"));
Parent titleBar = loader.load();
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
TitleBarConfig config = new GEarthThemedTitleBarConfig(stage) {
@Override
public boolean displayMinimizeButton() {
return false;
}
};
TitleBarController controller = initNewController(loader, stage, config);
controller.alert = alert;
Parent parent = alert.getDialogPane().getScene().getRoot();
VBox newParent = new VBox(titleBar, parent);
newParent.setId("titlebar-main-container");
stage.setScene(new Scene(newParent));
stage.getScene().setFill(Color.TRANSPARENT);
return controller;
}
private static TitleBarController initNewController(FXMLLoader loader, Stage stage, TitleBarConfig config) throws IOException {
TitleBarController controller = loader.getController();
controller.stage = stage;
controller.config = config;
stage.initStyle(StageStyle.TRANSPARENT);
stage.titleProperty().addListener((i) -> controller.setTitle(stage.getTitle()));
controller.setTitle(stage.getTitle());
stage.getIcons().addListener((InvalidationListener) observable -> controller.updateIcon());
controller.updateIcon();
Platform.runLater(() -> {
stage.getScene().setFill(Color.TRANSPARENT);
stage.getScene().getRoot().getStyleClass().add("root-node");
controller.themeBtn.setVisible(config.displayThemePicker());
if (!config.displayMinimizeButton()) {
((GridPane) controller.minimizeBtn.getParent()).getChildren().remove(controller.minimizeBtn);
}
});
return controller;
}
public void updateIcon() {
Platform.runLater(() -> titleIcon.setImage(stage.getIcons().size() > 0 ? stage.getIcons().get(0) :
new Image(GEarth.class.getResourceAsStream(
String.format("/gearth/ui/themes/%s/logoSmall.png", ThemeFactory.getDefaultTheme().internalName())))));
}
public void setTitle(String title) {
Platform.runLater(() -> titleLabel.setText(title));
}
public void handleCloseAction(MouseEvent event) {
config.onCloseClicked();
}
public void handleMinimizeAction(MouseEvent event) {
config.onMinimizeClicked();
}
private double xOffset, yOffset;
private boolean isMoving = false;
public void handleClickAction(MouseEvent event) {
xOffset = event.getSceneX();
yOffset = event.getSceneY();
isMoving = true;
}
public void handleMovementAction(MouseEvent event) {
if (isMoving) {
stage.setX(event.getScreenX() - xOffset);
stage.setY(event.getScreenY() - yOffset);
}
}
public void handleClickReleaseAction(MouseEvent mouseEvent) {
isMoving = false;
}
public void toggleTheme(MouseEvent event) {
int themeIndex = ThemeFactory.allThemes().indexOf(config.getCurrentTheme());
config.setTheme(ThemeFactory.allThemes().get((themeIndex + 1) % ThemeFactory.allThemes().size()));
}
public void showAlert() {
if (alert != null) {
alert.show();
Platform.runLater(() -> stage.sizeToScene());
}
}
public Optional<ButtonType> showAlertAndWait() {
if (alert != null) {
Platform.runLater(() -> stage.sizeToScene());
return alert.showAndWait();
}
return Optional.empty();
}
}

View File

@ -1,139 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane prefHeight="324.0" prefWidth="588.0" style="-fx-background-color: #FFFFFF;" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.services.internal_extensions.blockreplacepackets.BlockAndReplacePackets">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="276.0" minHeight="10.0" prefHeight="249.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="464.0" minWidth="10.0" prefWidth="464.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="283.0" minWidth="10.0" prefWidth="116.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane maxHeight="1.7976931348623157E308">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<children>
<GridPane prefHeight="41.0" prefWidth="580.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="191.0" minWidth="10.0" prefWidth="139.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="346.0" minWidth="10.0" prefWidth="50.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="314.0" minWidth="10.0" prefWidth="148.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="314.0" minWidth="10.0" prefWidth="110.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="52.0" prefWidth="78.0" text="Value:" GridPane.columnIndex="1" />
<TextField fx:id="txt_value" prefHeight="25.0" prefWidth="106.0" GridPane.columnIndex="2">
<GridPane.margin>
<Insets left="5.0" right="5.0" />
</GridPane.margin>
</TextField>
<ComboBox fx:id="cmb_type" maxWidth="1.7976931348623157E308">
<GridPane.margin>
<Insets left="5.0" right="5.0" />
</GridPane.margin>
</ComboBox>
<ComboBox fx:id="cmb_side" maxWidth="1.7976931348623157E308" GridPane.columnIndex="3">
<GridPane.margin>
<Insets left="5.0" right="5.0" />
</GridPane.margin>
</ComboBox>
</children>
<GridPane.margin>
<Insets right="10.0" />
</GridPane.margin>
</GridPane>
<GridPane prefHeight="45.0" prefWidth="546.0" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="153.0" minWidth="10.0" prefWidth="88.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="373.0" minWidth="10.0" prefWidth="366.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="1.7976931348623157E308" />
</rowConstraints>
<children>
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="32.0" prefWidth="99.0" text="Replace with:" />
<TextField fx:id="txt_replacement" disable="true" GridPane.columnIndex="1">
<GridPane.margin>
<Insets left="5.0" right="5.0" />
</GridPane.margin>
</TextField>
</children>
<GridPane.margin>
<Insets bottom="10.0" right="10.0" />
</GridPane.margin>
</GridPane>
</children>
<rowConstraints>
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="39.0" prefHeight="47.0" />
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="41.0" prefHeight="41.0" />
</rowConstraints>
<GridPane.margin>
<Insets />
</GridPane.margin>
</GridPane>
<Button fx:id="btn_add" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#click_btnAddRule" text="Add" GridPane.columnIndex="1">
<GridPane.margin>
<Insets bottom="7.0" left="5.0" top="5.0" />
</GridPane.margin>
</Button>
</children>
<GridPane.margin>
<Insets bottom="5.0" />
</GridPane.margin>
</GridPane>
<ScrollPane fx:id="scrollpane" hbarPolicy="NEVER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" style="-fx-border-color: #888888; -fx-background: #FFFFFF; -fx-border-radius: 4px;" vbarPolicy="ALWAYS">
<content>
<VBox fx:id="vbox" maxHeight="1.7976931348623157E308" prefWidth="574.0">
<children>
<GridPane fx:id="header" gridLinesVisible="true">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="163.0" minWidth="10.0" percentWidth="12.0" prefWidth="57.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="190.0" minWidth="10.0" percentWidth="14.0" prefWidth="189.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="118.0" minWidth="10.0" percentWidth="18.0" prefWidth="66.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="100.0" minWidth="10.0" percentWidth="33.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="100.0" minWidth="10.0" percentWidth="15.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="100.0" minWidth="10.0" percentWidth="6.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<VBox.margin>
<Insets bottom="-2.0" left="-2.0" right="-2.0" top="-2.0" />
</VBox.margin>
<children>
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" style="-fx-text-fill: #666666; -fx-background-color: #F7F7F7;" text="Option" />
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" style="-fx-text-fill: #666666; -fx-background-color: #F7F7F7;" text="Type" GridPane.columnIndex="1" />
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" style="-fx-text-fill: #666666; -fx-background-color: #F7F7F7;" text="Value" GridPane.columnIndex="2" />
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" style="-fx-text-fill: #666666; -fx-background-color: #F7F7F7;" text="Replacement" GridPane.columnIndex="3" />
<Label alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" style="-fx-text-fill: #666666; -fx-background-color: #F7F7F7;" text="Destination" GridPane.columnIndex="4" />
<Label alignment="CENTER" layoutX="564.0" layoutY="10.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" style="-fx-text-fill: #666666; -fx-background-color: #F7F7F7;" text=" " GridPane.columnIndex="5" />
</children>
</GridPane>
</children>
</VBox>
</content>
<GridPane.margin>
<Insets bottom="8.0" />
</GridPane.margin>
</ScrollPane>
</children>
<padding>
<Insets left="10.0" right="10.0" top="8.0" />
</padding>
</GridPane>

View File

@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane fx:id="grid" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="442.0" prefWidth="620.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.services.internal_extensions.packetinfoexplorer.PacketInfoExplorer">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="80.0" minHeight="80.0" prefHeight="80.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" prefHeight="360.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane style="-fx-border-width: 1px 0 0 0; -fx-border-color: #bbb;">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="105.0" minWidth="105.0" prefWidth="105.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="245.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="100.0" minWidth="100.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="100.0" minWidth="100.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="20.0" minHeight="20.0" prefHeight="20.0" vgrow="SOMETIMES" />
</rowConstraints>
<padding>
<Insets left="10.0" right="10.0" />
</padding>
<children>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Filter headerId:" textFill="#000000d3" />
<TextField fx:id="txt_filterHeaderId" GridPane.rowIndex="1" />
</children>
</GridPane>
<GridPane style="-fx-border-color: #bbb; -fx-border-width: 0 0 0 1px;" GridPane.columnIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="20.0" minHeight="20.0" prefHeight="20.0" vgrow="SOMETIMES" />
</rowConstraints>
<padding>
<Insets left="10.0" right="10.0" />
</padding>
<children>
<TextField fx:id="txt_filterNameHash" GridPane.rowIndex="1" />
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Filter name or hash:" textFill="#000000d3" />
</children>
</GridPane>
<GridPane prefHeight="100.0" prefWidth="101.0" style="-fx-border-color: #bbb; -fx-border-width: 0 0 0 1px;" GridPane.columnIndex="3">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="78.0" minHeight="10.0" prefHeight="70.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane fx:id="source_grid" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Filter source:" textFill="#000000d3" />
</children>
<padding>
<Insets left="5.0" right="5.0" />
</padding>
</GridPane>
<GridPane style="-fx-border-width: 0 0 0 1px; -fx-border-color: #bbb;" GridPane.columnIndex="2">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<CheckBox fx:id="chk_toClient" mnemonicParsing="false" selected="true" text="TOCLIENT" />
<CheckBox fx:id="chk_toServer" layoutX="10.0" layoutY="17.0" mnemonicParsing="false" selected="true" text="TOSERVER" GridPane.rowIndex="1" />
</children>
</GridPane>
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Filter direction:" textFill="#000000d3" />
</children>
<padding>
<Insets left="5.0" right="5.0" />
</padding>
</GridPane>
</children>
</GridPane>
</children>
</GridPane>

View File

@ -13,7 +13,7 @@
<CheckMenuItem fx:id="chkAlwaysOnTop" mnemonicParsing="false" onAction="#toggleAlwaysOnTop" text="Always on top" />
<Menu mnemonicParsing="false" text="On connect">
<items>
<CheckMenuItem fx:id="chkOpenOnConnect" mnemonicParsing="false" selected="true" text="Open window" />
<CheckMenuItem fx:id="chkOpenOnConnect" mnemonicParsing="false" text="Open window" />
<CheckMenuItem fx:id="chkResetOnConnect" mnemonicParsing="false" selected="true" text="Reset packetlogger" />
</items>
</Menu>
@ -26,7 +26,7 @@
</items>
</Menu>
<Menu mnemonicParsing="false" text="View">
<CheckMenuItem fx:id="chkViewIncoming" mnemonicParsing="false" selected="true" text="View Incoming">
<CheckMenuItem fx:id="chkViewIncoming" mnemonicParsing="false" text="View Incoming">
<accelerator>
<KeyCodeCombination alt="UP" code="I" control="DOWN" meta="UP" shift="UP" shortcut="UP" />
</accelerator></CheckMenuItem>

View File

@ -1,64 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<!--maxHeight="19.0" minHeight="19.0"-->
<VBox id="main-window" prefWidth="650.0" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.GEarthController">
<Pane id="title-bar" fx:id="titleBar" maxHeight="25.0" onMouseDragged="#handleMovementAction" onMousePressed="#handleClickAction" prefHeight="25.0" prefWidth="200.0">
<children>
<ImageView id="close-button" fitHeight="25.0" fitWidth="50.0" layoutX="601.0" onMouseClicked="#handleCloseAction" onTouchPressed="#handleCloseAction" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@titlebar/files/closeButton.png" />
</image>
</ImageView>
<ImageView id="minimize-button" fitHeight="25.0" fitWidth="50.0" layoutX="551.0" onMouseClicked="#handleMinimizeAction" onTouchPressed="#handleMinimizeAction" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@titlebar/files/minimizeButton.png" />
</image>
</ImageView>
<ImageView id="icon" fitHeight="16.0" fitWidth="16.0" layoutX="7.0" layoutY="5.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../themes/G-Earth/logoSmall.png" />
</image>
</ImageView>
<Label fx:id="titleLabel" layoutX="23.0" layoutY="5.0" text="G-Earth 1.5.1">
<padding>
<Insets left="2.0" />
</padding>
</Label>
<ImageView id="theme-button" fitHeight="20.0" fitWidth="38.0" layoutX="505.0" layoutY="3.0" onMouseClicked="#toggleTheme" onTouchPressed="#toggleTheme" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../themes/G-Earth/themeButton.png" />
</image></ImageView>
</children></Pane>
<VBox prefWidth="650.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.GEarthController">
<TabPane id="main-tab-pane" fx:id="tabBar" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="295.0" prefWidth="650.0" tabClosingPolicy="UNAVAILABLE">
<Tab text="Connection">
<fx:include fx:id="connection" source="connection/Connection.fxml" />
<fx:include fx:id="connection" source="subforms/connection/Connection.fxml" />
</Tab>
<Tab fx:id="tab_Logger" text="Logger">
<fx:include fx:id="logger" source="logger/Logger.fxml" />
<fx:include fx:id="logger" source="subforms/logger/Logger.fxml" />
</Tab>
<Tab text="Injection">
<fx:include fx:id="injection" source="injection/Injection.fxml" />
<fx:include fx:id="injection" source="subforms/injection/Injection.fxml" />
</Tab>
<Tab text="Tools">
<fx:include fx:id="tools" source="tools/Tools.fxml" />
<fx:include fx:id="tools" source="subforms/tools/Tools.fxml" />
</Tab>
<Tab text="Scheduler">
<fx:include fx:id="scheduler" source="scheduler/Scheduler.fxml" />
<fx:include fx:id="scheduler" source="subforms/scheduler/Scheduler.fxml" />
</Tab>
<Tab text="Extensions">
<fx:include fx:id="extensions" source="extensions/Extensions.fxml" />
<fx:include fx:id="extensions" source="subforms/extensions/Extensions.fxml" />
</Tab>
<Tab text="Extra">
<fx:include fx:id="extra" source="extra/Extra.fxml" />
<fx:include fx:id="extra" source="subforms/extra/Extra.fxml" />
</Tab>
<Tab text="Info">
<fx:include fx:id="info" source="info/Info.fxml" />
<fx:include fx:id="info" source="subforms/info/Info.fxml" />
</Tab>
</TabPane>

View File

@ -5,7 +5,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<GridPane alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.connection.ConnectionController">
<GridPane alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.subforms.connection.ConnectionController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>

View File

@ -4,7 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.extensions.ExtensionsController">
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.subforms.extensions.ExtensionsController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="277.0" />
</columnConstraints>

View File

@ -3,7 +3,7 @@
<?import javafx.geometry.*?>
<?import javafx.scene.layout.*?>
<BorderPane fx:id="borderPane" prefHeight="230.0" prefWidth="394.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.extensions.logger.ExtensionLoggerController">
<BorderPane fx:id="borderPane" prefHeight="230.0" prefWidth="394.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.subforms.extensions.logger.ExtensionLoggerController">
<padding>
<Insets bottom="1.0" left="5.0" right="1.0" top="5.0" />
</padding>

View File

@ -64,7 +64,7 @@
}
.label {
-fx-text-fill: #000000 !important;
/*-fx-text-fill: #000000 !important;*/
}
.scroll-bar:vertical {

View File

@ -4,7 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.extra.ExtraController">
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.subforms.extra.ExtraController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="331.0" minWidth="10.0" prefWidth="318.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="390.0" minWidth="10.0" prefWidth="247.0" />

View File

@ -5,7 +5,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.info.InfoController">
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.subforms.info.InfoController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="332.0" />
</columnConstraints>

View File

@ -5,7 +5,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<GridPane prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.injection.InjectionController">
<GridPane prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.subforms.injection.InjectionController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="180.0" minWidth="180.0" prefWidth="180.0" />

View File

@ -14,7 +14,7 @@
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="gearth.ui.logger.LoggerController">
fx:controller="gearth.ui.subforms.logger.LoggerController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="293.0" minWidth="10.0" prefWidth="242.0"/>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="390.0" minWidth="10.0" prefWidth="323.0"/>

View File

@ -4,7 +4,7 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.scheduler.SchedulerController">
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.subforms.scheduler.SchedulerController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="277.0" />
</columnConstraints>

View File

@ -12,7 +12,7 @@
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="gearth.ui.tools.ToolsController">
fx:controller="gearth.ui.subforms.tools.ToolsController">
<rowConstraints>
<RowConstraints maxHeight="158.0" minHeight="10.0" prefHeight="134.0" vgrow="SOMETIMES"/>
<RowConstraints maxHeight="141.0" minHeight="10.0" prefHeight="128.0" vgrow="SOMETIMES"/>

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 569 KiB

After

Width:  |  Height:  |  Size: 569 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -1,4 +1,4 @@
#main-window {
#titlebar-main-container {
-fx-body-color : transparent;
-fx-background-radius: 15;
-fx-outer-border : #cecece;
@ -6,6 +6,19 @@
-fx-border-radius: 11;
-fx-border-width: 0 1 1 1;
}
.themed-background {
-fx-background-color: white;
}
.themed-background2 {
-fx-background-color: #f4f4f4;
}
.root-node > * {
-fx-background-color: white;
-fx-background-radius: 0 0 10 10;
}
.button,.menu-button,.toggle-button,.split-menu-button {
-fx-font-size: 14;
-fx-background-radius: 4;
@ -57,7 +70,7 @@
.info > .label,
.warning > .label,
.danger > .label {
-fx-text-fill: white;
-fx-text-fill: black;
}
.action-btn {
@ -689,7 +702,7 @@ VBox > .split-menu-button.last > .arrow-button {
}
.titled-pane.primary {
-fx-text-fill: white;
-fx-text-fill: black;
}
.titled-pane.primary > .title {
@ -903,15 +916,15 @@ VBox > .split-menu-button.last > .arrow-button {
-fx-text-fill: #0096c8;
}
.internalExtension {
.tableRowBlue {
-fx-background-color: #F0FFFF;
}
.disconnectedExtension {
.tableRowInactive {
-fx-background-color: #CCCCCC;
}
.connectedExtension {
.tableRowActive {
-fx-background-color: #FFFFFF;
}
@ -921,39 +934,43 @@ VBox > .split-menu-button.last > .arrow-button {
}
#close-button {
-fx-image: url("../../ui/titlebar/files/closeButton.png");
-fx-image: url("../../titlebar/files/closeButton.png");
}
#close-button:hover {
-fx-image: url("../../ui/titlebar/files/closeButtonHover.png");
-fx-image: url("../../titlebar/files/closeButtonHover.png");
}
#close-button:pressed {
-fx-image: url("../../ui/titlebar/files/closeButtonPressed.png");
-fx-image: url("../../titlebar/files/closeButtonPressed.png");
}
#minimize-button {
-fx-image: url("../../ui/titlebar/files/minimizeButton.png");
-fx-image: url("../../titlebar/files/minimizeButton.png");
}
#minimize-button:hover {
-fx-image: url("../../ui/titlebar/files/minimizeButtonHover.png");
-fx-image: url("../../titlebar/files/minimizeButtonHover.png");
}
#minimize-button:pressed {
-fx-image: url("../../ui/titlebar/files/minimizeButtonPressed.png");
-fx-image: url("../../titlebar/files/minimizeButtonPressed.png");
}
#main-tab-pane, #main-tab-pane > * {
-fx-background-radius: 0 0 10 10;
}
.root-node {
-fx-background-radius: 0 0 10 10;
}
#icon {
-fx-image: url("./logoSmall.png");
/*-fx-image: url("logoSmall.png");*/
}
#theme-button {
-fx-image: url("./themeButton.png");
-fx-image: url("themeButton.png");
}
.corrupted-label {
@ -968,6 +985,10 @@ VBox > .split-menu-button.last > .arrow-button {
-fx-text-fill: black;
}
.label.softer {
-fx-text-fill: rgba(0, 0, 0, 0.8);
}
.list-view {
-fx-border-color: #cccccc;
-fx-border-radius: 4;

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 569 KiB

After

Width:  |  Height:  |  Size: 569 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -1,4 +1,4 @@
#main-window {
#titlebar-main-container {
-fx-body-color : transparent;
-fx-background-radius: 15;
-fx-outer-border: #222222;
@ -8,6 +8,18 @@
-fx-border-width: 0 1 1 1;
}
.themed-background {
-fx-background-color: #363636;
}
.themed-background2 {
-fx-background-color: #222222;
}
.root-node > * {
-fx-background-color: #363636;
-fx-background-radius: 0 0 10 10;
}
.button,.menu-button,.toggle-button,.split-menu-button {
-fx-font-size: 14;
-fx-background-radius: 4;
@ -925,15 +937,15 @@ VBox > .split-menu-button.last > .arrow-button {
-fx-text-fill: #0096c8;
}
.internalExtension {
.tableRowBlue {
-fx-background-color: #3d5b69;
}
.disconnectedExtension {
.tableRowInactive {
-fx-background-color: #5e5e5e;
}
.connectedExtension {
.tableRowActive {
-fx-background-color: #525252;
}
@ -960,49 +972,52 @@ VBox > .split-menu-button.last > .arrow-button {
}
#close-button {
-fx-image: url("../../ui/titlebar/files/closeButtonDark.png");
-fx-image: url("../../titlebar/files/closeButtonDark.png");
-fx-padding: 10;
-fx-background-color: firebrick;
}
#close-button:hover {
-fx-image: url("../../ui/titlebar/files/closeButtonHover.png");
-fx-image: url("../../titlebar/files/closeButtonHover.png");
-fx-background-color: #e81123;
}
#close-button:pressed {
-fx-image: url("../../ui/titlebar/files/closeButtonPressed.png");
-fx-image: url("../../titlebar/files/closeButtonPressed.png");
-fx-background-color: rgba(232, 17, 35, 0.8);
}
#minimize-button {
-fx-image: url("../../ui/titlebar/files/minimizeButtonDark.png");
-fx-image: url("../../titlebar/files/minimizeButtonDark.png");
}
#minimize-button:hover {
-fx-image: url("../../ui/titlebar/files/minimizeButtonDarkHover.png");
-fx-image: url("../../titlebar/files/minimizeButtonDarkHover.png");
}
#minimize-button:pressed {
-fx-image: url("../../ui/titlebar/files/minimizeButtonDarkPressed.png");
-fx-image: url("../../titlebar/files/minimizeButtonDarkPressed.png");
}
#main-tab-pane, #main-tab-pane > * {
-fx-background-radius: 0 0 10 10;
}
.root-node {
-fx-background-radius: 0 0 10 10;
}
#icon {
-fx-image: url("./logoSmall.png");
/*-fx-image: url("logoSmall.png");*/
}
#theme-button {
-fx-image: url("./themeButton.png");
-fx-image: url("themeButton.png");
}
/* Error window */
.dialog-pane {
-fx-background-color: #333333;
-fx-background-radius: 0;
}
.dialog-pane:header .header-panel {
@ -1031,6 +1046,10 @@ VBox > .split-menu-button.last > .arrow-button {
-fx-text-fill: #f0f0f0 !important;
}
.label.softer {
-fx-text-fill: rgba(240, 240, 240, 0.8);
}
.pckt-info {
-fx-fill: #ffffffa0;
}
@ -1041,4 +1060,56 @@ VBox > .split-menu-button.last > .arrow-button {
.not-corrupted-label {
-fx-fill: #8cff8c;
}
.table-view {
-fx-background-color: rgba(20, 20, 20, 0.4);
}
.table-view .table-cell{
-fx-text-fill: #f0f0f0;
}
.table-row-cell{
-fx-background-color: #313131;
}
.table-view .column-header {
-fx-background-color: #212121;
}
.table-view .table-cell{
-fx-border-color: #262626;
-fx-border-width: 0.5;
}
.table-row-cell:selected, .list-cell:selected {
-fx-background-color: #364349;
}
.table-view:focused .table-row-cell:selected, .list-view:focused .list-cell:selected {
-fx-background-color: #3d5b69;
}
.spinner .increment-arrow-button,
.spinner .decrement-arrow-button {
-fx-body-color: #262626;
}
.spinner .increment-arrow-button .increment-arrow,
.spinner .decrement-arrow-button .decrement-arrow {
-fx-background-color: #d7d7d7;
}
.slider .track {
-fx-background-color: #222222;
-fx-border-radius: 5;
-fx-border-color: rgba(240, 240, 240, 0.8);
}
.slider .thumb {
-fx-background-color: #222222;
-fx-border-radius: 10;
-fx-border-color: rgba(240, 240, 240, 0.8);
}

View File

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -1,4 +1,4 @@
#main-window {
#titlebar-main-container {
-fx-body-color : transparent;
-fx-background-radius: 15;
-fx-outer-border : #cecece;
@ -7,6 +7,18 @@
-fx-border-width: 0 1 1 1;
}
.themed-background {
-fx-background-color: white;
}
.themed-background2 {
-fx-background-color: #f4f4f4;
}
.root-node > * {
-fx-background-color: white;
-fx-background-radius: 0 0 10 10;
}
.button,.menu-button,.toggle-button,.split-menu-button {
-fx-font-size: 14;
-fx-background-radius: 4;
@ -59,7 +71,7 @@
.info > .label,
.warning > .label,
.danger > .label {
-fx-text-fill: white;
-fx-text-fill: black;
}
.action-btn {
@ -691,7 +703,7 @@ VBox > .split-menu-button.last > .arrow-button {
}
.titled-pane.primary {
-fx-text-fill: white;
-fx-text-fill: black;
}
.titled-pane.primary > .title {
@ -903,15 +915,15 @@ VBox > .split-menu-button.last > .arrow-button {
-fx-text-fill: #c88600;
}
.internalExtension {
.tableRowBlue {
-fx-background-color: #fff0e3;
}
.disconnectedExtension {
.tableRowInactive {
-fx-background-color: #CCCCCC;
}
.connectedExtension {
.tableRowActive {
-fx-background-color: #FFFFFF;
}
@ -921,39 +933,43 @@ VBox > .split-menu-button.last > .arrow-button {
}
#close-button {
-fx-image: url("../../ui/titlebar/files/closeButton.png");
-fx-image: url("../../titlebar/files/closeButton.png");
}
#close-button:hover {
-fx-image: url("../../ui/titlebar/files/closeButtonHover.png");
-fx-image: url("../../titlebar/files/closeButtonHover.png");
}
#close-button:pressed {
-fx-image: url("../../ui/titlebar/files/closeButtonPressed.png");
-fx-image: url("../../titlebar/files/closeButtonPressed.png");
}
#minimize-button {
-fx-image: url("../../ui/titlebar/files/minimizeButton.png");
-fx-image: url("../../titlebar/files/minimizeButton.png");
}
#minimize-button:hover {
-fx-image: url("../../ui/titlebar/files/minimizeButtonHover.png");
-fx-image: url("../../titlebar/files/minimizeButtonHover.png");
}
#minimize-button:pressed {
-fx-image: url("../../ui/titlebar/files/minimizeButtonPressed.png");
-fx-image: url("../../titlebar/files/minimizeButtonPressed.png");
}
#main-tab-pane, #main-tab-pane > * {
-fx-background-radius: 0 0 10 10;
}
.root-node {
-fx-background-radius: 0 0 10 10;
}
#icon {
-fx-image: url("./logoSmall.png");
/*-fx-image: url("logoSmall.png");*/
}
#theme-button {
-fx-image: url("./themeButton.png");
-fx-image: url("themeButton.png");
}
.corrupted-label {
@ -968,6 +984,10 @@ VBox > .split-menu-button.last > .arrow-button {
-fx-text-fill: black;
}
.label.softer {
-fx-text-fill: rgba(0, 0, 0, 0.8);
}
.list-view {
-fx-border-color: #cccccc;
-fx-border-radius: 4;

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<GridPane id="title-bar" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.titlebar.TitleBarController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="25.0" minHeight="25.0" prefHeight="25.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView fx:id="minimizeBtn" id="minimize-button" fitHeight="25.0" fitWidth="50.0" onMouseClicked="#handleMinimizeAction" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1">
<image>
<Image url="@files/minimizeButton.png" />
</image>
</ImageView>
<ImageView id="close-button" fitHeight="25.0" fitWidth="50.0" onMouseClicked="#handleCloseAction" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="2">
<image>
<Image url="@files/closeButton.png" />
</image>
</ImageView>
<GridPane maxHeight="25.0" maxWidth="1.7976931348623157E308" minHeight="25.0" minWidth="-Infinity" onMouseDragged="#handleMovementAction" onMousePressed="#handleClickAction" onMouseReleased="#handleClickReleaseAction" prefHeight="25.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="7.0" minWidth="7.0" prefWidth="7.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" />
<ColumnConstraints hgrow="ALWAYS" />
<ColumnConstraints maxWidth="-Infinity" />
<ColumnConstraints maxWidth="7.0" minWidth="7.0" prefWidth="7.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="25.0" minHeight="25.0" prefHeight="25.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ImageView id="icon" fx:id="titleIcon" fitHeight="16.0" fitWidth="16.0" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="1">
<image>
<Image url="@../themes/G-Earth/logoSmall.png" />
</image>
</ImageView>
<Label fx:id="titleLabel" text="Placeholder" GridPane.columnIndex="2">
<padding>
<Insets left="2.0" />
</padding>
</Label>
<ImageView fx:id="themeBtn" id="theme-button" fitHeight="20.0" fitWidth="38.0" onMouseClicked="#toggleTheme" pickOnBounds="true" preserveRatio="true" GridPane.columnIndex="3">
<image>
<Image url="@../themes/G-Earth/themeButton.png" />
</image>
</ImageView>
</children>
</GridPane>
</children>
</GridPane>