-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'quickCursorFix' into 'master'
UI fixes See merge request tdt4140-2018/02!45
- Loading branch information
Showing
9 changed files
with
205 additions
and
156 deletions.
There are no files selected for viewing
313 changes: 162 additions & 151 deletions
313
tdt4140-gr1802/app.ui/src/main/java/tdt4140/gr1802/app/ui/AddSleepdataController.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 |
---|---|---|
@@ -1,151 +1,162 @@ | ||
package tdt4140.gr1802.app.ui; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
|
||
import javafx.event.ActionEvent; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.fxml.LoadException; | ||
import javafx.scene.Node; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.control.CheckBox; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.TextField; | ||
import javafx.stage.Stage; | ||
import tdt4140.gr1802.app.core.App; | ||
import tdt4140.gr1802.app.core.Athlete; | ||
import tdt4140.gr1802.app.core.Database; | ||
import tdt4140.gr1802.app.core.Workout; | ||
|
||
public class AddSleepdataController { | ||
|
||
// Making variables for every element in the fxml-file | ||
|
||
@FXML | ||
private Button btAddSleepdata ; | ||
|
||
@FXML | ||
private Button btAddWorkout; | ||
|
||
@FXML | ||
private Button btSeeWorkouts; | ||
|
||
@FXML | ||
private Button btSeeCoaches; | ||
|
||
@FXML | ||
private Button btCoachRequests; | ||
|
||
@FXML | ||
private TextField filepathTextField; | ||
|
||
@FXML | ||
private Button addButton; | ||
|
||
@FXML | ||
private Label txtLabelUsername; | ||
|
||
@FXML | ||
private CheckBox checkBox; | ||
|
||
@FXML | ||
private TextField gpxField; | ||
|
||
private Button homeScreenButton; | ||
|
||
private Database db; | ||
|
||
private static App app; | ||
|
||
private static Athlete athlete; | ||
|
||
private boolean visibility; | ||
|
||
|
||
|
||
// Initialization method | ||
public void initialize() { | ||
athlete = app.getAthlete(); | ||
this.db = app.getDb(); | ||
|
||
// Set username label | ||
this.txtLabelUsername.setText(athlete.getUsername()); | ||
} | ||
|
||
|
||
// Method called when "Add" button clicked | ||
public void clickAddButton (ActionEvent event) throws IOException { | ||
// The text in the application is used as a filepath, adds workout to the DB | ||
String path = filepathTextField.getText(); | ||
URL filePath = new File(path).toURI().toURL(); | ||
athlete.addSleepData(filePath); | ||
db.addSleepData(athlete); | ||
} | ||
|
||
|
||
// Side-menu buttons | ||
public void clickAddWorkout (ActionEvent event) throws IOException, LoadException{ | ||
// Open new window | ||
Parent root = FXMLLoader.load(getClass().getResource("AddWorkout.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
|
||
} | ||
|
||
public void clickSeeWorkouts (ActionEvent event) throws IOException{ | ||
Parent root = FXMLLoader.load(getClass().getResource("SeeWorkouts.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
public void clickSeeCoaches (ActionEvent event) throws IOException{ | ||
Parent root = FXMLLoader.load(getClass().getResource("SeeCoaches.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
public void clickCoachRequest (ActionEvent event) throws IOException{ | ||
Parent root = FXMLLoader.load(getClass().getResource("CoachRequests.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
|
||
public void backToHomeScreen(ActionEvent event) throws IOException{ | ||
Parent root = FXMLLoader.load(getClass().getResource("HomeScreenAthlete.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
public void clickAddSleepdata (ActionEvent event) throws IOException, LoadException{ | ||
// Open new window | ||
Parent root = FXMLLoader.load(getClass().getResource("AddSleepdata.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
} | ||
|
||
package tdt4140.gr1802.app.ui; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
|
||
import javafx.event.ActionEvent; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.fxml.LoadException; | ||
import javafx.scene.Cursor; | ||
import javafx.scene.Node; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.scene.control.Button; | ||
import javafx.scene.control.CheckBox; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.TextField; | ||
import javafx.stage.Stage; | ||
import tdt4140.gr1802.app.core.App; | ||
import tdt4140.gr1802.app.core.Athlete; | ||
import tdt4140.gr1802.app.core.Database; | ||
import tdt4140.gr1802.app.core.Workout; | ||
|
||
public class AddSleepdataController { | ||
|
||
// Making variables for every element in the fxml-file | ||
|
||
@FXML | ||
private Button btAddSleepdata ; | ||
|
||
@FXML | ||
private Button btAddWorkout; | ||
|
||
@FXML | ||
private Button btSeeWorkouts; | ||
|
||
@FXML | ||
private Button btSeeCoaches; | ||
|
||
@FXML | ||
private Button btCoachRequests; | ||
|
||
@FXML | ||
private TextField filepathTextField; | ||
|
||
@FXML | ||
private Button addButton; | ||
|
||
@FXML | ||
private Label txtLabelUsername; | ||
|
||
@FXML | ||
private CheckBox checkBox; | ||
|
||
@FXML | ||
private TextField gpxField; | ||
|
||
@FXML | ||
private Button homeScreenButton; | ||
|
||
private Database db; | ||
|
||
private static App app; | ||
|
||
private static Athlete athlete; | ||
|
||
private boolean visibility; | ||
|
||
|
||
|
||
// Initialization method | ||
public void initialize() { | ||
athlete = app.getAthlete(); | ||
this.db = app.getDb(); | ||
|
||
// Set username label | ||
this.txtLabelUsername.setText(athlete.getUsername()); | ||
} | ||
|
||
@FXML | ||
public void homeScreenButtonCursorHand() { | ||
homeScreenButton.setCursor(Cursor.HAND); | ||
} | ||
@FXML | ||
public void homeScreenButtonCursorDefault() { | ||
homeScreenButton.setCursor(Cursor.DEFAULT); | ||
} | ||
|
||
|
||
// Method called when "Add" button clicked | ||
public void clickAddButton (ActionEvent event) throws IOException { | ||
// The text in the application is used as a filepath, adds workout to the DB | ||
String path = filepathTextField.getText(); | ||
URL filePath = new File(path).toURI().toURL(); | ||
athlete.addSleepData(filePath); | ||
db.addSleepData(athlete); | ||
} | ||
|
||
|
||
// Side-menu buttons | ||
public void clickAddWorkout (ActionEvent event) throws IOException, LoadException{ | ||
// Open new window | ||
Parent root = FXMLLoader.load(getClass().getResource("AddWorkout.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
|
||
} | ||
|
||
public void clickSeeWorkouts (ActionEvent event) throws IOException{ | ||
Parent root = FXMLLoader.load(getClass().getResource("SeeWorkouts.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
public void clickSeeCoaches (ActionEvent event) throws IOException{ | ||
Parent root = FXMLLoader.load(getClass().getResource("SeeCoaches.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
public void clickCoachRequest (ActionEvent event) throws IOException{ | ||
Parent root = FXMLLoader.load(getClass().getResource("CoachRequests.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
|
||
public void backToHomeScreen(ActionEvent event) throws IOException{ | ||
Parent root = FXMLLoader.load(getClass().getResource("HomeScreenAthlete.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
public void clickAddSleepdata (ActionEvent event) throws IOException, LoadException{ | ||
// Open new window | ||
Parent root = FXMLLoader.load(getClass().getResource("AddSleepdata.fxml")); | ||
Scene scene = new Scene(root,1280,720); | ||
Stage window = (Stage) ((Node)event.getSource()).getScene().getWindow(); | ||
|
||
window.setScene(scene); | ||
window.show(); | ||
} | ||
|
||
} | ||
|
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
Oops, something went wrong.