Skip to content

Commit

Permalink
#182: introduces new constructor for LogFileTab
Browse files Browse the repository at this point in the history
  • Loading branch information
rladstaetter committed Dec 28, 2023
1 parent d970258 commit 7179417
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
14 changes: 11 additions & 3 deletions app/src/main/scala/app/logorrr/views/logfiletab/LogFileTab.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

}


Expand All @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 7179417

Please sign in to comment.