Skip to content

Commit

Permalink
#114: show occurrences as tooltip in search tags
Browse files Browse the repository at this point in the history
  • Loading branch information
rladstaetter committed Oct 29, 2022
1 parent e8f4921 commit af30d85
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/src/main/scala/app/logorrr/views/search/SearchTag.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app.logorrr.views.search

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

Expand All @@ -13,8 +13,9 @@ object SearchTag {
, updateActiveFilter: () => Unit
, removeFilter: Filter => Unit): SearchTag = {
val i = occurrences(filter)
val buttonTitle = s"${filter.pattern} $i"
val button = new ToggleButton(buttonTitle)
val button = new ToggleButton(filter.pattern)
val tooltipMessage = if (i == 1) "one item found" else s"$i items found"
button.setTooltip(new Tooltip(tooltipMessage))
val r = new Rectangle(10, 10)
r.setFill(filter.color)
r.setStroke(Color.WHITE)
Expand Down

0 comments on commit af30d85

Please sign in to comment.