de.sciss.common
Class AppWindow

java.lang.Object
  extended by de.sciss.common.AppWindow
All Implemented Interfaces:
AbstractWindow

public class AppWindow
extends java.lang.Object
implements AbstractWindow

Common functionality for all application windows. This class provides means for storing and recalling window bounds in preferences. All subclass windows will get a copy of the main menubar as well.

Version:
0.71, 01-Aug-08
Author:
Hanns Holger Rutz
Todo:
tempFloatingTimer could maybe be eliminated in favour of a simple EventQueue.invokeLater

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.sciss.app.AbstractWindow
AbstractWindow.Adapter, AbstractWindow.Event, AbstractWindow.Listener
 
Field Summary
protected  boolean active
           
protected  javax.swing.JMenuBar bar
           
protected  AbstractWindow barBorrower
           
protected  boolean borrowMenuBar
           
protected  java.util.prefs.Preferences classPrefs
           
protected  boolean initialized
           
protected  SmartJFrame jf
           
protected  javax.swing.JInternalFrame jif
           
protected  boolean ownMenuBar
           
protected  boolean tempFloating
           
protected  javax.swing.Timer tempFloatingTimer
           
protected  BasicWindowHandler wh
           
 
Fields inherited from interface de.sciss.app.AbstractWindow
PALETTE, REGULAR, SUPPORT, TYPES_MASK
 
Constructor Summary
protected AppWindow(java.awt.Dialog wrap)
           
  AppWindow(int flags)
           
 
Method Summary
protected  void addDynamicListening(DynamicListening l)
           
 void addListener(AbstractWindow.Listener l)
           
protected  boolean alwaysPackSize()
          Queries whether this frame's bounds should be packed automatically to the preferred size independent of concurrent preference settings
protected  boolean autoUpdatePrefs()
           
protected  void borrowMenuBar(AbstractWindow aw)
           
static java.lang.String dimensionToString(java.awt.Dimension value)
           
 void dispose()
          Frees resources, clears references
 javax.swing.ActionMap getActionMap()
           
 java.awt.Rectangle getBounds()
           
protected  java.util.prefs.Preferences getClassPrefs()
           
 java.awt.Container getContentPane()
           
 javax.swing.InputMap getInputMap(int condition)
           
 java.awt.Insets getInsets()
           
 javax.swing.JMenuBar getJMenuBar()
           
 java.awt.Point getLocation()
           
 java.awt.Window[] getOwnedWindows()
           
protected  java.awt.geom.Point2D getPreferredLocation()
           
 java.awt.Dimension getSize()
           
 java.lang.String getTitle()
           
 java.awt.Component getWindow()
           
 BasicWindowHandler getWindowHandler()
           
 void init()
          Subclasses should call this after having constructed their GUI.
 boolean isActive()
           
 boolean isFloating()
           
 boolean isResizable()
           
 boolean isVisible()
           
static void lookAndFeelUpdate()
          Updates Swing component tree for all frames after a look-and-feel change
 void pack()
           
protected static java.lang.String pointToString(java.awt.Point value)
           
 void removeListener(AbstractWindow.Listener l)
           
protected  boolean restoreVisibility()
           
 void revalidate()
           
 void setBounds(java.awt.Rectangle r)
           
 void setContentPane(java.awt.Container c2)
           
 void setDefaultCloseOperation(int mode)
           
 void setDirty(boolean dirty)
           
 void setFocusTraversalKeysEnabled(boolean enabled)
           
 void setJMenuBar(javax.swing.JMenuBar m)
           
 void setLocation(java.awt.Point p)
           
 void setLocationRelativeTo(java.awt.Component comp)
           
 void setPreferredSize(java.awt.Dimension d)
           
 void setResizable(boolean b)
           
 void setSize(java.awt.Dimension d)
           
 void setTitle(java.lang.String title)
           
 void setUndecorated(boolean b)
           
 void setVisible(boolean b)
           
protected static java.awt.Dimension stringToDimension(java.lang.String value)
           
protected static java.awt.Point stringToPoint(java.lang.String value)
           
 void toFront()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classPrefs

protected java.util.prefs.Preferences classPrefs

jf

protected final SmartJFrame jf

jif

protected final javax.swing.JInternalFrame jif

ownMenuBar

protected final boolean ownMenuBar

borrowMenuBar

protected final boolean borrowMenuBar

wh

protected final BasicWindowHandler wh

bar

protected javax.swing.JMenuBar bar

barBorrower

protected AbstractWindow barBorrower

active

protected boolean active

initialized

protected boolean initialized

tempFloating

protected final boolean tempFloating

tempFloatingTimer

protected javax.swing.Timer tempFloatingTimer
Constructor Detail

AppWindow

public AppWindow(int flags)

AppWindow

protected AppWindow(java.awt.Dialog wrap)
Method Detail

getWindowHandler

public BasicWindowHandler getWindowHandler()

stringToDimension

protected static java.awt.Dimension stringToDimension(java.lang.String value)

stringToPoint

protected static java.awt.Point stringToPoint(java.lang.String value)

pointToString

