diff --git a/Praktikum/VINF_MaerklinControl/bin/gui/MainApp.class b/Praktikum/VINF_MaerklinControl/bin/gui/MainApp.class index d53c6b3b7e5a6e0dd404dd64afb686d4e4a0c0fb..58bed3efc17a1abc3ea3c7b715371bce1fcc873c 100644 Binary files a/Praktikum/VINF_MaerklinControl/bin/gui/MainApp.class and b/Praktikum/VINF_MaerklinControl/bin/gui/MainApp.class differ diff --git a/Praktikum/VINF_MaerklinControl/bin/gui/view/EngineController.class b/Praktikum/VINF_MaerklinControl/bin/gui/view/EngineController.class index 45f236aaad3c91ed9a6ce7b8df5c80565051e719..06031cbb88424aba6ae1302ab7dd6d0f0982b52e 100644 Binary files a/Praktikum/VINF_MaerklinControl/bin/gui/view/EngineController.class and b/Praktikum/VINF_MaerklinControl/bin/gui/view/EngineController.class differ diff --git a/Praktikum/VINF_MaerklinControl/bin/gui/view/RootLayoutController.class b/Praktikum/VINF_MaerklinControl/bin/gui/view/RootLayoutController.class index 622daaa07bf5fb8669ce5cc9373b3fdafca6be46..b4140357c2889d53743a6e76e50633463ec60f71 100644 Binary files a/Praktikum/VINF_MaerklinControl/bin/gui/view/RootLayoutController.class and b/Praktikum/VINF_MaerklinControl/bin/gui/view/RootLayoutController.class differ diff --git a/Praktikum/VINF_MaerklinControl/bin/gui/view/Turntable.fxml b/Praktikum/VINF_MaerklinControl/bin/gui/view/Turntable.fxml index ba51d6e1972c77b2831a875f5106910dc282256f..06a134e01bbae972b01bea37b66201782deb0f46 100644 --- a/Praktikum/VINF_MaerklinControl/bin/gui/view/Turntable.fxml +++ b/Praktikum/VINF_MaerklinControl/bin/gui/view/Turntable.fxml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.ChoiceBox?> -<?import javafx.scene.control.ToggleButton?> -<?import javafx.scene.control.ToggleGroup?> +<?import javafx.scene.control.Button?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.HBox?> @@ -10,12 +9,9 @@ <children> <HBox alignment="BOTTOM_CENTER" layoutX="70.0" layoutY="457.0" AnchorPane.bottomAnchor="20.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="0.0"> <children> - <ToggleButton fx:id="turntableLeftButton" mnemonicParsing="false" text="<"> - <toggleGroup> - <ToggleGroup fx:id="turntableDirection" /> - </toggleGroup></ToggleButton> + <Button fx:id="turntableLeftButton" mnemonicParsing="false" onAction="#handleTurnCCW" text="<" /> <ChoiceBox fx:id="slotChoiceBox" prefWidth="150.0" /> - <ToggleButton fx:id="turntableRightButton" mnemonicParsing="false" text=">" toggleGroup="$turntableDirection" /> + <Button fx:id="turntableRightButton" mnemonicParsing="false" onAction="#handleTurnCW" text=">" /> </children> </HBox> </children> diff --git a/Praktikum/VINF_MaerklinControl/bin/gui/view/TurntableController.class b/Praktikum/VINF_MaerklinControl/bin/gui/view/TurntableController.class index 6002e2d46f0d8a69310753830b02a872538da8d9..00da853b45178b3a87ddd07aa3ff6ee1db3d7ef9 100644 Binary files a/Praktikum/VINF_MaerklinControl/bin/gui/view/TurntableController.class and b/Praktikum/VINF_MaerklinControl/bin/gui/view/TurntableController.class differ diff --git a/Praktikum/VINF_MaerklinControl/src/gui/MainApp.java b/Praktikum/VINF_MaerklinControl/src/gui/MainApp.java index 70a1dbb52811800ffefb424d76a79136322e87fa..fc13d4868095e42e0f3b2e05a0c12f5a6cbb7165 100644 --- a/Praktikum/VINF_MaerklinControl/src/gui/MainApp.java +++ b/Praktikum/VINF_MaerklinControl/src/gui/MainApp.java @@ -13,7 +13,7 @@ import gui.model.Engine; import gui.model.Switch; import gui.model.Settings; import gui.view.EngineController; -//import gui.view.TurntableController; +import gui.view.TurntableController; import gui.view.RootLayoutController; import gui.view.SettingsController; import gui.view.SwitchListController; @@ -39,7 +39,7 @@ public class MainApp extends Application { private AnchorPane enginePane, turntablePane, settingsPane, switchListPane; private EngineController engineController; private SwitchListController switchListController; -// private TurntableController turntableController; + private TurntableController turntableController; private Settings configuration; private SettingsController settingsController; @@ -108,9 +108,6 @@ public class MainApp extends Application { initTabs(); } - /** - * Initializes the root layout. - */ public void initRootLayout() { try { // Load root layout from fxml file. @@ -151,8 +148,8 @@ public class MainApp extends Application { FXMLLoader turntableLoader = new FXMLLoader(); turntableLoader.setLocation(MainApp.class.getResource("view/Turntable.fxml")); turntablePane = turntableLoader.load(); - //turntableController = turntableLoader.getController(); - //turntableController.setMainApp(this); + turntableController = turntableLoader.getController(); + turntableController.setMainApp(this); FXMLLoader settingsLoader = new FXMLLoader(); settingsLoader.setLocation(MainApp.class.getResource("view/Settings.fxml")); @@ -164,7 +161,7 @@ public class MainApp extends Application { // Add the tabs tabs.add(new Tab("Loks", enginePane)); tabs.add(new Tab("Weichen", switchListPane)); - tabs.add(new Tab("Drehscheibe", turntablePane)); + tabs.add(new Tab("Drehteller", turntablePane)); tabs.add(new Tab("Einstellungen", settingsPane)); rootController.loadTabs(); diff --git a/Praktikum/VINF_MaerklinControl/src/gui/view/EngineController.java b/Praktikum/VINF_MaerklinControl/src/gui/view/EngineController.java index b3ce21fce717fd7782db404af1067ddde67064c1..98eded74290c84c51acddd125d109d3ae4572037 100644 --- a/Praktikum/VINF_MaerklinControl/src/gui/view/EngineController.java +++ b/Praktikum/VINF_MaerklinControl/src/gui/view/EngineController.java @@ -37,11 +37,11 @@ public class EngineController { */ @FXML private void initialize() { - //engineChoiceBox.setItems(mainApp.getEngines()); doesn't work here (yet) - engineSpeedSlider.setValue(0); + engineSpeedSlider.setValue(0); engineFwdButton.setSelected(true); // initializes the forward Button as pressed engineChoiceBox.getSelectionModel().selectedItemProperty().addListener( (observable, oldValue, newValue) -> setSelectedEngine(newValue)); + engineSpeedSlider.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { diff --git a/Praktikum/VINF_MaerklinControl/src/gui/view/RootLayoutController.java b/Praktikum/VINF_MaerklinControl/src/gui/view/RootLayoutController.java index 8b41f4dfc1fdcc0a28bde76a1250af9c21755ce8..f47880d0f782ae54864ad646cee46dc944ef21e3 100644 --- a/Praktikum/VINF_MaerklinControl/src/gui/view/RootLayoutController.java +++ b/Praktikum/VINF_MaerklinControl/src/gui/view/RootLayoutController.java @@ -17,27 +17,6 @@ public class RootLayoutController { // Reference to the main application. private MainApp mainApp; - /** - * The constructor. - * The constructor is called before the initialize() method. - */ - public RootLayoutController() { - } - - /** - * Initializes the controller class. This method is automatically called - * after the fxml file has been loaded. - */ - @FXML - private void initialize() { - - } - - /** - * Is called by the main application to give a reference back to itself. - * - * @param mainApp - */ public void setMainApp(MainApp mainApp) { this.mainApp = mainApp; } diff --git a/Praktikum/VINF_MaerklinControl/src/gui/view/SwitchListController.java b/Praktikum/VINF_MaerklinControl/src/gui/view/SwitchListController.java index f083b8f67af3fde8dc7788aaaa30de431e23da1c..de5eebb19ff70962904f45575d52bb181f31be79 100644 --- a/Praktikum/VINF_MaerklinControl/src/gui/view/SwitchListController.java +++ b/Praktikum/VINF_MaerklinControl/src/gui/view/SwitchListController.java @@ -28,7 +28,7 @@ public class SwitchListController { */ @FXML private void initialize() { - //setSwitchControls(); // would be nice to do this here, doesn't work unti setMainApp has been called + //setSwitchControls(); // would be nice to do this here, doesn't work until setMainApp has been called } /** diff --git a/Praktikum/VINF_MaerklinControl/src/gui/view/Turntable.fxml b/Praktikum/VINF_MaerklinControl/src/gui/view/Turntable.fxml index ba51d6e1972c77b2831a875f5106910dc282256f..06a134e01bbae972b01bea37b66201782deb0f46 100644 --- a/Praktikum/VINF_MaerklinControl/src/gui/view/Turntable.fxml +++ b/Praktikum/VINF_MaerklinControl/src/gui/view/Turntable.fxml @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.ChoiceBox?> -<?import javafx.scene.control.ToggleButton?> -<?import javafx.scene.control.ToggleGroup?> +<?import javafx.scene.control.Button?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.HBox?> @@ -10,12 +9,9 @@ <children> <HBox alignment="BOTTOM_CENTER" layoutX="70.0" layoutY="457.0" AnchorPane.bottomAnchor="20.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="0.0"> <children> - <ToggleButton fx:id="turntableLeftButton" mnemonicParsing="false" text="<"> - <toggleGroup> - <ToggleGroup fx:id="turntableDirection" /> - </toggleGroup></ToggleButton> + <Button fx:id="turntableLeftButton" mnemonicParsing="false" onAction="#handleTurnCCW" text="<" /> <ChoiceBox fx:id="slotChoiceBox" prefWidth="150.0" /> - <ToggleButton fx:id="turntableRightButton" mnemonicParsing="false" text=">" toggleGroup="$turntableDirection" /> + <Button fx:id="turntableRightButton" mnemonicParsing="false" onAction="#handleTurnCW" text=">" /> </children> </HBox> </children> diff --git a/Praktikum/VINF_MaerklinControl/src/gui/view/TurntableController.java b/Praktikum/VINF_MaerklinControl/src/gui/view/TurntableController.java index bca491520ae885ea35976a565fe13c2ba05c87a3..0c8c6c16ae5ea763adf615195f6e70b1a7ad1cb2 100644 --- a/Praktikum/VINF_MaerklinControl/src/gui/view/TurntableController.java +++ b/Praktikum/VINF_MaerklinControl/src/gui/view/TurntableController.java @@ -1,38 +1,46 @@ package gui.view; import gui.MainApp; -import javafx.beans.value.ChangeListener; -import javafx.beans.value.ObservableValue; import javafx.fxml.FXML; -import javafx.scene.control.ToggleButton; +import javafx.scene.control.Button; import javafx.scene.control.ChoiceBox; public class TurntableController { -@FXML -private ToggleButton turntableLeftButton; -@FXML -private ToggleButton turntableRightButton; -@FXML -private ChoiceBox<Number> slotChoiceBox; -private MainApp mainApp; + @FXML + private Button turntableLeftButton; + @FXML + private Button turntableRightButton; + @FXML + private ChoiceBox<Number> slotChoiceBox; + private MainApp mainApp; + + /** + * Initializes the controller class. This method is automatically called + * after the fxml file has been loaded. + */ + @FXML + private void initialize() { + + } -/** - * Initializes the controller class. This method is automatically called - * after the fxml file has been loaded. - */ -@FXML -private void initialize() { + /** + * Is called by the main application to give a reference back to itself. + * + * @param mainApp + */ + public void setMainApp(MainApp mainApp) { + this.mainApp = mainApp; + + } -} - -/** - * Is called by the main application to give a reference back to itself. - * - * @param mainApp - */ -public void setMainApp(MainApp mainApp) { - this.mainApp = mainApp; - -} + public void handleTurnCCW (){ + mainApp.turntableTurnCCW(); + mainApp.setStatus("Letztes Kommando: Drehteller links drehen"); + } + + public void handleTurnCW (){ + mainApp.turntableTurnCW(); + mainApp.setStatus("Letztes Kommando: Drehteller rechts drehen"); + } }