Skip to content

Commit

Permalink
#43: fixes display of time slider range upon restart
Browse files Browse the repository at this point in the history
  • Loading branch information
rladstaetter committed Aug 25, 2024
1 parent 20966d8 commit 4f54286
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 13 additions & 11 deletions app/src/main/scala/app/logorrr/conf/mut/MutLogFileSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ object MutLogFileSettings {
case None =>
}
s.setAutoScroll(logFileSettings.autoScroll)
s.setLowerTimestamp(logFileSettings.lowerTimestamp)
s.setUpperTimestamp(logFileSettings.upperTimestamp)
// TODO: set values and boundaries correctly for sliders
// https://github.com/rladstaetter/LogoRRR/issues/261
//s.setLowerTimestampValue(logFileSettings.lowerTimestamp)
//s.setUpperTimestampValue(logFileSettings.upperTimestamp)
s
}
}
Expand Down Expand Up @@ -65,7 +67,7 @@ class MutLogFileSettings {
case None => true // if instant is not set, return true
case Some(value) =>
val asMilli = value.toEpochMilli
getLowTimestampBoundary <= asMilli && asMilli <= getHighTimestampBoundary
getLowerTimestampValue <= asMilli && asMilli <= getHigherTimestampValue
}) && computeCurrentFilter().matches(entry.value))
}

Expand All @@ -80,16 +82,16 @@ class MutLogFileSettings {
val selectedLineNumberProperty = new SimpleIntegerProperty()
val firstVisibleTextCellIndexProperty = new SimpleIntegerProperty()
val lastVisibleTextCellIndexProperty = new SimpleIntegerProperty()
private val lowerTimestampProperty = new SimpleLongProperty(LogFileSettings.DefaultLowerTimestamp)
private val upperTimestampProperty = new SimpleLongProperty(LogFileSettings.DefaultUpperTimestamp)
private val lowerTimestampValueProperty = new SimpleLongProperty(LogFileSettings.DefaultLowerTimestamp)
private val upperTimestampValueProperty = new SimpleLongProperty(LogFileSettings.DefaultUpperTimestamp)

def setLowerTimestamp(lowerValue: Long): Unit = lowerTimestampProperty.set(lowerValue)
def setLowerTimestampValue(lowerValue: Long): Unit = lowerTimestampValueProperty.set(lowerValue)

def getLowTimestampBoundary: Long = lowerTimestampProperty.get()
def getLowerTimestampValue: Long = lowerTimestampValueProperty.get()

def setUpperTimestamp(upperValue: Long): Unit = upperTimestampProperty.set(upperValue)
def setUpperTimestampValue(upperValue: Long): Unit = upperTimestampValueProperty.set(upperValue)

def getHighTimestampBoundary: Long = upperTimestampProperty.get()
def getHigherTimestampValue: Long = upperTimestampValueProperty.get()

val dividerPositionProperty = new SimpleDoubleProperty()
val autoScrollActiveProperty = new SimpleBooleanProperty()
Expand Down Expand Up @@ -171,8 +173,8 @@ class MutLogFileSettings {
, autoScrollActiveProperty.get()
, firstVisibleTextCellIndexProperty.get()
, lastVisibleTextCellIndexProperty.get()
, lowerTimestampProperty.get()
, upperTimestampProperty.get())
, lowerTimestampValueProperty.get()
, upperTimestampValueProperty.get())
lfs
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ class TimeOpsToolBar(mutLogFileSettings: MutLogFileSettings

lowerSlider.valueProperty.addListener((_, _, newValue) => {
if (newValue.doubleValue > upperSlider.getValue) lowerSlider.setValue(upperSlider.getValue)
mutLogFileSettings.setLowerTimestamp(newValue.longValue())
mutLogFileSettings.setLowerTimestampValue(newValue.longValue())
mutLogFileSettings.updateActiveFilter(filteredList)
})

upperSlider.valueProperty.addListener((_, _, newValue) => {
if (newValue.doubleValue < lowerSlider.getValue) upperSlider.setValue(lowerSlider.getValue)
mutLogFileSettings.setUpperTimestamp(newValue.longValue())
mutLogFileSettings.setUpperTimestampValue(newValue.longValue())
mutLogFileSettings.updateActiveFilter(filteredList)
})

Expand Down

0 comments on commit 4f54286

Please sign in to comment.