mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-01-18 16:26:26 +01:00
alwaysontop g-earth window
This commit is contained in:
parent
c8cb62d61f
commit
a7308c2a38
@ -35,9 +35,9 @@ public class Main extends Application {
|
||||
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/gearth/ui/G-Earth.fxml"));
|
||||
Parent root = loader.load();
|
||||
|
||||
GEarthController companion = loader.getController();
|
||||
companion.setStage(primaryStage);
|
||||
|
||||
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/gearth/G-EarthLogoSmaller.png")));
|
||||
|
||||
primaryStage.setResizable(false);
|
||||
|
@ -22,6 +22,8 @@ public class GEarthController {
|
||||
private Stage stage = null;
|
||||
private volatile HConnection hConnection;
|
||||
|
||||
private volatile int initcount = 0;
|
||||
|
||||
public Connection connectionController;
|
||||
public Injection injectionController;
|
||||
public Logger loggerController;
|
||||
@ -38,20 +40,14 @@ public class GEarthController {
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
connectionController.setParentController(this);
|
||||
injectionController.setParentController(this);
|
||||
loggerController.setParentController(this);
|
||||
toolsController.setParentController(this);
|
||||
schedulerController.setParentController(this);
|
||||
extraController.setParentController(this);
|
||||
infoController.setParentController(this);
|
||||
extensionsController.setParentController(this);
|
||||
synchronized (this) {
|
||||
trySetController();
|
||||
}
|
||||
|
||||
if (PacketLoggerFactory.usesUIlogger()) {
|
||||
tabBar.getTabs().remove(tab_Logger);
|
||||
}
|
||||
|
||||
|
||||
//custom header bar
|
||||
// final Point[] startpos = {null};
|
||||
// final Double[] xx = {0.0};
|
||||
@ -85,7 +81,24 @@ public class GEarthController {
|
||||
|
||||
public void setStage(Stage stage) {
|
||||
this.stage = stage;
|
||||
synchronized (this) {
|
||||
trySetController();
|
||||
}
|
||||
}
|
||||
|
||||
private void trySetController() {
|
||||
if (++initcount == 2) {
|
||||
connectionController.setParentController(this);
|
||||
injectionController.setParentController(this);
|
||||
loggerController.setParentController(this);
|
||||
toolsController.setParentController(this);
|
||||
schedulerController.setParentController(this);
|
||||
extraController.setParentController(this);
|
||||
infoController.setParentController(this);
|
||||
extensionsController.setParentController(this);
|
||||
}
|
||||
}
|
||||
|
||||
public Stage getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ public class SubForm {
|
||||
|
||||
protected GEarthController parentController;
|
||||
|
||||
//gets called when all UI elements are initialized, set parentController available & stage field is initialized
|
||||
public void setParentController(GEarthController controller) {
|
||||
parentController = controller;
|
||||
onParentSet();
|
||||
|
@ -3,6 +3,8 @@ package gearth.ui.extra;
|
||||
import gearth.Main;
|
||||
import gearth.ui.SubForm;
|
||||
import gearth.ui.info.Info;
|
||||
import javafx.beans.InvalidationListener;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.*;
|
||||
|
||||
@ -32,4 +34,9 @@ public class Extra extends SubForm {
|
||||
Info.activateHyperlink(url_troubleshooting);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onParentSet() {
|
||||
parentController.getStage().setAlwaysOnTop(cbx_alwaysOnTop.isSelected());
|
||||
cbx_alwaysOnTop.selectedProperty().addListener(observable -> parentController.getStage().setAlwaysOnTop(cbx_alwaysOnTop.isSelected()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user