Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

101 improve UI #103

Merged
merged 7 commits into from
Oct 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</dependency>
<dependency>
<groupId>io.github.mkpaz</groupId>
<artifactId>atlantafx-base</artifactId>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-javafx</artifactId>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-fontawesome5-pack</artifactId>
</dependency>
<!-- needed for Tailer functionality -->
<dependency>
<groupId>commons-io</groupId>
Expand Down
34 changes: 8 additions & 26 deletions app/src/main/scala/app/logorrr/views/LogFileTab.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import app.logorrr.views.text.LogTextView
import app.logorrr.views.visual.LogVisualView
import javafx.beans.binding.{Bindings, StringExpression}
import javafx.beans.property.{SimpleListProperty, SimpleObjectProperty}
import javafx.beans.value.ChangeListener
import javafx.collections.transformation.FilteredList
import javafx.collections.{ListChangeListener, ObservableList}
import javafx.scene.control._
import javafx.scene.layout._
import javafx.scene.paint.Color

import java.time.Instant
import java.util.stream.Collectors
Expand All @@ -24,6 +22,11 @@ import scala.jdk.CollectionConverters._

object LogFileTab {

private val BackgroundStyle: String =
"""
|-fx-background-color: WHITE;
|""".stripMargin

case class TimeRange(startTime: Instant, endTime: Instant)

def apply(logFileSettings: LogFileSettings): LogFileTab = {
Expand Down Expand Up @@ -53,6 +56,8 @@ class LogFileTab(val pathAsString: String
extends Tab
with CanLog {

setStyle(LogFileTab.BackgroundStyle)

val logoRRRTailer = LogoRRRTailer(pathAsString, logEntries)

def repaint(): Unit = logVisualView.repaint()
Expand All @@ -75,7 +80,6 @@ class LogFileTab(val pathAsString: String
/** list of search filters to be applied */
val filtersListProperty = new SimpleListProperty[Filter](CollectionUtils.mkEmptyObservableList())


/** split visual view and text view */
val splitPane = new SplitPane()

Expand All @@ -99,7 +103,7 @@ class LogFileTab(val pathAsString: String
op
}

val initialWidth = (Bindings.multiply(LogoRRRGlobals.settings.stageSettings.widthProperty, LogoRRRGlobals.getLogFileSettings(pathAsString).dividerPositionProperty))
val initialWidth = Bindings.multiply(LogoRRRGlobals.settings.stageSettings.widthProperty, LogoRRRGlobals.getLogFileSettings(pathAsString).dividerPositionProperty)

private lazy val logVisualView = {
val lvv = new LogVisualView(pathAsString, filteredList, initialWidth.intValue())
Expand All @@ -112,19 +116,9 @@ class LogFileTab(val pathAsString: String

private val logTextView = new LogTextView(pathAsString, filteredList, timings)

val footerLabel = {
val l = new Label("")
l.prefWidthProperty.bind(LogoRRRGlobals.settings.stageSettings.widthProperty)
l.setStyle(LogoRRRFonts.jetBrainsMono(20))
l.setTextFill(Color.WHITE)
l
}


val selectedEntryProperty = new SimpleObjectProperty[LogEntry]()

private val logEntryChangeListener: ChangeListener[LogEntry] = JfxUtils.onNew[LogEntry](updateFooter)


/** if a change event for filtersList Property occurs, save it to disc */
def initFiltersPropertyListChangeListener(): Unit = {
Expand Down Expand Up @@ -154,7 +148,6 @@ class LogFileTab(val pathAsString: String
val borderPane = new BorderPane()
borderPane.setTop(opsBorderPane)
borderPane.setCenter(splitPane)
borderPane.setBottom(footerLabel)
setContent(borderPane)

logVisualView.blockViewPane.blockSizeProperty.bind(opsBorderPane.blockSizeProperty)
Expand All @@ -177,7 +170,6 @@ class LogFileTab(val pathAsString: String
textProperty.bind(computeTabTitle)

selectedEntryProperty.bind(logVisualView.selectedEntryProperty)
selectedEntryProperty.addListener(logEntryChangeListener)

// if user changes selected item in listview, change footer as well
//logTextView.listView.getSelectionModel.selectedItemProperty.addListener(logEntryChangeListener)
Expand Down Expand Up @@ -221,16 +213,6 @@ class LogFileTab(val pathAsString: String
logoRRRTailer.stop()
}

def updateFooter(logEntry: LogEntry): Unit = {
Option(logEntry) match {
case Some(entry) =>
footerLabel.setBackground(entry.background)
footerLabel.setText(entry.value)
case None =>
footerLabel.setBackground(null)
footerLabel.setText("")
}
}

def setDivider(pos: Double): Unit = splitPane.getDividers.get(0).setPosition(pos)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@ object LogoRRRMainTabPane {
|-fx-background-size: 100%;
|""".stripMargin


}

class LogoRRRMainTabPane()
extends TabPane
with CanLog {

/** bound to sceneWidthProperty of parent logorrrMainBorderPane */
val sceneWidthProperty = new SimpleIntegerProperty()

setStyle(LogoRRRMainTabPane.BackgroundStyle)

/**
Expand All @@ -49,8 +45,11 @@ class LogoRRRMainTabPane()
})
}

def add(tab: LogFileTab): Unit = getTabs.add(tab)

def add(tab: LogFileTab): Unit = {
getTabs.add(tab)
setStyle(null)
}

def contains(p: String): Boolean = getLogFileTabs.exists(lr => lr.pathAsString == p)

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/scala/app/logorrr/views/main/LogoRRRStage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import app.logorrr.conf.mut.MutStageSettings
import app.logorrr.meta.AppMeta
import app.logorrr.util.JfxUtils
import app.logorrr.views.LogoRRRAccelerators
import atlantafx.base.theme.PrimerLight
import javafx.application.Application
import javafx.scene.Scene
import javafx.scene.image.Image
import javafx.stage.{Stage, WindowEvent}
Expand Down Expand Up @@ -32,7 +34,7 @@ case class LogoRRRStage(stage: Stage) {
stage.setTitle(AppMeta.fullAppName)
stage.getIcons.add(LogoRRRStage.icon)
stage.setScene(scene)

Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet())
// make sure to cleanup on close
stage.setOnCloseRequest((_: WindowEvent) => {
LogoRRRGlobals.persist()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ import javafx.beans.property.SimpleListProperty
import javafx.collections.ListChangeListener
import javafx.collections.transformation.FilteredList
import javafx.scene.control.{Button, ToolBar}
import org.kordamp.ikonli.fontawesome5.FontAwesomeSolid
import org.kordamp.ikonli.javafx.FontIcon

import java.text.DecimalFormat
import scala.jdk.CollectionConverters._

/** A toolbar with buttons which filter log events */
object FiltersToolBar {

class RemoveButton(filter: Filter, removeFilter: Filter => Unit) extends Button("x") {
class RemoveButton(filter: Filter, removeFilter: Filter => Unit) extends Button {
setGraphic(new FontIcon(FontAwesomeSolid.TIMES_CIRCLE))
setDisable(filter.isInstanceOf[UnclassifiedFilter])
setOnAction(_ => removeFilter(filter))
}
Expand Down Expand Up @@ -61,7 +63,7 @@ class FiltersToolBar(filteredList: FilteredList[LogEntry]
private def updateUnclassified(): Unit = {
val unclassified = new UnclassifiedFilter(filterButtons.keySet)
updateOccurrences(unclassified)
val searchTag = search.SearchTag(unclassified, occurrences, updateActiveFilter, removeFilter)
val searchTag = SearchTag(unclassified, occurrences, updateActiveFilter, removeFilter)
someUnclassifiedFilter.foreach(ftb => getItems.remove(ftb._2))
getItems.add(0, searchTag)
someUnclassifiedFilter = Option((unclassified, searchTag))
Expand Down
7 changes: 2 additions & 5 deletions app/src/main/scala/app/logorrr/views/search/SearchTag.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package app.logorrr.views.search

import javafx.beans.{InvalidationListener, Observable}
import javafx.scene.control.{Button, ToggleButton}
import javafx.scene.layout.HBox
import javafx.scene.control.{Button, ToggleButton, ToolBar}
import javafx.scene.paint.Color
import javafx.scene.shape.Rectangle

Expand Down Expand Up @@ -40,6 +39,4 @@ object SearchTag {
/**
* Groups a toggle button to activate a filter and a button to remove it
*/
class SearchTag(val toggleButton: ToggleButton, val closeButton: Button) extends HBox {
getChildren.addAll(toggleButton, closeButton)
}
class SearchTag(val toggleButton: ToggleButton, val closeButton: Button) extends ToolBar(toggleButton, closeButton)
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class LogTextView(pathAsString: String

val listView: ListView[LogEntry] = {
val lv = new ListView[LogEntry]()
lv.getStyleClass.add("dense")
lv.setItems(filteredList)
val i = LogoRRRGlobals.getLogFileSettings(pathAsString).selectedIndexProperty.get()
lv.getSelectionModel.select(i)
Expand Down
2 changes: 1 addition & 1 deletion dist/dist-osx/installer-osx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<argument>--compress=2</argument>
<argument>--strip-debug</argument>
<argument>--add-modules</argument>
<argument>jdk.crypto.ec,jdk.localedata,java.base,java.desktop,jdk.jfr,jdk.unsupported
<argument>jdk.crypto.ec,jdk.localedata,java.base,java.desktop,jdk.jfr,java.logging,jdk.unsupported
</argument>
<argument>--include-locales=en</argument>
<argument>--output</argument>
Expand Down
2 changes: 0 additions & 2 deletions dist/dist-repackaged/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
<configuration>
<includes>**/**.class</includes>
<excludes>scala/**</excludes>
<!--
-->
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
Expand Down
26 changes: 21 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@
<changelist>-SNAPSHOT</changelist>

<scala.major.version>2.13</scala.major.version>
<scala.version>${scala.major.version}.8</scala.version>
<openjfx.version>19-ea+9</openjfx.version>
<gluonfx.plugin.version>1.0.14</gluonfx.plugin.version>
<scala.version>${scala.major.version}.9</scala.version>
<openjfx.version>19</openjfx.version>
<gluonfx.plugin.version>1.0.15</gluonfx.plugin.version>
<javafx.maven.plugin.version>0.0.8</javafx.maven.plugin.version>
<main.class>app.logorrr.LogoRRRApp</main.class>
<main.launcher.class>app.logorrr.LogoRRRAppLauncher</main.launcher.class>
<graalvm.log>${project.build.directory}/graal.log</graalvm.log>
<!-- settings for x64 and aarch64 builds on mac, can be ignored for other platforms -->
<osx.jdk.home.aarch64>/Users/lad/.sdkman/candidates/java/19.ea.34-open</osx.jdk.home.aarch64>
<osx.jdk.home.aarch64>/Users/lad/.sdkman/candidates/java/19-zulu</osx.jdk.home.aarch64>
<osx.jdk.home.x64>/Users/lad/.sdkman/candidates/java/19.ea.19-open</osx.jdk.home.x64>
<ikonli.version>12.3.1</ikonli.version>
</properties>

<profiles>
Expand Down Expand Up @@ -113,6 +114,21 @@
<artifactId>javafx-swing</artifactId>
<version>${openjfx.version}</version>
</dependency>
<dependency>
<groupId>io.github.mkpaz</groupId>
<artifactId>atlantafx-base</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-javafx</artifactId>
<version>${ikonli.version}</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-fontawesome5-pack</artifactId>
<version>${ikonli.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down Expand Up @@ -179,7 +195,7 @@
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.5.6</version>
<version>4.7.2</version>
<executions>
<execution>
<goals>
Expand Down