net.infonode.docking

Class RootWindow

public class RootWindow extends DockingWindow implements ReadWritable

The root window is a top level container for docking windows. Docking windows can't be dragged outside of their root window. The property values of a root window is inherited to the docking windows inside it.

Version: $Revision: 1.127 $

Author: $Author: jesper $

Constructor Summary
RootWindow(ViewSerializer viewSerializer)
Creates an empty root window.
RootWindow(boolean heavyweightSupport, ViewSerializer viewSerializer)
Creates an empty root window with support for heavyweight components inside the views.
RootWindow(ViewSerializer viewSerializer, DockingWindow window)
Creates a root window with the given window as window inside this root window.
RootWindow(boolean heavyweightSupport, ViewSerializer viewSerializer, DockingWindow window)
Creates a root window with support for heavyweight components inside the views and the given window inside as window inside this root window.
Method Summary
protected DropActionacceptInteriorDrop(Point p, DockingWindow window)
protected booleanacceptsSplitWith(DockingWindow window)
protected voidcleanUpModel()
FloatingWindowcreateFloatingWindow(Point location, Dimension innerSize, DockingWindow window)

Creates and shows a floating window with the given window as top-level window in the floating window or without any top-level window i.e. empty floating window.

protected PropertyMapcreatePropertyObject()
protected DropActiondoAcceptDrop(Point p, DockingWindow window)
protected voiddoRemoveWindow(DockingWindow window)
protected voiddoReplace(DockingWindow oldWindow, DockingWindow newWindow)
DockingWindowgetChildWindow(int index)
intgetChildWindowCount()
DirectiongetClosestWindowBar(DockingWindow window)
Returns the direction of the closest enabled window bar to a docking window.
ViewgetFocusedView()
Returns the view that currently contains the focus.
IcongetIcon()
DockingWindowgetMaximizedWindow()
Returns the maximized window in this root window, or null if there no maximized window.
protected PropertyMapgetPropertyObject()
RootWindowgetRootWindow()
RootWindowPropertiesgetRootWindowProperties()
Returns the property values for this root window.
ViewSerializergetViewSerializer()
Returns the view serializer object for the views inside this root window.
DockingWindowgetWindow()
Returns the top level docking window inside this root window.
WindowBargetWindowBar(Direction direction)
Returns the window bar in the direction.
protected booleanisShowingInRootWindow()
protected voidpaintComponent(Graphics g)
voidread(ObjectInputStream in)
Reads a previously written window state.
voidread(ObjectInputStream in, boolean readProperties)
Reads a previously written window state.
voidremoveView(View view)
Removes all internal references to a view.
voidsetMaximizedWindow(DockingWindow window)
Sets the maximized window in this root window.
voidsetWindow(DockingWindow newWindow)
Sets the top level docking window inside this root window.
protected voidshowChildWindow(DockingWindow window)
protected voidupdate()
voidupdateUI()
voidwrite(ObjectOutputStream out)
Writes the state of this root window and all child windows.
voidwrite(ObjectOutputStream out, boolean writeProperties)
Writes the state of this root window and all child windows.

Constructor Detail

RootWindow

public RootWindow(ViewSerializer viewSerializer)
Creates an empty root window.

Parameters: viewSerializer used when reading and writing views

Since: IDW 1.1.0

RootWindow

public RootWindow(boolean heavyweightSupport, ViewSerializer viewSerializer)
Creates an empty root window with support for heavyweight components inside the views.

Parameters: heavyweightSupport true for heavy weight component support, otherwise false viewSerializer used when reading and writing views

Since: IDW 1.4.0

RootWindow

public RootWindow(ViewSerializer viewSerializer, DockingWindow window)
Creates a root window with the given window as window inside this root window.

Parameters: viewSerializer used when reading and writing views window the window that is placed inside the root window

RootWindow

public RootWindow(boolean heavyweightSupport, ViewSerializer viewSerializer, DockingWindow window)
Creates a root window with support for heavyweight components inside the views and the given window inside as window inside this root window.

Parameters: heavyweightSupport true for heavy weight component support, otherwise false viewSerializer used when reading and writing views window the window that is placed inside the root window

Since: IDW 1.4.0

Method Detail

acceptInteriorDrop

protected DropAction acceptInteriorDrop(Point p, DockingWindow window)

acceptsSplitWith

protected boolean acceptsSplitWith(DockingWindow window)

cleanUpModel

protected void cleanUpModel()

createFloatingWindow

public FloatingWindow createFloatingWindow(Point location, Dimension innerSize, DockingWindow window)

