diff --git a/src/main/java/NTNU/IDATT1002/controllers/Search.java b/src/main/java/NTNU/IDATT1002/controllers/Search.java index c64c9813dc5c2e2a789564a0ec7237576aabb432..8b49b92e2b16d6b1a6a672911c48877ad32066f0 100644 --- a/src/main/java/NTNU/IDATT1002/controllers/Search.java +++ b/src/main/java/NTNU/IDATT1002/controllers/Search.java @@ -57,7 +57,7 @@ public class Search implements Initializable { public ScrollPane scrollpane; public ChoiceBox sorted_by_choicebox; public VBox vBox; - + public Text amount; /** @@ -73,12 +73,13 @@ public class Search implements Initializable { List<NTNU.IDATT1002.models.Image> images = new ImageService(App.ex.getEntityManager()).searchResult(App.ex.getSearchField()); + amount.setText(String.valueOf(images.size())); + for(int i = 0; i < images.size(); i++) { HBox hBox = new HBox(); hBox.setPrefHeight(300); hBox.setPrefWidth(1920); - hBox.setAlignment(Pos.CENTER); - hBox.setStyle("-fx-background-color: #999999;"); + hBox.setAlignment(Pos.TOP_LEFT); Pane pane = new Pane(); pane.setPrefWidth(1400); @@ -108,10 +109,21 @@ public class Search implements Initializable { String tagsString = TagService.getTagsAsString(images.get(i).getTags()); Text tag_Field = setText(tagsString, 700, 97, "System Bold", 24); Text metadata_Field = setText(images.get(i).getMetadata().toString(), 700, 126, "System Bold", 18); + VBox metaBox = new VBox(); + metaBox.getChildren().add(metadata_Field); + ScrollPane meta = new ScrollPane(); + meta.setMaxWidth(630); + meta.setPrefWidth(630); + meta.setContent(metaBox); + meta.setLayoutX(700); + meta.setLayoutY(126); + meta.setMaxHeight(150); + - pane.getChildren().addAll(imageView, title, tag, desc, title_Field, tag_Field, metadata_Field); + pane.getChildren().addAll(imageView, title, tag, desc, title_Field, tag_Field, meta); hBox.getChildren().add(pane); vBox.getChildren().add(hBox); + vBox.setMinHeight(1550+(images.size()*310)); } } diff --git a/src/main/java/NTNU/IDATT1002/models/Metadata.java b/src/main/java/NTNU/IDATT1002/models/Metadata.java index 66904315a042ed2448a76068c5357b19f691a836..963f198c7e990273d548d4d062e56d1738aaef40 100644 --- a/src/main/java/NTNU/IDATT1002/models/Metadata.java +++ b/src/main/java/NTNU/IDATT1002/models/Metadata.java @@ -165,17 +165,17 @@ public class Metadata { @Override public String toString() { return "Metadata{" + - "metadataId=" + metadataId + - ", camera='" + camera + '\'' + - ", lens='" + lens + '\'' + - ", aperture='" + aperture + '\'' + - ", shutterSpeed='" + shutterSpeed + '\'' + - ", ISO='" + ISO + '\'' + - ", focalLength='" + focalLength + '\'' + - ", fileType='" + fileType + '\'' + - ", photoDate='" + photoDate + '\'' + - ", fileSize='" + fileSize + '\'' + - ", fileDimension='" + fileDimension + '\'' + + "\nmetadataId=" + metadataId + + "\ncamera='" + camera + '\'' + + "\nlens='" + lens + '\'' + + "\naperture='" + aperture + '\'' + + "\nshutterSpeed='" + shutterSpeed + '\'' + + "\nISO='" + ISO + '\'' + + "\nfocalLength='" + focalLength + '\'' + + "\nfileType='" + fileType + '\'' + + "\nphotoDate='" + photoDate + '\'' + + "\nfileSize='" + fileSize + '\'' + + "\nfileDimension='" + fileDimension + '\'' + '}'; } } diff --git a/src/main/resources/NTNU/IDATT1002/search.fxml b/src/main/resources/NTNU/IDATT1002/search.fxml index e4f53a225036d353a6853e7b728e211dab22112a..a6ad0e69424a2584a28f54d27ed4084b63a02269 100644 --- a/src/main/resources/NTNU/IDATT1002/search.fxml +++ b/src/main/resources/NTNU/IDATT1002/search.fxml @@ -1,21 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<?import java.lang.String?> -<?import javafx.collections.FXCollections?> +<?import javafx.geometry.Insets?> <?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.layout.BorderPane?> <?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 javafx.geometry.Insets?> <VBox prefHeight="1080.0" prefWidth="1920.0" style="-fx-background-color: #555555;" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="NTNU.IDATT1002.controllers.Search"> <children> <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" styleClass="tbarbg" stylesheets="@style.css"> @@ -55,67 +50,41 @@ </HBox> </children> </HBox> - <HBox alignment="CENTER" prefHeight="986.0" prefWidth="1920.0" style="-fx-background-color: #555555;" VBox.vgrow="ALWAYS"> - <children> - <ScrollPane fx:id="scrollpane" fitToWidth="true" hbarPolicy="NEVER" maxWidth="1.7976931348623157E308" minHeight="960.0" prefWidth="1920.0" style="-fx-background-color: #555555; -fx-fit-to-width: true;" HBox.hgrow="ALWAYS"> - <content> - <BorderPane prefHeight="200.0" prefWidth="200.0" styleClass="bodybg" stylesheets="@style.css"> - <top> - <HBox alignment="CENTER" maxWidth="Infinity" prefHeight="201.0" prefWidth="1920.0" spacing="10.0" stylesheets="@style.css" BorderPane.alignment="CENTER"> - <children> - <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Found"> - <font> - <Font size="36.0" /> - </font> - </Text> - <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="X"> - <font> - <Font name="System Bold Italic" size="36.0" /> - </font> - </Text> - <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="results for your search" wrappingWidth="350.982421875"> - <font> - <Font size="36.0" /> - </font> - </Text> - <Text fx:id="search_result" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text=""result""> - <font> - <Font name="System Italic" size="36.0" /> - </font> - </Text> - <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text=", sorted by:" wrappingWidth="184.341796875"> - <font> - <Font size="36.0" /> - </font> - </Text> - <ChoiceBox fx:id="sorted_by_choicebox" prefHeight="40.0" prefWidth="166.0" value="Most Popular"> - <items> - <FXCollections fx:factory="observableArrayList"> - <String fx:value="Most Popular" /> - <String fx:value="Newest First" /> - <String fx:value="Oldest First" /> - </FXCollections> - </items> - </ChoiceBox> - </children> - </HBox> - </top> - <center> - <VBox fx:id="vBox" maxHeight="1.7976931348623157E308" maxWidth="Infinity" minHeight="980.0" prefWidth="1920.0" spacing="10.0" styleClass="transparentbg" stylesheets="@style.css" BorderPane.alignment="CENTER" /> - </center> - <left> - <VBox prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER" /> - </left> - <right> - <VBox prefHeight="200.0" prefWidth="100.0" stylesheets="@style.css" BorderPane.alignment="CENTER" /> - </right> - <bottom> - <VBox prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER" /> - </bottom> - </BorderPane> - </content> - </ScrollPane> - </children> - </HBox> + <ScrollPane fx:id="scrollpane" fitToWidth="true" hbarPolicy="NEVER" maxWidth="1.7976931348623157E308" minHeight="960.0" prefWidth="1920.0" stylesheets="@style.css" VBox.vgrow="ALWAYS"> + <content> + <VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" spacing="50.0" styleClass="bodybg" stylesheets="@style.css"> + <children> + <HBox alignment="CENTER" prefWidth="1920.0" spacing="10.0" stylesheets="@style.css"> + <children> + <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="Found"> + <font> + <Font size="36.0" /> + </font> + </Text> + <Text fx:id="amount" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="X"> + <font> + <Font name="System Bold Italic" size="36.0" /> + </font> + </Text> + <Text fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text="results for your search" wrappingWidth="350.982421875"> + <font> + <Font size="36.0" /> + </font> + </Text> + <Text fx:id="search_result" fill="WHITE" strokeType="OUTSIDE" strokeWidth="0.0" text=""result""> + <font> + <Font name="System Italic" size="36.0" /> + </font> + </Text> + </children> + </HBox> + <VBox fx:id="vBox" maxHeight="1.7976931348623157E308" minHeight="1550.0" spacing="10.0" styleClass="transparentbg" stylesheets="@style.css" VBox.vgrow="ALWAYS" /> + </children> + <padding> + <Insets bottom="80.0" left="80.0" right="80.0" top="50.0" /> + </padding> + </VBox> + </content> + </ScrollPane> </children> </VBox>