bibliothek.gui.dock.station.screen
Class MediumBoundaryRestriction

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

public class MediumBoundaryRestriction
extends java.lang.Object
implements BoundaryRestriction

A restriction that ensures that the title of each dialog is always visible.

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from interface bibliothek.gui.dock.station.screen.BoundaryRestriction
FREE, HARD, MEDIUM
 
Constructor Summary
MediumBoundaryRestriction()
           
 
Method Summary
 java.awt.Rectangle check(ScreenDockWindow window)
          Calculates the bounds which window can have.
 java.awt.Rectangle check(ScreenDockWindow window, java.awt.Rectangle target)
          Calculates the bounds which window can have.
protected  java.awt.Rectangle findDevice(int x, int y)
          Finds and returns the boundaries of the screen in which x/y are.
protected  java.awt.Rectangle validate(java.awt.Rectangle target, java.awt.Point center, java.awt.Point search)
          Ensures that center will be in a visible part of the screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MediumBoundaryRestriction

public MediumBoundaryRestriction()
Method Detail

check

public java.awt.Rectangle check(ScreenDockWindow window)
Description copied from interface: BoundaryRestriction
Calculates the bounds which window can have.

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

check

public java.awt.Rectangle check(ScreenDockWindow window,
                                java.awt.Rectangle target)
Description copied from interface: BoundaryRestriction
Calculates the bounds which window can have.

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

validate

protected java.awt.Rectangle validate(java.awt.Rectangle target,
                                      java.awt.Point center,
                                      java.awt.Point search)
Ensures that center will be in a visible part of the screen.

Parameters:
target - the next boundaries for a window
center - the point that should remain visible
search - the point used to find the best matching screen device
Returns:
a set of boundaries that is as close to target as possible

findDevice

protected java.awt.Rectangle findDevice(int x,
                                        int y)
Finds and returns the boundaries of the screen in which x/y are.

Parameters:
x - some x coordinate
y - some y coordinate
Returns:
the boundaries of the nearest screen containing x/y or null