Module org.controlsfx.controls
Class ToWestChangeStrategy
- java.lang.Object
-
- impl.org.controlsfx.tools.rectangle.change.ToWestChangeStrategy
-
- All Implemented Interfaces:
Rectangle2DChangeStrategy
public class ToWestChangeStrategy extends Object
A strategy which enlarges an existing rectangle to the west.
-
-
Constructor Summary
Constructors Constructor Description ToWestChangeStrategy(Rectangle2D original, boolean ratioFixed, double ratio, double maxX, double maxY)
Creates a new change strategy which enlarges the specifiedoriginal
rectangle to the northeast.ToWestChangeStrategy(Rectangle2D original, boolean ratioFixed, double ratio, Rectangle2D bounds)
Creates a new change strategy which enlarges the specifiedoriginal
rectangle to the west.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterEndHook(Point2D point)
Called after the change ends at the specified point.protected void
beforeBeginHook(Point2D point)
Called before the change begins at the specified point.Rectangle2D
beginChange(Point2D point)
Begins the change at the specified point.Rectangle2D
continueChange(Point2D point)
Continues the change to the specified point.protected Rectangle2D
doBegin(Point2D point)
Begins the change at the specified point.protected Rectangle2D
doContinue(Point2D point)
Continues the change to the specified point.protected Rectangle2D
doEnd(Point2D point)
Ends the change at the specified point.Rectangle2D
endChange(Point2D point)
Ends the change at the specified point.protected Edge2D
getFixedEdge()
Returns the edge which is fixed during the change.protected double
getRatio()
The current ratio.protected boolean
isRatioFixed()
Indicates whether the ratio is fixed.
-
-
-
Constructor Detail
-
ToWestChangeStrategy
public ToWestChangeStrategy(Rectangle2D original, boolean ratioFixed, double ratio, Rectangle2D bounds)
Creates a new change strategy which enlarges the specifiedoriginal
rectangle to the west. The givenratio
is enforced when indicated byratioFixed
.- Parameters:
original
- the original rectangleratioFixed
- indicates whether the rectangle's ratio will be fixed to theratio
ratio
- the possibly fixed ratio of the rectangle created by this strategybounds
- the bounds within which the rectangle can be resized
-
ToWestChangeStrategy
public ToWestChangeStrategy(Rectangle2D original, boolean ratioFixed, double ratio, double maxX, double maxY)
Creates a new change strategy which enlarges the specifiedoriginal
rectangle to the northeast. The givenratio
is enforced when indicated byratioFixed
.- Parameters:
original
- the original rectangleratioFixed
- indicates whether the rectangle's ratio will be fixed to theratio
ratio
- the possibly fixed ratio of the rectangle created by this strategymaxX
- the maximal x-coordinate of the right edge of the created rectangles; must be greater than or equal to the previous rectangle's widthmaxY
- the maximal y-coordinate of the lower edge of the created rectangles; must be greater than or equal to the previous rectangle's height
-
-
Method Detail
-
getFixedEdge
protected Edge2D getFixedEdge()
Returns the edge which is fixed during the change. Called once when the change begins.- Returns:
- the edge which is fixed during the change
-
doBegin
protected final Rectangle2D doBegin(Point2D point)
Begins the change at the specified point.- Parameters:
point
- a point- Returns:
- the new rectangle
-
doContinue
protected Rectangle2D doContinue(Point2D point)
Continues the change to the specified point. Must not be called before a call toRectangle2DChangeStrategy.beginChange(javafx.geometry.Point2D)
.- Parameters:
point
- a point- Returns:
- the new rectangle
-
doEnd
protected final Rectangle2D doEnd(Point2D point)
Ends the change at the specified point. Must not be called before a call toRectangle2DChangeStrategy.beginChange(javafx.geometry.Point2D)
.- Parameters:
point
- a point- Returns:
- the new rectangle
-
isRatioFixed
protected final boolean isRatioFixed()
Indicates whether the ratio is fixed. If so, the ratio can be accessed withgetRatio()
.- Returns:
- true if the ratio is fixed; false otherwise
-
getRatio
protected final double getRatio()
The current ratio. Can only be called without exception whenisRatioFixed()
returns true.- Returns:
- the current ratio
-
beginChange
public final Rectangle2D beginChange(Point2D point)
Begins the change at the specified point.- Specified by:
beginChange
in interfaceRectangle2DChangeStrategy
- Parameters:
point
- a point- Returns:
- the new rectangle
-
continueChange
public final Rectangle2D continueChange(Point2D point)
Continues the change to the specified point. Must not be called before a call toRectangle2DChangeStrategy.beginChange(javafx.geometry.Point2D)
.- Specified by:
continueChange
in interfaceRectangle2DChangeStrategy
- Parameters:
point
- a point- Returns:
- the new rectangle
-
endChange
public final Rectangle2D endChange(Point2D point)
Ends the change at the specified point. Must not be called before a call toRectangle2DChangeStrategy.beginChange(javafx.geometry.Point2D)
.- Specified by:
endChange
in interfaceRectangle2DChangeStrategy
- Parameters:
point
- a point- Returns:
- the new rectangle
-
beforeBeginHook
protected void beforeBeginHook(Point2D point)
Called before the change begins at the specified point.- Parameters:
point
- a point
-
afterEndHook
protected void afterEndHook(Point2D point)
Called after the change ends at the specified point.- Parameters:
point
- a point
-
-