|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.flexdock.docking.defaults.DefaultRegionChecker
public class DefaultRegionChecker
| Field Summary |
|---|
| Fields inherited from interface org.flexdock.docking.RegionChecker |
|---|
DEFAULT_REGION_SIZE, DEFAULT_SIBLING_SIZE, DEFAULT_SIBLING_SIZE_KEY, MAX_REGION_SIZE, MAX_SIBILNG_SIZE, MIN_REGION_SIZE, MIN_SIBILNG_SIZE |
| Fields inherited from interface org.flexdock.docking.DockingConstants |
|---|
ACTIVE_WINDOW, BOTTOM, CENTER, CENTER_REGION, CLOSE_ACTION, DEFAULT_PERSISTENCE_KEY, DOCKING_ID, EAST_REGION, HEAVYWEIGHT_DOCKABLES, HORIZONTAL, LEFT, MOUSE_PRESSED, NORTH_REGION, PERMANENT_FOCUS_OWNER, PIN_ACTION, REGION, RIGHT, SOUTH_REGION, TOP, UNINITIALIZED, UNINITIALIZED_RATIO, UNKNOWN_REGION, UNSPECIFIED_SIBLING_PREF, VERTICAL, WEST_REGION |
| Constructor Summary | |
|---|---|
DefaultRegionChecker()
|
|
| Method Summary | |
|---|---|
protected Rectangle |
calculateRegionalBounds(Component c,
String region,
float size)
|
protected static float |
checkBounds(float val,
float max,
float min)
|
protected static float |
getDockingInset(Float value,
float defaultVal,
float max,
float min)
|
Rectangle |
getEastRegion(Component c)
Returns the rectangular bounds within the specified component that represent it's DockingConstants.EAST_REGION. |
Rectangle |
getNorthRegion(Component c)
Returns the rectangular bounds within the specified component that represent it's DockingConstants.NORTH_REGION. |
String |
getRegion(Component comp,
Point point)
Returns the docking region of the supplied Component that
contains the coordinates of the specified Point. |
Rectangle |
getRegionBounds(Component c,
String region)
Returns the bounding Rectangle within the specified component
that represents the specified region. |
static float |
getRegionPreference(Dockable d,
String region)
Returns a percentage (0.0F through 1.0F) representing the amount of space allotted for the specified region within the specified Dockable. |
float |
getRegionSize(Component c,
String region)
Returns a percentage (0.0F through 1.0F) representing the amount of space allotted for the specified region within the specified Component. |
Rectangle |
getSiblingBounds(Component c,
String region)
Returns the bounding Rectangle within the specified component
that represents the desired area to be allotted for sibling
Components in the specified region. |
static float |
getSiblingPreference(Dockable d,
String region)
Returns a percentage (0.0F through 1.0F) representing the amount of space allotted for sibling Components docked to the specified region
within the specified Dockable. |
float |
getSiblingSize(Component c,
String region)
Returns a percentage (0.0F through 1.0F) representing the amount of space allotted for sibling Component docked to the specified region
within the specified Component. |
Rectangle |
getSouthRegion(Component c)
Returns the rectangular bounds within the specified component that represent it's DockingConstants.SOUTH_REGION. |
Rectangle |
getWestRegion(Component c)
Returns the rectangular bounds within the specified component that represent it's DockingConstants.WEST_REGION. |
static float |
validateRegionSize(float size)
Returns size if it is between the values
RegionChecker.MIN_REGION_SIZE and
RegionChecker.MAX_REGION_SIZE. |
static float |
validateSiblingSize(float size)
Returns size if it is between the values
RegionChecker.MIN_SIBILNG_SIZE and
RegionChecker.MAX_SIBILNG_SIZE. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultRegionChecker()
| Method Detail |
|---|
public String getRegion(Component comp,
Point point)
Component that
contains the coordinates of the specified Point. If either
comp or point is null, then
UNKNOWN_REGION is returned. If the specified Component
bounds do not contain the supplied Point, then
UNKNOWN_REGION is returned.
This implementation assumes that comp is a Component
embedded within a DockingPort. If comp is itself a
DockingPort, then CENTER_REGION is returned. Otherwise,
the returned region is based upon a section of the bounds of the
specified Component relative to the containing
DockingPort.
This method divides the specified Component's bounds into four
Rectangles determined by getNorthRegion(Component c),
getSouthRegion(Component c), getEastRegion(Component c),
and getWestRegion(Component c), respectively. Each
Rectangle is then checked to see if it contains the specified
Point. The order of precedence is NORTH, SOUTH, EAST, and then
WEST. If the specified Point is contained by the
Component bounds but none of the sub-Rectangles, then
CENTER_REGION is returned.
For NORTH and SOUTH Rectangles, the distance is checked between
the top/bottom and left or right edge of the regional bounds. If the
horizontal distance to the regional edge is smaller than the vertical
distance, then EAST or WEST takes precendence of NORTH or SOUTH. This
allows for proper determination between "northeast", "northwest",
"southeast", and "southwest" cases.
getRegion in interface RegionCheckercomp - the Component whose region is to be examined.point - the coordinates whose region is to be determined.
Point.RegionChecker.getRegion(Component, Point),
getNorthRegion(Component),
getSouthRegion(Component),
getEastRegion(Component),
getWestRegion(Component)public Rectangle getNorthRegion(Component c)
DockingConstants.NORTH_REGION. This method
dispatches to getRegionBounds(Component c, String region),
passing an argument of DockingConstants.NORTH_REGION for the
region parameter. If the specified Component is null,
then a null reference is returned.
getNorthRegion in interface RegionCheckerc - the Component whose north region is to be returned.
Component.RegionChecker.getNorthRegion(Component),
getRegionBounds(Component, String)public Rectangle getSouthRegion(Component c)
DockingConstants.SOUTH_REGION. This method
dispatches to getRegionBounds(Component c, String region),
passing an argument of DockingConstants.SOUTH_REGION for the
region parameter. If the specified Component is null,
then a null reference is returned.
getSouthRegion in interface RegionCheckerc - the Component whose south region is to be returned.
Component.RegionChecker.getSouthRegion(Component),
getRegionBounds(Component, String)public Rectangle getEastRegion(Component c)
DockingConstants.EAST_REGION. This method
dispatches to getRegionBounds(Component c, String region),
passing an argument of DockingConstants.EAST_REGION for the
region parameter. If the specified Component is null,
then a null reference is returned.
getEastRegion in interface RegionCheckerc - the Component whose east region is to be returned.
Component.RegionChecker.getEastRegion(Component),
getRegionBounds(Component, String)public Rectangle getWestRegion(Component c)
DockingConstants.WEST_REGION. This method
dispatches to getRegionBounds(Component c, String region),
passing an argument of DockingConstants.WEST_REGION for the
region parameter. If the specified Component is null,
then a null reference is returned.
getWestRegion in interface RegionCheckerc - the Component whose west region is to be returned.
Component.RegionChecker.getWestRegion(Component),
getRegionBounds(Component, String)
public Rectangle getRegionBounds(Component c,
String region)
Rectangle within the specified component
that represents the specified region. If c or region are
null, then this method returns a null reference.
This method dispatches to
getRegionSize(Component c, String region) to determine the
proportional size of the specified Component dedicated to the
specified region. It then multiplies this value by the relevant
Component dimension (width for east/west,
height for north/south) and returns a Rectangle with
the resulting dimension, spanning the Component edge for the
specified region.
getRegionBounds in interface RegionCheckerc - the Component whose region bounds are to be returned.region - the specified region that is to be examined.
Component.RegionChecker.getRegionBounds(Component, String),
getRegionSize(Component, String)
public Rectangle getSiblingBounds(Component c,
String region)
Rectangle within the specified component
that represents the desired area to be allotted for sibling
Components in the specified region. If c or
region are null, then this method returns a null
reference.
This method dispatches to
getSiblingSize(Component c, String region) to determine the
proportional size of the specified Component dedicated to
siblings in the specified region. It then multiplies this value by the
relevant Component dimension (width for east/west,
height for north/south) and returns a Rectangle with
the resulting dimension, spanning the Component edge for the
specified region.
getSiblingBounds in interface RegionCheckerc - the Component whose sibling bounds are to be returned.region - the specified region that is to be examined.
Component.RegionChecker.getSiblingBounds(Component, String),
getSiblingSize(Component, String)
protected Rectangle calculateRegionalBounds(Component c,
String region,
float size)
public float getRegionSize(Component c,
String region)
Component.
This method resolves the Dockable associated with the specified
Component and dispatches to
getRegionPreference(Dockable d, String region).
getRegionPreference(Dockable d, String region) attempts to invoke
getDockingProperties() on the Dockable to resolve a
DockablePropertySet instance and return from its
getRegionInset(String region) method.
If the specified Component is null, no Dockable
can be resolved, or no value is specified in the Dockable's
associated DockingProps instance, then the default value of
RegionChecker.DEFAULT_REGION_SIZE is returned.
getRegionSize in interface RegionCheckerc - the Component whose region is to be examined.region - the specified region that is to be examined.
Component allotted for
the specified region.RegionChecker.getRegionSize(Component, String),
DockingManager.getDockable(Component),
getRegionPreference(Dockable, String),
Dockable.getDockingProperties()
public float getSiblingSize(Component c,
String region)
Component docked to the specified region
within the specified Component.
This method resolves the Dockable associated with the specified
Component and dispatches to
getSiblingPreference(Dockable d, String region).
getSiblingPreference(Dockable d, String region) attempts to
invoke getDockingProperties() on the Dockable to resolve
a DockablePropertySet instance and return from its
getSiblingSize(String region) method.
If the specified Component is null, no Dockable
can be resolved, or no value is specified in the Dockable's
associated DockingProps instance, then the default value of
RegionChecker.DEFAULT_SIBLING_SIZE is returned.
getSiblingSize in interface RegionCheckerc - the Component whose sibling size is to be examined.region - the specified region that is to be examined.
Component allotted for
the siblings within the specified region.DockingManager.getDockable(Component),
getSiblingPreference(Dockable, String),
Dockable.getDockingProperties()
protected static float getDockingInset(Float value,
float defaultVal,
float max,
float min)
protected static float checkBounds(float val,
float max,
float min)
public static float validateRegionSize(float size)
size if it is between the values
RegionChecker.MIN_REGION_SIZE and
RegionChecker.MAX_REGION_SIZE. If size is less than
RegionChecker.MIN_REGION_SIZE, then
RegionChecker.MIN_REGION_SIZE is returned. If size is
greater than RegionChecker.MAX_REGION_SIZE, then
RegionChecker.MAX_REGION_SIZE is returned.
size value between
RegionChecker.MIN_REGION_SIZE and
RegionChecker.MAX_REGION_SIZE, inclusive.public static float validateSiblingSize(float size)
size if it is between the values
RegionChecker.MIN_SIBILNG_SIZE and
RegionChecker.MAX_SIBILNG_SIZE. If size is less than
RegionChecker.MIN_SIBILNG_SIZE, then
RegionChecker.MIN_SIBILNG_SIZE is returned. If size is
greater than RegionChecker.MAX_SIBILNG_SIZE, then
RegionChecker.MAX_SIBILNG_SIZE is returned.
size value between
RegionChecker.MIN_SIBILNG_SIZE and
RegionChecker.MAX_SIBILNG_SIZE, inclusive.
public static float getRegionPreference(Dockable d,
String region)
Dockable.
This method calls getDockingProperties() on the Dockable
to resolve a DockablePropertySet instance. It then invokes
getRegionInset(String region) on the DockablePropertySet
to retrieve the preferred region size. If the Dockable is
null or no region preference can be found, then the default value
of RegionChecker.DEFAULT_REGION_SIZE is returned. Otherwise, the
retrieved region preference is passed through
validateRegionSize(float size) and returned.
d - the Dockable whose region is to be checkedregion - the region of the specified Dockable to be checked
Dockable.Dockable.getDockingProperties(),
RegionChecker.DEFAULT_REGION_SIZE,
validateRegionSize(float)
public static float getSiblingPreference(Dockable d,
String region)
Components docked to the specified region
within the specified Dockable.
This method calls getDockingProperties() on the Dockable
to resolve a DockablePropertySet instance. It then invokes
getSiblingSize(String region) on the DockablePropertySet
to retrieve the preferred sibling size. If the Dockable is
null or no sibling preference can be found, then the default
value of RegionChecker.DEFAULT_SIBLING_SIZE is returned.
Otherwise, the retrieved region preference is passed through
validateSiblingSize(float size) and returned.
d - the Dockable whose sibling size is to be checkedregion - the region of the specified Dockable to be checked
Components docked to the specified
region within the specified Dockable.Dockable.getDockingProperties(),
RegionChecker.DEFAULT_SIBLING_SIZE,
validateSiblingSize(float)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||