diff options
author | Adrien Hopkins <ahopk127@my.yorku.ca> | 2021-12-15 17:52:43 -0500 |
---|---|---|
committer | Adrien Hopkins <ahopk127@my.yorku.ca> | 2021-12-16 10:02:10 -0500 |
commit | 4f754b0bc136b972607aa1b39f2358bd98dc4e1c (patch) | |
tree | c5c81ef152c011fec2c2f1d6b3c916c5cc6ca93e /src/main/java/sevenUnits/newGUI/Presenter.java | |
parent | 9c30c3ad4d4658964e2bb2bb5be6c2eebbfbe8af (diff) |
Designed the API for a new GUI
Currently "supports" unit conversion, expression conversion and settings loading
Diffstat (limited to 'src/main/java/sevenUnits/newGUI/Presenter.java')
-rw-r--r-- | src/main/java/sevenUnits/newGUI/Presenter.java | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/main/java/sevenUnits/newGUI/Presenter.java b/src/main/java/sevenUnits/newGUI/Presenter.java new file mode 100644 index 0000000..6f7d34a --- /dev/null +++ b/src/main/java/sevenUnits/newGUI/Presenter.java @@ -0,0 +1,97 @@ +/** + * Copyright (C) 2021 Adrien Hopkins + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ +package sevenUnits.newGUI; + +/** + * An object that handles interactions between the view and the backend code + * + * @author Adrien Hopkins + * @since 2021-12-15 + */ +public final class Presenter { + /** + * The view that this presenter communicates with + */ + private final View view; + + /** + * Creates a Presenter + * + * @param view the view that this presenter communicates with + * @since 2021-12-15 + */ + public Presenter(View view) { + this.view = view; + } + + /** + * Sets the dimension of the view's From and To units. + * + * @throws UnsupportedOperationException if the view does not support + * unit-based conversion (does not + * implement + * {@link UnitConversionView}) + * @since 2021-12-15 + */ + public void applyDimensionFilter() {} + + /** + * Gets settings from the view and applies them to both view and presenter. + * + * @since 2021-12-15 + */ + public void applySettings() {} + + /** + * Converts from the view's input expression to its output expression. + * Displays an error message if any of the required fields are invalid. + * + * @throws UnsupportedOperationException if the view does not support + * expression-based conversion (does + * not implement + * {@link ExpressionConversionView}) + * @since 2021-12-15 + */ + public void convertExpressions() {} + + /** + * Converts from the view's input unit to its output unit. Displays an error + * message if any of the required fields are invalid. + * + * @throws UnsupportedOperationException if the view does not support + * unit-based conversion (does not + * implement + * {@link UnitConversionView}) + * @since 2021-12-15 + */ + public void convertUnits() {} + + /** + * Loads settings from the user's settings file and applies them to the view. + * + * @since 2021-12-15 + */ + public void loadSettings() {} + + /** + * Gets user settings from the view then saves them to the user's settings + * file. + * + * @since 2021-12-15 + */ + public void saveSettings() {} +} |