Skip to content

Commit

Permalink
format/imports
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgk committed Aug 24, 2024
1 parent c761765 commit 61a5b63
Show file tree
Hide file tree
Showing 32 changed files with 56 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sealed abstract class ReSwingEvent[T] {
}

final class ReSwingEventOut[T] private[ex2013reswing] (initLazily: ReSwingEventOut[T] => Unit) extends ReSwingEvent[T] {
private val event: Lazy[Evt[T]] = Lazy { Evt[T]() }
private val event: Lazy[Evt[T]] = Lazy { Evt[T]() }
private[ex2013reswing] def toEvent = { if !event.isDefined then initLazily(this); event() }
private[ex2013reswing] def apply(value: T) = if event.isDefined then event().fire(value)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ sealed abstract class ReSwingValue[T] {
}

final case class ReSwingNoValue[T]() extends ReSwingValue[T] {
protected val signal = Lazy { event().hold(latestValue) }
protected val signal = Lazy { event().hold(latestValue) }
private[ex2013reswing] def fixed = false
private[ex2013reswing] def get = latestValue
private[ex2013reswing] def use(setter: T => Unit): Unit = {}
}

final case class ReSwingValueValue[T](private val value: T) extends ReSwingValue[T] {
protected val signal = Lazy { event() `hold` latestValue }
protected val signal = Lazy { event() `hold` latestValue }
private[ex2013reswing] def fixed = false
private[ex2013reswing] def get = latestValue
private[ex2013reswing] def use(setter: T => Unit) = setter(value)
}

final case class ReSwingEventValue[T](private val value: Lazy[Event[T]]) extends ReSwingValue[T] {
protected val signal = Lazy { (value() || event()) `hold` latestValue }
protected val signal = Lazy { (value() || event()) `hold` latestValue }
private[ex2013reswing] def fixed = false
private[ex2013reswing] def get = latestValue
private[ex2013reswing] def use(setter: T => Unit) = {
Expand All @@ -53,7 +53,7 @@ final case class ReSwingEventValue[T](private val value: Lazy[Event[T]]) extends
}

final case class ReSwingSignalValue[T](private val value: Lazy[Signal[T]]) extends ReSwingValue[T] {
protected val signal = Lazy { (value().changed || event()) `hold` value().readValueOnce }
protected val signal = Lazy { (value().changed || event()) `hold` value().readValueOnce }
private[ex2013reswing] def fixed = true
private[ex2013reswing] def get = value().readValueOnce
private[ex2013reswing] def use(setter: T => Unit): Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.dropdown

import reactives.default.*
import ex2013reswing.ReTextField
import reactives.default.*

import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSwingApplication}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.dropdown

import reactives.default.*
import ex2013reswing.ReTextField
import reactives.default.*

import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSwingApplication}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.dropdown

import reactives.default.*
import ex2013reswing.ReTextField
import reactives.default.*

import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSwingApplication}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.dropdown

import reactives.default.*
import ex2013reswing.ReTextField
import reactives.default.*

import scala.swing.{BoxPanel, FlowPanel, Label, MainFrame, Orientation, SimpleSwingApplication}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.dropdown

import reactives.default.*
import ex2013reswing.ReTextField
import reactives.default.*

import scala.swing.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ex201x.reswingexamples.millgame.versions.signals

import reactives.default.*
import ex2013reswing.{ReComponent, ReLabel, ReSwingValue}
import ex201x.reswingexamples.millgame.*
import ex201x.reswingexamples.millgame.types.*
import ex2013reswing.{ReComponent, ReLabel, ReSwingValue}
import reactives.default.*

import java.awt.{BasicStroke, Color, Dimension, Font, RenderingHints}
import scala.swing.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ex201x.reswingexamples.millgame.versions.signals

import reactives.default.*
import ex201x.reswingexamples.millgame.*
import ex201x.reswingexamples.millgame.types.*
import reactives.default.*

