bibliothek.gui.dock.station.screen
Class HardBoundaryRestriction

java.lang.Object
  extended by bibliothek.gui.dock.station.screen.HardBoundaryRestriction
All Implemented Interfaces:
BoundaryRestriction

public class HardBoundaryRestriction
extends Object
implements BoundaryRestriction

A restriction that ensures that each dialog is always visible, even when some screens can't be used because of that.

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from interface bibliothek.gui.dock.station.screen.BoundaryRestriction
FREE, HARD
 
Constructor Summary
HardBoundaryRestriction()
           
 
Method Summary
protected  Rectangle boundsInDevice(ScreenDockDialog dialog, int x, int y, int width, int height, GraphicsDevice device)
          Calculates size and location of dialog such that it is in device.
 Rectangle check(ScreenDockDialog dialog)
          Calculates the bounds which dialog can have.
 Rectangle check(ScreenDockDialog dialog, Rectangle target)
          Calculates the bounds which dialog can have.
protected  double measureBounds(ScreenDockDialog dialog, int x, int y, int width, int height, GraphicsDevice device)
          Checks how good dialog fits into the screen device
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HardBoundaryRestriction

public HardBoundaryRestriction()
Method Detail

check

public Rectangle check(ScreenDockDialog dialog)
Description copied from interface: BoundaryRestriction
Calculates the bounds which dialog can have.

Specified by:
check in interface BoundaryRestriction
Parameters:
dialog - the dialog whose bounds should be checked.
Returns:
the new boundaries of dialog, can be null to indicate that the current boundaries are valid.

check

public Rectangle check(ScreenDockDialog dialog,
                       Rectangle target)
Description copied from interface: BoundaryRestriction
Calculates the bounds which dialog can have.

Specified by:
check in interface BoundaryRestriction
Parameters:
dialog - the dialog whose future bounds should be checked.
target - the bounds dialog should have, this method should not write into target.
Returns:
the new boundaries, null to indicate that target is valid.

measureBounds

protected double measureBounds(ScreenDockDialog dialog,
                               int x,
                               int y,
                               int width,
                               int height,
                               GraphicsDevice device)
Checks how good dialog fits into the screen device

Parameters:
dialog - the dialog that is checked
x - the desired x-coordinate
y - the desired y-coordinate
width - the desired width
height - the desired height
device - the targeted screen
Returns:
a value between 0 and 1, where 0 means "does not fit" and 1 means "perfect".

boundsInDevice

protected Rectangle boundsInDevice(ScreenDockDialog dialog,
                                   int x,
                                   int y,
                                   int width,
                                   int height,
                                   GraphicsDevice device)
Calculates size and location of dialog such that it is in device.

Parameters:
dialog - the dialog to check
x - the desired x-coordinate
y - the desired y-coordinate
width - the desired width
height - the desired height
device - the screen in which to show this dialog
Returns:
the new bounds, can be null