bibliothek.gui.dock.station.screen
Class AbstractScreenDockWindow

java.lang.Object
  extended by bibliothek.gui.dock.station.screen.DisplayerScreenDockWindow
      extended by bibliothek.gui.dock.station.screen.AbstractScreenDockWindow
All Implemented Interfaces:
ScreenDockWindow
Direct Known Subclasses:
ScreenDockDialog, ScreenDockFrame, SecureAbstractScreenDockWindow

public abstract class AbstractScreenDockWindow
extends DisplayerScreenDockWindow

This abstract implementation of ScreenDockWindow uses a DockableDisplayer to show the Dockable. It can operate with any window. Clients need to call init(Component, Container, boolean) to put this object onto some Container.

Author:
Benjamin Sigg

Constructor Summary
protected AbstractScreenDockWindow(ScreenDockStation station)
          Creates a new window.
  AbstractScreenDockWindow(ScreenDockStation station, Component window, Container contentParent, boolean resizeable)
          Creates a new window.
 
Method Summary
 void checkWindowBounds()
          Ensures the correctness of the boundaries of this window.
protected  OverpaintablePanel createContent()
          Creates the component that will be used as content-pane.
 DockableDisplayer getDisplayer()
          Gets the displayer which is shown on this dialog.
protected  Container getDisplayerParent()
          Gets the container on which the displayer is shown.
 Insets getDockableInsets()
          Makes a guess how big the insets of the Dockable compared to the whole dialog are.
protected  Icon getTitleIcon()
          Gets the icon which should be used in the title.
protected  String getTitleText()
          Gets the text which should be used in the title.
 Rectangle getWindowBounds()
          Gets the boundaries of the window.
protected  Component getWindowComponent()
          Gets the component on which ScreenDockWindow.setWindowBounds(java.awt.Rectangle) is applied.
protected  void init(Component window, Container contentParent, boolean resizeable)
          Initializes this window.
 void invalidate()
          Invalidates the layout of this window.
 boolean isVisible()
          Tells whether this window is visible or not.
protected  void setCursor(Cursor cursor)
          Sets the current cursor of this window
 void setDockable(Dockable dockable)
          Sets the Dockable which should be shown on this window.
 void setPaintCombining(boolean paint)
          Sets whether this window should paint some additional markings which indicate that a Dockable is about to be dropped onto it.
 void setTitleIcon(Icon titleIcon)
          Explicitly sets the icon of the title.
 void setTitleText(String titleText)
          Explicitly sets the text of the title.
 void setVisible(boolean visible)
          Changes the visibility state of this window.
 void setWindowBounds(Rectangle bounds)
          Sets the bounds the window is supposed to have.
protected  void showDisplayer(DockableDisplayer displayer)
          Forces the subclass of this window to show displayer.
protected  void updateTitleIcon()
          Called when the icon of the title should be updated.
protected  void updateTitleText()
          Called when the text of the title should be updated.
 void validate()
          Forces this window to update the boundaries of its children.
 
Methods inherited from class bibliothek.gui.dock.station.screen.DisplayerScreenDockWindow
addScreenDockWindowListener, discardDisplayer, fireFullscreenChanged, fireShapeChanged, fireVisibilityChanged, getController, getDockable, getNormalBounds, getOffsetDrop, getOffsetMove, getStation, inCombineArea, isFullscreen, isShowTitle, listeners, removeScreenDockWindowListener, setController, setFullscreen, setFullscreenStrategy, setNormalBounds, setShowTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.station.screen.ScreenDockWindow
destroy, toFront
 

Constructor Detail

AbstractScreenDockWindow

protected AbstractScreenDockWindow(ScreenDockStation station)
Creates a new window. Subclasses must call init(Component, Container, boolean) when using this constructor.

Parameters:
station - the owner of this window

AbstractScreenDockWindow

public AbstractScreenDockWindow(ScreenDockStation station,
                                Component window,
                                Container contentParent,
                                boolean resizeable)
Creates a new window.

Parameters:
station - the owner of this window
window - the root component of this window
contentParent - the container onto which the contents of this window will be put
resizeable - whether this window should create its own resizing system or not
See Also:
init(Component, Container, boolean)
Method Detail

init

protected void init(Component window,
                    Container contentParent,
                    boolean resizeable)
Initializes this window.