class MillBoard {
/* wrap stones Var, to have the same interface as other versions */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.millgame.versions.signals

import reactives.default.*
import ex201x.reswingexamples.millgame.types.*
import reactives.default.*

sealed abstract class Gamestate {
def getPlayer: Slot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ex201x.reswingexamples.reader

import reactives.default.*
import ex201x.reswingexamples.reader.connectors.{CentralizedEvents, SimpleReporter}
import ex201x.reswingexamples.reader.data.{FeedStore, RSSItem, XmlParser}
import ex201x.reswingexamples.reader.gui.GUI
import ex201x.reswingexamples.reader.network.{Fetcher, UrlChecker}
import reactives.default.*

import java.net.URL
import scala.io.Source
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ex201x.reswingexamples.reader.connectors

import reactives.default.*
import ex201x.reswingexamples.reader.data.{FeedStore, XmlParser}
import ex201x.reswingexamples.reader.network.{Fetcher, UrlChecker}
import reactives.default.*

trait EventMediator {
def mediate(fetcher: Fetcher, parser: XmlParser, store: FeedStore, checker: UrlChecker): Unit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.reader.data

import reactives.default.*
import ex201x.reswingexamples.reader.Observable
import reactives.default.*

import java.net.{MalformedURLException, URI, URL}
import java.text.{ParseException, SimpleDateFormat}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ex201x.reswingexamples.reader.gui

import reactives.default.*
import ex201x.reswingexamples.reader.data.{FeedStore, RSSChannel, RSSItem}
import ex2013reswing.{ReButton, ReCheckBox, ReLabel, ReSwingValue}
import ex201x.reswingexamples.reader.data.{FeedStore, RSSChannel, RSSItem}
import reactives.default.*

import java.awt.{Dimension, Point, Toolkit}
import javax.swing.ImageIcon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.reader.gui

import reactives.default.*
import ex201x.reswingexamples.reader.data.RSSItem
import reactives.default.*

import java.awt.Desktop
import java.io.IOException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.reader.network

import reactives.default.*
import ex201x.reswingexamples.reader.Observable
import reactives.default.*

import java.net.{SocketException, SocketTimeoutException, URL, UnknownHostException}
import scala.xml.{NodeSeq, XML}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.reader.network

import reactives.default.*
import ex201x.reswingexamples.reader.Observable
import reactives.default.*

import java.io.FileNotFoundException
import java.net.{MalformedURLException, URI, URL, UnknownHostException}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package ex201x.reswingexamples.reshapes

import ex2013reswing.{ReMenu, ReMenuItem, ReSwingValue}
import reactives.default.*
import ex2013reswing.ReMenuItem.toMenuItem
import ex2013reswing.{ReMenu, ReMenuItem, ReSwingValue}
import ex201x.reswingexamples.reshapes.actions.{LoadAction, SaveAction}
import ex201x.reswingexamples.reshapes.drawing.{Command, DrawingSpaceState, MergeDrawingSpaces, NetworkSpaceState}
import ex201x.reswingexamples.reshapes.figures.Shape
import ex201x.reswingexamples.reshapes.ui.dialogs.{NewTabDialog, ServerDialog}
import ex201x.reswingexamples.reshapes.ui.panels.{CommandPanel, DrawingPanel, InfoPanel, ShapePanel, ShapeSelectionPanel, ShowCoordinateSystem, ShowIntersection, ShowNameLabels, StrokeInputPanel}
import ex201x.reswingexamples.reshapes.util.ReactiveUtil.{UnionEvent, bilateralValues}
import reactives.default.*

import java.net.{BindException, ConnectException}
import javax.swing.JOptionPane
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ex201x.reswingexamples.reshapes.actions

import reactives.default.*
import ex201x.reswingexamples.reshapes.ReShapes
import ex201x.reswingexamples.reshapes.drawing.CreateShape
import ex201x.reswingexamples.reshapes.figures.Shape
import reactives.default.*

import java.io.File
import scala.swing.{Action, FileChooser}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.reshapes.drawing

import reactives.default.*
import ex201x.reswingexamples.reshapes.figures.{Line, Shape}
import reactives.default.*

import java.awt.Color
import java.io.{OutputStreamWriter, PrintWriter}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ex201x.reswingexamples.reshapes.ui.panels

import reactives.default.*
import ex2013reswing.{ReBoxPanel, ReButton}
import ex201x.reswingexamples.reshapes.ReShapes
import ex201x.reswingexamples.reshapes.drawing.Command
import ex201x.reswingexamples.reshapes.util.ReactiveUtil.UnionEvent
import reactives.default.*

import scala.swing.{BoxPanel, Component, Orientation, ScrollPane}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ex201x.reswingexamples.reshapes.ui.panels

import reactives.default.*
import ex201x.reswingexamples.reshapes.drawing.{Command, CreateShape, DrawingSpaceState, EditShape}
import ex201x.reswingexamples.reshapes.figures.{Movable, Resizable, Shape}
import ex201x.reswingexamples.reshapes.util.MathUtil
import reactives.default.*

import java.awt.BasicStroke
import scala.collection.mutable.ListBuffer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ex201x.reswingexamples.reshapes.ui.panels

import reactives.default.*
import ex2013reswing.ReLabel
import ex201x.reswingexamples.reshapes.ReShapes
import reactives.default.*

import scala.swing.FlowPanel

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package ex201x.reswingexamples.reshapes.ui.panels

import reactives.default.*
import ex2013reswing.{ReBoxPanel, ReButton}
import ex201x.reswingexamples.reshapes.ReShapes
import ex201x.reswingexamples.reshapes.drawing.{DeleteShape, DrawingSpaceState}
import ex201x.reswingexamples.reshapes.figures.Shape
import ex201x.reswingexamples.reshapes.util.ReactiveUtil.UnionEvent
import reactives.default.*

import scala.swing.{BoxPanel, Color, Component, Label, Orientation, ScrollPane}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ex201x.reswingexamples.reshapes.ui.panels

import reactives.default.*
import ex2013reswing.ReButton
import ex201x.reswingexamples.reshapes.ReShapes
import ex201x.reswingexamples.reshapes.figures.{Freedraw, Line, Oval, Rectangle, Shape, Triangle}
import reactives.default.*

import scala.swing.{BoxPanel, Orientation}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package ex201x.reswingexamples.reshapes.ui.panels

import ex2013reswing.{ReSlider, ReSwingValue}
import ex2013reswing.{ReButton, ReSlider, ReSwingValue}
import reactives.default.*
import ex2013reswing.ReButton

import java.awt.Color
import javax.swing.JColorChooser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ex201x.reswingexamples.texteditor.signalsAndEventsFromImperative

import reactives.default.*
import ex2013reswing.{ReButton, ReLabel}
import reactives.default.*

import scala.swing.BorderPanel.Position
import scala.swing.{BorderPanel, Dimension, GridPanel, MainFrame, ScrollPane, SimpleSwingApplication}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package ex201x.reswingexamples.texteditor.signalsAndEventsFromImperative

import ex2013reswing.{ReLabel, ReTextArea}
import ex2013reswing.{ReButton, ReLabel, ReTextArea}
import reactives.default.*
import ex2013reswing.ReButton

import scala.math.min
import scala.swing.BorderPanel.Position
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ex201x.reswingexamples.texteditor.signalsAndEventsFromImperative

import ex2013reswing.{ReComponent, ReSwingValue}
import reactives.default.*
import ex201x.reswingexamples.texteditor.{JScrollableComponent, LineIterator, LineOffset, Position}
import reactives.default.*

import java.awt.datatransfer.{DataFlavor, StringSelection}
import java.awt.{Dimension, Graphics2D, Point, Rectangle, SystemColor, Toolkit}
Expand Down
Loading

0 comments on commit 61a5b63

Please sign in to comment.