Pulled up the SuperMixin that calls closeOperations for frames into window and let dialogs mix it in as well. Closes #3708.

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25495 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
imaier 2011-08-12 16:16:12 +00:00
parent 8a21ab74a5
commit f920598023
2 changed files with 11 additions and 11 deletions

View File

@ -75,14 +75,6 @@ sealed trait RichWindow extends Window {
class Frame(gc: java.awt.GraphicsConfiguration = null) extends RichWindow {
override lazy val peer: JFrame with InterfaceMixin = new JFrame(gc) with InterfaceMixin with SuperMixin
protected trait SuperMixin extends JFrame {
override protected def processWindowEvent(e: java.awt.event.WindowEvent) {
super.processWindowEvent(e)
if (e.getID() == java.awt.event.WindowEvent.WINDOW_CLOSING)
closeOperation()
}
}
def iconify() { peer.setExtendedState(peer.getExtendedState | AWTFrame.ICONIFIED) }
def uniconify() { peer.setExtendedState(peer.getExtendedState & ~AWTFrame.ICONIFIED) }
def iconified: Boolean = (peer.getExtendedState & AWTFrame.ICONIFIED) != 0
@ -189,10 +181,10 @@ object Dialog {
*/
class Dialog(owner: Window, gc: java.awt.GraphicsConfiguration = null) extends RichWindow {
override lazy val peer: JDialog with InterfaceMixin =
if (owner == null) new JDialog with InterfaceMixin
if (owner == null) new JDialog with InterfaceMixin with SuperMixin
else owner match {
case f: Frame => new JDialog(f.peer, "", false, gc) with InterfaceMixin
case d: Dialog => new JDialog(d.peer, "", false, gc) with InterfaceMixin
case f: Frame => new JDialog(f.peer, "", false, gc) with InterfaceMixin with SuperMixin
case d: Dialog => new JDialog(d.peer, "", false, gc) with InterfaceMixin with SuperMixin
}
def this() = this(null)

View File

@ -27,6 +27,14 @@ abstract class Window extends UIElement with RootPanel with Publisher { outer =>
protected trait InterfaceMixin extends javax.swing.RootPaneContainer
protected trait SuperMixin extends AWTWindow {
override protected def processWindowEvent(e: java.awt.event.WindowEvent) {
super.processWindowEvent(e)
if (e.getID() == java.awt.event.WindowEvent.WINDOW_CLOSING)
closeOperation()
}
}
/**
* This method is called when the window is closing, after all other window
* event listeners have been processed.