diff --git a/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java b/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java index c3515913fbc3258a6d220dd70a7f660293d9b5d3..359b68ab574c8e5e56b13e501913be8fef71a6da 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java +++ b/src/main/java/NTNU/IDATT1002/controllers/DataExchange.java @@ -12,7 +12,6 @@ public class DataExchange { private String searchField; private List<File> uploadedFiles; private Long albumId; - private String chosenImg; public DataExchange(){ searchField = ""; @@ -29,10 +28,6 @@ public class DataExchange { return albumId; } - public String getChosenImg() { - return chosenImg; - } - public void setUploadedFiles(List<File> uploadedFiles) { this.uploadedFiles = uploadedFiles; } @@ -44,8 +39,4 @@ public class DataExchange { public void setAlbumId(Long albumId) { this.albumId = albumId; } - - public void setChosenImg(String chosenImg) { - this.chosenImg = chosenImg; - } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/Search.java b/src/main/java/NTNU/IDATT1002/controllers/Search.java index fe8073a5520190a705783e51d93ee7f87bb583e1..0394c52bde25e627bf9abbce7b7d792654dcaa15 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Search.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Search.java @@ -1,31 +1,20 @@ package NTNU.IDATT1002.controllers; import NTNU.IDATT1002.App; -import com.sun.scenario.effect.impl.state.HVSeparableKernel; import javafx.event.ActionEvent; -import javafx.event.EventHandler; import javafx.fxml.Initializable; -import javafx.geometry.Pos; -import javafx.scene.Node; 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.layout.HBox; import javafx.scene.layout.Pane; -import javafx.scene.layout.VBox; -import javafx.scene.text.Font; import javafx.scene.text.Text; import java.io.IOException; import java.net.URL; -import java.util.Arrays; -import java.util.List; import java.util.ResourceBundle; -import java.util.stream.Collectors; /** * Controls the buttons and changeable elements on search.fxml, @@ -40,17 +29,48 @@ public class Search implements Initializable { public Button tbar_explore; public Button tbar_map; public Button tbar_upload; - public Button tbar_albums; public Text search_result; public ScrollPane scrollpane; public ChoiceBox sorted_by_choicebox; - public VBox vBox; + + public Button footer_previousBtn; + public Button footer_nextBtn; + public Button tbar_albums; + public Pane pane1; + public ImageView picture; + public Text tag_field; + public Text title_field; + public Text desc_field; + public Button openPic_btn; + public Pane pane11; + public ImageView picture1; + public Text tag_field1; + public Text title_field1; + public Text desc_field1; + public Button openPic_btn1; + public Pane pane12; + public ImageView picture2; + public Text tag_field2; + public Text title_field2; + public Text desc_field2; + public Button openPic_btn2; + public Pane pane13; + public ImageView picture3; + public Text tag_field3; + public Text title_field3; + public Text desc_field3; + public Button openPic_btn3; + public Pane pane14; + public ImageView picture4; + public Text tag_field4; + public Text title_field4; + public Text desc_field4; + public Button openPic_btn4; /** - * Method that writes the word that is searched for. - * Also generates HBoxes with image title, tags... + * Method that writes the word that is searched for * @param location * @param resources */ @@ -58,62 +78,6 @@ public class Search implements Initializable { if (!App.ex.getSearchField().isEmpty()){ search_result.setText(App.ex.getSearchField()); } - List<String> urls = Arrays.asList("@../../Images/placeholder-1920x1080.png", "@../../Images/party.jpg", "@../../Images/placeholderLogo.png"); - for(int i = 0; i < urls.size(); i++) { - HBox h = new HBox(); - h.setPrefHeight(300); - h.setPrefWidth(1920); - h.setAlignment(Pos.CENTER); - h.setStyle("-fx-background-color: #999999;"); - - Pane p = new Pane(); - p.setPrefWidth(1400); - p.setPrefHeight(300); - - ImageView iV = new ImageView(); - iV.setImage(new Image(urls.get(i))); - iV.setFitHeight(300); - iV.setFitWidth(500); - iV.pickOnBoundsProperty().setValue(true); - iV.setPreserveRatio(true); - iV.setOnMouseClicked(new EventHandler<MouseEvent>() { - @Override public void handle(MouseEvent e) { - try{ - switchToPicture(e); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - }); - - Text title = setText("TITLE:", 550, 66, 153, "System Bold", 48); - Text tag = setText("TAG:", 550, 97, 70, "System Bold", 24); - Text desc = setText("DESCRIPTION:", 550, 126, 129, "System Bold", 18); - Text title_Field = setText(urls.get(i), 700, 66, "System Bold", 48); - Text tag_Field = setText("####", 700, 97, "System Bold", 24); - Text desc_Field = setText("####", 700, 126, "System Bold", 18); - - p.getChildren().addAll(iV, title, tag, desc, title_Field, tag_Field, desc_Field); - h.getChildren().add(p); - vBox.getChildren().add(h); - } - } - - public Text setText(String text, int layoutX, int layoutY, double wrappingWidth, String fontName, double fontSize){ - Text t = new Text(text); - t.setLayoutX(layoutX); - t.setLayoutY(layoutY); - t.setWrappingWidth(wrappingWidth); - t.setFont(Font.font(fontName, fontSize)); - return t; - } - - public Text setText(String text, int layoutX, int layoutY, String fontName, double fontSize){ - Text t = new Text(text); - t.setLayoutX(layoutX); - t.setLayoutY(layoutY); - t.setFont(Font.font(fontName, fontSize)); - return t; } /** @@ -193,14 +157,12 @@ public class Search implements Initializable { } /** - * Method for opening the chosen picture. - * @param mouseEvent what is clicked on + * Method for opening the chosen picture + * @param actionEvent * @throws IOException */ - public void switchToPicture(MouseEvent mouseEvent) throws IOException { - if(mouseEvent.getSource() instanceof ImageView){ - App.ex.setChosenImg(((ImageView) mouseEvent.getSource()).getImage().getUrl()); - App.setRoot("view_picture"); - } + public void switchToPicture(ActionEvent actionEvent) throws IOException { + //TODO: Make method that opens the chosen picture + App.setRoot("view_picture"); } } diff --git a/src/main/java/NTNU/IDATT1002/controllers/ViewPicture.java b/src/main/java/NTNU/IDATT1002/controllers/ViewPicture.java index 229764c2df972327fa241c3f01a6777614e419f7..acde159954f2a111a19844b86a86dd2344bb18b5 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/ViewPicture.java +++ b/src/main/java/NTNU/IDATT1002/controllers/ViewPicture.java @@ -2,25 +2,21 @@ package NTNU.IDATT1002.controllers; import NTNU.IDATT1002.App; import javafx.event.ActionEvent; -import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.TextField; -import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Pane; import javafx.scene.text.Text; import java.io.IOException; -import java.net.URL; -import java.util.ResourceBundle; /** * 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 implements Initializable { +public class ViewPicture { public ImageView tbar_logo; public TextField tbar_search; public Button tbar_explore; @@ -34,11 +30,6 @@ public class ViewPicture implements Initializable { public Button tbar_searchBtn; public Button tbar_albums; - @Override - public void initialize(URL url, ResourceBundle resourceBundle) { - picture.setImage(new Image(App.ex.getChosenImg())); - } - /** * Method that changes stage to Main page * @param mouseEvent diff --git a/src/main/resources/NTNU/IDATT1002/search.fxml b/src/main/resources/NTNU/IDATT1002/search.fxml index c0794c9fc0c4ad7bfe1d44bb65841926d93f41fd..48e70b3239667e3bf60e39622b63cc05061643c7 100644 --- a/src/main/resources/NTNU/IDATT1002/search.fxml +++ b/src/main/resources/NTNU/IDATT1002/search.fxml @@ -40,7 +40,7 @@ <Pane maxWidth="Infinity" prefWidth="1920.0"> <children> - <VBox fx:id="vBox" maxHeight="1.7976931348623157E308" maxWidth="Infinity" minHeight="980.0" prefWidth="1920.0" spacing="10.0" style="-fx-background-color: #555555;"> + <VBox maxWidth="Infinity" prefHeight="1960.0" prefWidth="1920.0" spacing="10.0" style="-fx-background-color: #555555;"> <children> <HBox alignment="CENTER" maxWidth="Infinity" prefHeight="201.0" prefWidth="1920.0" spacing="10.0"> <children> @@ -80,6 +80,260 @@ </ChoiceBox> </children> </HBox> + <HBox alignment="CENTER" prefHeight="300.0" prefWidth="1920.0" style="-fx-background-color: #999999;"> + <children> + <Pane fx:id="pane1" prefHeight="300.0" prefWidth="1400.0"> + <children> + <ImageView fx:id="picture" fitHeight="307.0" fitWidth="516.0" layoutX="-2.0" layoutY="-1.0" pickOnBounds="true" preserveRatio="true"> + <image> + <Image url="@../../Images/placeholder-1920x1080.png" /> + </image> + </ImageView> + <Text layoutX="545.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TITLE:" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TAGS:" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="DESCRIPTION:" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Text fx:id="tag_field" layoutX="707.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text fx:id="title_field" layoutX="707.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text fx:id="desc_field" layoutX="707.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Button fx:id="openPic_btn" layoutX="545.0" layoutY="249.0" mnemonicParsing="false" onAction="#switchToPicture" text="Open Picture"> + <font> + <Font size="18.0" /> + </font> + </Button> + </children> + </Pane> + </children> + </HBox> + <HBox alignment="CENTER" prefHeight="300.0" prefWidth="1920.0" style="-fx-background-color: #999999;"> + <children> + <Pane fx:id="pane11" prefHeight="300.0" prefWidth="1400.0"> + <children> + <ImageView fx:id="picture1" fitHeight="307.0" fitWidth="516.0" layoutX="-2.0" layoutY="-1.0" pickOnBounds="true" preserveRatio="true"> + <image> + <Image url="@../../Images/placeholder-1920x1080.png" /> + </image> + </ImageView> + <Text layoutX="545.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TITLE:" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TAGS:" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="DESCRIPTION:" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Text fx:id="tag_field1" layoutX="707.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text fx:id="title_field1" layoutX="707.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text fx:id="desc_field1" layoutX="707.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Button fx:id="openPic_btn1" layoutX="545.0" layoutY="249.0" mnemonicParsing="false" onAction="#switchToPicture" text="Open Picture"> + <font> + <Font size="18.0" /> + </font> + </Button> + </children> + </Pane> + </children> + </HBox> + <HBox alignment="CENTER" prefHeight="300.0" prefWidth="1920.0" style="-fx-background-color: #999999;"> + <children> + <Pane fx:id="pane12" prefHeight="300.0" prefWidth="1400.0"> + <children> + <ImageView fx:id="picture2" fitHeight="307.0" fitWidth="516.0" layoutX="-2.0" layoutY="-1.0" pickOnBounds="true" preserveRatio="true"> + <image> + <Image url="@../../Images/placeholder-1920x1080.png" /> + </image> + </ImageView> + <Text layoutX="545.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TITLE:" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TAGS:" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="DESCRIPTION:" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Text fx:id="tag_field2" layoutX="707.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text fx:id="title_field2" layoutX="707.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text fx:id="desc_field2" layoutX="707.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Button fx:id="openPic_btn2" layoutX="545.0" layoutY="249.0" mnemonicParsing="false" onAction="#switchToPicture" text="Open Picture"> + <font> + <Font size="18.0" /> + </font> + </Button> + </children> + </Pane> + </children> + </HBox> + <HBox alignment="CENTER" prefHeight="300.0" prefWidth="1920.0" style="-fx-background-color: #999999;"> + <children> + <Pane fx:id="pane13" prefHeight="300.0" prefWidth="1400.0"> + <children> + <ImageView fx:id="picture3" fitHeight="307.0" fitWidth="516.0" layoutX="-2.0" layoutY="-1.0" pickOnBounds="true" preserveRatio="true"> + <image> + <Image url="@../../Images/placeholder-1920x1080.png" /> + </image> + </ImageView> + <Text layoutX="545.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TITLE:" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TAGS:" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="DESCRIPTION:" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Text fx:id="tag_field3" layoutX="707.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text fx:id="title_field3" layoutX="707.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text fx:id="desc_field3" layoutX="707.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Button fx:id="openPic_btn3" layoutX="545.0" layoutY="249.0" mnemonicParsing="false" onAction="#switchToPicture" text="Open Picture"> + <font> + <Font size="18.0" /> + </font> + </Button> + </children> + </Pane> + </children> + </HBox> + <HBox alignment="CENTER" prefHeight="300.0" prefWidth="1920.0" style="-fx-background-color: #999999;"> + <children> + <Pane fx:id="pane14" prefHeight="300.0" prefWidth="1400.0"> + <children> + <ImageView fx:id="picture4" fitHeight="307.0" fitWidth="516.0" layoutX="-2.0" layoutY="-1.0" pickOnBounds="true" preserveRatio="true"> + <image> + <Image url="@../../Images/placeholder-1920x1080.png" /> + </image> + </ImageView> + <Text layoutX="545.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TITLE:" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="TAGS:" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text layoutX="551.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="DESCRIPTION:" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Text fx:id="tag_field4" layoutX="707.0" layoutY="97.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="70.0"> + <font> + <Font name="System Bold" size="24.0" /> + </font> + </Text> + <Text fx:id="title_field4" layoutX="707.0" layoutY="66.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="153.0"> + <font> + <Font name="System Bold" size="48.0" /> + </font> + </Text> + <Text fx:id="desc_field4" layoutX="707.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="""" wrappingWidth="129.0"> + <font> + <Font name="System Bold" size="18.0" /> + </font> + </Text> + <Button fx:id="openPic_btn4" layoutX="545.0" layoutY="249.0" mnemonicParsing="false" onAction="#switchToPicture" text="Open Picture"> + <font> + <Font size="18.0" /> + </font> + </Button> + </children> + </Pane> + </children> + </HBox> + <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0"> + <children> + <Button fx:id="footer_previousBtn" mnemonicParsing="false" text="PREVIOUS"> + <font> + <Font size="18.0" /> + </font> + </Button> + <Button fx:id="footer_nextBtn" mnemonicParsing="false" text="NEXT"> + <font> + <Font size="18.0" /> + </font> + </Button> + </children> + </HBox> </children> </VBox> </children>