org.flexdock.util
Class RootWindow

java.lang.Object
  extended by org.flexdock.util.RootWindow

public class RootWindow
extends java.lang.Object

This class provides an abstraction of root containers used in Swing. It allows transparent use of methods common to JFrame, JApplet, JWindow, and JDialog without making an outward distinction between the different container types. This is accomplished by wrapping the root component.

Author:
Chris Butler

Field Summary
static java.lang.Integer DEFAULT_MAXED_LAYER
           
 
Constructor Summary
protected RootWindow(java.awt.Component root)
          Creates a new RootSwingContainer wrapping the specified component.
 
Method Summary
 java.awt.Rectangle getBounds()
           
 java.lang.Object getClientProperty(java.lang.Object key)
           
 java.awt.Container getContentPane()
          Returns the contentPane object for the wrapped component.
 java.awt.Component getGlassPane()
          Returns the glassPane object for the wrapped component.
 javax.swing.JLayeredPane getLayeredPane()
          Returns the layeredPane object for the wrapped component.
 java.awt.Point getLocationOnScreen()
          Gets the location of the wrapped component in the form of a point specifying the component's top-left corner in the screen's coordinate space.
 java.lang.Integer getMaximizationLayer()
          Deprecated. dead code last used in 0.2.0
 java.awt.LayoutManager getMaximizedLayout()
          Deprecated. dead code last used in 0.2.0
 java.awt.Window[] getOwnedWindows()
          Return an array containing all the windows this window currently owns.
 java.awt.Window getOwner()
           
 java.awt.Component getRootContainer()
          Returns the the wrapped component.
static RootWindow getRootContainer(java.awt.Component c)
          Traverses the container hierarchy to locate the root container and returns corresponding RootSwingContainer.
 javax.swing.JRootPane getRootPane()
          Returns the rootPane object for the wrapped component.
static RootWindow[] getVisibleWindows()
           
 boolean isActive()
           
static boolean isValidRootContainer(java.awt.Component c)
          Indicates whether the supplied Component is, in fact, a root Swing container.
 void pack()
           
 void putClientProperty(java.lang.Object key, java.lang.Object value)
           
 void revalidateContentPane()
          Convenience method that calls revalidate() on the current content pane if it is a JComponent.
 void setContentPane(java.awt.Container contentPane)
          Sets the contentPane property for the wrapped component.
 void setGlassPane(java.awt.Component glassPane)
          Sets the glassPane property for the wrapped component.
 void setLayeredPane(javax.swing.JLayeredPane layeredPane)
          Sets the layeredPane property for the wrapped component.
 void setMaximizationLayer(java.lang.Integer layer)
          Deprecated. dead code last used in 0.2.0
 void setMaximizedLayout(java.awt.LayoutManager mgr)
          Deprecated. dead code last used in 0.2.0
protected  void setRootContainer(java.awt.Component root)
          Sets the wrapped root container.
 void toFront()
           
 void updateComponentTreeUI()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAXED_LAYER

public static final java.lang.Integer DEFAULT_MAXED_LAYER
Constructor Detail

RootWindow

protected RootWindow(java.awt.Component root)
Creates a new RootSwingContainer wrapping the specified component.

Method Detail

getRootContainer

public static RootWindow getRootContainer(java.awt.Component c)
Traverses the container hierarchy to locate the root container and returns corresponding RootSwingContainer. If c is null, a null reference is returned.

Parameters:
c - the container whose root we wish to find
Returns:
the enclosing RootSwingcontainer

isValidRootContainer

public static boolean isValidRootContainer(java.awt.Component c)
Indicates whether the supplied Component is, in fact, a root Swing container.

Parameters:
c - the Component we wish to check

getVisibleWindows

public static RootWindow[] getVisibleWindows()

getContentPane

public java.awt.Container getContentPane()
Returns the contentPane object for the wrapped component.

Returns:
the contentPane property

getGlassPane

public java.awt.Component getGlassPane()
Returns the glassPane object for the wrapped component.

Returns:
the glassPane property

getLayeredPane

public javax.swing.JLayeredPane getLayeredPane()
Returns the layeredPane object for the wrapped component.

Returns:
the layeredPane property

getLocationOnScreen

public java.awt.Point getLocationOnScreen()
Gets the location of the wrapped component in the form of a point specifying the component's top-left corner in the screen's coordinate space.

Returns:
An instance of Point representing the top-left corner of the component's bounds in the coordinate space of the screen.

getMaximizationLayer

public java.lang.Integer getMaximizationLayer()
Deprecated. dead code last used in 0.2.0

Returns the layer associated with Component maximization.

Returns:
an Integer indicating the maximization layer property

getMaximizedLayout

public java.awt.LayoutManager getMaximizedLayout()
Deprecated. dead code last used in 0.2.0

Returns the LayoutManager associated with Component maximization within the RootSwingContainer.

Returns:
a LayoutManager indicating the maximization layout property

getRootContainer

public java.awt.Component getRootContainer()
Returns the the wrapped component. (JFrame, JApplet, etc...)

Returns:
the wrapped root container

getRootPane

public javax.swing.JRootPane getRootPane()
Returns the rootPane object for the wrapped component.

Returns:
the rootPane property

revalidateContentPane

public void revalidateContentPane()
Convenience method that calls revalidate() on the current content pane if it is a JComponent. If not, no action is taken.


setContentPane

public void setContentPane(java.awt.Container contentPane)
Sets the contentPane property for the wrapped component.

Parameters:
contentPane - the contentPane object for the wrapped component

setGlassPane

public void setGlassPane(java.awt.Component glassPane)
Sets the glassPane property for the wrapped component.

Parameters:
glassPane - the glassPane object for the wrapped component

setLayeredPane

public void setLayeredPane(javax.swing.JLayeredPane layeredPane)
Sets the layeredPane property for the wrapped component.

Parameters:
layeredPane - the layeredPane object for the wrapped component

getOwnedWindows

public java.awt.Window[] getOwnedWindows()
Return an array containing all the windows this window currently owns.

Returns:
all the windows currently owned by this root window.

setMaximizationLayer

public void setMaximizationLayer(java.lang.Integer layer)
Deprecated. dead code last used in 0.2.0

Sets the layer associated with Component maximization within the RootSwingContainer. If layer is null, DEFAULT_MAXED_LAYER is used instead.

Parameters:
layer - an Integer indicating the maximization layer property

setMaximizedLayout

public void setMaximizedLayout(java.awt.LayoutManager mgr)
Deprecated. dead code last used in 0.2.0

Sets the LayoutManager associated with Component maximization within the RootSwingContainer.

Parameters:
mgr - the LayoutManager associated with Component maximization within the RootSwingContainer.

setRootContainer

protected void setRootContainer(java.awt.Component root)
Sets the wrapped root container.

Parameters:
root - the new wrapped root container

updateComponentTreeUI

public void updateComponentTreeUI()

pack

public void pack()

toFront

public void toFront()

isActive

public boolean isActive()

getOwner

public java.awt.Window getOwner()

getBounds

public java.awt.Rectangle getBounds()

putClientProperty

public void putClientProperty(java.lang.Object key,
                              java.lang.Object value)

getClientProperty

public java.lang.Object getClientProperty(java.lang.Object key)