diff --git a/src/main/java/NTNU/IDATT1002/controllers/CreateAlbum.java b/src/main/java/NTNU/IDATT1002/controllers/CreateAlbum.java index 53c5ff3209ee5390d9a709d9c344c153f79b4f00..6758c35e9087aa11e22c91caf9359df3a328b457 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/CreateAlbum.java +++ b/src/main/java/NTNU/IDATT1002/controllers/CreateAlbum.java @@ -50,6 +50,9 @@ public class CreateAlbum extends NavBarController implements Initializable { private AlbumService albumService; private ImageService imageService; + /** + * Tells {@link DataExchange} that create album page was visited. + */ public CreateAlbum() { App.ex.newPage("create_album"); EntityManager entityManager = App.ex.getEntityManager(); @@ -57,6 +60,13 @@ public class CreateAlbum extends NavBarController implements Initializable { imageService = new ImageService(entityManager); } + /** + * Generates container for all images of current user with a checkbox. + * These can be added to the album. + * Add text fields for user to fill + * @param url + * @param resourceBundle + */ @Override public void initialize(URL url, ResourceBundle resourceBundle) { List<Image> allImages = imageService.getImageFromUser(ApplicationState.getCurrentUser()); diff --git a/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java b/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java index 0af8f4f00c2e0a0847ea96b5e3cbb6d33145eb41..7372c99e4db3984f5bc9145cd13e806806ca04ad 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java +++ b/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java @@ -123,7 +123,8 @@ public class DataExchange { } /** - * Empties the page log if logged out + * Method that empties the array of visited pages. + * This method is called when logout button is pressed. */ public void emptyPageLog(){ FXMLHistory = new ArrayList<>(); diff --git a/src/main/java/NTNU/IDATT1002/controllers/Explore.java b/src/main/java/NTNU/IDATT1002/controllers/Explore.java index 9c82c53b0e9bd243b2d4c687255bdace4cccc675..51ffa1cf339c95026d43784899fa94b592446db9 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Explore.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Explore.java @@ -28,6 +28,7 @@ public class Explore extends PaginatedContent<Image> { /** * Tell {@link PaginatedContent} which fields to sort {@link Image}s by. + * Tell {@link DataExchange} that explore page is visited */ public Explore() { super("uploadedAt", "title"); diff --git a/src/main/java/NTNU/IDATT1002/controllers/ExploreAlbums.java b/src/main/java/NTNU/IDATT1002/controllers/ExploreAlbums.java index da466350be35d48983b2f0cb9273ac553c7f5fc7..6905533606aa7658d078624e57a23e758a84e0b0 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/ExploreAlbums.java +++ b/src/main/java/NTNU/IDATT1002/controllers/ExploreAlbums.java @@ -14,7 +14,6 @@ import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.input.MouseEvent; import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,6 +41,11 @@ public class ExploreAlbums extends PaginatedContent<Album> { private static Logger logger = LoggerFactory.getLogger(ExploreAlbums.class); + + /** + * Tell {@link PaginatedContent} which fields to sort {@link Album}s by. + * Tell {@link DataExchange} that explore albums page is visited. + */ public ExploreAlbums() { super("createdAt", "title"); @@ -50,10 +54,8 @@ public class ExploreAlbums extends PaginatedContent<Album> { } /** - * Provides the albumService to be used by PaginatedContent - * @return + * Return an {@link AlbumService} to use in {@link PaginatedContent}. */ - @Override protected PageableService<Album> getService() { return albumService; @@ -65,7 +67,6 @@ public class ExploreAlbums extends PaginatedContent<Album> { * @param page * @return a list of Hboxes with the Album content for the specific page */ - @Override public List<HBox> getContentsFrom(Page<Album> page) { diff --git a/src/main/java/NTNU/IDATT1002/controllers/ImageMapFactory.java b/src/main/java/NTNU/IDATT1002/controllers/ImageMapFactory.java index dabe21a0928082bb7d92e6e1993c7f973d20e458..1a3728d2c51f8a77f8dbd9396c515001ce3ae51a 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/ImageMapFactory.java +++ b/src/main/java/NTNU/IDATT1002/controllers/ImageMapFactory.java @@ -8,12 +8,6 @@ import NTNU.IDATT1002.utils.MetadataStringFormatter; import com.lynden.gmapsfx.GoogleMapView; import com.lynden.gmapsfx.javascript.event.UIEventType; import com.lynden.gmapsfx.javascript.object.*; -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import javax.imageio.ImageIO; import javax.xml.bind.DatatypeConverter; import netscape.javascript.JSObject; import org.slf4j.Logger; @@ -29,6 +23,8 @@ import java.util.stream.Collectors; /** * Class ImageMapFactory. Factory for map creation with markers for given images and default options. * Default center location is Copenhagen in order to center the full scale map onto a page. + * + * @version 1.0 20.04.2020 */ public class ImageMapFactory { diff --git a/src/main/java/NTNU/IDATT1002/controllers/Login.java b/src/main/java/NTNU/IDATT1002/controllers/Login.java index d40d6bcedc6bab9720fb731bb09f9a1a2c697c0b..1c2e0fac9bd60671cfcec4378aa7f8a35ef9bbcb 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Login.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Login.java @@ -46,7 +46,9 @@ public class Login { /** - * Method that changes scene to Main page + * Method that tries to log in to the page with the entered + * credentials. If successful, scene changes to Main page. If not + * it displays an error. * @throws IOException */ public void login() throws IOException { @@ -65,7 +67,7 @@ public class Login { } /** - * Method that registers a keyevent and tries to login if keyevent is enter + * Method that registers a keyevent and tries to login if keyevent is entered * @param keyEvent * @throws IOException */ @@ -76,7 +78,7 @@ public class Login { } /** - * Method trying to login is login button is pressed + * Method trying to login if login button is pressed * @param event * @throws IOException */ diff --git a/src/main/java/NTNU/IDATT1002/controllers/Main.java b/src/main/java/NTNU/IDATT1002/controllers/Main.java index cc5fecfa755ab3868c5c0fb6c6c0cc074acd561d..e074f8d6aa7e029d57fbf348a9e6c2ccd455ee63 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Main.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Main.java @@ -1,19 +1,21 @@ package NTNU.IDATT1002.controllers; import NTNU.IDATT1002.App; -import javafx.event.ActionEvent; import javafx.scene.control.Button; /** * Controls the buttons and changeable elements on main.fxml, * a page where you explore albums + * * @version 1.0 22.03.2020 */ public class Main extends NavBarController { public Button uploadBtn; - + /** + * Tells {@link DataExchange} that main page is visited. + */ public Main(){ App.ex.newPage("main"); } diff --git a/src/main/java/NTNU/IDATT1002/controllers/Map.java b/src/main/java/NTNU/IDATT1002/controllers/Map.java index 88f06e3dfb48695ea92f79abe84b2e7644318ba2..5745fb9cb97545b208c18181bf22debc65ca7c36 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Map.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Map.java @@ -44,37 +44,32 @@ import java.util.stream.Stream; /** * 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 extends NavBarController implements Initializable, MapComponentInitializedListener { + @FXML public TextField search; - + @FXML public Button searchBtn; - @FXML private GoogleMapView mapView; - @FXML private TextField addressTextField; private List<String> autoCompletions = new ArrayList<>(); - private GoogleMap googleMap; - private GeoApiContext geoApiContext; - private StringProperty address = new SimpleStringProperty(); - private ImageService imageService; - private AlbumService albumService; - private ExecutorService executorService = Executors.newCachedThreadPool(); - private static Logger logger = LoggerFactory.getLogger(Map.class); - + /** + * Tell {@link DataExchange} that map page is visited. + */ public Map() { App.ex.newPage("map"); EntityManager entityManager = App.ex.getEntityManager(); diff --git a/src/main/java/NTNU/IDATT1002/controllers/NavBarController.java b/src/main/java/NTNU/IDATT1002/controllers/NavBarController.java index c018e7461ff8903131292e4bb8df7dba3a35ce2d..db23b34984d2fb2024e90ff609a32a2ef49812c5 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/NavBarController.java +++ b/src/main/java/NTNU/IDATT1002/controllers/NavBarController.java @@ -10,6 +10,11 @@ import javafx.scene.input.MouseEvent; import java.io.IOException; +/** + * Class for controlling actions in the navigation bar + * + * @version 1.0 20.04.2020 + */ public class NavBarController { public ImageView navBarLogo; @@ -32,6 +37,12 @@ public class NavBarController { App.setRoot("main"); } + /** + * If {@link DataExchange} has a previous page it changes + * to it. + * @param actionEvent + * @throws IOException + */ public void goToPrevious(ActionEvent actionEvent) throws IOException { String previousPage = App.ex.previousPage(); if (previousPage != null){ @@ -41,7 +52,7 @@ public class NavBarController { /** * Method that changes scene to Search page. It reads the value of the search - * field and if not empty it is passed to dataexchange + * field and if not empty it is passed to {@link DataExchange} * @param actionEvent * @throws IOException */ @@ -85,15 +96,22 @@ public class NavBarController { /** * Method that changes scene to Upload page - * @param actionEvent the mouse has done something - * @throws IOException this page does not exist + * @param actionEvent + * @throws IOException */ public void switchToUpload(ActionEvent actionEvent) throws IOException { App.ex.setChosenAlbumId(null); App.setRoot("upload"); } + /** + * Method for logging out user. Also empties the list of + * visited pages and chosen album in {@link DataExchange}. + * @param actionEvent + * @throws IOException + */ public void logOut(ActionEvent actionEvent) throws IOException { + App.ex.emptyPageLog(); UserService.logOut(); App.ex.setChosenAlbumId(null); App.setRoot("login"); diff --git a/src/main/java/NTNU/IDATT1002/controllers/PaginatedContent.java b/src/main/java/NTNU/IDATT1002/controllers/PaginatedContent.java index 72f90fd16889bc4492ef9795086abea25fed13dd..b0435a4333dc806dff7cbff31baf841dcdb24455 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/PaginatedContent.java +++ b/src/main/java/NTNU/IDATT1002/controllers/PaginatedContent.java @@ -72,22 +72,6 @@ import java.util.ResourceBundle; */ public abstract class PaginatedContent<T> extends NavBarController implements Initializable { - private final Integer[] AMOUNT_SELECTION = {15, 30, 50, 100}; - - private PageableService<T> service; - - private Pagination pagination; - - protected Integer pageSize = 15; - - private Page<T> currentPage; - - private Sort currentSort; - - private PageRequest currentPageRequest = PageRequest.of(0, pageSize, currentSort); - - private Map<String, Sort> choiceSortMapping; - @FXML private ScrollPane scrollPane; @FXML @@ -101,7 +85,24 @@ public abstract class PaginatedContent<T> extends NavBarController implements In @FXML private Text total; + private final Integer[] AMOUNT_SELECTION = {15, 30, 50, 100}; + + private PageableService<T> service; + + private Pagination pagination; + + protected Integer pageSize = 15; + + private Page<T> currentPage; + + private Sort currentSort; + + private PageRequest currentPageRequest = PageRequest.of(0, pageSize, currentSort); + + private Map<String, Sort> choiceSortMapping; + protected abstract PageableService<T> getService(); + protected abstract List<? extends Node> getContentsFrom(Page<T> page); /** diff --git a/src/main/java/NTNU/IDATT1002/controllers/Search.java b/src/main/java/NTNU/IDATT1002/controllers/Search.java index 6dbe55077fb71cd234d1f741f4e9763079fe0a4b..566624d43a7443e1cc84c1518c7d072c187002b8 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Search.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Search.java @@ -40,56 +40,42 @@ import java.util.stream.Stream; /** * Controls the buttons and changeable elements on search.fxml, - * a page where you can search for images and sort them + * a page where you can search for images + * * @version 1.0 22.03.2020 */ public class Search extends NavBarController implements Initializable { @FXML public Text searchWord; - @FXML public Text amountTotal; - - @FXML - public Text amountImages; - @FXML public Text amountAlbums; - + @FXML + public Text amountImages; @FXML public VBox rootAlbumsContainer; - @FXML public VBox rootImagesContainer; - @FXML public Text albumsPlaceholder; - + @FXML + public Text imagesPlaceholder; @FXML public ProgressBar progressBar; - @FXML public HBox progressBarContainer; - @FXML public VBox pageRootContainer; - - @FXML - public Text imagesPlaceholder; - @FXML public TabPane tabContainer; - - @FXML - public Tab imagesTab; - @FXML public Tab albumsTab; - + @FXML + public Tab imagesTab; @FXML public Button previousBtn; - @FXML public Button nextBtn; @@ -103,17 +89,21 @@ public class Search extends NavBarController implements Initializable { private ObservableList<Album> listOfAlbums; private ObservableList<NTNU.IDATT1002.models.Image> listOfImages; - private final ExecutorService executorService = Executors.newFixedThreadPool(ELEMENTS_PER_PAGE); + private final ExecutorService executorService = Executors.newCachedThreadPool(); private static Logger logger = LoggerFactory.getLogger(Search.class); + /** + * Tell {@link DataExchange} that search page was visited. + * Display search word. + */ public Search(){ App.ex.newPage("search"); searchTextField = App.ex.getSearchField(); } /** - * Method that writes the word that is searched for. - * Also generates HBoxes with image title, tags... + * Generates content based on the search word. Searches both images and albums. + * When the tasks is done the content is displayed as well as the number of each result type. * @param location * @param resources */ @@ -172,7 +162,9 @@ public class Search extends NavBarController implements Initializable { } /** - * Method for updating previous and next buttons when selected tab is changed + * Method that updates next and previous buttons disable-properties based on the active tab. + * If albums tab is active and it is not possible to go to next page due to too few search results, + * the button is disabled. */ public void addTabListeners(){ //If image tab is selected/unselected @@ -186,7 +178,7 @@ public class Search extends NavBarController implements Initializable { } /** - * Button state to the current active tab + * Find out if it is possible to go to next or previous on active tab * @param start active tabs start value * @param end active tabs end value * @param size size of search results @@ -262,7 +254,7 @@ public class Search extends NavBarController implements Initializable { /** - * Update content to current albums. + * Updates the content in the album tab content container. * * @param albums the {@link VBox} containing the albums */ @@ -274,7 +266,7 @@ public class Search extends NavBarController implements Initializable { } /** - * Update content with to current images. + * Updates the content in the image tab content container * * @param images the {@link VBox} containing the images */ @@ -296,10 +288,12 @@ public class Search extends NavBarController implements Initializable { * Create a {@link VBox} of image {@link HBox} children to add to a root container. * * @param listOfImages the images to add + * @param start min index of image list to be added + * @param end max index of images list to be added * @return the VBox containing image containers */ public VBox computeRootImagesContainerChildren(ObservableList<Image> listOfImages , int start, int end){ - int loadEnd = Math.min(listOfImages.size(), end); + int loadEnd = Math.min(listOfImages.size(), end); //Will not exceed list of image size if end is higher List<HBox> imageHBoxes = new ArrayList<>(); for (int i = start; i < loadEnd; i++) { @@ -320,6 +314,8 @@ public class Search extends NavBarController implements Initializable { * Load each corresponding preview images in a separate background task and add them when ready. * * @param listOfAlbums the albums to add + * @param start min index of albums list to be added + * @param end max index of albums list to be added * @return the VBox containing album containers */ public VBox computeRootAlbumsContainerChildren(ObservableList<Album> listOfAlbums, int start, int end){ @@ -421,9 +417,8 @@ public class Search extends NavBarController implements Initializable { } /** - * Method that updates content to previous "page". It checks if the start property of the selected tab - * is larger than zero, since it started on zero and is added or subtracted 25 every time a button is pressed. Prevoius button - * is disabled when start becomes zero. + * It finds out witch is current selected tab and if it is possible to load previous content on that page. + * If yes it updates content to previous elements of the list. * @param actionEvent * @throws IOException */ @@ -455,8 +450,8 @@ public class Search extends NavBarController implements Initializable { } /** - * Method that updates content to next "page". It checks if the end property of the selected tab - * is smaller than the size of the list of search results of that type + * It finds out witch is current selected tab and if it is possible to load next content on that page. + * If yes it updates content to next elements of the list. * @param actionEvent * @throws IOException */ @@ -490,9 +485,9 @@ public class Search extends NavBarController implements Initializable { } /** - * Open specific Image. It takes a clicked element within an image container + * Changes to view image page. It takes a clicked element within an image container * and finds the fx:id of the main parent, and - * passes the value to Data Exchange so that View Image will know which album was clicked. + * passes the value to {@link DataExchange}. * * @param mouseEvent * @throws IOException @@ -507,9 +502,9 @@ public class Search extends NavBarController implements Initializable { } /** - * Open specific albums. It takes a clicked element within an album container + * Changes to view album page. It takes a clicked element within an album container * and finds the fx:id of the main parent, and - * passes the value to Data Exchange so that View Album will know which album was clicked. + * passes the value to {@link DataExchange}. * * @param mouseEvent * @throws IOException @@ -527,7 +522,7 @@ public class Search extends NavBarController implements Initializable { * It takes a clicked element within an container * and finds the fx:id of the main parent * @param mouseEvent - * @return main containers id of clickede element + * @return main containers id of clicked element */ public long findId(MouseEvent mouseEvent){ boolean idFound = false; diff --git a/src/main/java/NTNU/IDATT1002/controllers/SignUp.java b/src/main/java/NTNU/IDATT1002/controllers/SignUp.java index 48afeb0cf8b9f73fcf926ff8ebba75a7f81a81e3..7fe754d6da25f080df5054f004706729237799bc 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/SignUp.java +++ b/src/main/java/NTNU/IDATT1002/controllers/SignUp.java @@ -93,17 +93,18 @@ public class SignUp { /** - * Checks both that the user put info in the necessary textfields and that the username and/or email isn't in use. + * Checks both that the user put info in the necessary text fields and that the username and/or email isn't in use. * - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phoneCode - * @param phoneNR - * @param birthdate + * @param username username + * @param firstName first name + * @param lastName last name + * @param email email address + * @param password password + * @param phoneCode phone code + * @param phoneNR phone number + * @param birthdate birth date * + * @return whether the parameters is valid */ private boolean validateInfo (String username, String firstName, String lastName, String email, String password, String confirmedPassword, String phoneCode, String phoneNR, LocalDate birthdate){ check = true; diff --git a/src/main/java/NTNU/IDATT1002/controllers/Upload.java b/src/main/java/NTNU/IDATT1002/controllers/Upload.java index 55672b88f43f46fd99fa3ac978a1b5ecf32c6409..01c23e4f5421ff9c7d7d14ccc26e3c5cf87788ce 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Upload.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Upload.java @@ -1,9 +1,3 @@ -/** - * Controls the buttons and changable elements on upload page - * @version 1.0 17.03.2020 - * @author Simon Jensen - */ - package NTNU.IDATT1002.controllers; import NTNU.IDATT1002.App; @@ -24,6 +18,7 @@ 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 extends NavBarController { @@ -36,8 +31,7 @@ public class Upload extends NavBarController { } /** - * Method that changs scene to Uploaded Single page - * If the user has chosen 1 image this method is called + * Changes page to upload images page * @throws IOException */ private void switchToUploadImages() throws IOException { @@ -45,8 +39,9 @@ public class Upload extends NavBarController { } /** - * Method that opens file browser with an image filter - * The user will choose what files to upload + * Method that opens file browser with an image filter. + * The user will choose what files to upload. If the size of one or more files + * exceeds 4.1 MB, an error is displayed. * @throws IOException */ public void chooseFile() throws IOException { @@ -93,7 +88,6 @@ public class Upload extends NavBarController { * @param event something is dragged over the container */ public void acceptDrop(DragEvent event) { - //TODO: Choose valid file types List<String> validExtensions = Arrays.asList("jpg", "png", "jpeg"); //Checks if the event contains files if(event.getDragboard().hasFiles()){ diff --git a/src/main/java/NTNU/IDATT1002/controllers/UploadImages.java b/src/main/java/NTNU/IDATT1002/controllers/UploadImages.java index d8b967b64c991b0238725dd2666f71ea16f90d86..1030a13f2b933fcf5305cf1575f7c357c5b06a1a 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/UploadImages.java +++ b/src/main/java/NTNU/IDATT1002/controllers/UploadImages.java @@ -1,7 +1,6 @@ package NTNU.IDATT1002.controllers; import NTNU.IDATT1002.App; -import NTNU.IDATT1002.Config; import NTNU.IDATT1002.models.Album; import NTNU.IDATT1002.models.Tag; import NTNU.IDATT1002.service.AlbumService; @@ -38,7 +37,7 @@ import java.util.ResourceBundle; import java.util.stream.Collectors; /** - * Controls the buttons and changeable elements on upload_single.fxml, + * Controls the buttons and changeable elements on upload_images.fxml, * a page where you add descriptions to your selected image * * @version 1.0 22.03.2020 @@ -55,7 +54,6 @@ public class UploadImages extends NavBarController implements Initializable { private TextField title; public UploadImages(){ - App.ex.newPage("upload_images"); EntityManager entityManager = App.ex.getEntityManager(); albumService = new AlbumService(entityManager); imageService = new ImageService(entityManager); diff --git a/src/main/java/NTNU/IDATT1002/controllers/ViewAlbum.java b/src/main/java/NTNU/IDATT1002/controllers/ViewAlbum.java index c1144c1f39a7762de5ec39719cf4304679b3826f..7e50d630120477064009945bb1472c76a173baef 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/ViewAlbum.java +++ b/src/main/java/NTNU/IDATT1002/controllers/ViewAlbum.java @@ -25,7 +25,6 @@ import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; -import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.text.Font; @@ -45,16 +44,16 @@ import java.util.stream.Collectors; /** * 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 extends NavBarController implements Initializable { + @FXML public Button createAlbumPdf; public ImageView mainImageContainer; public Text mainImageTitle; public Text mainImageTags; - - @FXML public VBox albumTextContainer; public Button viewOnMapBtn; public HBox albumImagesContainer; @@ -64,12 +63,9 @@ public class ViewAlbum extends NavBarController implements Initializable { private AlbumService albumService; private Album currentAlbum; - public ViewAlbum(){ - App.ex.newPage("view_album"); - } - /** - * Initialize view with real album data. + * Generates content on the page based on the current album id in + * {@link DataExchange}. * * @param url * @param resourceBundle @@ -263,7 +259,7 @@ public class ViewAlbum extends NavBarController implements Initializable { } /** - * Makes a new stage and displays all metadata of the clicked image + * Makes a new stage and displays ALL metadata of the clicked image * @param mouseEvent */ public void openPopUpMetadata(MouseEvent mouseEvent){ @@ -328,6 +324,11 @@ public class ViewAlbum extends NavBarController implements Initializable { hostServices.showDocument(file.getAbsolutePath()); } + /** + * View image on the map + * @param actionEvent + * @throws IOException + */ public void viewOnMap(ActionEvent actionEvent) throws IOException { App.setRoot("map"); // TODO: 15.04.2020 Set App.ex.chosenAlbumId? } diff --git a/src/main/java/NTNU/IDATT1002/controllers/ViewImage.java b/src/main/java/NTNU/IDATT1002/controllers/ViewImage.java index e60ad418a9c6469a59e40395ebe3846231a770d1..9efc986cfb3d646d186dbafaac447a9ac2816e49 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/ViewImage.java +++ b/src/main/java/NTNU/IDATT1002/controllers/ViewImage.java @@ -5,9 +5,9 @@ import NTNU.IDATT1002.service.ImageService; import NTNU.IDATT1002.service.TagService; import NTNU.IDATT1002.utils.ImageUtil; import NTNU.IDATT1002.utils.MetadataStringFormatter; +import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.geometry.Pos; -import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.ScrollPane; @@ -20,7 +20,6 @@ import javafx.scene.text.Text; import javafx.stage.Stage; import javax.persistence.EntityManager; -import java.awt.*; import java.net.URL; import java.util.Optional; import java.util.ResourceBundle; @@ -29,19 +28,23 @@ import java.util.ResourceBundle; /** * Controls the buttons and changeable elements on view_.fxml, * a page where get a more detailed view of a image + * * @version 1.0 22.03.2020 */ public class ViewImage extends NavBarController implements Initializable{ + @FXML public ImageView imageContainer; public Text imageTagsField; public Text imageTitleField; public Text imageMetadataField; - public ViewImage(){ - App.ex.newPage("view_image"); - } - + /** + * Generates content on the page based on current clicked image id + * in {@link DataExchange} + * @param url + * @param resourceBundle + */ @Override public void initialize(URL url, ResourceBundle resourceBundle) { EntityManager entityManager = App.ex.getEntityManager(); @@ -89,7 +92,7 @@ public class ViewImage extends NavBarController implements Initializable{ } /** - * Makes a new stage and displays all metadata of the clicked image + * Makes a new stage and displays ALL metadata of the clicked image * @param mouseEvent */ public void openPopUpMetadata(MouseEvent mouseEvent){