diff --git a/app/src/main/scala/app/logorrr/views/LogFileTab.scala b/app/src/main/scala/app/logorrr/views/LogFileTab.scala index dd21ef41..455e67c1 100644 --- a/app/src/main/scala/app/logorrr/views/LogFileTab.scala +++ b/app/src/main/scala/app/logorrr/views/LogFileTab.scala @@ -66,16 +66,8 @@ object LogFileTab { * */ class LogFileTab(val pathAsString: String , val logEntries: ObservableList[LogEntry]) - extends Tab - with CanLog { + extends Tab with CanLog { - selectedProperty().addListener(JfxUtils.onNew[java.lang.Boolean](b => { - if (b) { - setStyle(LogFileTab.BackgroundSelectedStyle) - } else { - setStyle(LogFileTab.BackgroundStyle) - } - })) // lazy since only if autoscroll is set start tailer lazy val logTailer = LogTailer(pathAsString, logEntries) @@ -136,7 +128,6 @@ class LogFileTab(val pathAsString: String private val logTextView = new LogTextView(pathAsString, filteredList, timings) - // val selectedEntryProperty = new SimpleObjectProperty[LogEntry]() lazy val scrollToEndEventListener: InvalidationListener = (_: Observable) => { logVisualView.scrollToEnd() @@ -214,13 +205,19 @@ class LogFileTab(val pathAsString: String } else { } })) + selectedProperty().addListener(JfxUtils.onNew[java.lang.Boolean](b => { + if (b) { + setStyle(LogFileTab.BackgroundSelectedStyle) + } else { + setStyle(LogFileTab.BackgroundStyle) + } + })) + /** don't monitor file anymore if tab is closed, free invalidation listeners */ setOnClosed(_ => closeTab()) textProperty.bind(computeTabTitle) - val tooltip = new Tooltip() - tooltip.textProperty().bind(Bindings.concat(Bindings.size(logEntries).asString, " lines")) - setTooltip(tooltip) + setTooltip(mkTabToolTip) // selectedEntryProperty.bind(logVisualView.selectedEntryProperty) @@ -244,6 +241,16 @@ class LogFileTab(val pathAsString: String initFiltersPropertyListChangeListener() } + /** compute tab tooltip */ + private def mkTabToolTip: Tooltip = { + val tooltip = new Tooltip() + tooltip.textProperty().bind(Bindings.concat( + pathAsString, "\n", + Bindings.size(logEntries).asString, " lines") + ) + tooltip + } + /** compute title of tab */ private def computeTabTitle: StringExpression = Bindings.concat(Paths.get(pathAsString).getFileName.toString) diff --git a/app/src/test/scala/app/logorrr/LogProducer.scala b/app/src/test/scala/app/logorrr/LogProducer.scala index c10a4b35..9bcbc03f 100644 --- a/app/src/test/scala/app/logorrr/LogProducer.scala +++ b/app/src/test/scala/app/logorrr/LogProducer.scala @@ -14,8 +14,8 @@ case class SimpleWriter(path: Path) extends Runnable { override def run(): Unit = { var linenumber = 1 - Files.write(path, util.Arrays.asList("started, waiting 30 secs ..."), StandardOpenOption.CREATE, StandardOpenOption.APPEND) - Thread.sleep(30000) + Files.write(path, util.Arrays.asList("started, waiting 20 secs ..."), StandardOpenOption.CREATE, StandardOpenOption.APPEND) + Thread.sleep(20000) while (running) { Thread.sleep(50) val now = LocalDateTime.now();