Class MainController
java.lang.Object
page.codeberg.friedolyn.gui.controllers.Controller<Friedolyn>
page.codeberg.friedolyn.gui.controllers.MainController
- All Implemented Interfaces:
javafx.fxml.Initializable
,Preparable<Friedolyn>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.layout.BorderPane
private javafx.scene.control.Button
private final Countdown.CountdownListener
private @NonNull Friedolyn
private javafx.scene.control.MenuItem
private javafx.scene.control.MenuItem
private javafx.scene.control.MenuItem
private javafx.scene.control.MenuItem
private javafx.scene.control.MenuItem
private javafx.scene.control.MenuItem
private javafx.scene.control.MenuItem
private javafx.scene.control.MenuItem
private ResourceBundle
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
private javafx.scene.text.Text
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Makes the current window or dialog disappear from the user's screen.void
initialize
(URL url, ResourceBundle resourceBundle) private boolean
Determines the current state of the start/stop button.void
logOut()
void
void
void
openFile()
void
void
private void
openSupport
(Friedolyn.ContactRequest contactRequestType) private boolean
pause()
Attempts topause
periodic grade fetching and changes the appearance of the start/stop button accordingly.void
Provides the dialog or window with all the information that is required for correct operation.private boolean
resume()
Attempts toresume
periodic grade fetching and changes the appearance of the start/stop button accordingly.saveCopy()
void
saveTo()
private boolean
start()
Attempts tostart
periodic grade fetching and changes the appearance of the start/stop button accordingly.private void
Invoked when the user clicks the start/stop button.private void
toggleStartStopButtonAppearance
(boolean isStartButton) Updates the colour and text of the start/stop button.private void
updateCountdown
(Duration duration) Displays the givenDuration
in thetextCountdownDays
,textCountdownHours
,textCountdownMinutes
andtextCountdownSeconds
Text
fields.Methods inherited from class page.codeberg.friedolyn.gui.controllers.Controller
getSuccess
-
Field Details
-
resourceBundle
-
friedolyn
-
COUNTDOWN
-
borderPaneMain
private javafx.scene.layout.BorderPane borderPaneMain -
buttonStartStop
private javafx.scene.control.Button buttonStartStop -
textCountdownDays
private javafx.scene.text.Text textCountdownDays -
textCountdownHours
private javafx.scene.text.Text textCountdownHours -
textCountdownMinutes
private javafx.scene.text.Text textCountdownMinutes -
textCountdownSeconds
private javafx.scene.text.Text textCountdownSeconds
-
-
Constructor Details
-
MainController
public MainController()
-
-
Method Details
-
initialize
-
prepare
Description copied from class:Controller
Provides the dialog or window with all the information that is required for correct operation.- Specified by:
prepare
in interfacePreparable<Friedolyn>
- Overrides:
prepare
in classController<Friedolyn>
- Parameters:
friedolyn
- The data needed by the dialog or window.- See Also:
-
toggleStartStop
private void toggleStartStop()Invoked when the user clicks the start/stop button. Will eitherstart
orpause
the periodic grade fetching, depending on the current state of Friedolyn and the button. If there's a mismatch between the state of Friedolyn and the appearance of the button, the button's appearance will be updated to reflect the current state of Friedolyn. -
start
private boolean start()Attempts tostart
periodic grade fetching and changes the appearance of the start/stop button accordingly.- Returns:
- True if the periodic grade fetching was successfully started, false otherwise.
-
resume
private boolean resume()Attempts toresume
periodic grade fetching and changes the appearance of the start/stop button accordingly.- Returns:
- True if the periodic grade fetching was successfully resumed, false otherwise.
-
toggleStartStopButtonAppearance
private void toggleStartStopButtonAppearance(boolean isStartButton) Updates the colour and text of the start/stop button.- Parameters:
isStartButton
- True if the button should be styled as a start button, false if it should be styled as a stop button.
-
isStartButton
private boolean isStartButton()Determines the current state of the start/stop button.- Returns:
- True if the button is currently styled as a start button, false if it is styled as a stop button.
-
pause
private boolean pause()Attempts topause
periodic grade fetching and changes the appearance of the start/stop button accordingly. -
updateCountdown
Displays the givenDuration
in thetextCountdownDays
,textCountdownHours
,textCountdownMinutes
andtextCountdownSeconds
Text
fields.- Parameters:
duration
- The new countdown value to display.
-
openFile
public void openFile() -
saveTo
public void saveTo() -
saveCopy
-
openSettings
public void openSettings() -
logOut
public void logOut() -
openSupport
public void openSupport() -
openBugReport
public void openBugReport() -
openFeedback
public void openFeedback() -
openSupport
-
close
public void close()Description copied from class:Controller
Makes the current window or dialog disappear from the user's screen.- Specified by:
close
in classController<Friedolyn>
-