From 20859263f2a2cf85464b333b9842bb31c020ee5e Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 15 Aug 2011 20:48:25 +0000 Subject: Removing the code which has been deprecated sin... Removing the code which has been deprecated since 2.8.0. Contributed by Simon Ochsenreither, although deleting code is such fun one hesitates to call it a contribution. Still, we will. Closes SI-4860, no review. --- src/swing/scala/swing/Component.scala | 3 -- src/swing/scala/swing/GUIApplication.scala | 30 -------------- src/swing/scala/swing/ListView.scala | 11 ------ src/swing/scala/swing/SimpleGUIApplication.scala | 46 ---------------------- src/swing/scala/swing/SimpleSwingApplication.scala | 19 +++++++++ src/swing/scala/swing/SwingApplication.scala | 8 ++++ src/swing/scala/swing/UIElement.scala | 3 -- src/swing/scala/swing/Window.scala | 2 +- src/swing/scala/swing/event/ComponentEvent.scala | 9 ----- src/swing/scala/swing/test/LinePainting.scala | 5 ++- 10 files changed, 31 insertions(+), 105 deletions(-) delete mode 100644 src/swing/scala/swing/GUIApplication.scala delete mode 100644 src/swing/scala/swing/SimpleGUIApplication.scala (limited to 'src/swing') diff --git a/src/swing/scala/swing/Component.scala b/src/swing/scala/swing/Component.scala index 9b7fd726ef..dcbe1507c0 100644 --- a/src/swing/scala/swing/Component.scala +++ b/src/swing/scala/swing/Component.scala @@ -117,9 +117,6 @@ abstract class Component extends UIElement { def verify(c: javax.swing.JComponent) = v(UIElement.cachedWrapper[Component](c)) }) }*/ - - @deprecated("Use mouse instead", "2.8.0") lazy val Mouse = mouse - /** * Contains publishers for various mouse events. They are separated for * efficiency reasons. diff --git a/src/swing/scala/swing/GUIApplication.scala b/src/swing/scala/swing/GUIApplication.scala deleted file mode 100644 index 8c63115707..0000000000 --- a/src/swing/scala/swing/GUIApplication.scala +++ /dev/null @@ -1,30 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - - -package scala.swing - -import event.Event -import javax.swing._ - -/** - * Convenience class with utility methods for GUI applications. - */ -@deprecated("Use SwingApplication instead", "2.8.0") class GUIApplication { - - /** - * Called before the GUI is created. Override to customize. - */ - def init() {} - - /** - * Initializes the framework and runs the given program. - */ - def run(prog: => Unit) = Swing.onEDT { init(); prog } -} diff --git a/src/swing/scala/swing/ListView.scala b/src/swing/scala/swing/ListView.scala index 9525efefa1..282d24696e 100644 --- a/src/swing/scala/swing/ListView.scala +++ b/src/swing/scala/swing/ListView.scala @@ -195,24 +195,13 @@ class ListView[A] extends Component { object indices extends Indices(peer.getSelectedIndices) { def -=(n: Int): this.type = { peer.removeSelectionInterval(n,n); this } def +=(n: Int): this.type = { peer.addSelectionInterval(n,n); this } - @deprecated("Use ListView.selection.leadIndex", "2.8.0") - def leadIndex: Int = peer.getSelectionModel.getLeadSelectionIndex - @deprecated("Use ListView.selection.anchorIndex", "2.8.0") - def anchorIndex: Int = peer.getSelectionModel.getAnchorSelectionIndex } - @deprecated("Use ListView.selectIndices", "2.8.0") - def selectIndices(ind: Int*) = peer.setSelectedIndices(ind.toArray) - /** * The currently selected items. */ object items extends scala.collection.SeqProxy[A] { def self = peer.getSelectedValues.map(_.asInstanceOf[A]) - @deprecated("Use ListView.selection.leadIndex", "2.8.0") - def leadIndex: Int = peer.getSelectionModel.getLeadSelectionIndex - @deprecated("Use ListView.selection.anchorIndex", "2.8.0") - def anchorIndex: Int = peer.getSelectionModel.getAnchorSelectionIndex } def intervalMode: IntervalMode.Value = IntervalMode(peer.getSelectionModel.getSelectionMode) diff --git a/src/swing/scala/swing/SimpleGUIApplication.scala b/src/swing/scala/swing/SimpleGUIApplication.scala deleted file mode 100644 index f12e43ff5f..0000000000 --- a/src/swing/scala/swing/SimpleGUIApplication.scala +++ /dev/null @@ -1,46 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala.swing - -import javax.swing._ - -/** - * Extend this class for most simple UI applications. Clients need to - * implement the `top` method. Framework initialization is done by this class. - * - * In order to conform to Swing's threading policy, never implement top or any - * additional member that created Swing components as a value unless component - * creation happens on the EDT (see `Swing.onEDT` and `Swing.onEDTWait`). - * Lazy values are okay for the same reason if they are initialized on the EDT - * always. - */ -@deprecated("Use SimpleSwingApplication instead", "2.8.0") abstract class SimpleGUIApplication extends GUIApplication { - - /** - * A GUI application's version of the main method. Called by the default - * main method implementation provided by this class. - * Implement to return the top-level frame of this application. - */ - def top: Frame - - /** - * Calls top, packs the frame, and displays it. - */ - def main(args: Array[String]) = run { - val t = top - t.pack() - t.visible = true - } - - def resourceFromClassloader(path: String): java.net.URL = - this.getClass.getResource(path) - - def resourceFromUserDirectory(path: String): java.io.File = - new java.io.File(util.Properties.userDir, path) -} diff --git a/src/swing/scala/swing/SimpleSwingApplication.scala b/src/swing/scala/swing/SimpleSwingApplication.scala index 786c7b4711..cd0f2be874 100644 --- a/src/swing/scala/swing/SimpleSwingApplication.scala +++ b/src/swing/scala/swing/SimpleSwingApplication.scala @@ -1,8 +1,27 @@ package scala.swing +/** + * Extend this class for most simple UI applications. Clients need to + * implement the `top` method. Framework initialization is done by this class. + * + * In order to conform to Swing's threading policy, never implement top or any + * additional member that created Swing components as a value unless component + * creation happens on the EDT (see `Swing.onEDT` and `Swing.onEDTWait`). + * Lazy values are okay for the same reason if they are initialized on the EDT + * always. + */ abstract class SimpleSwingApplication extends SwingApplication { + + /** + * A GUI application's version of the main method. Called by the default + * main method implementation provided by this class. + * Implement to return the top-level frame of this application. + */ def top: Frame + /** + * Calls `top`, packs the frame, and displays it. + */ override def startup(args: Array[String]) { val t = top if (t.size == new Dimension(0,0)) t.pack() diff --git a/src/swing/scala/swing/SwingApplication.scala b/src/swing/scala/swing/SwingApplication.scala index 6da3ab2053..214001f72a 100644 --- a/src/swing/scala/swing/SwingApplication.scala +++ b/src/swing/scala/swing/SwingApplication.scala @@ -1,9 +1,17 @@ package scala.swing +/** Convenience class with utility methods for GUI applications. */ abstract class SwingApplication extends Reactor { + + /** Initializes the application and runs the given program. */ def main(args: Array[String]) = Swing.onEDT { startup(args) } + /** Called before the GUI is created. Override to customize. */ def startup(args: Array[String]) + + /** Finalizes the application by calling `shutdown` and exits.*/ def quit() { shutdown(); sys.exit(0) } + + /** Called before the application is exited. Override to customize. */ def shutdown() {} } diff --git a/src/swing/scala/swing/UIElement.scala b/src/swing/scala/swing/UIElement.scala index 9e505ea9a6..04e2217943 100644 --- a/src/swing/scala/swing/UIElement.scala +++ b/src/swing/scala/swing/UIElement.scala @@ -96,9 +96,6 @@ trait UIElement extends Proxy with LazyPublisher { def location = peer.getLocation def bounds = peer.getBounds def size = peer.getSize - @deprecated("Explicit size assignment for UIElements is not supported anymore. " + - "Use a layout manager or subclass Window.", "2.8.0") - def size_=(dim: Dimension) = peer.setSize(dim) def locale = peer.getLocale def toolkit = peer.getToolkit diff --git a/src/swing/scala/swing/Window.scala b/src/swing/scala/swing/Window.scala index c3918551db..7991026a69 100644 --- a/src/swing/scala/swing/Window.scala +++ b/src/swing/scala/swing/Window.scala @@ -61,7 +61,7 @@ abstract class Window extends UIElement with RootPanel with Publisher { outer => def setLocationRelativeTo(c: UIElement) { peer.setLocationRelativeTo(c.peer) } def centerOnScreen() { peer.setLocationRelativeTo(null) } def location_=(p: Point) { peer.setLocation(p) } - override def size_=(size: Dimension) { peer.setSize(size) } + def size_=(size: Dimension) { peer.setSize(size) } def bounds_=(rect: Rectangle) { peer.setBounds(rect) } def owner: Window = UIElement.cachedWrapper[Window](peer.getOwner) diff --git a/src/swing/scala/swing/event/ComponentEvent.scala b/src/swing/scala/swing/event/ComponentEvent.scala index d8cff46168..f338a15868 100644 --- a/src/swing/scala/swing/event/ComponentEvent.scala +++ b/src/swing/scala/swing/event/ComponentEvent.scala @@ -14,12 +14,3 @@ package event trait ComponentEvent extends UIEvent { val source: Component } - -@deprecated("Use UIElementMoved instead.", "2.8.0") -case class ComponentMoved(source: Component) extends ComponentEvent -@deprecated("Use UIElementResized instead.", "2.8.0") -case class ComponentResized(source: Component) extends ComponentEvent -@deprecated("Use UIElementShown instead.", "2.8.0") -case class ComponentShown(source: Component) extends ComponentEvent -@deprecated("Use UIElementHidden instead.", "2.8.0") -case class ComponentHidden(source: Component) extends ComponentEvent diff --git a/src/swing/scala/swing/test/LinePainting.scala b/src/swing/scala/swing/test/LinePainting.scala index 78a94dbab7..8588665ddc 100644 --- a/src/swing/scala/swing/test/LinePainting.scala +++ b/src/swing/scala/swing/test/LinePainting.scala @@ -1,9 +1,10 @@ package scala.swing package test + import scala.swing.Swing._ -import scala.swing.{MainFrame, Panel, SimpleGUIApplication} +import scala.swing.{MainFrame, Panel} import scala.swing.event._ -import java.awt.{Color, Dimension, Graphics, Graphics2D, Point, geom} +import java.awt.{Color, Graphics2D, Point, geom} /** * Dragging the mouse draws a simple graph -- cgit v1.2.3