protected static java.lang.String pointToString(java.awt.Point value)

dimensionToString

public static java.lang.String dimensionToString(java.awt.Dimension value)

isFloating

public boolean isFloating()
Specified by:
isFloating in interface AbstractWindow

lookAndFeelUpdate

public static void lookAndFeelUpdate()
Updates Swing component tree for all frames after a look-and-feel change


alwaysPackSize

protected boolean alwaysPackSize()
Queries whether this frame's bounds should be packed automatically to the preferred size independent of concurrent preference settings

Returns:
true, if the frame wishes to be packed each time a custom setSize() would be applied in the course of a preference recall. The default value of true can be modified by subclasses by overriding this method.
See Also:
Window.pack()

restoreVisibility

protected boolean restoreVisibility()

autoUpdatePrefs

protected boolean autoUpdatePrefs()

getPreferredLocation

protected java.awt.geom.Point2D getPreferredLocation()

init

public void init()
Subclasses should call this after having constructed their GUI. Then this method will attach a copy of the main menu from root.menuFactory and restore bounds from preferences.

Specified by:
init in interface AbstractWindow

getClassPrefs

protected java.util.prefs.Preferences getClassPrefs()

addDynamicListening

protected void addDynamicListening(DynamicListening l)

getWindow

public java.awt.Component getWindow()
Specified by:
getWindow in interface AbstractWindow

getInsets

public java.awt.Insets getInsets()
Specified by:
getInsets in interface AbstractWindow

dispose

public void dispose()
Frees resources, clears references

Specified by:
dispose in interface AbstractWindow

setSize

public void setSize(java.awt.Dimension d)
Specified by:
setSize in interface AbstractWindow

getSize

public java.awt.Dimension getSize()
Specified by:
getSize in interface AbstractWindow

getBounds

public java.awt.Rectangle getBounds()
Specified by:
getBounds in interface AbstractWindow

setBounds

public void setBounds(java.awt.Rectangle r)
Specified by:
setBounds in interface AbstractWindow

setLocation

public void setLocation(java.awt.Point p)
Specified by:
setLocation in interface AbstractWindow

getLocation

public java.awt.Point getLocation()
Specified by:
getLocation in interface AbstractWindow

setPreferredSize

public void setPreferredSize(java.awt.Dimension d)

isActive

public boolean isActive()
Specified by:
isActive in interface AbstractWindow

addListener

public void addListener(AbstractWindow.Listener l)
Specified by:
addListener in interface AbstractWindow

removeListener

public void removeListener(AbstractWindow.Listener l)
Specified by:
removeListener in interface AbstractWindow

toFront

public void toFront()
Specified by:
toFront in interface AbstractWindow

setVisible

public void setVisible(boolean b)
Specified by:
setVisible in interface AbstractWindow

isVisible

public boolean isVisible()
Specified by:
isVisible in interface AbstractWindow

setDefaultCloseOperation

public void setDefaultCloseOperation(int mode)
Specified by:
setDefaultCloseOperation in interface AbstractWindow

pack

public void pack()
Specified by:
pack in interface AbstractWindow

setTitle

public void setTitle(java.lang.String title)
Specified by:
setTitle in interface AbstractWindow

getTitle

public java.lang.String getTitle()
Specified by:
getTitle in interface AbstractWindow

getContentPane

public java.awt.Container getContentPane()
Specified by:
getContentPane in interface AbstractWindow

setContentPane

public void setContentPane(java.awt.Container c2)
Specified by:
setContentPane in interface AbstractWindow

setJMenuBar

public void setJMenuBar(javax.swing.JMenuBar m)
Specified by:
setJMenuBar in interface AbstractWindow

getJMenuBar

public javax.swing.JMenuBar getJMenuBar()
Specified by:
getJMenuBar in interface AbstractWindow

borrowMenuBar

protected void borrowMenuBar(AbstractWindow aw)

getInputMap

public javax.swing.InputMap getInputMap(int condition)
Specified by:
getInputMap in interface AbstractWindow

getActionMap

public javax.swing.ActionMap getActionMap()
Specified by:
getActionMap in interface AbstractWindow

getOwnedWindows

public java.awt.Window[] getOwnedWindows()
Specified by:
getOwnedWindows in interface AbstractWindow

setFocusTraversalKeysEnabled

public void setFocusTraversalKeysEnabled(boolean enabled)
Specified by:
setFocusTraversalKeysEnabled in interface AbstractWindow

setDirty

public void setDirty(boolean dirty)
Specified by:
setDirty in interface AbstractWindow

setLocationRelativeTo

public void setLocationRelativeTo(java.awt.Component comp)
Specified by:
setLocationRelativeTo in interface AbstractWindow

setUndecorated

public void setUndecorated(boolean b)
Specified by:
setUndecorated in interface AbstractWindow

setResizable

public void setResizable(boolean b)
Specified by:
setResizable in interface AbstractWindow

isResizable

public boolean isResizable()
Specified by:
isResizable in interface AbstractWindow

revalidate

public void revalidate()
Specified by:
revalidate in interface AbstractWindow