Package NTNU.IDATT1002.controllers
Class Upload
java.lang.Object
NTNU.IDATT1002.controllers.NavBarController
NTNU.IDATT1002.controllers.Upload
public class Upload extends NavBarController
Controls the buttons and changeable elements on upload.fxml,
a page where you select images to upload
- Version:
- 1.0 22.03.2020
-
Field Summary
Fields Modifier and Type Field Description javafx.scene.layout.Pane
drag_drop
javafx.scene.control.Button
uploadBtn
Fields inherited from class NTNU.IDATT1002.controllers.NavBarController
navBarAlbums, navBarExplore, navBarLogo, navBarLogOut, navBarMap, navBarSearch, navBarSearchBtn, navBarUpload, returnButton
-
Constructor Summary
Constructors Constructor Description Upload()
-
Method Summary
Modifier and Type Method Description void
acceptDrop(javafx.scene.input.DragEvent event)
Method that decides if something can be dropped The method is called whenever something is hoovered over the drag-drop panevoid
chooseFile()
Method that opens file browser with an image filter.void
droppedFiles(javafx.scene.input.DragEvent event)
Method that stores the dropped filesjava.lang.String
getExtension(java.lang.String fileName)
Method that finds the extension of a fileMethods inherited from class NTNU.IDATT1002.controllers.NavBarController
doBeforePageExit, enterSearch, goToPrevious, logOut, search, switchToAlbums, switchToExplore, switchToMain, switchToMap, switchToSearch, switchToUpload
-
Field Details
-
Constructor Details
-
Upload
public Upload()
-
-
Method Details
-
chooseFile
public void chooseFile() throws java.io.IOExceptionMethod 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:
java.io.IOException
-
getExtension
public java.lang.String getExtension(java.lang.String fileName)Method that finds the extension of a file- Parameters:
fileName
- the name of the file (img.jpg, img2.png ect.)- Returns:
- file extension (jpg, png ect.)
-
acceptDrop
public void acceptDrop(javafx.scene.input.DragEvent event)Method that decides if something can be dropped The method is called whenever something is hoovered over the drag-drop pane- Parameters:
event
- something is dragged over the container
-
droppedFiles
public void droppedFiles(javafx.scene.input.DragEvent event) throws java.io.IOExceptionMethod that stores the dropped files- Parameters:
event
- something is dropped into the container- Throws:
java.io.IOException
-