From cfaa2921791a3e0d40b30d13af8877bd6b570947 Mon Sep 17 00:00:00 2001 From: Denis-Cosmin NUTIU Date: Sat, 6 Apr 2024 13:02:30 +0300 Subject: [PATCH] display image file name in row --- .../ui/controls/ImageTagsEntryControl.kt | 16 +++++++++++++--- .../ui/controls/image-tags-entry.fxml | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/controls/ImageTagsEntryControl.kt b/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/controls/ImageTagsEntryControl.kt index ef43dcd..2ce57ad 100644 --- a/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/controls/ImageTagsEntryControl.kt +++ b/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/controls/ImageTagsEntryControl.kt @@ -1,6 +1,8 @@ package dev.nuculabs.imagetagger.ui.controls + import javafx.fxml.FXML import javafx.fxml.FXMLLoader +import javafx.scene.control.Label import javafx.scene.control.TextArea import javafx.scene.image.Image import javafx.scene.image.ImageView @@ -29,6 +31,12 @@ class ImageTagsEntryControl @FXML private lateinit var predictedImageTags: TextArea + /** + * The file name label. + */ + @FXML + private lateinit var fileNameLabel: Label + init { val resource = ImageTagsEntryControl::class.java.getResource("image-tags-entry.fxml") logger.fine("Using resource URL: $resource") @@ -45,21 +53,23 @@ class ImageTagsEntryControl } /** - * Getter for the image view. + * Setter for predicted tags text. * * @param predictions The prediction list. */ fun setText(predictions: List) { - predictedImageTags.text = predictions.joinToString { it } + predictedImageTags.text = predictions.joinToString { it } } /** * Setter for setting the image. */ fun setImage(imagePath: String) { - File(imagePath).inputStream().use { + val file = File(imagePath) + file.inputStream().use { imageView.image = Image(it, 244.0, 244.0, true, true) imageView.isCache = true } + fileNameLabel.text = "File: ${file.name}" } } \ No newline at end of file diff --git a/img-ui/src/main/resources/dev/nuculabs/imagetagger/ui/controls/image-tags-entry.fxml b/img-ui/src/main/resources/dev/nuculabs/imagetagger/ui/controls/image-tags-entry.fxml index 56d950e..2141126 100644 --- a/img-ui/src/main/resources/dev/nuculabs/imagetagger/ui/controls/image-tags-entry.fxml +++ b/img-ui/src/main/resources/dev/nuculabs/imagetagger/ui/controls/image-tags-entry.fxml @@ -17,6 +17,7 @@ +