Creates and shows a floating window with the given window as top-level window in the floating window or without any top-level window i.e. empty floating window.

Note 1: The created floating window is not visible per default. To make it visible, call {@link FloatingWindow}.getTopLevelAncestor().setVisible(true);

Note 2: Floating windows are dynamically created when a window is undocked and closed/removed when all windows inside the floating window has been removed (i.e. cloased/docked/undocked to another floating window) from the floating window. The root window has a refernce to the floating window as long as the floating window has windows inside it i.e. it is not necessary to keep references to the floating window because the root window will handle this.

Parameters: location the floating window's location on the screen innerSize the inner dimension of the floating window's top level container i.e.the size of the root pane window the docking window that is the top level window in this floating window or null for no top-level window i.e. empty floating window

Returns: the floating window

Since: IDW 1.4.0

createPropertyObject

protected PropertyMap createPropertyObject()

doAcceptDrop

protected DropAction doAcceptDrop(Point p, DockingWindow window)

doRemoveWindow

protected void doRemoveWindow(DockingWindow window)

doReplace

protected void doReplace(DockingWindow oldWindow, DockingWindow newWindow)

getChildWindow

public DockingWindow getChildWindow(int index)

getChildWindowCount

public int getChildWindowCount()

getClosestWindowBar

public Direction getClosestWindowBar(DockingWindow window)
Returns the direction of the closest enabled window bar to a docking window. The distance is measured from the window edge that is furthest away from the bar.

Parameters: window the docking window

Returns: the direction of the closest enabled window bar to a docking window

getFocusedView

public View getFocusedView()
Returns the view that currently contains the focus.

Returns: The currently focused view, null if no view has focus

getIcon

public Icon getIcon()

getMaximizedWindow

public DockingWindow getMaximizedWindow()
Returns the maximized window in this root window, or null if there no maximized window.

Returns: the maximized window in this root window, or null if there no maximized window

Since: IDW 1.1.0

getPropertyObject

protected PropertyMap getPropertyObject()

getRootWindow

public RootWindow getRootWindow()

getRootWindowProperties

public RootWindowProperties getRootWindowProperties()
Returns the property values for this root window. The property values will be inherited to docking windows inside this root window.

Returns: the property values for this root window

getViewSerializer

public ViewSerializer getViewSerializer()
Returns the view serializer object for the views inside this root window.

Returns: the view serializer object for the views inside this root window

getWindow

public DockingWindow getWindow()
Returns the top level docking window inside this root window.

Returns: the top level docking window inside this root window

getWindowBar

public WindowBar getWindowBar(Direction direction)
Returns the window bar in the direction.

Parameters: direction the direction

Returns: the window bar in the direction

isShowingInRootWindow

protected boolean isShowingInRootWindow()

paintComponent

protected void paintComponent(Graphics g)

read

public void read(ObjectInputStream in)
Reads a previously written window state. This will create child windows and read their state.

Parameters: in the stream from which to read the state

Throws: IOException if there is a stream error

read

public void read(ObjectInputStream in, boolean readProperties)
Reads a previously written window state. This will create child windows and read their state.

Parameters: in the stream from which to read the state readProperties true if the property values for all child windows should be read. This parameter can be set to true or false regardless of if the property values was included when the state was written, though obviously no property values are read if there aren't any in the stream.

Throws: IOException if there is a stream error

removeView

public void removeView(View view)
Removes all internal references to a view. It's not possible to restore the view to the previous location after this method has been called. If the view is located in the window tree where this is the root nothing happens.

Parameters: view all internal references to this view are removed

Since: IDW 1.4.0

setMaximizedWindow

public void setMaximizedWindow(DockingWindow window)
Sets the maximized window in this root window. This method takes the window component and displays it at the top in the root window. It does NOT modify the window tree structure, ie the window parent remains the unchanged.

Parameters: window the maximized window in this root window, null means no maximized window

Since: IDW 1.1.0

setWindow

public void setWindow(DockingWindow newWindow)
Sets the top level docking window inside this root window.

Parameters: newWindow the top level docking window

showChildWindow

protected void showChildWindow(DockingWindow window)

update

protected void update()

updateUI

public void updateUI()

write

public void write(ObjectOutputStream out)
Writes the state of this root window and all child windows.

Parameters: out the stream on which to write the state

Throws: IOException if there is a stream error

write

public void write(ObjectOutputStream out, boolean writeProperties)
Writes the state of this root window and all child windows.

Parameters: out the stream on which to write the state writeProperties true if the property values for all docking windows should be written to the stream

Throws: IOException if there is a stream error