public class Region
extends Parent
Every Region has its layout bounds, which are specified to be (0, 0, width, height). A Region might draw outside these bounds. The content area of a Region is the area which is occupied for the layout of its children. This area is, by default, the same as the layout bounds of the Region, but can be modified by either the properties of a border (either with BorderStrokes or BorderImages), and by padding. The padding can be negative, such that the content area of a Region might extend beyond the layout bounds of the Region, but does not affect the layout bounds.
A Region has a Background, and a Border, although either or both of these might be empty. The Background of a Region is made up of zero or more BackgroundFills, and zero or more BackgroundImages. Likewise, the border of a Region is defined by its Border, which is made up of zero or more BorderStrokes and zero or more BorderImages. All BackgroundFills are drawn first, followed by BackgroundImages, BorderStrokes, and finally BorderImages. The content is drawn above all backgrounds and borders. If a BorderImage is present (and loaded all images properly), then no BorderStrokes are actually drawn, although they are considered for computing the position of the content area (see the stroke width property of a BorderStroke). These semantics are in line with the CSS 3 specification. The purpose of these semantics are to allow an application to specify a fallback BorderStroke to be displayed in the case that an ImageStroke fails to download or load.
By default a Region appears as a Rectangle. A BackgroundFill radii might cause the Rectangle to appear rounded.
This affects not only making the visuals look like a rounded rectangle, but it also causes the picking behavior
of the Region to act like a rounded rectangle, such that locations outside the corner radii are ignored. A
Region can be made to use any shape, however, by specifying the shape
property. If a shape is specified,
then all BackgroundFills, BackgroundImages, and BorderStrokes will be applied to the shape. BorderImages are
not used for Regions which have a shape specified.
Although the layout bounds of a Region are not influenced by any Border or Background, the content area
insets and the picking area of the Region are. The insets
of the Region define the distance
between the edge of the layout bounds and the edge of the content area. For example, if the Region
layout bounds are (x=0, y=0, width=200, height=100), and the insets are (top=10, right=20, bottom=30, left=40),
then the content area bounds will be (x=40, y=10, width=140, height=60). A Region subclass which is laying
out its children should compute and honor these content area bounds.
By default a Region inherits the layout behavior of its superclass, Parent
,
which means that it will resize any resizable child nodes to their preferred
size, but will not reposition them. If an application needs more specific
layout behavior, then it should use one of the Region subclasses:
StackPane
, HBox
, VBox
, TilePane
, FlowPane
,
BorderPane
, GridPane
, or AnchorPane
.
To implement a more custom layout, a Region subclass must override
computePrefWidth
, computePrefHeight
, and
layoutChildren
. Note that layoutChildren
is called automatically
by the scene graph while executing a top-down layout pass and it should not be invoked directly by the
region subclass.
Region subclasses which layout their children will position nodes by setting
layoutX
/layoutY
and do not alter
translateX
/translateY
, which are reserved for
adjustments and animation.
Type | Property and Description |
---|---|
<any> |
background
The background of the Region, which is made up of zero or more BackgroundFills, and
zero or more BackgroundImages.
|
<any> |
border
The border of the Region, which is made up of zero or more BorderStrokes, and
zero or more BorderImages.
|
BooleanProperty |
cacheShape
Defines a hint to the system indicating that the Shape used to define the region's
background is stable and would benefit from caching.
|
BooleanProperty |
centerShape
Defines whether the shape is centered within the Region's width or height.
|
ReadOnlyDoubleProperty |
height
The height of this resizable node.
|
<any> |
insets
The insets of the Region define the distance from the edge of the region (its layout bounds,
or (0, 0, width, height)) to the edge of the content area.
|
DoubleProperty |
maxHeight
Property for overriding the region's computed maximum height.
|
DoubleProperty |
maxWidth
Property for overriding the region's computed maximum width.
|
DoubleProperty |
minHeight
Property for overriding the region's computed minimum height.
|
DoubleProperty |
minWidth
Property for overriding the region's computed minimum width.
|
<any> |
opaqueInsets
Defines the area of the region within which completely opaque pixels
are drawn.
|
<any> |
padding
The top, right, bottom, and left padding around the region's content.
|
DoubleProperty |
prefHeight
Property for overriding the region's computed preferred height.
|
DoubleProperty |
prefWidth
Property for overriding the region's computed preferred width.
|
BooleanProperty |
scaleShape
Specifies whether the shape, if defined, is scaled to match the size of the Region.
|
<any> |
shape
When specified, the
Shape will cause the region to be
rendered as the specified shape rather than as a rounded rectangle. |
BooleanProperty |
snapToPixel
Defines whether this region adjusts position, spacing, and size values of
its children to pixel boundaries.
|
ReadOnlyDoubleProperty |
width
The width of this resizable node.
|
Modifier and Type | Class and Description |
---|---|
private class |
Region.InsetsProperty |
private class |
Region.MinPrefMaxProperty
This class is reused for the min, pref, and max properties since
they all performed the same function (to call requestParentLayout).
|
private class |
Region.ShapeProperty
An implementation for the ShapeProperty.
|
private static class |
Region.StyleableProperties |
Modifier and Type | Field and Description |
---|---|
private double |
_height
Because the height is very often set and very often read but only sometimes
listened to, it is beneficial to use the super-lazy pattern property, where we
only inflate the property object when heightProperty() is explicitly invoked.
|
private double |
_maxHeight |
private double |
_maxWidth |
private double |
_minHeight |
private double |
_minWidth |
private double |
_prefHeight |
private double |
_prefWidth |
private Shape |
_shape |
private boolean |
_snapToPixel
I'm using a super-lazy property pattern here, so as to only create the
property object when needed for listeners or when being set from CSS,
but also making sure that we only call requestParentLayout in the case
that the snapToPixel value has actually changed, whether set via the setter
or set via the property object.
|
private double |
_width
Because the width is very often set and very often read but only sometimes
listened to, it is beneficial to use the super-lazy pattern property, where we
only inflate the property object when widthProperty() is explicitly invoked.
|
private <any> |
background
The background of the Region, which is made up of zero or more BackgroundFills, and
zero or more BackgroundImages.
|
private <any> |
border
The border of the Region, which is made up of zero or more BorderStrokes, and
zero or more BorderImages.
|
private Bounds |
boundingBox |
private BooleanProperty |
cacheShape
Defines a hint to the system indicating that the Shape used to define the region's
background is stable and would benefit from caching.
|
private BooleanProperty |
centerShape
Defines whether the shape is centered within the Region's width or height.
|
private boolean |
cornersValid |
private ReadOnlyDoubleWrapper |
height
The height of this resizable node.
|
private InvalidationListener |
imageChangeListener
At the time that a Background or Border is set on a Region, we inspect any
BackgroundImage or BorderImage objects, to see if the Image backing them
is background loading and not yet complete, or is animated.
|
private Region.InsetsProperty |
insets
The insets of the Region define the distance from the edge of the region (its layout bounds,
or (0, 0, width, height)) to the edge of the content area.
|
private DoubleProperty |
maxHeight
Property for overriding the region's computed maximum height.
|
private DoubleProperty |
maxWidth
Property for overriding the region's computed maximum width.
|
private DoubleProperty |
minHeight
Property for overriding the region's computed minimum height.
|
private DoubleProperty |
minWidth
Property for overriding the region's computed minimum width.
|
private java.util.List<CornerRadii> |
normalizedFillCorners |
private java.util.List<CornerRadii> |
normalizedStrokeCorners |
private <any> |
opaqueInsets |
private <any> |
padding
The top, right, bottom, and left padding around the region's content.
|
private DoubleProperty |
prefHeight
Property for overriding the region's computed preferred height.
|
private DoubleProperty |
prefWidth
Property for overriding the region's computed preferred width.
|
private BooleanProperty |
scaleShape
Specifies whether the shape, if defined, is scaled to match the size of the Region.
|
private <any> |
shape
When specified, the
Shape will cause the region to be
rendered as the specified shape rather than as a rounded rectangle. |
private double |
snappedBottomInset |
private double |
snappedLeftInset |
private double |
snappedRightInset |
private double |
snappedTopInset
cached results of snapped insets, this are used a lot during layout so makes sense
to keep fast access cached copies here.
|
private BooleanProperty |
snapToPixel
Defines whether this region adjusts position, spacing, and size values of
its children to pixel boundaries.
|
(package private) static Vec2d |
TEMP_VEC2D |
static double |
USE_COMPUTED_SIZE
Sentinel value which can be passed to a region's
setMinWidth ,
setMinHeight ,
setPrefWidth ,
setPrefHeight ,
setMaxWidth ,
setMaxHeight methods
to reset the region's size constraint back to it's intrinsic size returned
by computeMinWidth , computeMinHeight ,
computePrefWidth , computePrefHeight ,
computeMaxWidth , or computeMaxHeight . |
static double |
USE_PREF_SIZE
Sentinel value which can be passed to a region's
setMinWidth ,
setMinHeight ,
setMaxWidth or
setMaxHeight
methods to indicate that the preferred dimension should be used for that max and/or min constraint. |
private ReadOnlyDoubleWrapper |
width
The width of this resizable node.
|
Constructor and Description |
---|
Region()
Creates a new Region with an empty Background and and empty Border.
|
Modifier and Type | Method and Description |
---|---|
private static double |
_getSnapScaleXimpl(Scene scene) |
private static double |
_getSnapScaleYimpl(Scene scene) |
(package private) void |
addImageListener(Image image)
Adds the imageChangeListener to this image.
|
(package private) double |
adjustHeightByMargin(double height,
Insets margin) |
(package private) double |
adjustWidthByMargin(double width,
Insets margin) |
<any> |
backgroundProperty()
The background of the Region, which is made up of zero or more BackgroundFills, and
zero or more BackgroundImages.
|
<any> |
borderProperty()
The border of the Region, which is made up of zero or more BorderStrokes, and
zero or more BorderImages.
|
(package private) static Vec2d |
boundedNodeSizeWithBias(Node node,
double areaWidth,
double areaHeight,
boolean fillWidth,
boolean fillHeight,
Vec2d result)
Returns the size of a Node that should be placed in an area of the specified size,
bounded in it's min/max size, respecting bias.
|
(package private) static double |
boundedSize(double min,
double pref,
double max)
Computes the value based on the given min and max values.
|
BooleanProperty |
cacheShapeProperty()
Defines a hint to the system indicating that the Shape used to define the region's
background is stable and would benefit from caching.
|
BooleanProperty |
centerShapeProperty()
Defines whether the shape is centered within the Region's width or height.
|
(package private) double |
computeChildMaxAreaHeight(Node child,
double maxBaselineComplement,
Insets margin,
double width) |
(package private) double |
computeChildMaxAreaWidth(Node child,
double baselineComplement,
Insets margin,
double height,
boolean fillHeight) |
(package private) double |
computeChildMinAreaHeight(Node child,
double minBaselineComplement,
Insets margin,
double width) |
(package private) double |
computeChildMinAreaHeight(Node child,
Insets margin) |
(package private) double |
computeChildMinAreaWidth(Node child,
double baselineComplement,
Insets margin,
double height,
boolean fillHeight) |
(package private) double |
computeChildMinAreaWidth(Node child,
Insets margin) |
(package private) double |
computeChildPrefAreaHeight(Node child,
double prefBaselineComplement,
Insets margin,
double width) |
(package private) double |
computeChildPrefAreaHeight(Node child,
Insets margin) |
(package private) double |
computeChildPrefAreaWidth(Node child,
double baselineComplement,
Insets margin,
double height,
boolean fillHeight) |
(package private) double |
computeChildPrefAreaWidth(Node child,
Insets margin) |
protected double |
computeMaxHeight(double width)
Computes the maximum height of this region.
|
(package private) double |
computeMaxMinAreaHeight(java.util.List<Node> children,
<any> childMargins,
double[] childWidths,
VPos valignment) |
(package private) double |
computeMaxMinAreaHeight(java.util.List<Node> children,
<any> margins,
VPos valignment) |
(package private) double |
computeMaxMinAreaHeight(java.util.List<Node> children,
<any> margins,
VPos valignment,
double width) |
(package private) double |
computeMaxMinAreaWidth(java.util.List<Node> children,
<any> margins) |
(package private) double |
computeMaxMinAreaWidth(java.util.List<Node> children,
<any> childMargins,
double[] childHeights,
boolean fillHeight) |
(package private) double |
computeMaxMinAreaWidth(java.util.List<Node> children,
<any> margins,
double height,
boolean fillHeight) |
(package private) double |
computeMaxPrefAreaHeight(java.util.List<Node> children,
<any> childMargins,
double[] childWidths,
VPos valignment) |
(package private) double |
computeMaxPrefAreaHeight(java.util.List<Node> children,
<any> margins,
double width,
VPos valignment) |
(package private) double |
computeMaxPrefAreaHeight(java.util.List<Node> children,
<any> margins,
VPos valignment) |
(package private) double |
computeMaxPrefAreaWidth(java.util.List<Node> children,
<any> margins) |
(package private) double |
computeMaxPrefAreaWidth(java.util.List<Node> children,
<any> childMargins,
double[] childHeights,
boolean fillHeight) |
(package private) double |
computeMaxPrefAreaWidth(java.util.List<Node> children,
<any> margins,
double height,
boolean fillHeight) |
protected double |
computeMaxWidth(double height)
Computes the maximum width for this region.
|
protected double |
computeMinHeight(double width)
Computes the minimum height of this region.
|
protected double |
computeMinWidth(double height)
Computes the minimum width of this region.
|
protected double |
computePrefHeight(double width)
Computes the preferred height of this region for the given width;
Region subclasses should override this method to return an appropriate
value based on their content and layout strategy.
|
protected double |
computePrefWidth(double height)
Computes the preferred width of this region for the given height.
|
private BaseBounds |
computeShapeBounds(BaseBounds bounds) |
(package private) static double |
computeXOffset(double width,
double contentWidth,
HPos hpos) |
(package private) static double |
computeYOffset(double height,
double contentHeight,
VPos vpos) |
private boolean |
contains(double px,
double py,
double x1,
double y1,
double x2,
double y2,
BorderWidths widths,
boolean filled,
Insets insets,
CornerRadii rad)
Basically we will perform two contains tests.
|
private boolean |
contains(double px,
double py,
double x1,
double y1,
double x2,
double y2,
Insets insets,
CornerRadii rad)
Determines whether the point (px, py) is contained within the the bounds (x1, y1)-(x2, y2),
after taking into account the insets and the corner radii.
|
(package private) static double[] |
createDoubleArray(int length,
double value) |
private boolean |
doComputeContains(double localX,
double localY) |
private BaseBounds |
doComputeGeomBounds(BaseBounds bounds,
BaseTransform tx) |
private Bounds |
doComputeLayoutBounds()
The layout bounds of this region:
0, 0 width x height |
private NGNode |
doCreatePeer() |
private void |
doNotifyLayoutBoundsChanged() |
private void |
doPickNodeLocal(PickRay pickRay,
PickResultChooser result)
Some skins relying on this
Note: This method MUST only be called via its accessor method.
|
private void |
doUpdatePeer()
*
PG Implementation *
*
|
(package private) double |
getAreaBaselineOffset(java.util.List<Node> children,
<any> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
boolean fillHeight) |
(package private) static double |
getAreaBaselineOffset(java.util.List<Node> children,
<any> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
boolean fillHeight,
boolean snapToPixel) |
(package private) double |
getAreaBaselineOffset(java.util.List<Node> children,
<any> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
boolean fillHeight,
double minComplement) |
(package private) static double |
getAreaBaselineOffset(java.util.List<Node> children,
<any> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
boolean fillHeight,
double minComplement,
boolean snapToPixel) |
(package private) double |
getAreaBaselineOffset(java.util.List<Node> children,
<any> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
java.util.function.Function<java.lang.Integer,java.lang.Boolean> fillHeight,
double minComplement) |
(package private) static double |
getAreaBaselineOffset(java.util.List<Node> children,
<any> margins,
java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth,
double areaHeight,
java.util.function.Function<java.lang.Integer,java.lang.Boolean> fillHeight,
double minComplement,
boolean snapToPixel)
Returns the baseline offset of provided children, with respect to the minimum complement, computed
by
getMinBaselineComplement(java.util.List) from the same set of children. |
Background |
getBackground()
Gets the value of the property background.
|
private static double |
getBaselineComplement(java.util.List<Node> children,
boolean min,
boolean max) |
Border |
getBorder()
Gets the value of the property border.
|
static java.util.List<<any>> |
getClassCssMetaData() |
java.util.List<<any>> |
getCssMetaData() |
double |
getHeight()
Gets the value of the property height.
|
Insets |
getInsets()
Gets the value of the property insets.
|
private double |
getMaxAreaHeight(java.util.List<Node> children,
<any> childMargins,
double[] childWidths,
VPos valignment,
boolean minimum) |
private double |
getMaxAreaWidth(java.util.List<javafx.scene.Node> children,
<any> childMargins,
double[] childHeights,
boolean fillHeight,
boolean minimum) |
(package private) static double |
getMaxBaselineComplement(java.util.List<Node> children)
Return the maximal complement of baseline
|
double |
getMaxHeight()
Gets the value of the property maxHeight.
|
double |
getMaxWidth()
Gets the value of the property maxWidth.
|
(package private) static double |
getMinBaselineComplement(java.util.List<Node> children)
Return the minimum complement of baseline
|
double |
getMinHeight()
Gets the value of the property minHeight.
|
double |
getMinWidth()
Gets the value of the property minWidth.
|
private CornerRadii |
getNormalizedFillCorner(int i)
Returns the normalized absolute radii for the indicated BackgroundFill,
taking the current size of the region into account to eliminate any
percentage-based measurements and to scale the radii to prevent
overflowing the width or height.
|
private CornerRadii |
getNormalizedStrokeCorner(int i)
Returns the normalized absolute radii for the indicated BorderStroke,
taking the current size of the region into account to eliminate any
percentage-based measurements and to scale the radii to prevent
overflowing the width or height.
|
Insets |
getOpaqueInsets()
Gets the value of the property opaqueInsets.
|
Insets |
getPadding()
Gets the value of the property padding.
|
(package private) static double |
getPrefBaselineComplement(java.util.List<Node> children)
Return the preferred complement of baseline
|
double |
getPrefHeight()
Gets the value of the property prefHeight.
|
double |
getPrefWidth()
Gets the value of the property prefWidth.
|
Shape |
getShape()
Gets the value of the property shape.
|
private double |
getSnapScaleX() |
private static double |
getSnapScaleX(Node n) |
private double |
getSnapScaleY() |
private static double |
getSnapScaleY(Node n) |
java.lang.String |
getUserAgentStylesheet()
An implementation may specify its own user-agent styles for this Region, and its children,
by overriding this method.
|
double |
getWidth()
Gets the value of the property width.
|
private void |
heightChanged(double value) |
ReadOnlyDoubleProperty |
heightProperty()
The height of this resizable node.
|
<any> |
insetsProperty()
The insets of the Region define the distance from the edge of the region (its layout bounds,
or (0, 0, width, height)) to the edge of the content area.
|
boolean |
isCacheShape()
Gets the value of the property cacheShape.
|
boolean |
isCenterShape()
Gets the value of the property centerShape.
|
boolean |
isResizable()
Returns
true since all Regions are resizable. |
boolean |
isScaleShape()
Gets the value of the property scaleShape.
|
boolean |
isSnapToPixel()
Gets the value of the property snapToPixel.
|
protected void |
layoutInArea(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
HPos halignment,
VPos valignment)
Utility method which lays out the child within an area of this
region defined by
areaX , areaY , areaWidth x areaHeight ,
with a baseline offset relative to that area. |
protected void |
layoutInArea(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
Insets margin,
boolean fillWidth,
boolean fillHeight,
HPos halignment,
VPos valignment)
Utility method which lays out the child within an area of this
region defined by
areaX , areaY , areaWidth x areaHeight ,
with a baseline offset relative to that area. |
static void |
layoutInArea(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
Insets margin,
boolean fillWidth,
boolean fillHeight,
HPos halignment,
VPos valignment,
boolean isSnapToPixel)
Utility method which lays out the child within an area of it's
parent defined by
areaX , areaY , areaWidth x areaHeight ,
with a baseline offset relative to that area. |
protected void |
layoutInArea(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
Insets margin,
HPos halignment,
VPos valignment)
Utility method which lays out the child within an area of this
region defined by
areaX , areaY , areaWidth x areaHeight ,
with a baseline offset relative to that area. |
double |
maxHeight(double width)
Called during layout to determine the maximum height for this node.
|
DoubleProperty |
maxHeightProperty()
Property for overriding the region's computed maximum height.
|
double |
maxWidth(double height)
Called during layout to determine the maximum width for this node.
|
DoubleProperty |
maxWidthProperty()
Property for overriding the region's computed maximum width.
|
double |
minHeight(double width)
Called during layout to determine the minimum height for this node.
|
DoubleProperty |
minHeightProperty()
Property for overriding the region's computed minimum height.
|
double |
minWidth(double height)
Called during layout to determine the minimum width for this node.
|
DoubleProperty |
minWidthProperty()
Property for overriding the region's computed minimum width.
|
private static CornerRadii |
normalize(CornerRadii radii,
Insets insets,
double width,
double height)
Return a version of the radii that is not percentage based and is scaled to
fit the indicated inset rectangle without overflow.
|
<any> |
opaqueInsetsProperty()
Defines the area of the region within which completely opaque pixels
are drawn.
|
<any> |
paddingProperty()
The top, right, bottom, and left padding around the region's content.
|
private static void |
position(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
double topMargin,
double rightMargin,
double bottomMargin,
double leftMargin,
HPos hpos,
VPos vpos,
boolean isSnapToPixel) |
protected void |
positionInArea(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
HPos halignment,
VPos valignment)
Utility method which positions the child within an area of this
region defined by
areaX , areaY , areaWidth x areaHeight ,
with a baseline offset relative to that area. |
static void |
positionInArea(Node child,
double areaX,
double areaY,
double areaWidth,
double areaHeight,
double areaBaselineOffset,
Insets margin,
HPos halignment,
VPos valignment,
boolean isSnapToPixel)
Utility method which positions the child within an area of this
region defined by
areaX , areaY , areaWidth x areaHeight ,
with a baseline offset relative to that area. |
double |
prefHeight(double width)
Called during layout to determine the preferred height for this node.
|
DoubleProperty |
prefHeightProperty()
Property for overriding the region's computed preferred height.
|
double |
prefWidth(double height)
Called during layout to determine the preferred width for this node.
|
DoubleProperty |
prefWidthProperty()
Property for overriding the region's computed preferred width.
|
(package private) void |
removeImageListener(Image image)
Removes the imageChangeListener from this image.
|
void |
resize(double width,
double height)
Invoked by the region's parent during layout to set the region's
width and height.
|
private static double |
scaledCeil(double value,
double scale) |
private static double |
scaledFloor(double value,
double scale) |
private static double |
scaledRound(double value,
double scale) |
BooleanProperty |
scaleShapeProperty()
Specifies whether the shape, if defined, is scaled to match the size of the Region.
|
void |
setBackground(Background value)
Sets the value of the property background.
|
void |
setBorder(Border value)
Sets the value of the property border.
|
void |
setCacheShape(boolean value)
Sets the value of the property cacheShape.
|
void |
setCenterShape(boolean value)
Sets the value of the property centerShape.
|
protected void |
setHeight(double value)
Sets the value of the property height.
|
void |
setMaxHeight(double value)
Sets the value of the property maxHeight.
|
void |
setMaxSize(double maxWidth,
double maxHeight)
Convenience method for overriding the region's computed maximum width and height.
|
void |
setMaxWidth(double value)
Sets the value of the property maxWidth.
|
void |
setMinHeight(double value)
Sets the value of the property minHeight.
|
void |
setMinSize(double minWidth,
double minHeight)
Convenience method for overriding the region's computed minimum width and height.
|
void |
setMinWidth(double value)
Sets the value of the property minWidth.
|
void |
setOpaqueInsets(Insets value)
Sets the value of the property opaqueInsets.
|
void |
setPadding(Insets value)
Sets the value of the property padding.
|
void |
setPrefHeight(double value)
Sets the value of the property prefHeight.
|
void |
setPrefSize(double prefWidth,
double prefHeight)
Convenience method for overriding the region's computed preferred width and height.
|
void |
setPrefWidth(double value)
Sets the value of the property prefWidth.
|
void |
setScaleShape(boolean value)
Sets the value of the property scaleShape.
|
void |
setShape(Shape value)
Sets the value of the property shape.
|
void |
setSnapToPixel(boolean value)
Sets the value of the property snapToPixel.
|
protected void |
setWidth(double value)
Sets the value of the property width.
|
private boolean |
shapeContains(com.sun.javafx.geom.Shape shape,
double x,
double y,
double topOffset,
double rightOffset,
double bottomOffset,
double leftOffset)
Transform x, y in local Region coordinates to local coordinates of scaled/centered shape and
check if the shape contains the coordinates.
|
<any> |
shapeProperty()
When specified, the
Shape will cause the region to be
rendered as the specified shape rather than as a rounded rectangle. |
double |
snappedBottomInset()
Utility method to get the bottom inset which includes padding and border
inset.
|
double |
snappedLeftInset()
Utility method to get the left inset which includes padding and border
inset.
|
double |
snappedRightInset()
Utility method to get the right inset which includes padding and border
inset.
|
double |
snappedTopInset()
Utility method to get the top inset which includes padding and border
inset.
|
(package private) double |
snapPortionX(double value) |
private double |
snapPortionX(double value,
boolean snapToPixel) |
(package private) double |
snapPortionY(double value) |
private double |
snapPortionY(double value,
boolean snapToPixel) |
protected double |
snapPosition(double value)
Deprecated.
replaced by
snapPositionX() and snapPositionY() |
private static double |
snapPosition(double value,
boolean snapToPixel,
double snapScale) |
double |
snapPositionX(double value)
If this region's snapToPixel property is true, returns a value rounded
to the nearest pixel in the horizontal direction, else returns the
same value.
|
private double |
snapPositionX(double value,
boolean snapToPixel)
If snapToPixel is true, then the value is rounded using Math.round.
|
double |
snapPositionY(double value)
If this region's snapToPixel property is true, returns a value rounded
to the nearest pixel in the vertical direction, else returns the
same value.
|
private double |
snapPositionY(double value,
boolean snapToPixel) |
protected double |
snapSize(double value)
Deprecated.
replaced by
snapSizeX() and snapSizeY() |
private static double |
snapSize(double value,
boolean snapToPixel,
double snapScale) |
double |
snapSizeX(double value)
If this region's snapToPixel property is true, returns a value ceiled
to the nearest pixel in the horizontal direction, else returns the
same value.
|
private double |
snapSizeX(double value,
boolean snapToPixel)
If snapToPixel is true, then the value is ceil'd using Math.ceil.
|
double |
snapSizeY(double value)
If this region's snapToPixel property is true, returns a value ceiled
to the nearest pixel in the vertical direction, else returns the
same value.
|
private double |
snapSizeY(double value,
boolean snapToPixel) |
protected double |
snapSpace(double value)
Deprecated.
replaced by
snapSpaceX() and snapSpaceY() |
private static double |
snapSpace(double value,
boolean snapToPixel,
double snapScale) |
double |
snapSpaceX(double value)
If this region's snapToPixel property is true, returns a value rounded
to the nearest pixel in the horizontal direction, else returns the
same value.
|
private double |
snapSpaceX(double value,
boolean snapToPixel)
If snapToPixel is true, then the value is rounded using Math.round.
|
double |
snapSpaceY(double value)
If this region's snapToPixel property is true, returns a value rounded
to the nearest pixel in the vertical direction, else returns the
same value.
|
private double |
snapSpaceY(double value,
boolean snapToPixel) |
BooleanProperty |
snapToPixelProperty()
Defines whether this region adjusts position, spacing, and size values of
its children to pixel boundaries.
|
private void |
updateSnappedInsets()
Called to update the cached snapped insets
|
private void |
validateCorners()
This method validates all CornerRadii objects in both the set of
BackgroundFills and BorderStrokes and saves the normalized values
into the private fields above.
|
private void |
widthChanged(double value) |
ReadOnlyDoubleProperty |
widthProperty()
The width of this resizable node.
|
public final BooleanProperty snapToPixelProperty
isSnapToPixel()
,
setSnapToPixel(boolean)
public final <any> paddingProperty
getPadding()
,
setPadding(Insets)
public final <any> backgroundProperty
getBackground()
,
setBackground(Background)
public final <any> borderProperty
getBorder()
,
setBorder(Border)
public final <any> opaqueInsetsProperty
getOpaqueInsets()
,
setOpaqueInsets(Insets)
public final <any> insetsProperty
getInsets()
public final ReadOnlyDoubleProperty widthProperty
minWidth
, prefWidth
,
and maxWidth
properties.getWidth()
,
setWidth(double)
public final ReadOnlyDoubleProperty heightProperty
minHeight
, prefHeight
,
and maxHeight
properties.getHeight()
,
setHeight(double)
public final DoubleProperty minWidthProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minWidth(forHeight)
will return the region's internally
computed minimum width.
Setting this value to the USE_PREF_SIZE
flag will cause
minWidth(forHeight)
to return the region's preferred width,
enabling applications to easily restrict the resizability of the region.
getMinWidth()
,
setMinWidth(double)
public final DoubleProperty minHeightProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minHeight(forWidth)
will return the region's internally
computed minimum height.
Setting this value to the USE_PREF_SIZE
flag will cause
minHeight(forWidth)
to return the region's preferred height,
enabling applications to easily restrict the resizability of the region.
getMinHeight()
,
setMinHeight(double)
public final DoubleProperty prefWidthProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefWidth(forHeight)
will return the region's internally
computed preferred width.
getPrefWidth()
,
setPrefWidth(double)
public final DoubleProperty prefHeightProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefHeight(forWidth)
will return the region's internally
computed preferred width.
getPrefHeight()
,
setPrefHeight(double)
public final DoubleProperty maxWidthProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getMaxWidth(forHeight)
will return the region's internally
computed maximum width.
Setting this value to the USE_PREF_SIZE
flag will cause
getMaxWidth(forHeight)
to return the region's preferred width,
enabling applications to easily restrict the resizability of the region.
getMaxWidth()
,
setMaxWidth(double)
public final DoubleProperty maxHeightProperty
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getMaxHeight(forWidth)
will return the region's internally
computed maximum height.
Setting this value to the USE_PREF_SIZE
flag will cause
getMaxHeight(forWidth)
to return the region's preferred height,
enabling applications to easily restrict the resizability of the region.
getMaxHeight()
,
setMaxHeight(double)
public final <any> shapeProperty
Shape
will cause the region to be
rendered as the specified shape rather than as a rounded rectangle.
When null, the Region is rendered as a rounded rectangle. When rendered
as a Shape, any Background is used to fill the shape, although any
background insets are ignored as are background radii. Any BorderStrokes
defined are used for stroking the shape. Any BorderImages are ignored.getShape()
,
setShape(Shape)
public final BooleanProperty scaleShapeProperty
true
means the shape is scaled to fit the size of the Region, false
means the shape is at its source size, its positioning depends on the value of
centerShape
.isScaleShape()
,
setScaleShape(boolean)
public final BooleanProperty centerShapeProperty
true
means the shape centered within the Region's width and height,
false
means the shape is positioned at its source position.isCenterShape()
,
setCenterShape(boolean)
public final BooleanProperty cacheShapeProperty
isCacheShape()
,
setCacheShape(boolean)
public static final double USE_PREF_SIZE
setMinWidth
,
setMinHeight
,
setMaxWidth
or
setMaxHeight
methods to indicate that the preferred dimension should be used for that max and/or min constraint.public static final double USE_COMPUTED_SIZE
setMinWidth
,
setMinHeight
,
setPrefWidth
,
setPrefHeight
,
setMaxWidth
,
setMaxHeight
methods
to reset the region's size constraint back to it's intrinsic size returned
by computeMinWidth
, computeMinHeight
,
computePrefWidth
, computePrefHeight
,
computeMaxWidth
, or computeMaxHeight
.static Vec2d TEMP_VEC2D
private InvalidationListener imageChangeListener
private BooleanProperty snapToPixel
private boolean _snapToPixel
private <any> padding
private final <any> background
private final <any> border
private <any> opaqueInsets
private final Region.InsetsProperty insets
private double snappedTopInset
private double snappedRightInset
private double snappedBottomInset
private double snappedLeftInset
private ReadOnlyDoubleWrapper width
minWidth
, prefWidth
,
and maxWidth
properties.private double _width
private ReadOnlyDoubleWrapper height
minHeight
, prefHeight
,
and maxHeight
properties.private double _height
private DoubleProperty minWidth
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minWidth(forHeight)
will return the region's internally
computed minimum width.
Setting this value to the USE_PREF_SIZE
flag will cause
minWidth(forHeight)
to return the region's preferred width,
enabling applications to easily restrict the resizability of the region.
private double _minWidth
private DoubleProperty minHeight
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minHeight(forWidth)
will return the region's internally
computed minimum height.
Setting this value to the USE_PREF_SIZE
flag will cause
minHeight(forWidth)
to return the region's preferred height,
enabling applications to easily restrict the resizability of the region.
private double _minHeight
private DoubleProperty prefWidth
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefWidth(forHeight)
will return the region's internally
computed preferred width.
private double _prefWidth
private DoubleProperty prefHeight
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefHeight(forWidth)
will return the region's internally
computed preferred width.
private double _prefHeight
private DoubleProperty maxWidth
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getMaxWidth(forHeight)
will return the region's internally
computed maximum width.
Setting this value to the USE_PREF_SIZE
flag will cause
getMaxWidth(forHeight)
to return the region's preferred width,
enabling applications to easily restrict the resizability of the region.
private double _maxWidth
private DoubleProperty maxHeight
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getMaxHeight(forWidth)
will return the region's internally
computed maximum height.
Setting this value to the USE_PREF_SIZE
flag will cause
getMaxHeight(forWidth)
to return the region's preferred height,
enabling applications to easily restrict the resizability of the region.
private double _maxHeight
private <any> shape
Shape
will cause the region to be
rendered as the specified shape rather than as a rounded rectangle.
When null, the Region is rendered as a rounded rectangle. When rendered
as a Shape, any Background is used to fill the shape, although any
background insets are ignored as are background radii. Any BorderStrokes
defined are used for stroking the shape. Any BorderImages are ignored.private Shape _shape
private BooleanProperty scaleShape
true
means the shape is scaled to fit the size of the Region, false
means the shape is at its source size, its positioning depends on the value of
centerShape
.private BooleanProperty centerShape
true
means the shape centered within the Region's width and height,
false
means the shape is positioned at its source position.private BooleanProperty cacheShape
private boolean cornersValid
private java.util.List<CornerRadii> normalizedFillCorners
private java.util.List<CornerRadii> normalizedStrokeCorners
private Bounds boundingBox
public Region()
static double boundedSize(double min, double pref, double max)
min
- The minimum boundpref
- The value to be clamped between the min and maxmax
- the maximum bounddouble adjustWidthByMargin(double width, Insets margin)
double adjustHeightByMargin(double height, Insets margin)
private static double getSnapScaleX(Node n)
private static double _getSnapScaleXimpl(Scene scene)
private static double getSnapScaleY(Node n)
private static double _getSnapScaleYimpl(Scene scene)
private double getSnapScaleX()
private double getSnapScaleY()
private static double scaledRound(double value, double scale)
private static double scaledFloor(double value, double scale)
private static double scaledCeil(double value, double scale)
private double snapSpaceX(double value, boolean snapToPixel)
value
- The value that needs to be snappedsnapToPixel
- Whether to snap to pixelprivate double snapSpaceY(double value, boolean snapToPixel)
private static double snapSpace(double value, boolean snapToPixel, double snapScale)
private double snapSizeX(double value, boolean snapToPixel)
value
- The value that needs to be snappedsnapToPixel
- Whether to snap to pixelprivate double snapSizeY(double value, boolean snapToPixel)
private static double snapSize(double value, boolean snapToPixel, double snapScale)
private double snapPositionX(double value, boolean snapToPixel)
value
- The value that needs to be snappedsnapToPixel
- Whether to snap to pixelprivate double snapPositionY(double value, boolean snapToPixel)
private static double snapPosition(double value, boolean snapToPixel, double snapScale)
private double snapPortionX(double value, boolean snapToPixel)
private double snapPortionY(double value, boolean snapToPixel)
double getAreaBaselineOffset(java.util.List<Node> children, <any> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, boolean fillHeight)
static double getAreaBaselineOffset(java.util.List<Node> children, <any> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, boolean fillHeight, boolean snapToPixel)
double getAreaBaselineOffset(java.util.List<Node> children, <any> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, boolean fillHeight, double minComplement)
static double getAreaBaselineOffset(java.util.List<Node> children, <any> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, boolean fillHeight, double minComplement, boolean snapToPixel)
double getAreaBaselineOffset(java.util.List<Node> children, <any> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, java.util.function.Function<java.lang.Integer,java.lang.Boolean> fillHeight, double minComplement)
static double getAreaBaselineOffset(java.util.List<Node> children, <any> margins, java.util.function.Function<java.lang.Integer,java.lang.Double> positionToWidth, double areaHeight, java.util.function.Function<java.lang.Integer,java.lang.Boolean> fillHeight, double minComplement, boolean snapToPixel)
getMinBaselineComplement(java.util.List)
from the same set of children.children
- the children with baseline alignmentmargins
- their margins (callback)positionToWidth
- callback for children widths (can return -1 if no bias is used)areaHeight
- height of the area to layout infillHeight
- callback to specify children that has fillHeight constraintminComplement
- minimum complementstatic double getMinBaselineComplement(java.util.List<Node> children)
children
- static double getPrefBaselineComplement(java.util.List<Node> children)
children
- static double getMaxBaselineComplement(java.util.List<Node> children)
children
- private static double getBaselineComplement(java.util.List<Node> children, boolean min, boolean max)
static double computeXOffset(double width, double contentWidth, HPos hpos)
static double computeYOffset(double height, double contentHeight, VPos vpos)
static double[] createDoubleArray(int length, double value)
public final boolean isSnapToPixel()
public final void setSnapToPixel(boolean value)
public final BooleanProperty snapToPixelProperty()
isSnapToPixel()
,
setSnapToPixel(boolean)
public final void setPadding(Insets value)
public final Insets getPadding()
public final <any> paddingProperty()
getPadding()
,
setPadding(Insets)
public final void setBackground(Background value)
public final Background getBackground()
public final <any> backgroundProperty()
getBackground()
,
setBackground(Background)
public final void setBorder(Border value)
public final Border getBorder()
public final <any> borderProperty()
getBorder()
,
setBorder(Border)
void addImageListener(Image image)
image
- a non-null imagevoid removeImageListener(Image image)
image
- a non-null imagepublic final <any> opaqueInsetsProperty()
getOpaqueInsets()
,
setOpaqueInsets(Insets)
public final void setOpaqueInsets(Insets value)
public final Insets getOpaqueInsets()
public final Insets getInsets()
public final <any> insetsProperty()
getInsets()
private void updateSnappedInsets()
protected void setWidth(double value)
private void widthChanged(double value)
public final double getWidth()
public final ReadOnlyDoubleProperty widthProperty()
minWidth
, prefWidth
,
and maxWidth
properties.getWidth()
,
setWidth(double)
protected void setHeight(double value)
private void heightChanged(double value)
public final double getHeight()
public final ReadOnlyDoubleProperty heightProperty()
minHeight
, prefHeight
,
and maxHeight
properties.getHeight()
,
setHeight(double)
public final void setMinWidth(double value)
public final double getMinWidth()
public final DoubleProperty minWidthProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minWidth(forHeight)
will return the region's internally
computed minimum width.
Setting this value to the USE_PREF_SIZE
flag will cause
minWidth(forHeight)
to return the region's preferred width,
enabling applications to easily restrict the resizability of the region.
getMinWidth()
,
setMinWidth(double)
public final void setMinHeight(double value)
public final double getMinHeight()
public final DoubleProperty minHeightProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
minHeight(forWidth)
will return the region's internally
computed minimum height.
Setting this value to the USE_PREF_SIZE
flag will cause
minHeight(forWidth)
to return the region's preferred height,
enabling applications to easily restrict the resizability of the region.
getMinHeight()
,
setMinHeight(double)
public void setMinSize(double minWidth, double minHeight)
minWidth
- the override value for minimum widthminHeight
- the override value for minimum heightsetMinWidth(double)
,
setMinHeight(double)
public final void setPrefWidth(double value)
public final double getPrefWidth()
public final DoubleProperty prefWidthProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefWidth(forHeight)
will return the region's internally
computed preferred width.
getPrefWidth()
,
setPrefWidth(double)
public final void setPrefHeight(double value)
public final double getPrefHeight()
public final DoubleProperty prefHeightProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getPrefHeight(forWidth)
will return the region's internally
computed preferred width.
getPrefHeight()
,
setPrefHeight(double)
public void setPrefSize(double prefWidth, double prefHeight)
prefWidth
- the override value for preferred widthprefHeight
- the override value for preferred heightsetPrefWidth(double)
,
setPrefHeight(double)
public final void setMaxWidth(double value)
public final double getMaxWidth()
public final DoubleProperty maxWidthProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getMaxWidth(forHeight)
will return the region's internally
computed maximum width.
Setting this value to the USE_PREF_SIZE
flag will cause
getMaxWidth(forHeight)
to return the region's preferred width,
enabling applications to easily restrict the resizability of the region.
getMaxWidth()
,
setMaxWidth(double)
public final void setMaxHeight(double value)
public final double getMaxHeight()
public final DoubleProperty maxHeightProperty()
Defaults to the USE_COMPUTED_SIZE
flag, which means that
getMaxHeight(forWidth)
will return the region's internally
computed maximum height.
Setting this value to the USE_PREF_SIZE
flag will cause
getMaxHeight(forWidth)
to return the region's preferred height,
enabling applications to easily restrict the resizability of the region.
getMaxHeight()
,
setMaxHeight(double)
public void setMaxSize(double maxWidth, double maxHeight)
maxWidth
- the override value for maximum widthmaxHeight
- the override value for maximum heightsetMaxWidth(double)
,
setMaxHeight(double)
public final Shape getShape()
public final void setShape(Shape value)
public final <any> shapeProperty()
Shape
will cause the region to be
rendered as the specified shape rather than as a rounded rectangle.
When null, the Region is rendered as a rounded rectangle. When rendered
as a Shape, any Background is used to fill the shape, although any
background insets are ignored as are background radii. Any BorderStrokes
defined are used for stroking the shape. Any BorderImages are ignored.getShape()
,
setShape(Shape)
public final void setScaleShape(boolean value)
public final boolean isScaleShape()
public final BooleanProperty scaleShapeProperty()
true
means the shape is scaled to fit the size of the Region, false
means the shape is at its source size, its positioning depends on the value of
centerShape
.isScaleShape()
,
setScaleShape(boolean)
public final void setCenterShape(boolean value)
public final boolean isCenterShape()
public final BooleanProperty centerShapeProperty()
true
means the shape centered within the Region's width and height,
false
means the shape is positioned at its source position.isCenterShape()
,
setCenterShape(boolean)
public final void setCacheShape(boolean value)
public final boolean isCacheShape()
public final BooleanProperty cacheShapeProperty()
isCacheShape()
,
setCacheShape(boolean)
public boolean isResizable()
true
since all Regions are resizable.public void resize(double width, double height)
setMinSize()
,
setPrefSize()
, or setMaxSize()
and it's parent
will honor those overrides during layout.width
- the target layout bounds widthheight
- the target layout bounds heightpublic final double minWidth(double height)
computeMinWidth(forHeight)
unless
the application overrode the minimum width by setting the minWidth property.setMinWidth(double)
public final double minHeight(double width)
computeMinHeight(forWidth)
unless
the application overrode the minimum height by setting the minHeight property.setMinHeight(double)
public final double prefWidth(double height)
computePrefWidth(forHeight)
unless
the application overrode the preferred width by setting the prefWidth property.setPrefWidth(double)
public final double prefHeight(double width)
computePrefHeight(forWidth)
unless
the application overrode the preferred height by setting the prefHeight property.setPrefHeight(double)
public final double maxWidth(double height)
computeMaxWidth(forHeight)
unless
the application overrode the maximum width by setting the maxWidth property.setMaxWidth(double)
public final double maxHeight(double width)
computeMaxHeight(forWidth)
unless
the application overrode the maximum height by setting the maxHeight property.setMaxHeight(double)
protected double computeMinWidth(double height)
protected double computeMinHeight(double width)
protected double computePrefWidth(double height)
protected double computePrefHeight(double width)
protected double computeMaxWidth(double height)
height
- The height of the Region, in case this value might dictate
the maximum widthprotected double computeMaxHeight(double width)
width
- The width of the Region, in case this value might dictate
the maximum height@Deprecated protected double snapSpace(double value)
snapSpaceX()
and snapSpaceY()
value
- the space value to be snappedpublic double snapSpaceX(double value)
value
- the space value to be snappedpublic double snapSpaceY(double value)
value
- the space value to be snapped@Deprecated protected double snapSize(double value)
snapSizeX()
and snapSizeY()
value
- the size value to be snappedpublic double snapSizeX(double value)
value
- the size value to be snappedpublic double snapSizeY(double value)
value
- the size value to be snapped@Deprecated protected double snapPosition(double value)
snapPositionX()
and snapPositionY()
value
- the position value to be snappedpublic double snapPositionX(double value)
value
- the position value to be snappedpublic double snapPositionY(double value)
value
- the position value to be snappeddouble snapPortionX(double value)
double snapPortionY(double value)
public final double snappedTopInset()
public final double snappedBottomInset()
public final double snappedLeftInset()
public final double snappedRightInset()
double computeChildMinAreaWidth(Node child, Insets margin)
double computeChildMinAreaWidth(Node child, double baselineComplement, Insets margin, double height, boolean fillHeight)
double computeChildMinAreaHeight(Node child, Insets margin)
double computeChildMinAreaHeight(Node child, double minBaselineComplement, Insets margin, double width)
double computeChildPrefAreaWidth(Node child, Insets margin)
double computeChildPrefAreaWidth(Node child, double baselineComplement, Insets margin, double height, boolean fillHeight)
double computeChildPrefAreaHeight(Node child, Insets margin)
double computeChildPrefAreaHeight(Node child, double prefBaselineComplement, Insets margin, double width)
double computeChildMaxAreaWidth(Node child, double baselineComplement, Insets margin, double height, boolean fillHeight)
double computeChildMaxAreaHeight(Node child, double maxBaselineComplement, Insets margin, double width)
double computeMaxMinAreaWidth(java.util.List<Node> children, <any> margins)
double computeMaxMinAreaWidth(java.util.List<Node> children, <any> margins, double height, boolean fillHeight)
double computeMaxMinAreaWidth(java.util.List<Node> children, <any> childMargins, double[] childHeights, boolean fillHeight)
double computeMaxMinAreaHeight(java.util.List<Node> children, <any> margins, VPos valignment)
double computeMaxMinAreaHeight(java.util.List<Node> children, <any> margins, VPos valignment, double width)
double computeMaxMinAreaHeight(java.util.List<Node> children, <any> childMargins, double[] childWidths, VPos valignment)
double computeMaxPrefAreaWidth(java.util.List<Node> children, <any> margins)
double computeMaxPrefAreaWidth(java.util.List<Node> children, <any> margins, double height, boolean fillHeight)
double computeMaxPrefAreaWidth(java.util.List<Node> children, <any> childMargins, double[] childHeights, boolean fillHeight)
double computeMaxPrefAreaHeight(java.util.List<Node> children, <any> margins, VPos valignment)
double computeMaxPrefAreaHeight(java.util.List<Node> children, <any> margins, double width, VPos valignment)
double computeMaxPrefAreaHeight(java.util.List<Node> children, <any> childMargins, double[] childWidths, VPos valignment)
static Vec2d boundedNodeSizeWithBias(Node node, double areaWidth, double areaHeight, boolean fillWidth, boolean fillHeight, Vec2d result)
node
- the nodeareaWidth
- the width of the bounding area where the node is going to be placedareaHeight
- the height of the bounding area where the node is going to be placedfillWidth
- if Node should try to fill the area widthfillHeight
- if Node should try to fill the area heightresult
- Vec2d object for the result or null if new one should be createdprivate double getMaxAreaHeight(java.util.List<Node> children, <any> childMargins, double[] childWidths, VPos valignment, boolean minimum)
private double getMaxAreaWidth(java.util.List<javafx.scene.Node> children, <any> childMargins, double[] childHeights, boolean fillHeight, boolean minimum)
protected void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, HPos halignment, VPos valignment)
areaX
, areaY
, areaWidth
x areaHeight
,
with a baseline offset relative to that area.
This function does not resize the node and uses the node's layout bounds width and height to determine how it should be positioned within the area.
If the vertical alignment is VPos.BASELINE
then it
will position the node so that its own baseline aligns with the passed in
baselineOffset
, otherwise the baseline parameter is ignored.
If snapToPixel
is true
for this region, then the x/y position
values will be rounded to their nearest pixel boundaries.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEhalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areapublic static void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment, boolean isSnapToPixel)
areaX
, areaY
, areaWidth
x areaHeight
,
with a baseline offset relative to that area.
This function does not resize the node and uses the node's layout bounds width and height to determine how it should be positioned within the area.
If the vertical alignment is VPos.BASELINE
then it
will position the node so that its own baseline aligns with the passed in
baselineOffset
, otherwise the baseline parameter is ignored.
If snapToPixel
is true
for this region, then the x/y position
values will be rounded to their nearest pixel boundaries.
If margin
is non-null, then that space will be allocated around the
child within the layout area. margin may be null.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEmargin
- the margin of space to be allocated around the childhalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areaisSnapToPixel
- whether to snap size and position to pixelsprotected void layoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, HPos halignment, VPos valignment)
areaX
, areaY
, areaWidth
x areaHeight
,
with a baseline offset relative to that area.
If the child is resizable, this method will resize it to fill the specified area unless the node's maximum size prevents it. If the node's maximum size preference is less than the area size, the maximum size will be used. If node's maximum is greater than the area size, then the node will be resized to fit within the area, unless its minimum size prevents it.
If the child has a non-null contentBias, then this method will use it when resizing the child. If the contentBias is horizontal, it will set its width first to the area's width (up to the child's max width limit) and then pass that value to compute the child's height. If child's contentBias is vertical, then it will set its height to the area height (up to child's max height limit) and pass that height to compute the child's width. If the child's contentBias is null, then it's width and height have no dependencies on each other.
If the child is not resizable (Shape, Group, etc) then it will only be positioned and not resized.
If the child's resulting size differs from the area's size (either
because it was not resizable or it's sizing preferences prevented it), then
this function will align the node relative to the area using horizontal and
vertical alignment values.
If valignment is VPos.BASELINE
then the node's baseline will be aligned
with the area baseline offset parameter, otherwise the baseline parameter
is ignored.
If snapToPixel
is true
for this region, then the resulting x,y
values will be rounded to their nearest pixel boundaries and the
width/height values will be ceiled to the next pixel boundary.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEhalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areaprotected void layoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment)
areaX
, areaY
, areaWidth
x areaHeight
,
with a baseline offset relative to that area.
If the child is resizable, this method will resize it to fill the specified area unless the node's maximum size prevents it. If the node's maximum size preference is less than the area size, the maximum size will be used. If node's maximum is greater than the area size, then the node will be resized to fit within the area, unless its minimum size prevents it.
If the child has a non-null contentBias, then this method will use it when resizing the child. If the contentBias is horizontal, it will set its width first to the area's width (up to the child's max width limit) and then pass that value to compute the child's height. If child's contentBias is vertical, then it will set its height to the area height (up to child's max height limit) and pass that height to compute the child's width. If the child's contentBias is null, then it's width and height have no dependencies on each other.
If the child is not resizable (Shape, Group, etc) then it will only be positioned and not resized.
If the child's resulting size differs from the area's size (either
because it was not resizable or it's sizing preferences prevented it), then
this function will align the node relative to the area using horizontal and
vertical alignment values.
If valignment is VPos.BASELINE
then the node's baseline will be aligned
with the area baseline offset parameter, otherwise the baseline parameter
is ignored.
If margin
is non-null, then that space will be allocated around the
child within the layout area. margin may be null.
If snapToPixel
is true
for this region, then the resulting x,y
values will be rounded to their nearest pixel boundaries and the
width/height values will be ceiled to the next pixel boundary.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEmargin
- the margin of space to be allocated around the childhalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areaprotected void layoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, boolean fillWidth, boolean fillHeight, HPos halignment, VPos valignment)
areaX
, areaY
, areaWidth
x areaHeight
,
with a baseline offset relative to that area.
If the child is resizable, this method will use fillWidth
and fillHeight
to determine whether to resize it to fill the area or keep the child at its
preferred dimension. If fillWidth/fillHeight are true, then this method
will only resize the child up to its max size limits. If the node's maximum
size preference is less than the area size, the maximum size will be used.
If node's maximum is greater than the area size, then the node will be
resized to fit within the area, unless its minimum size prevents it.
If the child has a non-null contentBias, then this method will use it when resizing the child. If the contentBias is horizontal, it will set its width first and then pass that value to compute the child's height. If child's contentBias is vertical, then it will set its height first and pass that value to compute the child's width. If the child's contentBias is null, then it's width and height have no dependencies on each other.
If the child is not resizable (Shape, Group, etc) then it will only be positioned and not resized.
If the child's resulting size differs from the area's size (either
because it was not resizable or it's sizing preferences prevented it), then
this function will align the node relative to the area using horizontal and
vertical alignment values.
If valignment is VPos.BASELINE
then the node's baseline will be aligned
with the area baseline offset parameter, otherwise the baseline parameter
is ignored.
If margin
is non-null, then that space will be allocated around the
child within the layout area. margin may be null.
If snapToPixel
is true
for this region, then the resulting x,y
values will be rounded to their nearest pixel boundaries and the
width/height values will be ceiled to the next pixel boundary.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEmargin
- the margin of space to be allocated around the childfillWidth
- whether or not the child should be resized to fill the area width or kept to its preferred widthfillHeight
- whether or not the child should e resized to fill the area height or kept to its preferred heighthalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areapublic static void layoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, boolean fillWidth, boolean fillHeight, HPos halignment, VPos valignment, boolean isSnapToPixel)
areaX
, areaY
, areaWidth
x areaHeight
,
with a baseline offset relative to that area.
If the child is resizable, this method will use fillWidth
and fillHeight
to determine whether to resize it to fill the area or keep the child at its
preferred dimension. If fillWidth/fillHeight are true, then this method
will only resize the child up to its max size limits. If the node's maximum
size preference is less than the area size, the maximum size will be used.
If node's maximum is greater than the area size, then the node will be
resized to fit within the area, unless its minimum size prevents it.
If the child has a non-null contentBias, then this method will use it when resizing the child. If the contentBias is horizontal, it will set its width first and then pass that value to compute the child's height. If child's contentBias is vertical, then it will set its height first and pass that value to compute the child's width. If the child's contentBias is null, then it's width and height have no dependencies on each other.
If the child is not resizable (Shape, Group, etc) then it will only be positioned and not resized.
If the child's resulting size differs from the area's size (either
because it was not resizable or it's sizing preferences prevented it), then
this function will align the node relative to the area using horizontal and
vertical alignment values.
If valignment is VPos.BASELINE
then the node's baseline will be aligned
with the area baseline offset parameter, otherwise the baseline parameter
is ignored.
If margin
is non-null, then that space will be allocated around the
child within the layout area. margin may be null.
If snapToPixel
is true
for this region, then the resulting x,y
values will be rounded to their nearest pixel boundaries and the
width/height values will be ceiled to the next pixel boundary.
child
- the child being positioned within this regionareaX
- the horizontal offset of the layout area relative to this regionareaY
- the vertical offset of the layout area relative to this regionareaWidth
- the width of the layout areaareaHeight
- the height of the layout areaareaBaselineOffset
- the baseline offset to be used if VPos is BASELINEmargin
- the margin of space to be allocated around the childfillWidth
- whether or not the child should be resized to fill the area width or kept to its preferred widthfillHeight
- whether or not the child should e resized to fill the area height or kept to its preferred heighthalignment
- the horizontal alignment for the child within the areavalignment
- the vertical alignment for the child within the areaisSnapToPixel
- whether to snap size and position to pixelsprivate static void position(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, double topMargin, double rightMargin, double bottomMargin, double leftMargin, HPos hpos, VPos vpos, boolean isSnapToPixel)
private void doUpdatePeer()
private NGNode doCreatePeer()
private boolean shapeContains(com.sun.javafx.geom.Shape shape, double x, double y, double topOffset, double rightOffset, double bottomOffset, double leftOffset)
private boolean doComputeContains(double localX, double localY)
private boolean contains(double px, double py, double x1, double y1, double x2, double y2, BorderWidths widths, boolean filled, Insets insets, CornerRadii rad)
px
- The x position of the point to testpy
- The y position of the point to testx1
- The x1 position of the bounds to testy1
- The y1 position of the bounds to testx2
- The x2 position of the bounds to testy2
- The y2 position of the bounds to testwidths
- The widths of the stroke on each sidefilled
- Whether the area is filled or is just strokedinsets
- The insets to apply to (x1,y1)-(x2,y2) to get the final bounds to testrad
- The corner radii to test with. Must not be null.maxRadius
- The maximum possible radius valueprivate boolean contains(double px, double py, double x1, double y1, double x2, double y2, Insets insets, CornerRadii rad)
px
- The x position of the point to testpy
- The y position of the point to testx1
- The x1 position of the bounds to testy1
- The y1 position of the bounds to testx2
- The x2 position of the bounds to testy2
- The y2 position of the bounds to testinsets
- The insets to apply to (x1,y1)-(x2,y2) to get the final bounds to testrad
- The corner radii to test with. Must not be null.maxRadius
- The maximum possible radius valueprivate CornerRadii getNormalizedFillCorner(int i)
i
- the index of the BackgroundFill whose radii will be normalized.private CornerRadii getNormalizedStrokeCorner(int i)
i
- the index of the BorderStroke whose radii will be normalized.private void validateCorners()
private static CornerRadii normalize(CornerRadii radii, Insets insets, double width, double height)
radii
- The radii.insets
- The insets for the associated background or stroke.width
- The width of the region before insets are applied.height
- The height of the region before insets are applied.private void doPickNodeLocal(PickRay pickRay, PickResultChooser result)
private Bounds doComputeLayoutBounds()
0, 0 width x height
private void doNotifyLayoutBoundsChanged()
private BaseBounds computeShapeBounds(BaseBounds bounds)
private BaseBounds doComputeGeomBounds(BaseBounds bounds, BaseTransform tx)
public java.lang.String getUserAgentStylesheet()
The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.
Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.
package com.example.javafx.app;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MyApp extends Application {
@Override public void start(Stage stage) {
Scene scene = new Scene(new Group());
scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
For additional information about using CSS with the scene graph,
see the CSS Reference Guide.public static java.util.List<<any>> getClassCssMetaData()
public java.util.List<<any>> getCssMetaData()