From 63152a2509fa2ff52ba22c191e59decd189aee24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Ladst=C3=A4tter?= Date: Wed, 27 Dec 2023 16:14:15 +0100 Subject: [PATCH] #188: sets white background for tab content --- .../logorrr/views/logfiletab/LogFileTab.scala | 4 +- .../views/logfiletab/LogFileTabContent.scala | 5 ++- .../app/logorrr/views/main/MainTabPane.scala | 39 ++++++++----------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTab.scala b/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTab.scala index 38dae498..e66661d3 100644 --- a/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTab.scala +++ b/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTab.scala @@ -7,7 +7,7 @@ import app.logorrr.model.LogEntry import app.logorrr.util._ import app.logorrr.views.LogoRRRAccelerators import app.logorrr.views.autoscroll.LogTailer -import app.logorrr.views.logfiletab.actions.{CloseAllFilesMenuItem, CloseLeftFilesMenuItem, CloseMenuItem, CloseOtherFilesMenuItem, CloseRightFilesMenuItem, OpenInFinderMenuItem} +import app.logorrr.views.logfiletab.actions._ import app.logorrr.views.search.Fltr import javafx.beans.binding.Bindings import javafx.collections.{ListChangeListener, ObservableList} @@ -100,7 +100,7 @@ class LogFileTab(val mutLogFileSettings: MutLogFileSettings }) - def recalculateChunkListViewAndScrollToActiveElement() :Unit = { + def recalculateChunkListViewAndScrollToActiveElement(): Unit = { logFileTabContent.recalculateChunkListView() logFileTabContent.scrollToActiveElement() } diff --git a/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTabContent.scala b/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTabContent.scala index 732efe72..c85a0892 100644 --- a/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTabContent.scala +++ b/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTabContent.scala @@ -15,6 +15,9 @@ import javafx.scene.layout.BorderPane class LogFileTabContent(mutLogFileSettings: MutLogFileSettings , val entries: ObservableList[LogEntry]) extends BorderPane { + // make sure we have a white background for our tabs - see https://github.com/rladstaetter/LogoRRR/issues/188 + setStyle("-fx-background-color: white;") + /** list which holds all entries, default to display all (can be changed via buttons) */ private val filteredList = new FilteredList[LogEntry](entries) @@ -34,7 +37,7 @@ class LogFileTabContent(mutLogFileSettings: MutLogFileSettings def addTailerListener(): Unit = filteredList.addListener(scrollToEndEventListener) - def removeTailerListener() = filteredList.removeListener(scrollToEndEventListener) + def removeTailerListener(): Unit = filteredList.removeListener(scrollToEndEventListener) val opsToolBar = new OpsToolBar(mutLogFileSettings.getPathAsString(), addFilter, entries, filteredList, mutLogFileSettings.blockSizeProperty) diff --git a/app/src/main/scala/app/logorrr/views/main/MainTabPane.scala b/app/src/main/scala/app/logorrr/views/main/MainTabPane.scala index e4085370..eb820af9 100644 --- a/app/src/main/scala/app/logorrr/views/main/MainTabPane.scala +++ b/app/src/main/scala/app/logorrr/views/main/MainTabPane.scala @@ -26,7 +26,7 @@ object MainTabPane { } class MainTabPane extends TabPane with CanLog { - // leave her otherwise css rendering breaks + // leave here otherwise css rendering breaks setStyle(MainTabPane.BackgroundStyle) val selectedTabListener: ChangeListener[Tab] = JfxUtils.onNew { @@ -39,7 +39,22 @@ class MainTabPane extends TabPane with CanLog { } def init(): Unit = { - initDnD() + /** needed to activate drag'n drop */ + setOnDragOver((event: DragEvent) => { + if (event.getDragboard.hasFiles) { + event.acceptTransferModes(TransferMode.ANY: _*) + } + }) + + /** try to interpret dropped element as log file, activate view */ + setOnDragDropped((event: DragEvent) => { + for (f <- event.getDragboard.getFiles.asScala) { + val path = f.toPath + if (Files.isDirectory(path)) { + Files.list(path).filter((p: Path) => Files.isRegularFile(p)).forEach((t: Path) => dropLogFile(t)) + } else dropLogFile(path) + } + }) } /** @@ -80,25 +95,6 @@ class MainTabPane extends TabPane with CanLog { def selectLastLogFile(): Unit = getSelectionModel.selectLast() - private def initDnD(): Unit = { - /** needed to activate drag'n drop */ - setOnDragOver((event: DragEvent) => { - if (event.getDragboard.hasFiles) { - event.acceptTransferModes(TransferMode.ANY: _*) - } - }) - - /** try to interpret dropped element as log file, activate view */ - setOnDragDropped((event: DragEvent) => { - for (f <- event.getDragboard.getFiles.asScala) { - val path = f.toPath - if (Files.isDirectory(path)) { - Files.list(path).filter((p: Path) => Files.isRegularFile(p)).forEach((t: Path) => dropLogFile(t)) - } else dropLogFile(path) - } - }) - } - private def dropLogFile(path: Path): Unit = { val pathAsString = path.toAbsolutePath.toString @@ -127,7 +123,6 @@ class MainTabPane extends TabPane with CanLog { def addLogFileTab(tab: LogFileTab): Unit = { tab.init() getTabs.add(tab) - setStyle(null) } }