diff --git a/src/main/java/NTNU/IDATT1002/controllers/CreateAlbum.java b/src/main/java/NTNU/IDATT1002/controllers/CreateAlbum.java index 30cd514944e1b1beab7d965d728dfa52ff2160c5..cd4784b077177a02a8f1a7d1dee659335320375d 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/CreateAlbum.java +++ b/src/main/java/NTNU/IDATT1002/controllers/CreateAlbum.java @@ -12,6 +12,11 @@ import javafx.scene.layout.Pane; import java.io.IOException; +/** + * Controls the buttons and changeable elements on create_album.fxml, + * a page where you create albums + * @version 1.0 22.03.2020 + */ public class CreateAlbum { public TextField tbar_search; public ImageView tbar_logo; @@ -28,27 +33,61 @@ public class CreateAlbum { public Button tbar_albums; public Button tbar_searchBtn; - public void switchToSearch(ActionEvent actionEvent) throws IOException { - App.setRoot("search"); - } - - public void switchToUpload(ActionEvent actionEvent) throws IOException { - App.setRoot("upload"); + /** + * Method that changes stage to Main page + * @param mouseEvent + * @throws IOException + */ + public void switchToMain(MouseEvent mouseEvent) throws IOException { + App.setRoot("main"); } - public void switchToMap(ActionEvent actionEvent) throws IOException { - App.setRoot("map"); + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ + public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } + App.setRoot("search"); } + /** + * Method that changes stage to Explore page + * @param actionEvent + * @throws IOException + */ public void switchToExplore(ActionEvent actionEvent) throws IOException { App.setRoot("explore"); } - public void switchToMain(MouseEvent mouseEvent) throws IOException { - App.setRoot("main"); - } - + /** + * Method that changes stage to Albums page + * @param actionEvent + * @throws IOException + */ public void switchToAlbums(ActionEvent actionEvent) throws IOException { App.setRoot("explore_albums"); } + + /** + * Method that changes stage to Map page + * @param actionEvent + * @throws IOException + */ + public void switchToMap(ActionEvent actionEvent) throws IOException { + App.setRoot("map"); + } + + /** + * Method that changes stage to Upload page + * @param actionEvent the mouse has done something + * @throws IOException this page does not exist + */ + public void switchToUpload(ActionEvent actionEvent) throws IOException { + App.setRoot("upload"); + } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java b/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java index c9d445206582c024f423ed1375134f16bf2a2987..02a9617eea633098ffc43f9ef80b5008378a9b73 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java +++ b/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java @@ -3,13 +3,15 @@ package NTNU.IDATT1002.controllers; import java.io.File; import java.util.List; +/** + * Class for storing temporary variables between controllers, + * when tha stage changes + * @version 1.0 22.03.2020 + */ public class DataExchange { private String searchField; private List<File> uploadedFiles; - public DataExchange(){ - searchField = ""; - } public List<File> getUploadedFiles() { return uploadedFiles; } diff --git a/src/main/java/NTNU/IDATT1002/controllers/Explore.java b/src/main/java/NTNU/IDATT1002/controllers/Explore.java index 166b5a340b5dc5eef8d96de2eb27eb831864b959..703e0dbd101fd1a398cfb674bf821dc25792d345 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Explore.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Explore.java @@ -11,6 +11,11 @@ import javafx.scene.layout.Pane; import java.io.IOException; +/** + * Controls the buttons and changeable elements on explore.fxml, + * a page where you explore images + * @version 1.0 22.03.2020 + */ public class Explore { public ImageView tbar_logo; @@ -49,6 +54,19 @@ public class Explore { App.setRoot("main"); } + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ + public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } + App.setRoot("search"); + } + /** * Method that changes stage to Explore page * @param actionEvent @@ -59,29 +77,25 @@ public class Explore { } /** - * Method for switching to Map page + * Method that changes stage to Albums page * @param actionEvent * @throws IOException */ - public void switchToMap(ActionEvent actionEvent) throws IOException { - App.setRoot("map"); + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } /** - * Method for switching to Search page. It reads the value of the search - * field and if not empty it is passed to dataexchange + * Method that changes stage to Map page * @param actionEvent * @throws IOException */ - public void switchToSearch(ActionEvent actionEvent) throws IOException { - if (!tbar_search.getText().isEmpty()){ - App.ex.setSearchField(tbar_search.getText()); - } - App.setRoot("search"); + public void switchToMap(ActionEvent actionEvent) throws IOException { + App.setRoot("map"); } /** - * Method for switching to Upload page + * Method that changes stage to Upload page * @param actionEvent the mouse has done something * @throws IOException this page does not exist */ @@ -106,23 +120,4 @@ public class Explore { public void switchToNext(ActionEvent actionEvent) throws IOException { //TODO: Make method that updates content to next "page" } - - /** - * Method for switching to Explore Albums page - * @param actionEvent - * @throws IOException - */ - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); - } - - /** - * Method that opens "View picture" page for the picture that got clicked - * @param mouseEvent - * @throws IOException - */ - public void switchToPicture(MouseEvent mouseEvent) throws IOException { - //TODO: write method to switch to the correct picture depending on which pane gets clicked - App.setRoot("view_picture"); - } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/ExploreAlbums.java b/src/main/java/NTNU/IDATT1002/controllers/ExploreAlbums.java index ca6784e93ddfb1e2916e6ab8dfd3080bd79c1b45..47bc562fb15f4e7e8904922cc99aeb7914ffdec8 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/ExploreAlbums.java +++ b/src/main/java/NTNU/IDATT1002/controllers/ExploreAlbums.java @@ -12,6 +12,11 @@ import javafx.scene.text.Text; import java.io.IOException; +/** + * Controls the buttons and changeable elements on explore_albums.fxml, + * a page where you explore albums + * @version 1.0 22.03.2020 + */ public class ExploreAlbums { public ImageView tbar_logo; public TextField tbar_search; @@ -52,39 +57,88 @@ public class ExploreAlbums { public Text album_tags5; public Button tbar_albums; + /** + * Method that changes stage to Main page + * @param mouseEvent + * @throws IOException + */ + public void switchToMain(MouseEvent mouseEvent) throws IOException { + App.setRoot("main"); + } + + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } App.setRoot("search"); } - public void switchToMain(MouseEvent mouseEvent) throws IOException { - App.setRoot("main"); + /** + * Method that changes stage to Explore page + * @param actionEvent + * @throws IOException + */ + public void switchToExplore(ActionEvent actionEvent) throws IOException { + App.setRoot("explore"); + } + + /** + * Method that changes stage to Albums page + * @param actionEvent + * @throws IOException + */ + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } + /** + * Method that changes stage to Map page + * @param actionEvent + * @throws IOException + */ public void switchToMap(ActionEvent actionEvent) throws IOException { App.setRoot("map"); } + /** + * Method that changes stage to Upload page + * @param actionEvent the mouse has done something + * @throws IOException this page does not exist + */ public void switchToUpload(ActionEvent actionEvent) throws IOException { App.setRoot("upload"); } - public void switchToPrevious(ActionEvent actionEvent) { - - } - - public void switchToNext(ActionEvent actionEvent) throws IOException { - - } - + /** + * Method that changes stage to Create Album page + * @param actionEvent the mouse has done something + * @throws IOException this page does not exist + */ public void switchToCreateAlbum(ActionEvent actionEvent) throws IOException { App.setRoot("create_album"); } - public void switchToExplore(ActionEvent actionEvent) throws IOException { - App.setRoot("explore"); + /** + * Method that updates content to previous "page" + * @param actionEvent + * @throws IOException + */ + public void switchToPrevious(ActionEvent actionEvent) throws IOException { + //TODO: Make method that updates content } - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); + /** + * Method that updates content to next "page" + * @param actionEvent + * @throws IOException + */ + public void switchToNext(ActionEvent actionEvent) throws IOException { + //TODO: Make method that updates content } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/Login.java b/src/main/java/NTNU/IDATT1002/controllers/Login.java index 4f9f87176143969f19454da9910feca226286767..d3d78509e9843d3a38326178025061d595f291a9 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Login.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Login.java @@ -6,13 +6,18 @@ import NTNU.IDATT1002.App; import javafx.event.ActionEvent; import javafx.scene.control.Button; +/** + * Controls the buttons and changeable elements on login.fxml, + * the page where you log into the application + * @version 1.0 22.03.2020 + */ public class Login { public Button signup; public Button login; /** - * Method that switches to sign up page + * Method that changes stage to Sign Up page * @param actionEvent * @throws IOException */ @@ -21,11 +26,12 @@ public class Login { } /** - * Method that switches to main page + * Method that changes stage to Main page * @param actionEvent * @throws IOException */ - public void switchToMain(ActionEvent actionEvent) throws IOException { + public void login(ActionEvent actionEvent) throws IOException { + //TODO: Verify username and password App.setRoot("main"); } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/Main.java b/src/main/java/NTNU/IDATT1002/controllers/Main.java index 831a4c67e3ed7f8e86d348b62437101097a2750c..e90d42a34ce04a950b4eb5fbc1550aeb75308b87 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Main.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Main.java @@ -9,6 +9,11 @@ import javafx.scene.input.MouseEvent; import java.io.IOException; +/** + * Controls the buttons and changeable elements on main.fxml, + * a page where you explore albums + * @version 1.0 22.03.2020 + */ public class Main { public ImageView tbar_logo; @@ -30,6 +35,19 @@ public class Main { App.setRoot("main"); } + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ + public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } + App.setRoot("search"); + } + /** * Method that changes stage to Explore page * @param actionEvent @@ -40,37 +58,29 @@ public class Main { } /** - * Method for switching to Map page + * Method that changes stage to Albums page * @param actionEvent * @throws IOException */ - public void switchToMap(ActionEvent actionEvent) throws IOException { - App.setRoot("map"); + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } /** - * Method for switching to Search page. It reads the value of the search - * field and if not empty it is passed to dataexchange + * Method that changes stage to Map page * @param actionEvent * @throws IOException */ - public void switchToSearch(ActionEvent actionEvent) throws IOException { - if (!tbar_search.getText().isEmpty()){ - App.ex.setSearchField(tbar_search.getText()); - } - App.setRoot("search"); + public void switchToMap(ActionEvent actionEvent) throws IOException { + App.setRoot("map"); } /** - * Method for switching to Upload page + * Method that changes stage to Upload page * @param actionEvent the mouse has done something * @throws IOException this page does not exist */ public void switchToUpload(ActionEvent actionEvent) throws IOException { App.setRoot("upload"); } - - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); - } } \ No newline at end of file diff --git a/src/main/java/NTNU/IDATT1002/controllers/Map.java b/src/main/java/NTNU/IDATT1002/controllers/Map.java index 1b3e90d8932d09c9bad18bd5cc6796738a38ae91..897b549f2e1ca2978aca3399694d0c2d041951b1 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Map.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Map.java @@ -9,6 +9,11 @@ import javafx.scene.input.MouseEvent; import java.io.IOException; +/** + * Controls the buttons and changeable elements on map.fxml, + * a page where you can find images by location + * @version 1.0 22.03.2020 + */ public class Map { public ImageView tbar_logo; public TextField tbar_search; @@ -30,6 +35,19 @@ public class Map { App.setRoot("main"); } + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ + public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } + App.setRoot("search"); + } + /** * Method that changes stage to Explore page * @param actionEvent @@ -40,29 +58,25 @@ public class Map { } /** - * Method for switching to Map page + * Method that changes stage to Albums page * @param actionEvent * @throws IOException */ - public void switchToMap(ActionEvent actionEvent) throws IOException { - App.setRoot("map"); + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } /** - * Method for switching to Search page. It reads the value of the search - * field and if not empty it is passed to dataexchange + * Method that changes stage to Map page * @param actionEvent * @throws IOException */ - public void switchToSearch(ActionEvent actionEvent) throws IOException { - if (!tbar_search.getText().isEmpty()){ - App.ex.setSearchField(tbar_search.getText()); - } - App.setRoot("search"); + public void switchToMap(ActionEvent actionEvent) throws IOException { + App.setRoot("map"); } /** - * Method for switching to Upload page + * Method that changes stage to Upload page * @param actionEvent the mouse has done something * @throws IOException this page does not exist */ @@ -77,9 +91,5 @@ public class Map { public void MapSearch(ActionEvent actionEvent) { //TODO: Make method } - - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); - } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/Search.java b/src/main/java/NTNU/IDATT1002/controllers/Search.java index fbc7339c80f870f650dd63bd3dae5045e8b3206d..591841838a9f048ab81d76e870dd3b94d5e3d849 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Search.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Search.java @@ -7,7 +7,6 @@ import javafx.scene.control.Button; import javafx.scene.control.ChoiceBox; import javafx.scene.control.ScrollPane; import javafx.scene.control.TextField; -import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.text.Text; @@ -16,6 +15,11 @@ import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; +/** + * Controls the buttons and changeable elements on search.fxml, + * a page where you can search for images and sort them + * @version 1.0 22.03.2020 + */ public class Search implements Initializable { public ImageView tbar_logo; @@ -54,6 +58,19 @@ public class Search implements Initializable { App.setRoot("main"); } + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ + public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } + App.setRoot("search"); + } + /** * Method that changes stage to Explore page * @param actionEvent @@ -64,29 +81,25 @@ public class Search implements Initializable { } /** - * Method for switching to Map page + * Method that changes stage to Albums page * @param actionEvent * @throws IOException */ - public void switchToMap(ActionEvent actionEvent) throws IOException { - App.setRoot("map"); + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } /** - * Method for switching to Search page. It reads the value of the search - * field and if not empty it is passed to dataexchange + * Method that changes stage to Map page * @param actionEvent * @throws IOException */ - public void switchToSearch(ActionEvent actionEvent) throws IOException { - if (!tbar_search.getText().isEmpty()){ - App.ex.setSearchField(tbar_search.getText()); - } - App.setRoot("search"); + public void switchToMap(ActionEvent actionEvent) throws IOException { + App.setRoot("map"); } /** - * Method for switching to Upload page + * Method that changes stage to Upload page * @param actionEvent the mouse has done something * @throws IOException this page does not exist */ @@ -111,8 +124,4 @@ public class Search implements Initializable { public void switchToNext(ActionEvent actionEvent) throws IOException { //TODO: Make method that updates content to next "page" } - - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); - } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/SignUp.java b/src/main/java/NTNU/IDATT1002/controllers/SignUp.java index 4282666a0b349999bc9b7aeb17f25ada9f8c4bf4..2b5c2a7924dfff457b7ef5e76b451c0435ba636e 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/SignUp.java +++ b/src/main/java/NTNU/IDATT1002/controllers/SignUp.java @@ -10,6 +10,11 @@ import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; +/** + * Controls the buttons and changeable elements on signup.fxml, + * a page where you create a new user for the application + * @version 1.0 22.03.2020 + */ public class SignUp { public GridPane signup_form; @@ -25,11 +30,13 @@ public class SignUp { public Button signup_btn; /** - * Method that switches to login page + * Method that changes stage to Login * @param actionEvent * @throws IOException */ - public void switchToLogin(ActionEvent actionEvent) throws IOException { + public void signup(ActionEvent actionEvent) throws IOException { + //TODO: Verify that all fields is properly filled + //TODO: Register new user in database App.setRoot("login"); } } \ No newline at end of file diff --git a/src/main/java/NTNU/IDATT1002/controllers/Upload.java b/src/main/java/NTNU/IDATT1002/controllers/Upload.java index 38bbe9bf71a538aba886c2799acefcaa6696ffda..ebebfce917c95e75789d533e88e1491fffe04f14 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Upload.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Upload.java @@ -23,6 +23,11 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +/** + * Controls the buttons and changeable elements on upload.fxml, + * a page where you select images to upload + * @version 1.0 22.03.2020 + */ public class Upload { public ImageView tbar_logo; public TextField tbar_search; @@ -44,6 +49,19 @@ public class Upload { App.setRoot("main"); } + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ + public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } + App.setRoot("search"); + } + /** * Method that changes stage to Explore page * @param actionEvent @@ -54,29 +72,25 @@ public class Upload { } /** - * Method for switching to Map page + * Method that changes stage to Albums page * @param actionEvent * @throws IOException */ - public void switchToMap(ActionEvent actionEvent) throws IOException { - App.setRoot("map"); + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } /** - * Method for switching to Search page. It reads the value of the search - * field and if not empty it is passed to dataexchange + * Method that changes stage to Map page * @param actionEvent * @throws IOException */ - public void switchToSearch(ActionEvent actionEvent) throws IOException { - if (!tbar_searchBtn.getText().isEmpty()){ - App.ex.setSearchField(tbar_search.getText()); - } - App.setRoot("search"); + public void switchToMap(ActionEvent actionEvent) throws IOException { + App.setRoot("map"); } /** - * Method for switching to Upload page + * Method that changes stage to Upload page * @param actionEvent the mouse has done something * @throws IOException this page does not exist */ @@ -84,14 +98,20 @@ public class Upload { App.setRoot("upload"); } - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); - } - + /** + * Method that changs stage to Uploaded Single page + * If the user has chosen 1 image this method is called + * @throws IOException + */ private void switchToUploadedSingle() throws IOException { App.setRoot("uploaded_single"); } + /** + * Method that changs stage to Uploaded Multiple page + * If the user has chosen multiple images this method is called + * @throws IOException + */ private void switchToUploadedMultiple() throws IOException { App.setRoot("uploaded_multiple"); } @@ -101,7 +121,7 @@ public class Upload { /** * Method that opens file browser with an image filter - * The user chooses what files to upload + * The user will choose what files to upload * @throws IOException */ public void chooseFile() throws IOException { @@ -112,6 +132,7 @@ public class Upload { List<File> list = fileChooser.showOpenMultipleDialog(uploadBtn.getScene().getWindow()); if(!list.isEmpty()){ + //Store files in DataExchange App.ex.setUploadedFiles(list); if (list.size() == 1){ switchToUploadedSingle(); @@ -123,7 +144,7 @@ public class Upload { } /** - * Method that finds the extension/ file type + * Method that finds the extension of a file * @param fileName the name of the file (img.jpg, img2.png ect.) * @return file extension (jpg, png ect.) */ @@ -139,8 +160,8 @@ public class Upload { } /** - * Method that decides if something hoovered over the pane is acceptable - * Called when something is hoovered over the pane + * Method that decides if something can be dropped + * The method is called whenever something is hoovered over the drag-drop pane * @param event something is dragged over the container */ public void acceptDrop(DragEvent event) { @@ -170,6 +191,7 @@ public class Upload { public void droppedFiles(DragEvent event) throws IOException { List<File> list = event.getDragboard().getFiles(); if(!list.isEmpty()){ + //Stores files to DataExchange App.ex.setUploadedFiles(list); if (list.size() == 1){ switchToUploadedSingle(); diff --git a/src/main/java/NTNU/IDATT1002/controllers/UploadedMultiple.java b/src/main/java/NTNU/IDATT1002/controllers/UploadedMultiple.java index d485a5373145a29f095820e4de6b8369b6a216e9..2c4e14d902a2c6924475476f5fe1ce4c8ea11a24 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/UploadedMultiple.java +++ b/src/main/java/NTNU/IDATT1002/controllers/UploadedMultiple.java @@ -10,6 +10,11 @@ import javafx.scene.input.MouseEvent; import java.io.IOException; +/** + * Controls the buttons and changeable elements on upload_multiple.fxml, + * a page where you add descriptions to your selected images + * @version 1.0 22.03.2020 + */ public class UploadedMultiple { @@ -52,6 +57,19 @@ public class UploadedMultiple { App.setRoot("main"); } + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ + public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } + App.setRoot("search"); + } + /** * Method that changes stage to Explore page * @param actionEvent @@ -62,48 +80,40 @@ public class UploadedMultiple { } /** - * Method for switching to Map page + * Method that changes stage to Albums page * @param actionEvent * @throws IOException */ - public void switchToMap(ActionEvent actionEvent) throws IOException { - App.setRoot("map"); + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } /** - * Method for switching to Search page. It reads the value of the search - * field and if not empty it is passed to dataexchange + * Method that changes stage to Map page * @param actionEvent * @throws IOException */ - public void switchToSearch(ActionEvent actionEvent) throws IOException { - if (!tbar_search.getText().isEmpty()){ - App.ex.setSearchField(tbar_search.getText()); - } - App.setRoot("search"); + public void switchToMap(ActionEvent actionEvent) throws IOException { + App.setRoot("map"); } /** - * Method for switching to Upload page. - * @param actionEvent the mouse has done something - * @throws IOException this page does not exist + * Method that changes stage to Upload page + * @param actionEvent + * @throws IOException */ public void switchToUpload(ActionEvent actionEvent) throws IOException { App.setRoot("upload"); } /** - * Method for uploading image with title, tags and description to database - * Image itself is not stored but Url is - * @param actionEvent the mouse has done something - * @throws IOException this page does not exist + * Method for uploading several images to database with title, tags and description + * Image itself is not stored but URL is + * @param actionEvent + * @throws IOException */ - public void uploadAlbum(ActionEvent actionEvent) throws IOException { - //TODO: write method to accept and upload the photo with chosen settings, titles etc and then setRoot to main page + public void uploadMultiple(ActionEvent actionEvent) throws IOException { + //TODO: write method to accept and upload the photo with chosen settings, titles.. App.setRoot("main"); } - - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); - } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/UploadedSingle.java b/src/main/java/NTNU/IDATT1002/controllers/UploadedSingle.java index b53a764811628f607acfb84cb905c75921d037ce..2426930f95b796fb5511396da4e54e286241ed3d 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/UploadedSingle.java +++ b/src/main/java/NTNU/IDATT1002/controllers/UploadedSingle.java @@ -14,6 +14,11 @@ import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; +/** + * Controls the buttons and changeable elements on upload_single.fxml, + * a page where you add descriptions to your selected image + * @version 1.0 22.03.2020 + */ public class UploadedSingle implements Initializable { @@ -52,6 +57,19 @@ public class UploadedSingle implements Initializable { App.setRoot("main"); } + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ + public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } + App.setRoot("search"); + } + /** * Method that changes stage to Explore page * @param actionEvent @@ -62,48 +80,40 @@ public class UploadedSingle implements Initializable { } /** - * Method for switching to Map page + * Method that changes stage to Albums page * @param actionEvent * @throws IOException */ - public void switchToMap(ActionEvent actionEvent) throws IOException { - App.setRoot("map"); + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } /** - * Method for switching to Search page. It reads the value of the search - * field and if not empty it is passed to dataexchange + * Method that changes stage to Map page * @param actionEvent * @throws IOException */ - public void switchToSearch(ActionEvent actionEvent) throws IOException { - if (!tbar_search.getText().isEmpty()){ - App.ex.setSearchField(tbar_search.getText()); - } - App.setRoot("search"); + public void switchToMap(ActionEvent actionEvent) throws IOException { + App.setRoot("map"); } /** - * Method for switching to Upload page - * @param actionEvent the mouse has done something - * @throws IOException this page does not exist + * Method that changes stage to Upload page + * @param actionEvent + * @throws IOException */ public void switchToUpload(ActionEvent actionEvent) throws IOException { App.setRoot("upload"); } /** - * Method for uploading image with title, tags and description to database - * Image itself is not stored but Url is - * @param actionEvent the mouse has done something - * @throws IOException this page does not exist + * Method for uploading image to database with title, tags and description + * Image itself is not stored but URL is + * @param actionEvent + * @throws IOException */ - public void uploadPhoto(ActionEvent actionEvent) throws IOException { - //TODO: write method to accept and upload the photo with chosen settings, titles etc and then setRoot to logged-in page + public void uploadSingle(ActionEvent actionEvent) throws IOException { + //TODO: write method to accept and upload the photo with chosen settings, titles... App.setRoot("main"); } - - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); - } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/ViewAlbum.java b/src/main/java/NTNU/IDATT1002/controllers/ViewAlbum.java index 17d82f7f0f626377055ba6334364203e33a68e90..7125cbc8167c02a897157415c56752066700afa8 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/ViewAlbum.java +++ b/src/main/java/NTNU/IDATT1002/controllers/ViewAlbum.java @@ -3,7 +3,6 @@ package NTNU.IDATT1002.controllers; import NTNU.IDATT1002.App; import javafx.event.ActionEvent; import javafx.scene.control.Button; -import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; @@ -12,6 +11,11 @@ import javafx.scene.text.Text; import java.io.IOException; +/** + * Controls the buttons and changeable elements on view_album.fxml, + * a page where get a more detailed view of an album + * @version 1.0 22.03.2020 + */ public class ViewAlbum { public TextField tbar_search; public ImageView tbar_logo; @@ -37,20 +41,62 @@ public class ViewAlbum { public Button tbar_searchBtn; public Button tbar_albums; + /** + * Method that changes stage to Main page + * @param mouseEvent + * @throws IOException + */ + public void switchToMain(MouseEvent mouseEvent) throws IOException { + App.setRoot("main"); + } + + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } App.setRoot("search"); } - public void switchToUpload(ActionEvent actionEvent) throws IOException { - App.setRoot("upload"); + /** + * Method that changes stage to Explore page + * @param actionEvent + * @throws IOException + */ + public void switchToExplore(ActionEvent actionEvent) throws IOException { + App.setRoot("explore"); + } + + /** + * Method that changes stage to Albums page + * @param actionEvent + * @throws IOException + */ + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } + /** + * Method that changes stage to Map page + * @param actionEvent + * @throws IOException + */ public void switchToMap(ActionEvent actionEvent) throws IOException { App.setRoot("map"); } - public void switchToExplore(ActionEvent actionEvent) throws IOException { - App.setRoot("explore"); + /** + * Method that changes stage to Upload page + * @param actionEvent the mouse has done something + * @throws IOException this page does not exist + */ + public void switchToUpload(ActionEvent actionEvent) throws IOException { + App.setRoot("upload"); } public void openPopUpPicture(MouseEvent mouseEvent) { @@ -92,12 +138,4 @@ public class ViewAlbum { public void createPdf(ActionEvent actionEvent) { //write method that generates and downloads a PDF version of the album } - - public void switchToMain(MouseEvent mouseEvent) throws IOException { - App.setRoot("main"); - } - - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); - } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/ViewPicture.java b/src/main/java/NTNU/IDATT1002/controllers/ViewPicture.java index 6b56ef482f8544fd8d1c0ad5880938fc73fe615b..acde159954f2a111a19844b86a86dd2344bb18b5 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/ViewPicture.java +++ b/src/main/java/NTNU/IDATT1002/controllers/ViewPicture.java @@ -11,6 +11,11 @@ import javafx.scene.text.Text; import java.io.IOException; +/** + * Controls the buttons and changeable elements on view_picture.fxml, + * a page where get a more detailed view of a picture + * @version 1.0 22.03.2020 + */ public class ViewPicture { public ImageView tbar_logo; public TextField tbar_search; @@ -25,31 +30,69 @@ public class ViewPicture { public Button tbar_searchBtn; public Button tbar_albums; - public void switchToSearch(ActionEvent actionEvent) { - + /** + * Method that changes stage to Main page + * @param mouseEvent + * @throws IOException + */ + public void switchToMain(MouseEvent mouseEvent) throws IOException { + App.setRoot("main"); } - public void switchToExplore(ActionEvent actionEvent) { - + /** + * Method that changes stage to Search page. It reads the value of the search + * field and if not empty it is passed to dataexchange + * @param actionEvent + * @throws IOException + */ + public void switchToSearch(ActionEvent actionEvent) throws IOException { + if (!tbar_search.getText().isEmpty()){ + App.ex.setSearchField(tbar_search.getText()); + } + App.setRoot("search"); } - public void switchToMap(ActionEvent actionEvent) { - + /** + * Method that changes stage to Explore page + * @param actionEvent + * @throws IOException + */ + public void switchToExplore(ActionEvent actionEvent) throws IOException { + App.setRoot("explore"); } - public void switchToUpload(ActionEvent actionEvent) { - + /** + * Method that changes stage to Albums page + * @param actionEvent + * @throws IOException + */ + public void switchToAlbums(ActionEvent actionEvent) throws IOException { + App.setRoot("explore_albums"); } - public void openPopUpPicture(MouseEvent mouseEvent) { - //method that opens pop-up of picture + /** + * Method that changes stage to Map page + * @param actionEvent + * @throws IOException + */ + public void switchToMap(ActionEvent actionEvent) throws IOException { + App.setRoot("map"); } - public void switchToMain(MouseEvent mouseEvent) throws IOException { - App.setRoot("main"); + /** + * Method that changes stage to Upload page + * @param actionEvent the mouse has done something + * @throws IOException this page does not exist + */ + public void switchToUpload(ActionEvent actionEvent) throws IOException { + App.setRoot("upload"); } - public void switchToAlbums(ActionEvent actionEvent) throws IOException { - App.setRoot("explore_albums"); + /** + * Method that opens large version of image in popup + * @param mouseEvent + */ + public void openPopUpPicture(MouseEvent mouseEvent) { + //method that opens pop-up of picture } } diff --git a/src/main/resources/NTNU/IDATT1002/login.fxml b/src/main/resources/NTNU/IDATT1002/login.fxml index 18d1dcc8601b418cd9026b694050d117f1a99498..58007fade7e876212ac13b077a597ff56f5e6c63 100644 --- a/src/main/resources/NTNU/IDATT1002/login.fxml +++ b/src/main/resources/NTNU/IDATT1002/login.fxml @@ -30,7 +30,7 @@ <TextField GridPane.columnIndex="1" /> <PasswordField GridPane.columnIndex="1" GridPane.rowIndex="1" /> <Button fx:id="signup" onAction="#switchToSignup" text="Sign Up" GridPane.columnIndex="1" GridPane.halignment="RIGHT" GridPane.rowIndex="2" /> - <Button fx:id="login" onAction="#switchToMain" layoutX="171.0" layoutY="74.0" text="Log In" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2" /> + <Button fx:id="login" onAction="#login" layoutX="171.0" layoutY="74.0" text="Log In" GridPane.columnIndex="1" GridPane.halignment="LEFT" GridPane.rowIndex="2" /> </children> <padding> <Insets bottom="3.0" left="3.0" right="3.0" top="3.0" /> diff --git a/src/main/resources/NTNU/IDATT1002/signup.fxml b/src/main/resources/NTNU/IDATT1002/signup.fxml index 721a94e19569327c30e8a253d3d293988b8391bb..ba43eb562691d1a2a53e66683c79beb9437278f7 100644 --- a/src/main/resources/NTNU/IDATT1002/signup.fxml +++ b/src/main/resources/NTNU/IDATT1002/signup.fxml @@ -59,7 +59,7 @@ <Insets bottom="3.0" left="3.0" right="3.0" top="3.0" /> </padding> </GridPane> - <Button fx:id="signup_btn" onAction="#switchToLogin" prefHeight="26.0" prefWidth="57.0" text="Sign up" /> + <Button fx:id="signup_btn" onAction="#signup" prefHeight="26.0" prefWidth="57.0" text="Sign up" /> </children> <padding> <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" /> diff --git a/src/main/resources/NTNU/IDATT1002/uploaded_multiple.fxml b/src/main/resources/NTNU/IDATT1002/uploaded_multiple.fxml index 2559e256e9a095674dfe5d8fd50c06891c2082c2..34a3c5d0a53b607afc7a021cd3225ca3128f8c80 100644 --- a/src/main/resources/NTNU/IDATT1002/uploaded_multiple.fxml +++ b/src/main/resources/NTNU/IDATT1002/uploaded_multiple.fxml @@ -166,7 +166,7 @@ <Image url="@../../Images/placeholder-1920x1080.png" /> </image> </ImageView> - <Button fx:id="acceptBtn" layoutX="880.0" layoutY="2000.0" mnemonicParsing="false" onAction="#uploadAlbum" text="ACCEPT"> + <Button fx:id="acceptBtn" layoutX="880.0" layoutY="2000.0" mnemonicParsing="false" onAction="#uploadMultiple" text="ACCEPT"> <font> <Font name="System Bold" size="24.0" /> </font> diff --git a/src/main/resources/NTNU/IDATT1002/uploaded_single.fxml b/src/main/resources/NTNU/IDATT1002/uploaded_single.fxml index 91ecf4a832baa13ea125d04718c2cf2ca2dcfa1b..8374d0c3c831158b607851ceee725f84b98dba3c 100644 --- a/src/main/resources/NTNU/IDATT1002/uploaded_single.fxml +++ b/src/main/resources/NTNU/IDATT1002/uploaded_single.fxml @@ -78,7 +78,7 @@ </Text> </children> </Pane> - <Button fx:id="acceptBtn" layoutX="493.0" layoutY="870.0" mnemonicParsing="false" onAction="#uploadPhoto" text="ACCEPT"> + <Button fx:id="acceptBtn" layoutX="493.0" layoutY="870.0" mnemonicParsing="false" onAction="#uploadSingle" text="ACCEPT"> <font> <Font size="18.0" /> </font>