Checkstyle: fix variable declaration [VariableDeclarationUsageDistance]

This commit is contained in:
mkpaz 2023-02-10 15:00:49 +04:00
parent 3e9189ff44
commit 4c3daeb798
9 changed files with 124 additions and 163 deletions

@ -306,26 +306,24 @@ public class PopoverSkin implements Skin<Popover> {
lineJLeft; lineJLeft;
private void createPathElements() { private void createPathElements() {
DoubleProperty centerYProperty = new SimpleDoubleProperty(); final DoubleProperty centerYProperty = new SimpleDoubleProperty();
DoubleProperty centerXProperty = new SimpleDoubleProperty(); final DoubleProperty centerXProperty = new SimpleDoubleProperty();
DoubleProperty leftEdgeProperty = new SimpleDoubleProperty(); final DoubleProperty leftEdgeProperty = new SimpleDoubleProperty();
DoubleProperty leftEdgePlusRadiusProperty = new SimpleDoubleProperty(); final DoubleProperty leftEdgePlusRadiusProperty = new SimpleDoubleProperty();
DoubleProperty topEdgeProperty = new SimpleDoubleProperty(); final DoubleProperty topEdgeProperty = new SimpleDoubleProperty();
DoubleProperty topEdgePlusRadiusProperty = new SimpleDoubleProperty(); final DoubleProperty topEdgePlusRadiusProperty = new SimpleDoubleProperty();
DoubleProperty rightEdgeProperty = new SimpleDoubleProperty(); final DoubleProperty rightEdgeProperty = new SimpleDoubleProperty();
DoubleProperty rightEdgeMinusRadiusProperty = new SimpleDoubleProperty(); final DoubleProperty rightEdgeMinusRadiusProperty = new SimpleDoubleProperty();
DoubleProperty bottomEdgeProperty = new SimpleDoubleProperty(); final DoubleProperty bottomEdgeProperty = new SimpleDoubleProperty();
DoubleProperty bottomEdgeMinusRadiusProperty = new SimpleDoubleProperty(); final DoubleProperty bottomEdgeMinusRadiusProperty = new SimpleDoubleProperty();
DoubleProperty cornerProperty = getSkinnable().cornerRadiusProperty(); final DoubleProperty cornerProperty = getSkinnable().cornerRadiusProperty();
final DoubleProperty arrowSizeProperty = getSkinnable().arrowSizeProperty();
DoubleProperty arrowSizeProperty = getSkinnable().arrowSizeProperty(); final DoubleProperty arrowIndentProperty = getSkinnable().arrowIndentProperty();
DoubleProperty arrowIndentProperty = getSkinnable()
.arrowIndentProperty();
centerYProperty.bind(Bindings.divide(stackPane.heightProperty(), 2)); centerYProperty.bind(Bindings.divide(stackPane.heightProperty(), 2));
centerXProperty.bind(Bindings.divide(stackPane.widthProperty(), 2)); centerXProperty.bind(Bindings.divide(stackPane.widthProperty(), 2));
@ -351,52 +349,44 @@ public class PopoverSkin implements Skin<Popover> {
// == TOP EDGE == // == TOP EDGE ==
lineBTop = new HLineTo(); lineBTop = new HLineTo();
lineBTop.xProperty().bind( lineBTop.xProperty().bind(Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty));
Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty));
lineCTop = new LineTo(); lineCTop = new LineTo();
lineCTop.xProperty().bind( lineCTop.xProperty().bind(Bindings.add(lineBTop.xProperty(), arrowSizeProperty));
Bindings.add(lineBTop.xProperty(), arrowSizeProperty)); lineCTop.yProperty().bind(Bindings.subtract(topEdgeProperty, arrowSizeProperty));
lineCTop.yProperty().bind(
Bindings.subtract(topEdgeProperty, arrowSizeProperty));
lineDTop = new LineTo(); lineDTop = new LineTo();
lineDTop.xProperty().bind( lineDTop.xProperty().bind(Bindings.add(lineCTop.xProperty(), arrowSizeProperty));
Bindings.add(lineCTop.xProperty(), arrowSizeProperty));
lineDTop.yProperty().bind(topEdgeProperty); lineDTop.yProperty().bind(topEdgeProperty);
lineETop = new HLineTo(); lineETop = new HLineTo();
lineETop.xProperty().bind( lineETop.xProperty().bind(Bindings.subtract(centerXProperty, arrowSizeProperty));
Bindings.subtract(centerXProperty, arrowSizeProperty));
lineFTop = new LineTo(); lineFTop = new LineTo();
lineFTop.xProperty().bind(centerXProperty); lineFTop.xProperty().bind(centerXProperty);
lineFTop.yProperty().bind( lineFTop.yProperty().bind(Bindings.subtract(topEdgeProperty, arrowSizeProperty));
Bindings.subtract(topEdgeProperty, arrowSizeProperty));
lineGTop = new LineTo(); lineGTop = new LineTo();
lineGTop.xProperty().bind( lineGTop.xProperty().bind(Bindings.add(centerXProperty, arrowSizeProperty));
Bindings.add(centerXProperty, arrowSizeProperty));
lineGTop.yProperty().bind(topEdgeProperty); lineGTop.yProperty().bind(topEdgeProperty);
lineHTop = new HLineTo(); lineHTop = new HLineTo();
lineHTop.xProperty().bind( lineHTop.xProperty().bind(Bindings.subtract(
Bindings.subtract(Bindings.subtract( Bindings.subtract(rightEdgeMinusRadiusProperty, arrowIndentProperty),
rightEdgeMinusRadiusProperty, arrowIndentProperty), Bindings.multiply(arrowSizeProperty, 2)
Bindings.multiply(arrowSizeProperty, 2))); ));
lineITop = new LineTo(); lineITop = new LineTo();
lineITop.xProperty().bind( lineITop.xProperty().bind(Bindings.subtract(
Bindings.subtract(Bindings.subtract( Bindings.subtract(rightEdgeMinusRadiusProperty, arrowIndentProperty),
rightEdgeMinusRadiusProperty, arrowIndentProperty), arrowSizeProperty
arrowSizeProperty)); ));
lineITop.yProperty().bind( lineITop.yProperty().bind(Bindings.subtract(topEdgeProperty, arrowSizeProperty));
Bindings.subtract(topEdgeProperty, arrowSizeProperty));
lineJTop = new LineTo(); lineJTop = new LineTo();
lineJTop.xProperty().bind( lineJTop.xProperty().bind(Bindings.subtract(
Bindings.subtract(rightEdgeMinusRadiusProperty, rightEdgeMinusRadiusProperty, arrowIndentProperty
arrowIndentProperty)); ));
lineJTop.yProperty().bind(topEdgeProperty); lineJTop.yProperty().bind(topEdgeProperty);
lineKTop = new HLineTo(); lineKTop = new HLineTo();
@ -405,59 +395,51 @@ public class PopoverSkin implements Skin<Popover> {
// == RIGHT EDGE == // == RIGHT EDGE ==
rightCurveTo = new QuadCurveTo(); rightCurveTo = new QuadCurveTo();
rightCurveTo.xProperty().bind(rightEdgeProperty); rightCurveTo.xProperty().bind(rightEdgeProperty);
rightCurveTo.yProperty().bind( rightCurveTo.yProperty().bind(Bindings.add(topEdgeProperty, cornerProperty));
Bindings.add(topEdgeProperty, cornerProperty));
rightCurveTo.controlXProperty().bind(rightEdgeProperty); rightCurveTo.controlXProperty().bind(rightEdgeProperty);
rightCurveTo.controlYProperty().bind(topEdgeProperty); rightCurveTo.controlYProperty().bind(topEdgeProperty);
lineBRight = new VLineTo(); lineBRight = new VLineTo();
lineBRight.yProperty().bind( lineBRight.yProperty().bind(Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty));
Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty));
lineCRight = new LineTo(); lineCRight = new LineTo();
lineCRight.xProperty().bind( lineCRight.xProperty().bind(Bindings.add(rightEdgeProperty, arrowSizeProperty));
Bindings.add(rightEdgeProperty, arrowSizeProperty)); lineCRight.yProperty().bind(Bindings.add(lineBRight.yProperty(), arrowSizeProperty));
lineCRight.yProperty().bind(
Bindings.add(lineBRight.yProperty(), arrowSizeProperty));
lineDRight = new LineTo(); lineDRight = new LineTo();
lineDRight.xProperty().bind(rightEdgeProperty); lineDRight.xProperty().bind(rightEdgeProperty);
lineDRight.yProperty().bind( lineDRight.yProperty().bind(Bindings.add(lineCRight.yProperty(), arrowSizeProperty));
Bindings.add(lineCRight.yProperty(), arrowSizeProperty));
lineERight = new VLineTo(); lineERight = new VLineTo();
lineERight.yProperty().bind( lineERight.yProperty().bind(Bindings.subtract(centerYProperty, arrowSizeProperty));
Bindings.subtract(centerYProperty, arrowSizeProperty));
lineFRight = new LineTo(); lineFRight = new LineTo();
lineFRight.xProperty().bind( lineFRight.xProperty().bind(Bindings.add(rightEdgeProperty, arrowSizeProperty));
Bindings.add(rightEdgeProperty, arrowSizeProperty));
lineFRight.yProperty().bind(centerYProperty); lineFRight.yProperty().bind(centerYProperty);
lineGRight = new LineTo(); lineGRight = new LineTo();
lineGRight.xProperty().bind(rightEdgeProperty); lineGRight.xProperty().bind(rightEdgeProperty);
lineGRight.yProperty().bind( lineGRight.yProperty().bind(Bindings.add(centerYProperty, arrowSizeProperty));
Bindings.add(centerYProperty, arrowSizeProperty));
lineHRight = new VLineTo(); lineHRight = new VLineTo();
lineHRight.yProperty().bind( lineHRight.yProperty().bind(Bindings.subtract(
Bindings.subtract(Bindings.subtract( Bindings.subtract(bottomEdgeMinusRadiusProperty, arrowIndentProperty),
bottomEdgeMinusRadiusProperty, arrowIndentProperty), Bindings.multiply(arrowSizeProperty, 2)
Bindings.multiply(arrowSizeProperty, 2))); ));
lineIRight = new LineTo(); lineIRight = new LineTo();
lineIRight.xProperty().bind( lineIRight.xProperty().bind(Bindings.add(rightEdgeProperty, arrowSizeProperty));
Bindings.add(rightEdgeProperty, arrowSizeProperty)); lineIRight.yProperty().bind(Bindings.subtract(
lineIRight.yProperty().bind( Bindings.subtract(bottomEdgeMinusRadiusProperty, arrowIndentProperty),
Bindings.subtract(Bindings.subtract( arrowSizeProperty
bottomEdgeMinusRadiusProperty, arrowIndentProperty), ));
arrowSizeProperty));
lineJRight = new LineTo(); lineJRight = new LineTo();
lineJRight.xProperty().bind(rightEdgeProperty); lineJRight.xProperty().bind(rightEdgeProperty);
lineJRight.yProperty().bind( lineJRight.yProperty().bind(Bindings.subtract(
Bindings.subtract(bottomEdgeMinusRadiusProperty, bottomEdgeMinusRadiusProperty,
arrowIndentProperty)); arrowIndentProperty
));
lineKRight = new VLineTo(); lineKRight = new VLineTo();
lineKRight.yProperty().bind(bottomEdgeMinusRadiusProperty); lineKRight.yProperty().bind(bottomEdgeMinusRadiusProperty);
@ -470,51 +452,42 @@ public class PopoverSkin implements Skin<Popover> {
bottomCurveTo.controlYProperty().bind(bottomEdgeProperty); bottomCurveTo.controlYProperty().bind(bottomEdgeProperty);
lineBBottom = new HLineTo(); lineBBottom = new HLineTo();
lineBBottom.xProperty().bind( lineBBottom.xProperty().bind(Bindings.subtract(rightEdgeMinusRadiusProperty, arrowIndentProperty));
Bindings.subtract(rightEdgeMinusRadiusProperty,
arrowIndentProperty));
lineCBottom = new LineTo(); lineCBottom = new LineTo();
lineCBottom.xProperty().bind( lineCBottom.xProperty().bind(Bindings.subtract(lineBBottom.xProperty(), arrowSizeProperty));
Bindings.subtract(lineBBottom.xProperty(), arrowSizeProperty)); lineCBottom.yProperty().bind(Bindings.add(bottomEdgeProperty, arrowSizeProperty));
lineCBottom.yProperty().bind(
Bindings.add(bottomEdgeProperty, arrowSizeProperty));
lineDBottom = new LineTo(); lineDBottom = new LineTo();
lineDBottom.xProperty().bind( lineDBottom.xProperty().bind(Bindings.subtract(lineCBottom.xProperty(), arrowSizeProperty));
Bindings.subtract(lineCBottom.xProperty(), arrowSizeProperty));
lineDBottom.yProperty().bind(bottomEdgeProperty); lineDBottom.yProperty().bind(bottomEdgeProperty);
lineEBottom = new HLineTo(); lineEBottom = new HLineTo();
lineEBottom.xProperty().bind( lineEBottom.xProperty().bind(Bindings.add(centerXProperty, arrowSizeProperty));
Bindings.add(centerXProperty, arrowSizeProperty));
lineFBottom = new LineTo(); lineFBottom = new LineTo();
lineFBottom.xProperty().bind(centerXProperty); lineFBottom.xProperty().bind(centerXProperty);
lineFBottom.yProperty().bind( lineFBottom.yProperty().bind(Bindings.add(bottomEdgeProperty, arrowSizeProperty));
Bindings.add(bottomEdgeProperty, arrowSizeProperty));
lineGBottom = new LineTo(); lineGBottom = new LineTo();
lineGBottom.xProperty().bind( lineGBottom.xProperty().bind(Bindings.subtract(centerXProperty, arrowSizeProperty));
Bindings.subtract(centerXProperty, arrowSizeProperty));
lineGBottom.yProperty().bind(bottomEdgeProperty); lineGBottom.yProperty().bind(bottomEdgeProperty);
lineHBottom = new HLineTo(); lineHBottom = new HLineTo();
lineHBottom.xProperty().bind( lineHBottom.xProperty().bind(Bindings.add(
Bindings.add(Bindings.add(leftEdgePlusRadiusProperty, Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty),
arrowIndentProperty), Bindings.multiply( Bindings.multiply(arrowSizeProperty, 2)
arrowSizeProperty, 2))); ));
lineIBottom = new LineTo(); lineIBottom = new LineTo();
lineIBottom.xProperty().bind( lineIBottom.xProperty().bind(Bindings.add(
Bindings.add(Bindings.add(leftEdgePlusRadiusProperty, Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty),
arrowIndentProperty), arrowSizeProperty)); arrowSizeProperty
lineIBottom.yProperty().bind( ));
Bindings.add(bottomEdgeProperty, arrowSizeProperty)); lineIBottom.yProperty().bind(Bindings.add(bottomEdgeProperty, arrowSizeProperty));
lineJBottom = new LineTo(); lineJBottom = new LineTo();
lineJBottom.xProperty().bind( lineJBottom.xProperty().bind(Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty));
Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty));
lineJBottom.yProperty().bind(bottomEdgeProperty); lineJBottom.yProperty().bind(bottomEdgeProperty);
lineKBottom = new HLineTo(); lineKBottom = new HLineTo();
@ -523,58 +496,48 @@ public class PopoverSkin implements Skin<Popover> {
// == LEFT EDGE == // == LEFT EDGE ==
leftCurveTo = new QuadCurveTo(); leftCurveTo = new QuadCurveTo();
leftCurveTo.xProperty().bind(leftEdgeProperty); leftCurveTo.xProperty().bind(leftEdgeProperty);
leftCurveTo.yProperty().bind( leftCurveTo.yProperty().bind(Bindings.subtract(bottomEdgeProperty, cornerProperty));
Bindings.subtract(bottomEdgeProperty, cornerProperty));
leftCurveTo.controlXProperty().bind(leftEdgeProperty); leftCurveTo.controlXProperty().bind(leftEdgeProperty);
leftCurveTo.controlYProperty().bind(bottomEdgeProperty); leftCurveTo.controlYProperty().bind(bottomEdgeProperty);
lineBLeft = new VLineTo(); lineBLeft = new VLineTo();
lineBLeft.yProperty().bind( lineBLeft.yProperty().bind(Bindings.subtract(bottomEdgeMinusRadiusProperty, arrowIndentProperty));
Bindings.subtract(bottomEdgeMinusRadiusProperty,
arrowIndentProperty));
lineCLeft = new LineTo(); lineCLeft = new LineTo();
lineCLeft.xProperty().bind( lineCLeft.xProperty().bind(Bindings.subtract(leftEdgeProperty, arrowSizeProperty));
Bindings.subtract(leftEdgeProperty, arrowSizeProperty)); lineCLeft.yProperty().bind(Bindings.subtract(lineBLeft.yProperty(), arrowSizeProperty));
lineCLeft.yProperty().bind(
Bindings.subtract(lineBLeft.yProperty(), arrowSizeProperty));
lineDLeft = new LineTo(); lineDLeft = new LineTo();
lineDLeft.xProperty().bind(leftEdgeProperty); lineDLeft.xProperty().bind(leftEdgeProperty);
lineDLeft.yProperty().bind( lineDLeft.yProperty().bind(Bindings.subtract(lineCLeft.yProperty(), arrowSizeProperty));
Bindings.subtract(lineCLeft.yProperty(), arrowSizeProperty));
lineELeft = new VLineTo(); lineELeft = new VLineTo();
lineELeft.yProperty().bind( lineELeft.yProperty().bind(Bindings.add(centerYProperty, arrowSizeProperty));
Bindings.add(centerYProperty, arrowSizeProperty));
lineFLeft = new LineTo(); lineFLeft = new LineTo();
lineFLeft.xProperty().bind( lineFLeft.xProperty().bind(Bindings.subtract(leftEdgeProperty, arrowSizeProperty));
Bindings.subtract(leftEdgeProperty, arrowSizeProperty));
lineFLeft.yProperty().bind(centerYProperty); lineFLeft.yProperty().bind(centerYProperty);
lineGLeft = new LineTo(); lineGLeft = new LineTo();
lineGLeft.xProperty().bind(leftEdgeProperty); lineGLeft.xProperty().bind(leftEdgeProperty);
lineGLeft.yProperty().bind( lineGLeft.yProperty().bind(Bindings.subtract(centerYProperty, arrowSizeProperty));
Bindings.subtract(centerYProperty, arrowSizeProperty));
lineHLeft = new VLineTo(); lineHLeft = new VLineTo();
lineHLeft.yProperty().bind( lineHLeft.yProperty().bind(Bindings.add(
Bindings.add(Bindings.add(topEdgePlusRadiusProperty, Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty),
arrowIndentProperty), Bindings.multiply( Bindings.multiply(arrowSizeProperty, 2)
arrowSizeProperty, 2))); ));
lineILeft = new LineTo(); lineILeft = new LineTo();
lineILeft.xProperty().bind( lineILeft.xProperty().bind(Bindings.subtract(leftEdgeProperty, arrowSizeProperty));
Bindings.subtract(leftEdgeProperty, arrowSizeProperty)); lineILeft.yProperty().bind(Bindings.add(
lineILeft.yProperty().bind( Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty),
Bindings.add(Bindings.add(topEdgePlusRadiusProperty, arrowSizeProperty
arrowIndentProperty), arrowSizeProperty)); ));
lineJLeft = new LineTo(); lineJLeft = new LineTo();
lineJLeft.xProperty().bind(leftEdgeProperty); lineJLeft.xProperty().bind(leftEdgeProperty);
lineJLeft.yProperty().bind( lineJLeft.yProperty().bind(Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty));
Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty));
lineKLeft = new VLineTo(); lineKLeft = new VLineTo();
lineKLeft.yProperty().bind(topEdgePlusRadiusProperty); lineKLeft.yProperty().bind(topEdgePlusRadiusProperty);

