Skip to content
Snippets Groups Projects
Commit 48e963d1 authored by Dirksmöller Karin's avatar Dirksmöller Karin
Browse files

Merge remote-tracking branch 'origin/main'

parents 2210bca4 a59575b3
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ public class TastyPages extends Application {
private final static Logger log = LogManager.getLogger(TastyPages.class);
private static Stage stage;
public static final View startUpView = View.MAIN;
public static void main(String[] args) {
log.info("Starting TastyPages");
......
......@@ -15,8 +15,10 @@ public abstract class BaseController {
private final static Stage stage = TastyPages.getApplicationStage();
protected Scene currentScene;
private static View currentView = TastyPages.startUpView;
protected void changeScene(final View newScene) {
if (newScene == currentView) { return; }
try {
boolean wasMaximized = stage.isMaximized();
double sizeX = stage.getWidth();
......@@ -27,10 +29,12 @@ public abstract class BaseController {
Parent newParent = newScene.getScene();
currentScene = new Scene(newParent, sizeX, sizeY);
currentView = newScene;
stage.setTitle(newWindowTitle);
stage.setScene(currentScene);
stage.setMaximized(wasMaximized);
log.info("new view: {}", currentView);
} catch (IOException io) {
log.error("IO Exception: something went wrong when changing the scene.");
io.printStackTrace();
......
......@@ -34,7 +34,6 @@ public enum View {
}
public Parent getScene() throws IOException {
//TODO: keep track of current view and don't reload it if the user selects it again!
log.info("Loading FXML for '{}' view from: {}", windowTitle, path);
final FXMLLoader loader = new FXMLLoader(getClass().getResource(path));
log.debug("Successfully retrieved resource from {}", path);
......
......@@ -11,7 +11,7 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane fx:id="parent" prefHeight="540.0" prefWidth="872.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mi.hdm.controllers.MealPlanController">
<AnchorPane fx:id="parent" prefHeight="540.0" prefWidth="872.0" xmlns="http://javafx.com/javafx/14" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mi.hdm.controllers.MealPlanController">
<children>
<VBox layoutY="69.0" prefHeight="445.0" prefWidth="872.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<children>
......@@ -50,7 +50,7 @@
<Font name="Arial" size="17.0" />
</font>
</Text>
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: d9d9d9; -fx-background-radius: 5; -fx-control-inner-background: a; -fx-accent: d91c1c;">
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: #d9d9d9; -fx-background-radius: 5; -fx-control-inner-background: a; -fx-accent: d91c1c;">
<HBox.margin>
<Insets left="70.0" />
</HBox.margin>
......@@ -64,7 +64,7 @@
<Font name="Arial" size="17.0" />
</font>
</Text>
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: d9d9d9; -fx-background-radius: 5; -fx-control-inner-background: a; -fx-accent: d91c1c;">
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: #d9d9d9; -fx-background-radius: 5; -fx-control-inner-background: a; -fx-accent: d91c1c;">
<HBox.margin>
<Insets left="70.0" />
</HBox.margin>
......@@ -78,7 +78,7 @@
<Font name="Arial" size="17.0" />
</font>
</Text>
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: d9d9d9; -fx-control-inner-background: a; -fx-background-radius: 5; -fx-accent: d91c1c;">
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: #d9d9d9; -fx-control-inner-background: a; -fx-background-radius: 5; -fx-accent: d91c1c;">
<HBox.margin>
<Insets left="70.0" />
</HBox.margin>
......@@ -92,7 +92,7 @@
<Font name="Arial" size="17.0" />
</font>
</Text>
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: d9d9d9; -fx-control-inner-background: a; -fx-background-radius: 5; -fx-accent: d91c1c;">
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: #d9d9d9; -fx-control-inner-background: a; -fx-background-radius: 5; -fx-accent: d91c1c;">
<HBox.margin>
<Insets left="70.0" />
</HBox.margin>
......@@ -106,7 +106,7 @@
<Font name="Arial" size="17.0" />
</font>
</Text>
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: d9d9d9; -fx-control-inner-background: a; -fx-background-radius: 5; -fx-accent: d91c1c;">
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: #d9d9d9; -fx-control-inner-background: a; -fx-background-radius: 5; -fx-accent: d91c1c;">
<HBox.margin>
<Insets left="70.0" />
</HBox.margin>
......@@ -120,7 +120,7 @@
<Font name="Arial" size="17.0" />
</font>
</Text>
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color: d9d9d9; -fx-control-inner-background: a; -fx-background-radius: 5; -fx-accent: d91c1c;">
<ProgressBar prefHeight="24.0" prefWidth="631.0" progress="0.0" style="-fx-background-color:#d9d9d9; -fx-control-inner-background: a; -fx-background-radius: 5; -fx-accent: d91c1c;">
<HBox.margin>
<Insets left="70.0" />
</HBox.margin>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment