-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I forgot to pull before working on the startview
Merge branch 'main' of https://git.ntnu.no/einaskoi/Millions
- Loading branch information
Showing
10 changed files
with
195 additions
and
41 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...java/edu/ntnu/idi/idatt2003/gruppe42/Controller/AppControllers/SettingsAppController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package edu.ntnu.idi.idatt2003.gruppe42.Controller.AppControllers; | ||
|
|
||
| import edu.ntnu.idi.idatt2003.gruppe42.View.Apps.SettingsApp; | ||
| import java.nio.file.Path; | ||
|
|
||
| public class SettingsAppController implements AppController { | ||
|
|
||
| private SettingsApp settingsApp; | ||
| private Path userSelectedPath; | ||
| private Runnable onUserSelection; | ||
|
|
||
| public SettingsAppController(SettingsApp settingsApp) { | ||
| this.settingsApp = settingsApp; | ||
|
|
||
| if (!settingsApp.isLoggedIn()) { | ||
| settingsApp.getOpenFileChooserButton().setOnAction(event -> { | ||
| userSelectedPath = settingsApp.getFileChooser().showOpenDialog(settingsApp.getRoot().getScene().getWindow()).toPath(); | ||
| System.out.println(userSelectedPath.toString()); | ||
| onUserSelection.run(); | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| public Path getUserSelectedPath() { | ||
| return userSelectedPath; | ||
| } | ||
|
|
||
| public void setOnUserPathSelected(Runnable callback) { | ||
| onUserSelection = callback; | ||
| } | ||
|
|
||
| @Override | ||
| public void nextTick() { | ||
|
|
||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/Apps/SettingsApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package edu.ntnu.idi.idatt2003.gruppe42.View.Apps; | ||
|
|
||
| import edu.ntnu.idi.idatt2003.gruppe42.Model.App; | ||
| import edu.ntnu.idi.idatt2003.gruppe42.View.Popup; | ||
| import javafx.scene.control.Button; | ||
| import javafx.stage.FileChooser; | ||
|
|
||
| public class SettingsApp extends Popup { | ||
|
|
||
| private Button openFileChooserButton; | ||
| private FileChooser fileChooser; | ||
| private boolean isLoggedIn; | ||
|
|
||
| public SettingsApp(boolean isLoggedIn) { | ||
| super(720, 480, 80, 60, App.SETTINGS); | ||
| this.isLoggedIn = isLoggedIn; | ||
| updateContent(); | ||
| } | ||
|
|
||
| public Button getOpenFileChooserButton() { | ||
| return openFileChooserButton; | ||
| } | ||
|
|
||
| public FileChooser getFileChooser() { | ||
| return fileChooser; | ||
| } | ||
|
|
||
| public boolean isLoggedIn() { | ||
| return isLoggedIn; | ||
| } | ||
|
|
||
| public void setLoggedIn(boolean status) { | ||
| this.isLoggedIn = status; | ||
| updateContent(); | ||
| } | ||
|
|
||
| public void updateContent() { | ||
| if (!isLoggedIn) { | ||
| openFileChooserButton = new Button("Import stock file"); | ||
| fileChooser = new FileChooser(); | ||
| fileChooser.setTitle("Select .csv stock file"); | ||
| fileChooser.getExtensionFilters().addAll( | ||
| new FileChooser.ExtensionFilter("CSV files","*.csv")); | ||
|
|
||
| content.getChildren().setAll(openFileChooserButton); | ||
| } else { | ||
| //TODO: settings in desktopView | ||
| content.getChildren().setAll(); | ||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.