diff options
author | Adrien Hopkins <ahopk127@my.yorku.ca> | 2022-04-19 16:36:45 -0500 |
---|---|---|
committer | Adrien Hopkins <ahopk127@my.yorku.ca> | 2022-04-19 16:36:45 -0500 |
commit | 213a9b78cf39776c3832983e9d9c26435bad2282 (patch) | |
tree | af3bb8662dd4203fcfbd071f005e0619096f61ee /src/main/java/sevenUnitsGUI/View.java | |
parent | 9c30c3ad4d4658964e2bb2bb5be6c2eebbfbe8af (diff) | |
parent | 8cc60583134a4d01e9967424e5a51332de6cc38b (diff) |
Merge branch 'gui-redesign-0.4' into developv0.4.0a1
Diffstat (limited to 'src/main/java/sevenUnitsGUI/View.java')
-rw-r--r-- | src/main/java/sevenUnitsGUI/View.java | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/src/main/java/sevenUnitsGUI/View.java b/src/main/java/sevenUnitsGUI/View.java new file mode 100644 index 0000000..b2d2b94 --- /dev/null +++ b/src/main/java/sevenUnitsGUI/View.java @@ -0,0 +1,105 @@ +/** + * Copyright (C) 2021-2022 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 sevenUnitsGUI; + +import java.util.Optional; +import java.util.Set; + +import sevenUnits.unit.UnitType; +import sevenUnits.utils.NameSymbol; + +/** + * An object that controls user interaction with 7Units + * + * @author Adrien Hopkins + * @since 2021-12-15 + */ +public interface View { + /** + * @return a new tabbed view + * @since 2022-04-19 + */ + static View createTabbedView() { + return new TabbedView(); + } + + /** + * @return the presenter associated with this view + * @since 2022-04-19 + */ + Presenter getPresenter(); + + /** + * @return name of prefix currently being viewed + * @since 2022-04-10 + */ + Optional<String> getViewedPrefixName(); + + /** + * @return name of unit currently being viewed + * @since 2022-04-10 + */ + Optional<String> getViewedUnitName(); + + /** + * Sets the list of prefixes that are available to be viewed in a prefix + * viewer + * + * @param prefixNames prefix names to view + * @since 2022-04-10 + */ + void setViewablePrefixNames(Set<String> prefixNames); + + /** + * Sets the list of units that are available to be viewed in a unit viewer + * + * @param unitNames unit names to view + * @since 2022-04-10 + */ + void setViewableUnitNames(Set<String> unitNames); + + /** + * Shows an error message. + * + * @param title title of error message; on any view that uses an error + * dialog, this should be the title of the error dialog. + * @param message error message + * @since 2021-12-15 + */ + void showErrorMessage(String title, String message); + + /** + * Shows information about a prefix to the user. + * + * @param name name(s) and symbol of prefix + * @param multiplierString string representation of prefix multiplier + * @since 2022-04-10 + */ + void showPrefix(NameSymbol name, String multiplierString); + + /** + * Shows information about a unit to the user. + * + * @param name name(s) and symbol of unit + * @param definition unit's definition string + * @param dimensionName name of unit's dimension + * @param type type of unit (metric/semi-metric/non-metric) + * @since 2022-04-10 + */ + void showUnit(NameSymbol name, String definition, String dimensionName, + UnitType type); +} |