Top Description Fields Constructors Methods
impl.org.controlsfx.tools.rectangle.change

pack-priv abstract Class AbstractRatioRespectingChangeStrategy

extends AbstractBeginEndCheckingChangeStrategy
Class Inheritance
Known Direct Subclasses
impl.org.controlsfx.tools.rectangle.change.AbstractFixedEdgeChangeStrategy, impl.org.controlsfx.tools.rectangle.change.AbstractFixedPointChangeStrategy, impl.org.controlsfx.tools.rectangle.change.AbstractPreviousRectangleChangeStrategy

Abstract superclass to implementations of Rectangle2DChangeStrategy, which might be parameterized such that only rectangles of a defined ratio are created. This parameterization happens during construction. Subclasses must implement the ratio handling themselves! This class only holds the parameters.

Field Summary

Modifier and TypeField and Description
private final double
ratio

The currently used ratio.

private final boolean
ratioFixed

Indicates whether the current selection must have a fixed ratio.

Constructor Summary

AccessConstructor and Description
protected
AbstractRatioRespectingChangeStrategy(boolean
indicates whether the ratio will be fixed
ratioFixed
,
double
defines the fixed ratio
ratio
)

Creates a change strategy which respects the specified ratio if ratioFixed is true.

Method Summary

Modifier and TypeMethod and Description
protected final double

Returns:

the current ratio
getRatio
()

The current ratio.

protected final boolean

Returns:

true if the ratio is fixed; false otherwise
isRatioFixed
()

Indicates whether the ratio is fixed.

Inherited from impl.org.controlsfx.tools.rectangle.change.AbstractBeginEndCheckingChangeStrategy:
afterEndHookbeforeBeginHookbeginChangecontinueChangedoBegindoContinuedoEndendChange

Field Detail

ratioback to summary
private final double ratio

The currently used ratio. Should only be used if 'ratioFixed' is true.

ratioFixedback to summary
private final boolean ratioFixed

Indicates whether the current selection must have a fixed ratio. If so, 'ratio' can be used.

Constructor Detail

AbstractRatioRespectingChangeStrategyback to summary
protected AbstractRatioRespectingChangeStrategy(boolean ratioFixed, double ratio)

Creates a change strategy which respects the specified ratio if ratioFixed is true.

Parameters
ratioFixed:boolean

indicates whether the ratio will be fixed

ratio:double

defines the fixed ratio

Method Detail

getRatioback to summary
protected final double getRatio()

The current ratio. Can only be called without exception when isRatioFixed() returns true.

Returns:double

the current ratio

isRatioFixedback to summary
protected final boolean isRatioFixed()

Indicates whether the ratio is fixed. If so, the ratio can be accessed with getRatio().

Returns:boolean

true if the ratio is fixed; false otherwise