# HG changeset patch # User wenzelm # Date 1448647187 -3600 # Node ID aa7b748bd96ccb579c9bb0a6ee7af62ecb788753 # Parent c6c2508f94b85de77d9f7232da4576cb31e6b912 more reactive GUI; diff -r c6c2508f94b8 -r aa7b748bd96c src/Tools/jEdit/src/monitor_dockable.scala --- a/src/Tools/jEdit/src/monitor_dockable.scala Fri Nov 27 18:47:39 2015 +0100 +++ b/src/Tools/jEdit/src/monitor_dockable.scala Fri Nov 27 18:59:47 2015 +0100 @@ -13,7 +13,7 @@ import scala.collection.immutable.Queue import scala.swing.{TextArea, TextField, ScrollPane, Component, ComboBox, Button} -import scala.swing.event.{SelectionChanged, ButtonClicked} +import scala.swing.event.{SelectionChanged, ButtonClicked, ValueChanged} import org.jfree.chart.ChartPanel import org.jfree.data.xy.XYSeriesCollection @@ -57,7 +57,10 @@ case Some((_, fields)) => ML_Statistics("", statistics.toList).update_data(data, fields) } - private val delay_update = + private val input_delay = + GUI_Thread.delay_first(PIDE.options.seconds("editor_input_delay")) { update_chart } + + private val update_delay = GUI_Thread.delay_first(PIDE.options.seconds("editor_chart_delay")) { update_chart } @@ -89,6 +92,7 @@ tooltip = "Limit for accumulated data" verifier = (s: String) => s match { case Properties.Value.Int(x) => x > 0 case _ => false } + reactions += { case ValueChanged(_) => input_delay.invoke() } } private val controls = @@ -107,7 +111,7 @@ Session.Consumer[Any](getClass.getName) { case stats: Session.Statistics => add_statistics(stats.props) - delay_update.invoke() + update_delay.invoke() case _: Session.Global_Options => GUI_Thread.later { ml_stats.load() }