From 7179417c204dd697410bf9a9f8b7a422186c38e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Ladst=C3=A4tter?= Date: Thu, 28 Dec 2023 22:18:42 +0100 Subject: [PATCH] #182: introduces new constructor for LogFileTab --- .../app/logorrr/views/logfiletab/LogFileTab.scala | 14 +++++++++++--- .../scala/app/logorrr/views/main/LogoRRRMain.scala | 2 +- .../scala/app/logorrr/views/main/MainTabPane.scala | 2 +- .../views/settings/timer/TimerSettingStage.scala | 1 - 4 files changed, 13 insertions(+), 6 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 3916179d..7ac7aae7 100644 --- a/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTab.scala +++ b/app/src/main/scala/app/logorrr/views/logfiletab/LogFileTab.scala @@ -2,7 +2,7 @@ package app.logorrr.views.logfiletab import app.logorrr.conf.LogoRRRGlobals import app.logorrr.conf.mut.MutLogFileSettings -import app.logorrr.io.{FileId, Fs} +import app.logorrr.io.FileId import app.logorrr.model.LogEntry import app.logorrr.util._ import app.logorrr.views.LogoRRRAccelerators @@ -35,6 +35,13 @@ object LogFileTab { |-fx-border-color: LIGHTGREY; |""".stripMargin + def apply(mutLogFileSettings: MutLogFileSettings + , entries: ObservableList[LogEntry]): LogFileTab = { + new LogFileTab(mutLogFileSettings.getFileId + , mutLogFileSettings + , entries) + } + } @@ -45,12 +52,13 @@ object LogFileTab { * * @param entries report instance holding information of log file to be analyzed * */ -class LogFileTab(val mutLogFileSettings: MutLogFileSettings +class LogFileTab(val fileId: FileId + , val mutLogFileSettings: MutLogFileSettings , val entries: ObservableList[LogEntry]) extends Tab with TimerCode with CanLog { - val fileId: FileId = mutLogFileSettings.getFileId() + assert(fileId == mutLogFileSettings.getFileId) private lazy val logTailer = LogTailer(fileId, entries) diff --git a/app/src/main/scala/app/logorrr/views/main/LogoRRRMain.scala b/app/src/main/scala/app/logorrr/views/main/LogoRRRMain.scala index 2b120e2c..19c41ae2 100644 --- a/app/src/main/scala/app/logorrr/views/main/LogoRRRMain.scala +++ b/app/src/main/scala/app/logorrr/views/main/LogoRRRMain.scala @@ -37,7 +37,7 @@ class LogoRRRMain(closeStage: => Unit) extends BorderPane with CanLog { settings.map(lfs => Future { timeR({ val entries = lfs.readEntries() - val tab = new LogFileTab(LogoRRRGlobals.getLogFileSettings(lfs.fileId), entries) + val tab = LogFileTab(LogoRRRGlobals.getLogFileSettings(lfs.fileId), entries) mainTabPane.addLogFileTab(tab) tab }, s"Loaded '${lfs.fileId}'") 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 8946ebe5..5697cb46 100644 --- a/app/src/main/scala/app/logorrr/views/main/MainTabPane.scala +++ b/app/src/main/scala/app/logorrr/views/main/MainTabPane.scala @@ -116,7 +116,7 @@ class MainTabPane extends TabPane with CanLog { val logFileSettings = LogFileSettings(fileId) LogoRRRGlobals.registerSettings(logFileSettings) - addLogFileTab(new LogFileTab(LogoRRRGlobals.getLogFileSettings(fileId), logFileSettings.readEntries())) + addLogFileTab(LogFileTab(LogoRRRGlobals.getLogFileSettings(fileId), logFileSettings.readEntries())) selectLog(fileId) } diff --git a/app/src/main/scala/app/logorrr/views/settings/timer/TimerSettingStage.scala b/app/src/main/scala/app/logorrr/views/settings/timer/TimerSettingStage.scala index ec53dd09..32b7344c 100644 --- a/app/src/main/scala/app/logorrr/views/settings/timer/TimerSettingStage.scala +++ b/app/src/main/scala/app/logorrr/views/settings/timer/TimerSettingStage.scala @@ -1,7 +1,6 @@ package app.logorrr.views.settings.timer import app.logorrr.conf.mut.MutLogFileSettings -import app.logorrr.io.Fs import app.logorrr.model.{LogEntry, LogEntryInstantFormat} import app.logorrr.util.JfxUtils import javafx.collections.ObservableList