@ -270,7 +270,9 @@
</module> </module>
<module name="NoWhitespaceBeforeCaseDefaultColon"/> <module name="NoWhitespaceBeforeCaseDefaultColon"/>
<module name="OverloadMethodsDeclarationOrder"/> <module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/> <module name="VariableDeclarationUsageDistance">
<property name="allowedDistance" value="10"/>
</module>
<module name="CustomImportOrder"> <module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/> <property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/> <property name="separateLineBetweenGroups" value="true"/>

@ -140,8 +140,6 @@ public class DialogPage extends AbstractPage {
var printWriter = new PrintWriter(stringWriter); var printWriter = new PrintWriter(stringWriter);
exception.printStackTrace(printWriter); exception.printStackTrace(printWriter);
var label = new Label("Full stacktrace:");
var textArea = new TextArea(stringWriter.toString()); var textArea = new TextArea(stringWriter.toString());
textArea.setEditable(false); textArea.setEditable(false);
textArea.setWrapText(false); textArea.setWrapText(false);
@ -152,7 +150,7 @@ public class DialogPage extends AbstractPage {
var content = new GridPane(); var content = new GridPane();
content.setMaxWidth(Double.MAX_VALUE); content.setMaxWidth(Double.MAX_VALUE);
content.add(label, 0, 0); content.add(new Label("Full stacktrace:"), 0, 0);
content.add(textArea, 0, 1); content.add(textArea, 0, 1);
alert.getDialogPane().setExpandableContent(content); alert.getDialogPane().setExpandableContent(content);

@ -232,9 +232,9 @@ public class ProgressPage extends AbstractPage {
} }
private SampleBlock colorChangeSample() { private SampleBlock colorChangeSample() {
var stateSuccess = PseudoClass.getPseudoClass("state-success"); final var stateSuccess = PseudoClass.getPseudoClass("state-success");
var stateDanger = PseudoClass.getPseudoClass("state-danger"); final var stateDanger = PseudoClass.getPseudoClass("state-danger");
var width = 300; final var width = 300;
var bar = new ProgressBar(0); var bar = new ProgressBar(0);
bar.getStyleClass().add(LARGE); bar.getStyleClass().add(LARGE);

@ -248,8 +248,8 @@ public class TablePage extends AbstractPage {
} }
private MenuButton createTablePropertiesMenu(TableView<Product> table) { private MenuButton createTablePropertiesMenu(TableView<Product> table) {
var resizePolicyCaption = new CaptionMenuItem("Resize Policy"); final var resizePolicyCaption = new CaptionMenuItem("Resize Policy");
var resizePolicyGroup = new ToggleGroup(); final var resizePolicyGroup = new ToggleGroup();
resizePolicyGroup.selectedToggleProperty().addListener((obs, old, val) -> { resizePolicyGroup.selectedToggleProperty().addListener((obs, old, val) -> {
if (val != null && val.getUserData() instanceof Callback policy) { if (val != null && val.getUserData() instanceof Callback policy) {
//noinspection rawtypes,unchecked //noinspection rawtypes,unchecked
@ -257,51 +257,51 @@ public class TablePage extends AbstractPage {
} }
}); });
var unconstrainedResizeItem = new RadioMenuItem("Unconstrained"); final var unconstrainedResizeItem = new RadioMenuItem("Unconstrained");
unconstrainedResizeItem.setToggleGroup(resizePolicyGroup); unconstrainedResizeItem.setToggleGroup(resizePolicyGroup);
unconstrainedResizeItem.setUserData(TableView.UNCONSTRAINED_RESIZE_POLICY); unconstrainedResizeItem.setUserData(TableView.UNCONSTRAINED_RESIZE_POLICY);
unconstrainedResizeItem.setSelected(true); unconstrainedResizeItem.setSelected(true);
var constrainedResizeItem = new RadioMenuItem("Constrained"); final var constrainedResizeItem = new RadioMenuItem("Constrained");
constrainedResizeItem.setToggleGroup(resizePolicyGroup); constrainedResizeItem.setToggleGroup(resizePolicyGroup);
constrainedResizeItem.setUserData(TableView.CONSTRAINED_RESIZE_POLICY); constrainedResizeItem.setUserData(TableView.CONSTRAINED_RESIZE_POLICY);
// ~ // ~
var selectionModeCaption = new CaptionMenuItem("Selection Mode"); final var selectionModeCaption = new CaptionMenuItem("Selection Mode");
var selectionModeGroup = new ToggleGroup(); final var selectionModeGroup = new ToggleGroup();
selectionModeGroup.selectedToggleProperty().addListener((obs, old, val) -> { selectionModeGroup.selectedToggleProperty().addListener((obs, old, val) -> {
if (val != null && val.getUserData() instanceof SelectionMode mode) { if (val != null && val.getUserData() instanceof SelectionMode mode) {
table.getSelectionModel().setSelectionMode(mode); table.getSelectionModel().setSelectionMode(mode);
} }
}); });
var singleSelectionItem = new RadioMenuItem("Single"); final var singleSelectionItem = new RadioMenuItem("Single");
singleSelectionItem.setToggleGroup(selectionModeGroup); singleSelectionItem.setToggleGroup(selectionModeGroup);
singleSelectionItem.setUserData(SelectionMode.SINGLE); singleSelectionItem.setUserData(SelectionMode.SINGLE);
var multiSelectionItem = new RadioMenuItem("Multiple"); final var multiSelectionItem = new RadioMenuItem("Multiple");
multiSelectionItem.setToggleGroup(selectionModeGroup); multiSelectionItem.setToggleGroup(selectionModeGroup);
multiSelectionItem.setUserData(SelectionMode.MULTIPLE); multiSelectionItem.setUserData(SelectionMode.MULTIPLE);
multiSelectionItem.setSelected(true); multiSelectionItem.setSelected(true);
// ~ // ~
var editCellsItem = new CheckMenuItem("Editable"); final var editCellsItem = new CheckMenuItem("Editable");
table.editableProperty().bind(editCellsItem.selectedProperty()); table.editableProperty().bind(editCellsItem.selectedProperty());
editCellsItem.setSelected(true); editCellsItem.setSelected(true);
var cellSelectionItem = new CheckMenuItem("Enable cell selection"); final var cellSelectionItem = new CheckMenuItem("Enable cell selection");
table.getSelectionModel().cellSelectionEnabledProperty().bind(cellSelectionItem.selectedProperty()); table.getSelectionModel().cellSelectionEnabledProperty().bind(cellSelectionItem.selectedProperty());
cellSelectionItem.setSelected(false); cellSelectionItem.setSelected(false);
// ~ // ~
var menuButtonItem = new CheckMenuItem("Show menu button"); final var menuButtonItem = new CheckMenuItem("Show menu button");
table.tableMenuButtonVisibleProperty().bind(menuButtonItem.selectedProperty()); table.tableMenuButtonVisibleProperty().bind(menuButtonItem.selectedProperty());
menuButtonItem.setSelected(true); menuButtonItem.setSelected(true);
var propertiesMenu = new MenuButton("Properties"); final var propertiesMenu = new MenuButton("Properties");
propertiesMenu.getItems().setAll( propertiesMenu.getItems().setAll(
resizePolicyCaption, resizePolicyCaption,
unconstrainedResizeItem, unconstrainedResizeItem,

@ -227,8 +227,8 @@ public class TreeTablePage extends AbstractPage {
} }
private MenuButton createPropertiesMenu(TreeTableView<Product> treeTable) { private MenuButton createPropertiesMenu(TreeTableView<Product> treeTable) {
var resizePolicyCaption = new CaptionMenuItem("Resize Policy"); final var resizePolicyCaption = new CaptionMenuItem("Resize Policy");
var resizePolicyGroup = new ToggleGroup(); final var resizePolicyGroup = new ToggleGroup();
resizePolicyGroup.selectedToggleProperty().addListener((obs, old, val) -> { resizePolicyGroup.selectedToggleProperty().addListener((obs, old, val) -> {
if (val != null && val.getUserData() instanceof Callback policy) { if (val != null && val.getUserData() instanceof Callback policy) {
//noinspection rawtypes,unchecked //noinspection rawtypes,unchecked
@ -236,55 +236,55 @@ public class TreeTablePage extends AbstractPage {
} }
}); });
var unconstrainedResizeItem = new RadioMenuItem("Unconstrained"); final var unconstrainedResizeItem = new RadioMenuItem("Unconstrained");
unconstrainedResizeItem.setToggleGroup(resizePolicyGroup); unconstrainedResizeItem.setToggleGroup(resizePolicyGroup);
unconstrainedResizeItem.setUserData(TreeTableView.UNCONSTRAINED_RESIZE_POLICY); unconstrainedResizeItem.setUserData(TreeTableView.UNCONSTRAINED_RESIZE_POLICY);
unconstrainedResizeItem.setSelected(true); unconstrainedResizeItem.setSelected(true);
var constrainedResizeItem = new RadioMenuItem("Constrained"); final var constrainedResizeItem = new RadioMenuItem("Constrained");
constrainedResizeItem.setToggleGroup(resizePolicyGroup); constrainedResizeItem.setToggleGroup(resizePolicyGroup);
constrainedResizeItem.setUserData(TreeTableView.CONSTRAINED_RESIZE_POLICY); constrainedResizeItem.setUserData(TreeTableView.CONSTRAINED_RESIZE_POLICY);
// ~ // ~
var selectionModeCaption = new CaptionMenuItem("Selection Mode"); final var selectionModeCaption = new CaptionMenuItem("Selection Mode");
var selectionModeGroup = new ToggleGroup(); final var selectionModeGroup = new ToggleGroup();
selectionModeGroup.selectedToggleProperty().addListener((obs, old, val) -> { selectionModeGroup.selectedToggleProperty().addListener((obs, old, val) -> {
if (val != null && val.getUserData() instanceof SelectionMode mode) { if (val != null && val.getUserData() instanceof SelectionMode mode) {
treeTable.getSelectionModel().setSelectionMode(mode); treeTable.getSelectionModel().setSelectionMode(mode);
} }
}); });
var singleSelectionItem = new RadioMenuItem("Single"); final var singleSelectionItem = new RadioMenuItem("Single");
singleSelectionItem.setToggleGroup(selectionModeGroup); singleSelectionItem.setToggleGroup(selectionModeGroup);
singleSelectionItem.setUserData(SelectionMode.SINGLE); singleSelectionItem.setUserData(SelectionMode.SINGLE);
var multiSelectionItem = new RadioMenuItem("Multiple"); final var multiSelectionItem = new RadioMenuItem("Multiple");
multiSelectionItem.setToggleGroup(selectionModeGroup); multiSelectionItem.setToggleGroup(selectionModeGroup);
multiSelectionItem.setUserData(SelectionMode.MULTIPLE); multiSelectionItem.setUserData(SelectionMode.MULTIPLE);
multiSelectionItem.setSelected(true); multiSelectionItem.setSelected(true);
// ~ // ~
var showRootItem = new CheckMenuItem("Show root"); final var showRootItem = new CheckMenuItem("Show root");
treeTable.showRootProperty().bind(showRootItem.selectedProperty()); treeTable.showRootProperty().bind(showRootItem.selectedProperty());
showRootItem.setSelected(true); showRootItem.setSelected(true);
var editCellsItem = new CheckMenuItem("Editable"); final var editCellsItem = new CheckMenuItem("Editable");
treeTable.editableProperty().bind(editCellsItem.selectedProperty()); treeTable.editableProperty().bind(editCellsItem.selectedProperty());
editCellsItem.setSelected(true); editCellsItem.setSelected(true);
var cellSelectionItem = new CheckMenuItem("Enable cell selection"); final var cellSelectionItem = new CheckMenuItem("Enable cell selection");
treeTable.getSelectionModel().cellSelectionEnabledProperty().bind(cellSelectionItem.selectedProperty()); treeTable.getSelectionModel().cellSelectionEnabledProperty().bind(cellSelectionItem.selectedProperty());
cellSelectionItem.setSelected(false); cellSelectionItem.setSelected(false);
// ~ // ~
var menuButtonItem = new CheckMenuItem("Show menu button"); final var menuButtonItem = new CheckMenuItem("Show menu button");
treeTable.tableMenuButtonVisibleProperty().bind(menuButtonItem.selectedProperty()); treeTable.tableMenuButtonVisibleProperty().bind(menuButtonItem.selectedProperty());
menuButtonItem.setSelected(true); menuButtonItem.setSelected(true);
var propertiesMenu = new MenuButton("Properties"); final var propertiesMenu = new MenuButton("Properties");
propertiesMenu.getItems().setAll( propertiesMenu.getItems().setAll(
resizePolicyCaption, resizePolicyCaption,
unconstrainedResizeItem, unconstrainedResizeItem,

@ -159,7 +159,7 @@ class ContrastChecker extends GridPane {
var aaaLargeLabel = contrastLevelLabel(); var aaaLargeLabel = contrastLevelLabel();
var aaaLargeBox = contrastLevelBox(aaaLargeLabel, "AAA Large"); var aaaLargeBox = contrastLevelBox(aaaLargeLabel, "AAA Large");
var contrastLevels = new HBox(20, aaNormalBox, aaLargeBox, aaaNormalBox, aaaLargeBox); final var contrastLevels = new HBox(20, aaNormalBox, aaLargeBox, aaaNormalBox, aaaLargeBox);
contrastRatio.addListener((obs, old, val) -> { contrastRatio.addListener((obs, old, val) -> {
if (val == null) { if (val == null) {

@ -64,8 +64,6 @@ public class FileManagerPage extends ShowcasePage {
} }
private void createView() { private void createView() {
var topBar = new ToolBar();
var backBtn = iconButton(Feather.ARROW_LEFT, false); var backBtn = iconButton(Feather.ARROW_LEFT, false);
backBtn.setOnAction(e -> model.back()); backBtn.setOnAction(e -> model.back());
backBtn.disableProperty().bind(model.getHistory().canGoBackProperty().not()); backBtn.disableProperty().bind(model.getHistory().canGoBackProperty().not());
@ -92,6 +90,7 @@ public class FileManagerPage extends ShowcasePage {
menuBtn.getItems().setAll(toggleHiddenCheck); menuBtn.getItems().setAll(toggleHiddenCheck);
menuBtn.getStyleClass().addAll(BUTTON_ICON, Tweaks.NO_ARROW); menuBtn.getStyleClass().addAll(BUTTON_ICON, Tweaks.NO_ARROW);
var topBar = new ToolBar();
topBar.getItems().setAll( topBar.getItems().setAll(
backBtn, backBtn,
forthBtn, forthBtn,

@ -36,9 +36,6 @@ public class MusicPlayerPage extends ShowcasePage {
} }
private void createView() { private void createView() {
var startScreen = new StartScreen(model);
var playerScreen = new PlayerScreen(model);
var aboutBox = new HBox(new Text("Simple music player that able to play MP3 files.")); var aboutBox = new HBox(new Text("Simple music player that able to play MP3 files."));
aboutBox.setPadding(new Insets(5, 0, 5, 0)); aboutBox.setPadding(new Insets(5, 0, 5, 0));
aboutBox.getStyleClass().add("about"); aboutBox.getStyleClass().add("about");
@ -52,6 +49,8 @@ public class MusicPlayerPage extends ShowcasePage {
creditsBox.setPadding(new Insets(5, 0, 5, 0)); creditsBox.setPadding(new Insets(5, 0, 5, 0));
// ~ // ~
var startScreen = new StartScreen(model);
var playerScreen = new PlayerScreen(model);
var root = new BorderPane(); var root = new BorderPane();
root.setCenter(startScreen); root.setCenter(startScreen);