src/Tools/Graphview/mutator_dialog.scala
changeset 59459 985fc55e9f27
parent 59391 39a38657d16b
child 71383 8313dca6dee9
equal deleted inserted replaced
59458:9de8ac92cafa 59459:985fc55e9f27
    18   Dimension, BorderPanel, ScrollPane, Label, CheckBox, Alignment, Component, TextField}
    18   Dimension, BorderPanel, ScrollPane, Label, CheckBox, Alignment, Component, TextField}
    19 import scala.swing.event.ValueChanged
    19 import scala.swing.event.ValueChanged
    20 
    20 
    21 
    21 
    22 class Mutator_Dialog(
    22 class Mutator_Dialog(
    23     visualizer: Visualizer,
    23     graphview: Graphview,
    24     container: Mutator_Container,
    24     container: Mutator_Container,
    25     caption: String,
    25     caption: String,
    26     reverse_caption: String = "Inverse",
    26     reverse_caption: String = "Inverse",
    27     show_color_chooser: Boolean = true)
    27     show_color_chooser: Boolean = true)
    28   extends Dialog
    28   extends Dialog
   115   private val mutator_box = new ComboBox[Mutator](container.available)
   115   private val mutator_box = new ComboBox[Mutator](container.available)
   116 
   116 
   117   private val add_button = new Button {
   117   private val add_button = new Button {
   118     action = Action("Add") {
   118     action = Action("Add") {
   119       add_panel(
   119       add_panel(
   120         new Mutator_Panel(Mutator.Info(true, visualizer.Colors.next, mutator_box.selection.item)))
   120         new Mutator_Panel(Mutator.Info(true, graphview.Colors.next, mutator_box.selection.item)))
   121     }
   121     }
   122   }
   122   }
   123 
   123 
   124   private val apply_button = new Button {
   124   private val apply_button = new Button {
   125     action = Action("Apply") { container(get_mutators(panels)) }
   125     action = Action("Apply") { container(get_mutators(panels)) }
   244 
   244 
   245     focusList = focusList.reverse
   245     focusList = focusList.reverse
   246 
   246 
   247     def get_mutator: Mutator.Info =
   247     def get_mutator: Mutator.Info =
   248     {
   248     {
   249       val model = visualizer.model
   249       val model = graphview.model
   250       val m =
   250       val m =
   251         initials.mutator match {
   251         initials.mutator match {
   252           case Mutator.Identity() =>
   252           case Mutator.Identity() =>
   253             Mutator.Identity()
   253             Mutator.Identity()
   254           case Mutator.Node_Expression(r, _, _, _) =>
   254           case Mutator.Node_Expression(r, _, _, _) =>
   331 
   331 
   332     private val default_foreground = foreground
   332     private val default_foreground = foreground
   333     reactions +=
   333     reactions +=
   334     {
   334     {
   335       case ValueChanged(_) =>
   335       case ValueChanged(_) =>
   336         foreground = if (check(text)) default_foreground else visualizer.error_color
   336         foreground = if (check(text)) default_foreground else graphview.error_color
   337     }
   337     }
   338 
   338 
   339     def string = text
   339     def string = text
   340     def bool = true
   340     def bool = true
   341   }
   341   }