bibliothek.gui.dock.station.screen
Interface ScreenDockWindow

All Known Implementing Classes:
AbstractScreenDockWindow, DisplayerScreenDockWindow, InternalDockDialog, ScreenDockDialog, ScreenDockFrame

public interface ScreenDockWindow

A ScreenDockWindow is used by a ScreenDockStation to show a Dockable on the screen. Subclasses are free to show the Dockable in any way they like, however subclasses are encouraged to use a StationChildHandle to manage displayers and title.
New implementations of ScreenDockWindow may require the implementation of a ScreenDockFullscreenStrategy as well.
ScreenDockWindows offering users a way to modify the size or location should call ScreenDockStation.getMagnetController() to gain access to the MagnetController. This controller can be used to calculate magnetic attraction between two ScreenDockWindows.

Author:
Benjamin Sigg

Method Summary
 void addScreenDockWindowListener(ScreenDockWindowListener listener)
          Adds a listener to this window, the listener has to be informed about changes of this window.
 void checkWindowBounds()
          Ensures the correctness of the boundaries of this window.
 boolean contains(int x, int y)
          Tells whether the point x/y is over this window or not.
 void destroy()
          Informs this window that it is no longer used by the station and will never be used again.
 Dockable getDockable()
          Gets the Dockable which is currently shown in this window.
 DockableDisplayer getDockableDisplayer()
          Gets the DockableDisplayer which manages the dockable.
 Insets getDockableInsets()
          Gets the distances between the edges of the window and the edges of the Dockable.
 Dimension getMinimumWindowSize()
          Gets the minimum size this window should have.
 Rectangle getNormalBounds()
          Gets the boundaries this window should use if not in fullscreen mode.
 Point getOffsetDrop()
          Gets an offset that will be added to the location when dropping a window.
A value of null indicates that no such offset is available.
 Point getOffsetMove()
          Gets an offset that will be subtracted from the location when moving the window around.
 ScreenDockStation getStation()
          Gets the station which owns this window.
 Point getTitleCenter()
          Gets the center of the title of this window.
 Rectangle getWindowBounds()
          Gets the boundaries of the window.
 boolean inCombineArea(int x, int y)
          Checks what would happen if a Dockable is dropped at point x/y.
 boolean inTitleArea(int x, int y)
          Checks whether at x/y there is a title.
 boolean isFullscreen()
          Tells whether this window is in fullscreen mode or not.
 boolean isVisible()
          Tells whether this window is visible or not.
 void removeScreenDockWindowListener(ScreenDockWindowListener listener)
          Removes a listener from this window.
 void setController(DockController controller)
          Sets the controller in whose realm this window will be used.
 void setDockable(Dockable dockable)
          Sets the Dockable which should be shown on this window.
 void setFullscreen(boolean fullscreen)
          Changes the mode of this window to fullscreen or to normal.
 void setFullscreenStrategy(ScreenDockFullscreenStrategy strategy)
          Tells this window what strategy to use for handling fullscreen mode.
 void setNormalBounds(Rectangle bounds)
          Sets the boundaries this window should use if not in fullscreen mode.
 void setPaintCombining(CombinerTarget target)
          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.
 void setPaintRemoval(boolean removal)
          Informs this window that a drag and drop operation is in progress, and that the child of this window may be removed in the near future.
 void setPreventFocusStealing(boolean prevent)
          Tells this window that it should try not to steal the focus if possible.
 void setVisible(boolean visible)
          Changes the visibility state of this window.
 void setWindowBounds(Rectangle bounds, boolean screenCoordinates)
          Sets the bounds the window is supposed to have.
 void toFront()
          Called when this window should become the focus owner and be shown at the most prominent location.
 void validate()
          Forces this window to update the boundaries of its children.
 

Method Detail

addScreenDockWindowListener

void addScreenDockWindowListener(ScreenDockWindowListener listener)
Adds a listener to this window, the listener has to be informed about changes of this window.

Parameters:
listener - the new listener

removeScreenDockWindowListener

void removeScreenDockWindowListener(ScreenDockWindowListener listener)
Removes a listener from this window.

Parameters:
listener - the listener to remove

setController

void setController(DockController controller)
Sets the controller in whose realm this window will be used. This method will be called after the controller of the owning ScreenDockStation was set, so AbstractDockStation.getController() will always return the same value as controller. This also implies that any method of the station called from this method already uses the new controller.

Parameters:
controller - the new controller, can be null

getStation

ScreenDockStation getStation()
Gets the station which owns this window.

Returns:
the owner, not null

setDockable

void setDockable(Dockable dockable)
Sets the Dockable which should be shown on this window.

Parameters:
dockable - the new element, can be null to remove an old Dockable

getDockable

Dockable getDockable()
Gets the Dockable which is currently shown in this window.

Returns:
the current element, can be null
See Also:
setDockable(Dockable)

getDockableDisplayer

