Skip to content
Snippets Groups Projects
Commit b4d11bf6 authored by Nicolay Schiøll-Johansen's avatar Nicolay Schiøll-Johansen
Browse files

Page automatically extends based on how many search results you get, also...

Page automatically extends based on how many search results you get, also shows total amount of search results
parent 1d605c36
No related branches found
No related tags found
2 merge requests!165Weekly merge to Master,!145Updated search results page
Pipeline #80105 passed
......@@ -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));
}
}
......
......@@ -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 + '\'' +
'}';
}
}
<?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="&quot;result&quot;">
<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="&quot;result&quot;">
<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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment