Top Description Fields Constructors Methods
com.sun.javafx.scene.control

public Class ResizeHelper

extends Object
Class Inheritance
Imports
java.util.BitSet, .List, javafx.scene.Scene, javafx.scene.control.ResizeFeaturesBase, .TableColumnBase, javafx.scene.layout.Region, javafx.stage.Window

Helper class for Tree/TableView constrained column resize policies.

Field Summary

Modifier and TypeField and Description
private final List<? extends TableColumnBase<?, ?>>
private final int
private static final double
private final double[]
private final double[]
private final ConstrainedColumnResize.ResizeMode
private final double[]
private final ResizeFeaturesBase<S>
private final double[]
private final BitSet
private static final int
private final Region
private final double

Constructor Summary

AccessConstructor and Description
public
ResizeHelper(ResizeFeaturesBase<S> rf, double target, List<? extends TableColumnBase<?, ?>> columns, ConstrainedColumnResize.ResizeMode mode)

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if sum of columns equals or greater than the target width
applySizes
()

Applies computed column widths to the tree/table columns, snapping coordinates if required.

private double
avail(boolean grow, double[] desired, int ix)

private static double
clip(double v, double min, double max)

private double
computeAllowedDelta(boolean expanding)

returns the allowable delta for all of the opposite columns

private void
distribute(double delta, double[] desired)

distibuting delta (positive when growing and negative when shrinking)

private boolean
distributeDelta(int ix, double delta)

private double
private double
private void
private void
distributeLargeDelta(double delta, double[] desired)

private void
distributeSmallDelta(double delta)

private void
distributeSmallDelta(double delta, double[] desired)

for small deltas, we use a simpler, but more expensive algorithm to distribute space in small steps, each time favoring a column that is further away from its desired width.

private double
getAllowedDelta(int ix, boolean expanding)

non-negative

private boolean
isCornerCase(double delta, int ix)

private static boolean
isZero(double x)

private int
markOppositeColumns(int ix)

updates skip bitset with columns that might be resized, and returns the number of the opposite columns

private double
resize(int ix, double delta)

public boolean
public void
private void
setSkip(int from, int toExclusive)

range set with limit check

private boolean

Returns:

true if no candidate has been found and the process should stop
smallGrow
(double delta, double[] desired)

Finds the best column to grow, then increases its width by delta, which is expected to be one display pixel exactly.

private boolean

Returns:

true if no candidate has been found and the process should stop
smallShrink
(double delta, double[] desired)

Finds the best column to shrink, then reduces its width by delta, which is expected to be one display pixel exactly.

private double
snapCeil(double x)

private double
snapRound(double x)

private double

Returns:

returns scene render scale x value
snapScale
()

implementation copied from Region.

private double
sum(double[] widths)

private double
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnsback to summary
private final List<? extends TableColumnBase<?, ?>> columns
countback to summary
private final int count
EPSILONback to summary
private static final double EPSILON
maxback to summary
private final double[] max
minback to summary
private final double[] min
modeback to summary
private final ConstrainedColumnResize.ResizeMode mode
prefback to summary
private final double[] pref
rfback to summary
private final ResizeFeaturesBase<S> rf
sizeback to summary
private final double[] size
skipback to summary
private final BitSet skip
SMALL_DELTAback to summary
private static final int SMALL_DELTA
snapback to summary
private final Region snap
targetback to summary
private final double target

Constructor Detail

ResizeHelperback to summary
public ResizeHelper(ResizeFeaturesBase<S> rf, double target, List<? extends TableColumnBase<?, ?>> columns, ConstrainedColumnResize.ResizeMode mode)

Method Detail

applySizesback to summary
public boolean applySizes()

Applies computed column widths to the tree/table columns, snapping coordinates if required.

Returns:boolean

true if sum of columns equals or greater than the target width

availback to summary
private double avail(boolean grow, double[] desired, int ix)
clipback to summary
private static double clip(double v, double min, double max)
computeAllowedDeltaback to summary
private double computeAllowedDelta(boolean expanding)

returns the allowable delta for all of the opposite columns

distributeback to summary
private void distribute(double delta, double[] desired)

distibuting delta (positive when growing and negative when shrinking)

distributeDeltaback to summary
private boolean distributeDelta(int ix, double delta)
distributeDeltaFlexHeadback to summary
private double distributeDeltaFlexHead(double delta)
distributeDeltaFlexTailback to summary
private double distributeDeltaFlexTail(double delta)
distributeDeltaRemainingColumnsback to summary
private void distributeDeltaRemainingColumns(double delta)
distributeLargeDeltaback to summary
private void distributeLargeDelta(double delta, double[] desired)
distributeSmallDeltaback to summary
private void distributeSmallDelta(double delta)
distributeSmallDeltaback to summary
private void distributeSmallDelta(double delta, double[] desired)

for small deltas, we use a simpler, but more expensive algorithm to distribute space in small steps, each time favoring a column that is further away from its desired width.

getAllowedDeltaback to summary
private double getAllowedDelta(int ix, boolean expanding)

non-negative

isCornerCaseback to summary
private boolean isCornerCase(double delta, int ix)
isZeroback to summary
private static boolean isZero(double x)
markOppositeColumnsback to summary
private int markOppositeColumns(int ix)

updates skip bitset with columns that might be resized, and returns the number of the opposite columns

resizeback to summary
private double resize(int ix, double delta)
resizeColumnback to summary
public boolean resizeColumn(TableColumnBase<?, ?> column)
resizeToContentWidthback to summary
public void resizeToContentWidth()
setSkipback to summary
private void setSkip(int from, int toExclusive)

range set with limit check

smallGrowback to summary
private boolean smallGrow(double delta, double[] desired)

Finds the best column to grow, then increases its width by delta, which is expected to be one display pixel exactly.

Returns:boolean

true if no candidate has been found and the process should stop

smallShrinkback to summary
private boolean smallShrink(double delta, double[] desired)

Finds the best column to shrink, then reduces its width by delta, which is expected to be one display pixel exactly.

Returns:boolean

true if no candidate has been found and the process should stop

snapCeilback to summary
private double snapCeil(double x)
snapRoundback to summary
private double snapRound(double x)
snapScaleback to summary
private double snapScale()

implementation copied from Region.

Returns:double

returns scene render scale x value

sumback to summary
private double sum(double[] widths)
sumSizesback to summary
private double sumSizes()