diff --git a/src/main/java/bitchanger/gui/controller/AlphaNumKeysController.java b/src/main/java/bitchanger/gui/controller/AlphaNumKeysController.java index 557438f..21fda4b 100644 --- a/src/main/java/bitchanger/gui/controller/AlphaNumKeysController.java +++ b/src/main/java/bitchanger/gui/controller/AlphaNumKeysController.java @@ -52,7 +52,7 @@ * @author Tim Mühle * * @since Bitchanger 0.1.0 - * @version 0.1.4 + * @version 0.1.6 * */ /* @@ -72,7 +72,7 @@ * @author Tim Mühle * * @since Bitchanger 0.1.0 - * @version 0.1.4 + * @version 0.1.6 * */ public class AlphaNumKeysController extends ControllerBase { @@ -408,7 +408,7 @@ private void setAllToKeyboard(char startLetter) { * @see Preferences#getPrefs() */ private void setCommaBinding() { - Preferences.getPrefs().commaProperty.addListener(new ChangeListener() { + Preferences.getPrefs().commaProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Comma oldComma, Comma newComma) { commaBtn.setText(String.valueOf(newComma.get())); @@ -606,7 +606,7 @@ private void setSimulateKeyEvents() { @Override public void handle(ActionEvent event) { KeyCode commaKeyCode = KeyCode.COMMA; - if(Preferences.getPrefs().commaProperty.get().equals(Comma.COMMA_EN)) { + if(Preferences.getPrefs().commaProperty().get().equals(Comma.COMMA_EN)) { commaKeyCode = KeyCode.PERIOD; } diff --git a/src/main/java/bitchanger/gui/controller/ConverterController.java b/src/main/java/bitchanger/gui/controller/ConverterController.java index e1aac22..30d80ef 100644 --- a/src/main/java/bitchanger/gui/controller/ConverterController.java +++ b/src/main/java/bitchanger/gui/controller/ConverterController.java @@ -37,7 +37,7 @@ * @author Tim Mühle * * @since Bitchanger 0.1.0 - * @version 0.1.4 + * @version 0.1.6 * */ /* @@ -46,7 +46,7 @@ * @author Tim Muehle * * @since Bitchanger 0.1.0 - * @version 0.1.4 + * @version 0.1.6 * */ public class ConverterController extends ControllerBase { @@ -540,7 +540,7 @@ public void handle(MouseEvent event) { // TODO JavaDoc private void updateIndicateFractionalPrecision() { - Preferences.getPrefs().indicateFractionalPrecisionProperty.addListener(new ChangeListener() { + Preferences.getPrefs().indicateFractionalPrecisionProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Boolean oldValue, Boolean newValue) { try { diff --git a/src/main/java/bitchanger/gui/controller/ConverterMenuController.java b/src/main/java/bitchanger/gui/controller/ConverterMenuController.java index d9a781b..d926b1b 100644 --- a/src/main/java/bitchanger/gui/controller/ConverterMenuController.java +++ b/src/main/java/bitchanger/gui/controller/ConverterMenuController.java @@ -14,6 +14,14 @@ import javafx.scene.control.CheckMenuItem; //TODO JavaDoc +/** + * + * @author Tim Mühle + * + * @since Bitchanger 0.1.4 + * @version 0.1.6 + * + */ public class ConverterMenuController extends BasicMenuController { // ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## @@ -72,7 +80,7 @@ public void setActions() { super.setActions(); // Menu Options - Preferences.getPrefs().indicateFractionalPrecisionProperty.bindBidirectional(indicateFractionalInaccuracy.selectedProperty()); + Preferences.getPrefs().indicateFractionalPrecisionProperty().bindBidirectional(indicateFractionalInaccuracy.selectedProperty()); } diff --git a/src/main/java/bitchanger/gui/controls/BasicMenuBar.java b/src/main/java/bitchanger/gui/controls/BasicMenuBar.java index 6041de7..b71f203 100644 --- a/src/main/java/bitchanger/gui/controls/BasicMenuBar.java +++ b/src/main/java/bitchanger/gui/controls/BasicMenuBar.java @@ -40,7 +40,7 @@ * @author Tim Mühle * * @since Bitchanger 0.1.4 - * @version 0.1.4 + * @version 0.1.6 * * @see BasicMenuController */ @@ -53,7 +53,7 @@ * @author Tim Mühle * * @since Bitchanger 0.1.4 - * @version 0.1.4 + * @version 0.1.6 * * @see BasicMenuController */ @@ -263,7 +263,7 @@ private void setChooseCommaAction(MenuItem chooseComma, Comma comma) { chooseComma.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { - Preferences.getPrefs().commaProperty.setValue(comma); + Preferences.getPrefs().commaProperty().setValue(comma); } }); } diff --git a/src/main/java/bitchanger/gui/controls/InformationDialog.java b/src/main/java/bitchanger/gui/controls/InformationDialog.java index 8542650..6ba8101 100644 --- a/src/main/java/bitchanger/gui/controls/InformationDialog.java +++ b/src/main/java/bitchanger/gui/controls/InformationDialog.java @@ -13,6 +13,14 @@ import javafx.scene.control.Alert; //TODO JavaDoc erstellen +/** + * + * @author Tim Mühle + * + * @since Bitchanger 0.1.4 + * @version 0.1.6 + * + */ public class InformationDialog extends Alert { // ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## @@ -33,7 +41,7 @@ public InformationDialog() { public InformationDialog(InformationType informationType) { super(AlertType.INFORMATION); - this.getDialogPane().getStylesheets().add(Preferences.getPrefs().readOnlyStylesheetProperty.get()); + this.getDialogPane().getStylesheets().add(Preferences.getPrefs().stylesheetProperty().get()); switch(informationType) { case ABOUT: diff --git a/src/main/java/bitchanger/gui/controls/ValueField.java b/src/main/java/bitchanger/gui/controls/ValueField.java index 2a1e2de..0cdd63d 100644 --- a/src/main/java/bitchanger/gui/controls/ValueField.java +++ b/src/main/java/bitchanger/gui/controls/ValueField.java @@ -34,7 +34,7 @@ * @author Tim Mühle * * @since Bitchanger 0.1.0 - * @version 0.1.4 + * @version 0.1.6 * */ /* @@ -51,7 +51,7 @@ * @author Tim Mühle * * @since Bitchanger 0.1.0 - * @version 0.1.4 + * @version 0.1.6 * */ public class ValueField extends TextField { @@ -342,7 +342,7 @@ public void run() { * Monitors the CommaProperty from {@link Preferences} and adjusts the comma if the number is changing */ private void observeCommaProperty() { - Preferences.getPrefs().commaProperty.addListener(new ChangeListener() { + Preferences.getPrefs().commaProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Comma oldValue, Comma newValue) { if(oldValue.equals(newValue)) diff --git a/src/main/java/bitchanger/main/PrimaryFXApp.java b/src/main/java/bitchanger/main/PrimaryFXApp.java index cf7ebd3..834e468 100644 --- a/src/main/java/bitchanger/main/PrimaryFXApp.java +++ b/src/main/java/bitchanger/main/PrimaryFXApp.java @@ -16,6 +16,7 @@ import bitchanger.gui.views.IEEEView; import bitchanger.gui.views.Viewable; import bitchanger.preferences.Preferences; +import bitchanger.util.ArrayUtils; import bitchanger.util.Resources; import javafx.application.Application; import javafx.beans.property.ObjectProperty; @@ -122,14 +123,11 @@ public static void launchFXApplication(String[] args) { // ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## -// public ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +// private ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## /** Property für die aktuell im Fenster dargestellte View */ /* Property of the currently displayed View */ - public final ObjectProperty currentViewProperty; - - -// private ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## + private final ObjectProperty currentViewProperty; /** View für die Umwandlung von Zahlensystemen */ /* View for converting of numeral systems */ @@ -162,7 +160,7 @@ public PrimaryFXApp() { super(); this.currentViewProperty = new SimpleObjectProperty(); } - + // ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## @@ -267,10 +265,18 @@ public void start(Stage primaryStage) throws Exception { this.calculatorView = new CalculatorView(); adjustViews(converterView, ieeeView, calculatorView); + + changeView(converterView); + + for(Viewable view : ArrayUtils.arrayOf(converterView, ieeeView, calculatorView)) { + if(Preferences.getPrefs().viewClassProperty().get().equals(view.getClass())) { + changeView(view); + } + } + + updateViewClassProperty(); - currentViewProperty.set(converterView); - changeView(converterView); primaryStage.setTitle("Bitchanger " + VERSION); // Fenstergroesse an Scene anpassen und Maximale / Minimale Groesse einstellen (berechnet aus groesse der Scene und dem zusaetzlichen Fensterrahmen) @@ -280,6 +286,16 @@ public void start(Stage primaryStage) throws Exception { primaryStage.show(); } + + // TODO JavaDoc + private void updateViewClassProperty() { + this.currentViewProperty.addListener(new ChangeListener() { + @Override + public void changed(ObservableValue observable, Viewable oldValue, Viewable newView) { + Preferences.getPrefs().viewClassProperty().set(newView.getClass()); + } + }); + } // Layout ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## @@ -377,7 +393,7 @@ private void adjustViews(Viewable... views) { BasicMenuBar menubar = view.generateMenuBar(this); view.setMenuBar(menubar); - Preferences.getPrefs().readOnlyStylesheetProperty.addListener(new ChangeListener() { + Preferences.getPrefs().stylesheetProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, String oldStylesheet, String newStylesheet) { try { @@ -391,7 +407,7 @@ public void changed(ObservableValue observable, String oldStyl }); view.getScene().getStylesheets().add(Resources.LAYOUT_CSS); - view.getScene().getStylesheets().add(Preferences.getPrefs().readOnlyStylesheetProperty.get()); + view.getScene().getStylesheets().add(Preferences.getPrefs().stylesheetProperty().get()); } } diff --git a/src/main/java/bitchanger/preferences/Preferences.java b/src/main/java/bitchanger/preferences/Preferences.java index c64fc3c..238c9e8 100644 --- a/src/main/java/bitchanger/preferences/Preferences.java +++ b/src/main/java/bitchanger/preferences/Preferences.java @@ -22,6 +22,8 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import bitchanger.gui.views.ConverterView; +import bitchanger.gui.views.Viewable; import bitchanger.util.Resources; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; @@ -31,7 +33,6 @@ import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; -import javafx.beans.property.StringPropertyBase; /** * Preferences ist die globale Sammlung für alle möglichen Einstellungen, die am Bitchanger vorgenommen @@ -45,7 +46,7 @@ * @author Tim Mühle * * @since Bitchanger 0.1.0 - * @version 0.1.4 + * @version 0.1.6 */ /* * Preferences is the global collection for all possible settings that can be selected for the bitchanger. @@ -58,7 +59,7 @@ * @author Tim Mühle * * @since Bitchanger 0.1.0 - * @version 0.1.4 + * @version 0.1.6 */ public class Preferences { @@ -139,26 +140,15 @@ public static void loadDefault() { // ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## -// public ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +// private ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## /** Property für das Kommazeichen */ /* Property for comma character */ - public final ObjectProperty commaProperty; + private final ObjectProperty commaProperty; /** Property für die Anzeige von abgebrochenen Nachkommastellen */ /* Property for displaying aborted decimal places */ - public final BooleanProperty indicateFractionalPrecisionProperty; - - /** ReadOnlyProperty für das gewählte Stylesheet */ - /* ReadOnlyProperty for the selected Stylesheet */ - public final ReadOnlyStringProperty readOnlyStylesheetProperty; - - /** ReadOnlyProperty für das gewählte Stylesheet */ - /* ReadOnlyProperty for the selected Stylesheet */ - public final ReadOnlyObjectProperty + + bitchanger.gui.views.ConverterView \ No newline at end of file diff --git a/src/main/resources/bitchanger_resources/preferences/DefaultSettings.prefs b/src/main/resources/bitchanger_resources/preferences/DefaultSettings.prefs index 29fceff..0a760fc 100644 --- a/src/main/resources/bitchanger_resources/preferences/DefaultSettings.prefs +++ b/src/main/resources/bitchanger_resources/preferences/DefaultSettings.prefs @@ -3,6 +3,7 @@ COMMA_DE true - + + bitchanger.gui.views.ConverterView \ No newline at end of file