DockableDisplayer getDockableDisplayer()
Gets the DockableDisplayer which manages the dockable.

Returns:
the displayer or null

getTitleCenter

Point getTitleCenter()
Gets the center of the title of this window. In general the center of the title should remain visible all the time.

Returns:
the center, can be null

toFront

void toFront()
Called when this window should become the focus owner and be shown at the most prominent location.


setFullscreenStrategy

void setFullscreenStrategy(ScreenDockFullscreenStrategy strategy)
Tells this window what strategy to use for handling fullscreen mode.

Parameters:
strategy - the strategy

setFullscreen

void setFullscreen(boolean fullscreen)
Changes the mode of this window to fullscreen or to normal. This method should call ScreenDockFullscreenStrategy.setFullscreen(ScreenDockWindow, boolean), subclasses may execute additional code.

Parameters:
fullscreen - the new state

isFullscreen

boolean isFullscreen()
Tells whether this window is in fullscreen mode or not. This method should call ScreenDockFullscreenStrategy.isFullscreen(ScreenDockWindow), subclasses may execute additional checks.

Returns:
true if fullscreen mode is active

setVisible

void setVisible(boolean visible)
Changes the visibility state of this window.

Parameters:
visible - the new state

isVisible

boolean isVisible()
Tells whether this window is visible or not.

Returns:
the visibility state

setPreventFocusStealing

void setPreventFocusStealing(boolean prevent)
Tells this window that it should try not to steal the focus if possible.

Parameters:
prevent - whether to attempt to prevent focus stealing

destroy

void destroy()
Informs this window that it is no longer used by the station and will never be used again.


setPaintCombining

void setPaintCombining(CombinerTarget target)
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:
target - if null then nothing should be painted, otherwise the method CombinerTarget.paint(java.awt.Graphics, java.awt.Component, bibliothek.gui.dock.station.StationPaint, Rectangle, Rectangle) should be called

setPaintRemoval

void setPaintRemoval(boolean removal)
Informs this window that a drag and drop operation is in progress, and that the child of this window may be removed in the near future.

Parameters:
removal - whether the operation is in progress

getWindowBounds

Rectangle getWindowBounds()
Gets the boundaries of the window.

Returns:
the boundaries

setWindowBounds

void setWindowBounds(Rectangle bounds,
                     boolean screenCoordinates)
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
screenCoordinates - whether the location is relative to the real screen (true) or relative to the coordinate of this window (false).

setNormalBounds

void setNormalBounds(Rectangle bounds)
Sets the boundaries this window should use if not in fullscreen mode. This boundaries need to be stored but must not be applied. This property is intended to be used by a ScreenDockFullscreenStrategy and is usually set to null if this window is not in fullscreen mode.

Parameters:
bounds - the normal bounds, can be null

getNormalBounds

Rectangle getNormalBounds()
Gets the boundaries this window should use if not in fullscreen mode.

Returns:
the boundaries, can be null

getMinimumWindowSize

Dimension getMinimumWindowSize()
Gets the minimum size this window should have. Usually these boundaries are used by a BoundaryRestriction, but there are no guarantees that the window is not made smaller than this size.

Returns:
the minimum size

checkWindowBounds

void checkWindowBounds()
Ensures the correctness of the boundaries of this window. This method should use ScreenDockStation.getBoundaryRestriction() to do so.


validate

void validate()
Forces this window to update the boundaries of its children.


getDockableInsets

Insets getDockableInsets()
Gets the distances between the edges of the window and the edges of the Dockable. This is only an estimate and does not have to be correct. Implementations using DockableDisplayer should call DockableDisplayer.getDockableInsets() as well.

Returns:
the insets, not null

getOffsetMove

Point getOffsetMove()
Gets an offset that will be subtracted from the location when moving the window around. The offset should be equal to the point 0/0 on the DockTitle of the Dockable shown in this window. The value null can be returned to indicate that such an offset is not available.

Returns:
the offset or null

getOffsetDrop

Point getOffsetDrop()
Gets an offset that will be added to the location when dropping a window.
A value of null indicates that no such offset is available.

Returns:
the offset or null

inCombineArea

boolean inCombineArea(int x,
                      int y)
Checks what would happen if a Dockable is dropped at point x/y.

Parameters:
x - an x coordinate in the screen
y - an y coordinate in the screen
Returns:
true if dropping a Dockable at x/y should lead to a combination of the dropped element and the element in this window, false otherwise

inTitleArea

boolean inTitleArea(int x,
                    int y)
Checks whether at x/y there is a title.

Parameters:
x - an x coordinate in the screen
y - an y coordinate in the screen
Returns:
true if there is a title, false otherwise

contains

boolean contains(int x,
                 int y)
Tells whether the point x/y is over this window or not.

Parameters:
x - an x coordinate in the screen
y - an y coordinate in the screen
Returns:
true if this window is under x/y, false otherwise