Parameters:
window - the component which represents the window. This component will be used when calling methods like setWindowBounds(Rectangle). It is the root of this whole window.
contentParent - the container which will be used as parent for the contents of this window. This method will change the LayoutManager and add a child to contentParent. This component can be the same as window.
resizeable - If true, then a new border is installed for the displayer parent, and some MouseListeners are installed. When the mouse is over the border it will change the cursor and the user can resize or move the window. If false nothing happens and the resizing system has to be implemented by the subclass.

getWindowComponent

protected Component getWindowComponent()
Description copied from class: DisplayerScreenDockWindow
Gets the component on which ScreenDockWindow.setWindowBounds(java.awt.Rectangle) is applied.

Specified by:
getWindowComponent in class DisplayerScreenDockWindow
Returns:
the base component

setDockable

public void setDockable(Dockable dockable)
Description copied from interface: ScreenDockWindow
Sets the Dockable which should be shown on this window.

Specified by:
setDockable in interface ScreenDockWindow
Overrides:
setDockable in class DisplayerScreenDockWindow
Parameters:
dockable - the new element, can be null to remove an old Dockable

showDisplayer

protected void showDisplayer(DockableDisplayer displayer)
Description copied from class: DisplayerScreenDockWindow
Forces the subclass of this window to show displayer. Only one displayer should be shown at any time. A new displayer replaces an old one.

Specified by:
showDisplayer in class DisplayerScreenDockWindow
Parameters:
displayer - the displayer to show or null to remove the current displayer

setTitleIcon

public void setTitleIcon(Icon titleIcon)
Explicitly sets the icon of the title.

Parameters:
titleIcon - the new icon or null to use the Dockables icon.

getTitleIcon

protected Icon getTitleIcon()
Gets the icon which should be used in the title.

Returns:
the icon

updateTitleIcon

protected void updateTitleIcon()
Called when the icon of the title should be updated.

See Also:
getTitleIcon()

setTitleText

public void setTitleText(String titleText)
Explicitly sets the text of the title.

Parameters:
titleText - the new text or null to use the Dockables title text.

getTitleText

protected String getTitleText()
Gets the text which should be used in the title.

Returns:
the text, might be null

updateTitleText

protected void updateTitleText()
Called when the text of the title should be updated.

See Also:
getTitleText()

getWindowBounds

public Rectangle getWindowBounds()
Description copied from interface: ScreenDockWindow
Gets the boundaries of the window.

Returns:
the boundaries

setPaintCombining

public void setPaintCombining(boolean paint)
Description copied from interface: ScreenDockWindow
Sets whether this window should paint some additional markings which indicate that a Dockable is about to be dropped onto it.
Subclasses should use ScreenDockStation.getPaint() to get an algorithm that paints.

Parameters:
paint - true if something should be painted, false otherwise

setVisible

public void setVisible(boolean visible)
Description copied from interface: ScreenDockWindow
Changes the visibility state of this window.

Parameters:
visible - the new state

isVisible

public boolean isVisible()
Description copied from interface: ScreenDockWindow
Tells whether this window is visible or not.

Returns:
the visibility state

setWindowBounds

public void setWindowBounds(Rectangle bounds)
Description copied from interface: ScreenDockWindow
Sets the bounds the window is supposed to have. This method should use ScreenDockStation.getBoundaryRestriction() to check the validity of the new bounds.

Parameters:
bounds - the new location and size

checkWindowBounds

public void checkWindowBounds()
Description copied from interface: ScreenDockWindow
Ensures the correctness of the boundaries of this window. This method should use ScreenDockStation.getBoundaryRestriction() to do so.


invalidate

public void invalidate()
Invalidates the layout of this window.

See Also:
Component.invalidate()

validate

public void validate()
Description copied from interface: ScreenDockWindow
Forces this window to update the boundaries of its children.


setCursor

protected void setCursor(Cursor cursor)
Sets the current cursor of this window

Parameters:
cursor - the cursor
See Also:
Component.setCursor(Cursor)

getDockableInsets

public Insets getDockableInsets()
Makes a guess how big the insets of the Dockable compared to the whole dialog are.

Returns:
the insets, only a guess

createContent

protected OverpaintablePanel createContent()
Creates the component that will be used as content-pane. This method is invoked by the constructor.

Returns:
the new content pane

getDisplayerParent

protected Container getDisplayerParent()
Gets the container on which the displayer is shown.

Returns:
the parent of the displayer

getDisplayer

public DockableDisplayer getDisplayer()
Gets the displayer which is shown on this dialog.

Returns:
The displayer, may be null
See Also:
showDisplayer(DockableDisplayer)