Package org.flexdock.docking
Interface RegionChecker
-
- All Known Implementing Classes:
DefaultRegionChecker
public interface RegionCheckerThis interface provides an API for determining the desired regional bounds for aDockablecomponent. Implementing classes are responsible for determining the bounds and proportional sizes for both docking regions and sibling components. As aDockableis dragged across aDockingPortcontaining another embeddedDockable, a determination must be made as to where the draggedDockablewill be docked within the targetDockingPortbased upon the current mouse position relative to the embeddedDockableunderneath the mouse. Classes that implement this interface are responsible for making such determinations. For example, if aDockableis dragged over anotherDockableembedded within aDockingPort, and the current mouse position is near the top edge of the embeddedDockable, the currentRegionCheckeris responsible for determining whether the user is attempting to dock in thenorth,east,west, orcenterof the embeddedDockable. The visualDragPreviewdisplayed to the end user should reflect this determination. Once the docking operation is complete and the layout has been split between bothDockables, the actual percentage of space allotted to the newDockablein the layout, referred to as the "sibling", is also determined by the currentRegionCheckerimplementation.- Author:
- Christopher Butler, Mateusz Szczap
-
-
Field Summary
Fields Modifier and Type Field Description static floatDEFAULT_REGION_SIZEDefault region size.static floatDEFAULT_SIBLING_SIZEDefault sibling size.static java.lang.StringDEFAULT_SIBLING_SIZE_KEYA key to find a system property that will override the default sibling size in this interface.static floatMAX_REGION_SIZEDefault maximum region size.static floatMAX_SIBILNG_SIZEDefault maximum sibling size.static floatMIN_REGION_SIZEDefault minimum region size.static floatMIN_SIBILNG_SIZEDefault minimum sibling size.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.awt.RectanglegetEastRegion(java.awt.Component component)Returns the rectangular bounds within the specified component that represent it'sDockingConstants.EAST_REGION.java.awt.RectanglegetNorthRegion(java.awt.Component component)Returns the rectangular bounds within the specified component that represent it'sDockingConstants.NORTH_REGION.java.lang.StringgetRegion(java.awt.Component component, java.awt.Point point)Returns the docking region of the suppliedComponentthat contains the coordinates of the specifiedPoint.java.awt.RectanglegetRegionBounds(java.awt.Component component, java.lang.String region)Returns the rectangular bounds within the specified component that represent the specified region.floatgetRegionSize(java.awt.Component component, java.lang.String region)Returns a percentage representing the amount of space allotted for the specified region within the specifiedComponent.java.awt.RectanglegetSiblingBounds(java.awt.Component component, java.lang.String region)ARectanglerepresenting the actual amount of space to allot for siblingComponentsshould they be docked into the specified region.floatgetSiblingSize(java.awt.Component component, java.lang.String region)Returns a percentage representing the amount of space allotted for siblingComponentsto be docked within the specified region of the suppliedComponent.java.awt.RectanglegetSouthRegion(java.awt.Component component)Returns the rectangular bounds within the specified component that represent it'sDockingConstants.SOUTH_REGION.java.awt.RectanglegetWestRegion(java.awt.Component component)Returns the rectangular bounds within the specified component that represent it'sDockingConstants.WEST_REGION.
-
-
-
Field Detail
-
MAX_REGION_SIZE
static final float MAX_REGION_SIZE
Default maximum region size.- See Also:
- Constant Field Values
-
MIN_REGION_SIZE
static final float MIN_REGION_SIZE
Default minimum region size.- See Also:
- Constant Field Values
-
MAX_SIBILNG_SIZE
static final float MAX_SIBILNG_SIZE
Default maximum sibling size.- See Also:
- Constant Field Values
-
MIN_SIBILNG_SIZE
static final float MIN_SIBILNG_SIZE
Default minimum sibling size.- See Also:
- Constant Field Values
-
DEFAULT_REGION_SIZE
static final float DEFAULT_REGION_SIZE
Default region size.- See Also:
- Constant Field Values
-
DEFAULT_SIBLING_SIZE
static final float DEFAULT_SIBLING_SIZE
Default sibling size.- See Also:
- Constant Field Values
-
DEFAULT_SIBLING_SIZE_KEY
static final java.lang.String DEFAULT_SIBLING_SIZE_KEY
A key to find a system property that will override the default sibling size in this interface.- See Also:
DEFAULT_SIBLING_SIZE, Constant Field Values
-
-
Method Detail
-
getRegion
java.lang.String getRegion(java.awt.Component component, java.awt.Point point)Returns the docking region of the suppliedComponentthat contains the coordinates of the specifiedPoint. Valid return values are those regions defined inDockingConstantsand includeCENTER_REGION,NORTH_REGION,SOUTH_REGION,EAST_REGION,WEST_REGION, orUNKNOWN_REGION.- Parameters:
component- theComponentwhose region is to be examined.point- the coordinates whose region is to be determined.- Returns:
- the docking region containing the specified
Point.
-
getNorthRegion
java.awt.Rectangle getNorthRegion(java.awt.Component component)
Returns the rectangular bounds within the specified component that represent it'sDockingConstants.NORTH_REGION.- Parameters:
component- theComponentwhose north region is to be returned.- Returns:
- the bounds containing the north region of the specified
Component.
-
getSouthRegion
java.awt.Rectangle getSouthRegion(java.awt.Component component)
Returns the rectangular bounds within the specified component that represent it'sDockingConstants.SOUTH_REGION.- Parameters:
component- theComponentwhose south region is to be returned.- Returns:
- the bounds containing the south region of the specified
Component.
-
getEastRegion
java.awt.Rectangle getEastRegion(java.awt.Component component)
Returns the rectangular bounds within the specified component that represent it'sDockingConstants.EAST_REGION.- Parameters:
component- theComponentwhose east region is to be returned.- Returns:
- the bounds containing the east region of the specified
Component.
-
getWestRegion
java.awt.Rectangle getWestRegion(java.awt.Component component)
Returns the rectangular bounds within the specified component that represent it'sDockingConstants.WEST_REGION.- Parameters:
component- theComponentwhose west region is to be returned.- Returns:
- the bounds containing the west region of the specified
Component.
-
getRegionBounds
java.awt.Rectangle getRegionBounds(java.awt.Component component, java.lang.String region)Returns the rectangular bounds within the specified component that represent the specified region. Valid values for theregionparameter are those regions defined inDockingConstantsand includeNORTH_REGION,SOUTH_REGION,EAST_REGION, andWEST_REGION. All other region values should result in this method returning anullreference.- Parameters:
component- theComponentwhose region bounds are to be returned.region- the specified region that is to be examined.- Returns:
- the bounds containing the supplied region of the specified
Component.
-
getRegionSize
float getRegionSize(java.awt.Component component, java.lang.String region)Returns a percentage representing the amount of space allotted for the specified region within the specifiedComponent. For example, a return value of 0.25F for NORTH_REGION implies that the top 25% of the suppliedComponent'sbounds rectangle is to be interpreted as theComponent'snorthern region. Valid values for theregionparameter are those regions defined inDockingConstantsand includeNORTH_REGION,SOUTH_REGION,EAST_REGION, andWEST_REGION. All other region values should result in this method returning the constantDEFAULT_SIBLING_SIZE.- Parameters:
component- theComponentwhose region is to be examined.region- the specified region that is to be examined.- Returns:
- the percentage of the specified
Componentallotted for the specified region.
-
getSiblingBounds
java.awt.Rectangle getSiblingBounds(java.awt.Component component, java.lang.String region)ARectanglerepresenting the actual amount of space to allot for siblingComponentsshould they be docked into the specified region. This method differs fromgetRegionBounds(Component c, String region)in thatgetRegionBounds()determines the amount to space used to check whether aComponent'sdocking will intersect with a particular region, whereas this method returns the actual amount of space saidComponentwill take up after docking has been completed. Valid values for theregionparameter are those regions defined inDockingConstantsand includeNORTH_REGION,SOUTH_REGION,EAST_REGION, andWEST_REGION. All other region values should result in this method returning the constantDEFAULT_SIBLING_SIZE.- Parameters:
component- theComponentwhose sibling bounds are to be returned.region- the specified region that is to be examined.- Returns:
- the bounds containing the sibling bounds desired for
Componentsdocked into the specified region of the of the specifiedComponent.
-
getSiblingSize
float getSiblingSize(java.awt.Component component, java.lang.String region)Returns a percentage representing the amount of space allotted for siblingComponentsto be docked within the specified region of the suppliedComponent. This method differs fromgetRegionSize(Component c, String region)in thatgetRegionSize()determines the proportional space used to check whether aComponent'sdocking will intersect with a particular region, whereas this method returns the proportional space saidComponentwill take up after docking has been completed. Valid values for theregionparameter are those regions defined inDockingConstantsand includeNORTH_REGION,SOUTH_REGION,EAST_REGION, andWEST_REGION. All other region values should result in this method returning the constantDEFAULT_SIBLING_SIZE.- Parameters:
component- theComponentwhose sibling proportions are to be returned.region- the specified region that is to be examined.- Returns:
- the percentage of the specified
Componentallotted for siblingComponentsthat are to be docked into the specified region.
-
-