From 4c3daeb7984bd1779dad9b5944fcd07fe946208d Mon Sep 17 00:00:00 2001 From: mkpaz Date: Fri, 10 Feb 2023 15:00:49 +0400 Subject: [PATCH] Checkstyle: fix variable declaration [VariableDeclarationUsageDistance] --- .../atlantafx/base/controls/PopoverSkin.java | 213 ++++++++---------- checkstyle.xml | 4 +- .../sampler/page/components/DialogPage.java | 4 +- .../sampler/page/components/ProgressPage.java | 6 +- .../sampler/page/components/TablePage.java | 24 +- .../page/components/TreeTablePage.java | 26 +-- .../sampler/page/general/ContrastChecker.java | 2 +- .../showcase/filemanager/FileManagerPage.java | 3 +- .../showcase/musicplayer/MusicPlayerPage.java | 5 +- 9 files changed, 124 insertions(+), 163 deletions(-) diff --git a/base/src/main/java/atlantafx/base/controls/PopoverSkin.java b/base/src/main/java/atlantafx/base/controls/PopoverSkin.java index 52e77f8..318aa5b 100755 --- a/base/src/main/java/atlantafx/base/controls/PopoverSkin.java +++ b/base/src/main/java/atlantafx/base/controls/PopoverSkin.java @@ -306,26 +306,24 @@ public class PopoverSkin implements Skin { lineJLeft; private void createPathElements() { - DoubleProperty centerYProperty = new SimpleDoubleProperty(); - DoubleProperty centerXProperty = new SimpleDoubleProperty(); + final DoubleProperty centerYProperty = new SimpleDoubleProperty(); + final DoubleProperty centerXProperty = new SimpleDoubleProperty(); - DoubleProperty leftEdgeProperty = new SimpleDoubleProperty(); - DoubleProperty leftEdgePlusRadiusProperty = new SimpleDoubleProperty(); + final DoubleProperty leftEdgeProperty = new SimpleDoubleProperty(); + final DoubleProperty leftEdgePlusRadiusProperty = new SimpleDoubleProperty(); - DoubleProperty topEdgeProperty = new SimpleDoubleProperty(); - DoubleProperty topEdgePlusRadiusProperty = new SimpleDoubleProperty(); + final DoubleProperty topEdgeProperty = new SimpleDoubleProperty(); + final DoubleProperty topEdgePlusRadiusProperty = new SimpleDoubleProperty(); - DoubleProperty rightEdgeProperty = new SimpleDoubleProperty(); - DoubleProperty rightEdgeMinusRadiusProperty = new SimpleDoubleProperty(); + final DoubleProperty rightEdgeProperty = new SimpleDoubleProperty(); + final DoubleProperty rightEdgeMinusRadiusProperty = new SimpleDoubleProperty(); - DoubleProperty bottomEdgeProperty = new SimpleDoubleProperty(); - DoubleProperty bottomEdgeMinusRadiusProperty = new SimpleDoubleProperty(); + final DoubleProperty bottomEdgeProperty = new SimpleDoubleProperty(); + final DoubleProperty bottomEdgeMinusRadiusProperty = new SimpleDoubleProperty(); - DoubleProperty cornerProperty = getSkinnable().cornerRadiusProperty(); - - DoubleProperty arrowSizeProperty = getSkinnable().arrowSizeProperty(); - DoubleProperty arrowIndentProperty = getSkinnable() - .arrowIndentProperty(); + final DoubleProperty cornerProperty = getSkinnable().cornerRadiusProperty(); + final DoubleProperty arrowSizeProperty = getSkinnable().arrowSizeProperty(); + final DoubleProperty arrowIndentProperty = getSkinnable().arrowIndentProperty(); centerYProperty.bind(Bindings.divide(stackPane.heightProperty(), 2)); centerXProperty.bind(Bindings.divide(stackPane.widthProperty(), 2)); @@ -351,52 +349,44 @@ public class PopoverSkin implements Skin { // == TOP EDGE == lineBTop = new HLineTo(); - lineBTop.xProperty().bind( - Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty)); + lineBTop.xProperty().bind(Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty)); lineCTop = new LineTo(); - lineCTop.xProperty().bind( - Bindings.add(lineBTop.xProperty(), arrowSizeProperty)); - lineCTop.yProperty().bind( - Bindings.subtract(topEdgeProperty, arrowSizeProperty)); + lineCTop.xProperty().bind(Bindings.add(lineBTop.xProperty(), arrowSizeProperty)); + lineCTop.yProperty().bind(Bindings.subtract(topEdgeProperty, arrowSizeProperty)); lineDTop = new LineTo(); - lineDTop.xProperty().bind( - Bindings.add(lineCTop.xProperty(), arrowSizeProperty)); + lineDTop.xProperty().bind(Bindings.add(lineCTop.xProperty(), arrowSizeProperty)); lineDTop.yProperty().bind(topEdgeProperty); lineETop = new HLineTo(); - lineETop.xProperty().bind( - Bindings.subtract(centerXProperty, arrowSizeProperty)); + lineETop.xProperty().bind(Bindings.subtract(centerXProperty, arrowSizeProperty)); lineFTop = new LineTo(); lineFTop.xProperty().bind(centerXProperty); - lineFTop.yProperty().bind( - Bindings.subtract(topEdgeProperty, arrowSizeProperty)); + lineFTop.yProperty().bind(Bindings.subtract(topEdgeProperty, arrowSizeProperty)); lineGTop = new LineTo(); - lineGTop.xProperty().bind( - Bindings.add(centerXProperty, arrowSizeProperty)); + lineGTop.xProperty().bind(Bindings.add(centerXProperty, arrowSizeProperty)); lineGTop.yProperty().bind(topEdgeProperty); lineHTop = new HLineTo(); - lineHTop.xProperty().bind( - Bindings.subtract(Bindings.subtract( - rightEdgeMinusRadiusProperty, arrowIndentProperty), - Bindings.multiply(arrowSizeProperty, 2))); + lineHTop.xProperty().bind(Bindings.subtract( + Bindings.subtract(rightEdgeMinusRadiusProperty, arrowIndentProperty), + Bindings.multiply(arrowSizeProperty, 2) + )); lineITop = new LineTo(); - lineITop.xProperty().bind( - Bindings.subtract(Bindings.subtract( - rightEdgeMinusRadiusProperty, arrowIndentProperty), - arrowSizeProperty)); - lineITop.yProperty().bind( - Bindings.subtract(topEdgeProperty, arrowSizeProperty)); + lineITop.xProperty().bind(Bindings.subtract( + Bindings.subtract(rightEdgeMinusRadiusProperty, arrowIndentProperty), + arrowSizeProperty + )); + lineITop.yProperty().bind(Bindings.subtract(topEdgeProperty, arrowSizeProperty)); lineJTop = new LineTo(); - lineJTop.xProperty().bind( - Bindings.subtract(rightEdgeMinusRadiusProperty, - arrowIndentProperty)); + lineJTop.xProperty().bind(Bindings.subtract( + rightEdgeMinusRadiusProperty, arrowIndentProperty + )); lineJTop.yProperty().bind(topEdgeProperty); lineKTop = new HLineTo(); @@ -405,59 +395,51 @@ public class PopoverSkin implements Skin { // == RIGHT EDGE == rightCurveTo = new QuadCurveTo(); rightCurveTo.xProperty().bind(rightEdgeProperty); - rightCurveTo.yProperty().bind( - Bindings.add(topEdgeProperty, cornerProperty)); + rightCurveTo.yProperty().bind(Bindings.add(topEdgeProperty, cornerProperty)); rightCurveTo.controlXProperty().bind(rightEdgeProperty); rightCurveTo.controlYProperty().bind(topEdgeProperty); lineBRight = new VLineTo(); - lineBRight.yProperty().bind( - Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty)); + lineBRight.yProperty().bind(Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty)); lineCRight = new LineTo(); - lineCRight.xProperty().bind( - Bindings.add(rightEdgeProperty, arrowSizeProperty)); - lineCRight.yProperty().bind( - Bindings.add(lineBRight.yProperty(), arrowSizeProperty)); + lineCRight.xProperty().bind(Bindings.add(rightEdgeProperty, arrowSizeProperty)); + lineCRight.yProperty().bind(Bindings.add(lineBRight.yProperty(), arrowSizeProperty)); lineDRight = new LineTo(); lineDRight.xProperty().bind(rightEdgeProperty); - lineDRight.yProperty().bind( - Bindings.add(lineCRight.yProperty(), arrowSizeProperty)); + lineDRight.yProperty().bind(Bindings.add(lineCRight.yProperty(), arrowSizeProperty)); lineERight = new VLineTo(); - lineERight.yProperty().bind( - Bindings.subtract(centerYProperty, arrowSizeProperty)); + lineERight.yProperty().bind(Bindings.subtract(centerYProperty, arrowSizeProperty)); lineFRight = new LineTo(); - lineFRight.xProperty().bind( - Bindings.add(rightEdgeProperty, arrowSizeProperty)); + lineFRight.xProperty().bind(Bindings.add(rightEdgeProperty, arrowSizeProperty)); lineFRight.yProperty().bind(centerYProperty); lineGRight = new LineTo(); lineGRight.xProperty().bind(rightEdgeProperty); - lineGRight.yProperty().bind( - Bindings.add(centerYProperty, arrowSizeProperty)); + lineGRight.yProperty().bind(Bindings.add(centerYProperty, arrowSizeProperty)); lineHRight = new VLineTo(); - lineHRight.yProperty().bind( - Bindings.subtract(Bindings.subtract( - bottomEdgeMinusRadiusProperty, arrowIndentProperty), - Bindings.multiply(arrowSizeProperty, 2))); + lineHRight.yProperty().bind(Bindings.subtract( + Bindings.subtract(bottomEdgeMinusRadiusProperty, arrowIndentProperty), + Bindings.multiply(arrowSizeProperty, 2) + )); lineIRight = new LineTo(); - lineIRight.xProperty().bind( - Bindings.add(rightEdgeProperty, arrowSizeProperty)); - lineIRight.yProperty().bind( - Bindings.subtract(Bindings.subtract( - bottomEdgeMinusRadiusProperty, arrowIndentProperty), - arrowSizeProperty)); + lineIRight.xProperty().bind(Bindings.add(rightEdgeProperty, arrowSizeProperty)); + lineIRight.yProperty().bind(Bindings.subtract( + Bindings.subtract(bottomEdgeMinusRadiusProperty, arrowIndentProperty), + arrowSizeProperty + )); lineJRight = new LineTo(); lineJRight.xProperty().bind(rightEdgeProperty); - lineJRight.yProperty().bind( - Bindings.subtract(bottomEdgeMinusRadiusProperty, - arrowIndentProperty)); + lineJRight.yProperty().bind(Bindings.subtract( + bottomEdgeMinusRadiusProperty, + arrowIndentProperty + )); lineKRight = new VLineTo(); lineKRight.yProperty().bind(bottomEdgeMinusRadiusProperty); @@ -470,51 +452,42 @@ public class PopoverSkin implements Skin { bottomCurveTo.controlYProperty().bind(bottomEdgeProperty); lineBBottom = new HLineTo(); - lineBBottom.xProperty().bind( - Bindings.subtract(rightEdgeMinusRadiusProperty, - arrowIndentProperty)); + lineBBottom.xProperty().bind(Bindings.subtract(rightEdgeMinusRadiusProperty, arrowIndentProperty)); lineCBottom = new LineTo(); - lineCBottom.xProperty().bind( - Bindings.subtract(lineBBottom.xProperty(), arrowSizeProperty)); - lineCBottom.yProperty().bind( - Bindings.add(bottomEdgeProperty, arrowSizeProperty)); + lineCBottom.xProperty().bind(Bindings.subtract(lineBBottom.xProperty(), arrowSizeProperty)); + lineCBottom.yProperty().bind(Bindings.add(bottomEdgeProperty, arrowSizeProperty)); lineDBottom = new LineTo(); - lineDBottom.xProperty().bind( - Bindings.subtract(lineCBottom.xProperty(), arrowSizeProperty)); + lineDBottom.xProperty().bind(Bindings.subtract(lineCBottom.xProperty(), arrowSizeProperty)); lineDBottom.yProperty().bind(bottomEdgeProperty); lineEBottom = new HLineTo(); - lineEBottom.xProperty().bind( - Bindings.add(centerXProperty, arrowSizeProperty)); + lineEBottom.xProperty().bind(Bindings.add(centerXProperty, arrowSizeProperty)); lineFBottom = new LineTo(); lineFBottom.xProperty().bind(centerXProperty); - lineFBottom.yProperty().bind( - Bindings.add(bottomEdgeProperty, arrowSizeProperty)); + lineFBottom.yProperty().bind(Bindings.add(bottomEdgeProperty, arrowSizeProperty)); lineGBottom = new LineTo(); - lineGBottom.xProperty().bind( - Bindings.subtract(centerXProperty, arrowSizeProperty)); + lineGBottom.xProperty().bind(Bindings.subtract(centerXProperty, arrowSizeProperty)); lineGBottom.yProperty().bind(bottomEdgeProperty); lineHBottom = new HLineTo(); - lineHBottom.xProperty().bind( - Bindings.add(Bindings.add(leftEdgePlusRadiusProperty, - arrowIndentProperty), Bindings.multiply( - arrowSizeProperty, 2))); + lineHBottom.xProperty().bind(Bindings.add( + Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty), + Bindings.multiply(arrowSizeProperty, 2) + )); lineIBottom = new LineTo(); - lineIBottom.xProperty().bind( - Bindings.add(Bindings.add(leftEdgePlusRadiusProperty, - arrowIndentProperty), arrowSizeProperty)); - lineIBottom.yProperty().bind( - Bindings.add(bottomEdgeProperty, arrowSizeProperty)); + lineIBottom.xProperty().bind(Bindings.add( + Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty), + arrowSizeProperty + )); + lineIBottom.yProperty().bind(Bindings.add(bottomEdgeProperty, arrowSizeProperty)); lineJBottom = new LineTo(); - lineJBottom.xProperty().bind( - Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty)); + lineJBottom.xProperty().bind(Bindings.add(leftEdgePlusRadiusProperty, arrowIndentProperty)); lineJBottom.yProperty().bind(bottomEdgeProperty); lineKBottom = new HLineTo(); @@ -523,58 +496,48 @@ public class PopoverSkin implements Skin { // == LEFT EDGE == leftCurveTo = new QuadCurveTo(); leftCurveTo.xProperty().bind(leftEdgeProperty); - leftCurveTo.yProperty().bind( - Bindings.subtract(bottomEdgeProperty, cornerProperty)); + leftCurveTo.yProperty().bind(Bindings.subtract(bottomEdgeProperty, cornerProperty)); leftCurveTo.controlXProperty().bind(leftEdgeProperty); leftCurveTo.controlYProperty().bind(bottomEdgeProperty); lineBLeft = new VLineTo(); - lineBLeft.yProperty().bind( - Bindings.subtract(bottomEdgeMinusRadiusProperty, - arrowIndentProperty)); + lineBLeft.yProperty().bind(Bindings.subtract(bottomEdgeMinusRadiusProperty, arrowIndentProperty)); lineCLeft = new LineTo(); - lineCLeft.xProperty().bind( - Bindings.subtract(leftEdgeProperty, arrowSizeProperty)); - lineCLeft.yProperty().bind( - Bindings.subtract(lineBLeft.yProperty(), arrowSizeProperty)); + lineCLeft.xProperty().bind(Bindings.subtract(leftEdgeProperty, arrowSizeProperty)); + lineCLeft.yProperty().bind(Bindings.subtract(lineBLeft.yProperty(), arrowSizeProperty)); lineDLeft = new LineTo(); lineDLeft.xProperty().bind(leftEdgeProperty); - lineDLeft.yProperty().bind( - Bindings.subtract(lineCLeft.yProperty(), arrowSizeProperty)); + lineDLeft.yProperty().bind(Bindings.subtract(lineCLeft.yProperty(), arrowSizeProperty)); lineELeft = new VLineTo(); - lineELeft.yProperty().bind( - Bindings.add(centerYProperty, arrowSizeProperty)); + lineELeft.yProperty().bind(Bindings.add(centerYProperty, arrowSizeProperty)); lineFLeft = new LineTo(); - lineFLeft.xProperty().bind( - Bindings.subtract(leftEdgeProperty, arrowSizeProperty)); + lineFLeft.xProperty().bind(Bindings.subtract(leftEdgeProperty, arrowSizeProperty)); lineFLeft.yProperty().bind(centerYProperty); lineGLeft = new LineTo(); lineGLeft.xProperty().bind(leftEdgeProperty); - lineGLeft.yProperty().bind( - Bindings.subtract(centerYProperty, arrowSizeProperty)); + lineGLeft.yProperty().bind(Bindings.subtract(centerYProperty, arrowSizeProperty)); lineHLeft = new VLineTo(); - lineHLeft.yProperty().bind( - Bindings.add(Bindings.add(topEdgePlusRadiusProperty, - arrowIndentProperty), Bindings.multiply( - arrowSizeProperty, 2))); + lineHLeft.yProperty().bind(Bindings.add( + Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty), + Bindings.multiply(arrowSizeProperty, 2) + )); lineILeft = new LineTo(); - lineILeft.xProperty().bind( - Bindings.subtract(leftEdgeProperty, arrowSizeProperty)); - lineILeft.yProperty().bind( - Bindings.add(Bindings.add(topEdgePlusRadiusProperty, - arrowIndentProperty), arrowSizeProperty)); + lineILeft.xProperty().bind(Bindings.subtract(leftEdgeProperty, arrowSizeProperty)); + lineILeft.yProperty().bind(Bindings.add( + Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty), + arrowSizeProperty + )); lineJLeft = new LineTo(); lineJLeft.xProperty().bind(leftEdgeProperty); - lineJLeft.yProperty().bind( - Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty)); + lineJLeft.yProperty().bind(Bindings.add(topEdgePlusRadiusProperty, arrowIndentProperty)); lineKLeft = new VLineTo(); lineKLeft.yProperty().bind(topEdgePlusRadiusProperty); diff --git a/checkstyle.xml b/checkstyle.xml index 0a25a59..5b6615d 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -270,7 +270,9 @@ - + + + diff --git a/sampler/src/main/java/atlantafx/sampler/page/components/DialogPage.java b/sampler/src/main/java/atlantafx/sampler/page/components/DialogPage.java index cb131af..d6d806b 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/components/DialogPage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/components/DialogPage.java @@ -140,8 +140,6 @@ public class DialogPage extends AbstractPage { var printWriter = new PrintWriter(stringWriter); exception.printStackTrace(printWriter); - var label = new Label("Full stacktrace:"); - var textArea = new TextArea(stringWriter.toString()); textArea.setEditable(false); textArea.setWrapText(false); @@ -152,7 +150,7 @@ public class DialogPage extends AbstractPage { var content = new GridPane(); content.setMaxWidth(Double.MAX_VALUE); - content.add(label, 0, 0); + content.add(new Label("Full stacktrace:"), 0, 0); content.add(textArea, 0, 1); alert.getDialogPane().setExpandableContent(content); diff --git a/sampler/src/main/java/atlantafx/sampler/page/components/ProgressPage.java b/sampler/src/main/java/atlantafx/sampler/page/components/ProgressPage.java index 35fbac7..4df0137 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/components/ProgressPage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/components/ProgressPage.java @@ -232,9 +232,9 @@ public class ProgressPage extends AbstractPage { } private SampleBlock colorChangeSample() { - var stateSuccess = PseudoClass.getPseudoClass("state-success"); - var stateDanger = PseudoClass.getPseudoClass("state-danger"); - var width = 300; + final var stateSuccess = PseudoClass.getPseudoClass("state-success"); + final var stateDanger = PseudoClass.getPseudoClass("state-danger"); + final var width = 300; var bar = new ProgressBar(0); bar.getStyleClass().add(LARGE); diff --git a/sampler/src/main/java/atlantafx/sampler/page/components/TablePage.java b/sampler/src/main/java/atlantafx/sampler/page/components/TablePage.java index ee967ca..3e3ded4 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/components/TablePage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/components/TablePage.java @@ -248,8 +248,8 @@ public class TablePage extends AbstractPage { } private MenuButton createTablePropertiesMenu(TableView table) { - var resizePolicyCaption = new CaptionMenuItem("Resize Policy"); - var resizePolicyGroup = new ToggleGroup(); + final var resizePolicyCaption = new CaptionMenuItem("Resize Policy"); + final var resizePolicyGroup = new ToggleGroup(); resizePolicyGroup.selectedToggleProperty().addListener((obs, old, val) -> { if (val != null && val.getUserData() instanceof Callback policy) { //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.setUserData(TableView.UNCONSTRAINED_RESIZE_POLICY); unconstrainedResizeItem.setSelected(true); - var constrainedResizeItem = new RadioMenuItem("Constrained"); + final var constrainedResizeItem = new RadioMenuItem("Constrained"); constrainedResizeItem.setToggleGroup(resizePolicyGroup); constrainedResizeItem.setUserData(TableView.CONSTRAINED_RESIZE_POLICY); // ~ - var selectionModeCaption = new CaptionMenuItem("Selection Mode"); - var selectionModeGroup = new ToggleGroup(); + final var selectionModeCaption = new CaptionMenuItem("Selection Mode"); + final var selectionModeGroup = new ToggleGroup(); selectionModeGroup.selectedToggleProperty().addListener((obs, old, val) -> { if (val != null && val.getUserData() instanceof SelectionMode mode) { table.getSelectionModel().setSelectionMode(mode); } }); - var singleSelectionItem = new RadioMenuItem("Single"); + final var singleSelectionItem = new RadioMenuItem("Single"); singleSelectionItem.setToggleGroup(selectionModeGroup); singleSelectionItem.setUserData(SelectionMode.SINGLE); - var multiSelectionItem = new RadioMenuItem("Multiple"); + final var multiSelectionItem = new RadioMenuItem("Multiple"); multiSelectionItem.setToggleGroup(selectionModeGroup); multiSelectionItem.setUserData(SelectionMode.MULTIPLE); multiSelectionItem.setSelected(true); // ~ - var editCellsItem = new CheckMenuItem("Editable"); + final var editCellsItem = new CheckMenuItem("Editable"); table.editableProperty().bind(editCellsItem.selectedProperty()); editCellsItem.setSelected(true); - var cellSelectionItem = new CheckMenuItem("Enable cell selection"); + final var cellSelectionItem = new CheckMenuItem("Enable cell selection"); table.getSelectionModel().cellSelectionEnabledProperty().bind(cellSelectionItem.selectedProperty()); cellSelectionItem.setSelected(false); // ~ - var menuButtonItem = new CheckMenuItem("Show menu button"); + final var menuButtonItem = new CheckMenuItem("Show menu button"); table.tableMenuButtonVisibleProperty().bind(menuButtonItem.selectedProperty()); menuButtonItem.setSelected(true); - var propertiesMenu = new MenuButton("Properties"); + final var propertiesMenu = new MenuButton("Properties"); propertiesMenu.getItems().setAll( resizePolicyCaption, unconstrainedResizeItem, diff --git a/sampler/src/main/java/atlantafx/sampler/page/components/TreeTablePage.java b/sampler/src/main/java/atlantafx/sampler/page/components/TreeTablePage.java index 1518c0e..fb004de 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/components/TreeTablePage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/components/TreeTablePage.java @@ -227,8 +227,8 @@ public class TreeTablePage extends AbstractPage { } private MenuButton createPropertiesMenu(TreeTableView treeTable) { - var resizePolicyCaption = new CaptionMenuItem("Resize Policy"); - var resizePolicyGroup = new ToggleGroup(); + final var resizePolicyCaption = new CaptionMenuItem("Resize Policy"); + final var resizePolicyGroup = new ToggleGroup(); resizePolicyGroup.selectedToggleProperty().addListener((obs, old, val) -> { if (val != null && val.getUserData() instanceof Callback policy) { //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.setUserData(TreeTableView.UNCONSTRAINED_RESIZE_POLICY); unconstrainedResizeItem.setSelected(true); - var constrainedResizeItem = new RadioMenuItem("Constrained"); + final var constrainedResizeItem = new RadioMenuItem("Constrained"); constrainedResizeItem.setToggleGroup(resizePolicyGroup); constrainedResizeItem.setUserData(TreeTableView.CONSTRAINED_RESIZE_POLICY); // ~ - var selectionModeCaption = new CaptionMenuItem("Selection Mode"); - var selectionModeGroup = new ToggleGroup(); + final var selectionModeCaption = new CaptionMenuItem("Selection Mode"); + final var selectionModeGroup = new ToggleGroup(); selectionModeGroup.selectedToggleProperty().addListener((obs, old, val) -> { if (val != null && val.getUserData() instanceof SelectionMode mode) { treeTable.getSelectionModel().setSelectionMode(mode); } }); - var singleSelectionItem = new RadioMenuItem("Single"); + final var singleSelectionItem = new RadioMenuItem("Single"); singleSelectionItem.setToggleGroup(selectionModeGroup); singleSelectionItem.setUserData(SelectionMode.SINGLE); - var multiSelectionItem = new RadioMenuItem("Multiple"); + final var multiSelectionItem = new RadioMenuItem("Multiple"); multiSelectionItem.setToggleGroup(selectionModeGroup); multiSelectionItem.setUserData(SelectionMode.MULTIPLE); multiSelectionItem.setSelected(true); // ~ - var showRootItem = new CheckMenuItem("Show root"); + final var showRootItem = new CheckMenuItem("Show root"); treeTable.showRootProperty().bind(showRootItem.selectedProperty()); showRootItem.setSelected(true); - var editCellsItem = new CheckMenuItem("Editable"); + final var editCellsItem = new CheckMenuItem("Editable"); treeTable.editableProperty().bind(editCellsItem.selectedProperty()); editCellsItem.setSelected(true); - var cellSelectionItem = new CheckMenuItem("Enable cell selection"); + final var cellSelectionItem = new CheckMenuItem("Enable cell selection"); treeTable.getSelectionModel().cellSelectionEnabledProperty().bind(cellSelectionItem.selectedProperty()); cellSelectionItem.setSelected(false); // ~ - var menuButtonItem = new CheckMenuItem("Show menu button"); + final var menuButtonItem = new CheckMenuItem("Show menu button"); treeTable.tableMenuButtonVisibleProperty().bind(menuButtonItem.selectedProperty()); menuButtonItem.setSelected(true); - var propertiesMenu = new MenuButton("Properties"); + final var propertiesMenu = new MenuButton("Properties"); propertiesMenu.getItems().setAll( resizePolicyCaption, unconstrainedResizeItem, diff --git a/sampler/src/main/java/atlantafx/sampler/page/general/ContrastChecker.java b/sampler/src/main/java/atlantafx/sampler/page/general/ContrastChecker.java index fd40cf9..10719f9 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/general/ContrastChecker.java +++ b/sampler/src/main/java/atlantafx/sampler/page/general/ContrastChecker.java @@ -159,7 +159,7 @@ class ContrastChecker extends GridPane { var aaaLargeLabel = contrastLevelLabel(); 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) -> { if (val == null) { diff --git a/sampler/src/main/java/atlantafx/sampler/page/showcase/filemanager/FileManagerPage.java b/sampler/src/main/java/atlantafx/sampler/page/showcase/filemanager/FileManagerPage.java index 5abd762..9b5679a 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/showcase/filemanager/FileManagerPage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/showcase/filemanager/FileManagerPage.java @@ -64,8 +64,6 @@ public class FileManagerPage extends ShowcasePage { } private void createView() { - var topBar = new ToolBar(); - var backBtn = iconButton(Feather.ARROW_LEFT, false); backBtn.setOnAction(e -> model.back()); backBtn.disableProperty().bind(model.getHistory().canGoBackProperty().not()); @@ -92,6 +90,7 @@ public class FileManagerPage extends ShowcasePage { menuBtn.getItems().setAll(toggleHiddenCheck); menuBtn.getStyleClass().addAll(BUTTON_ICON, Tweaks.NO_ARROW); + var topBar = new ToolBar(); topBar.getItems().setAll( backBtn, forthBtn, diff --git a/sampler/src/main/java/atlantafx/sampler/page/showcase/musicplayer/MusicPlayerPage.java b/sampler/src/main/java/atlantafx/sampler/page/showcase/musicplayer/MusicPlayerPage.java index f966ece..97df92c 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/showcase/musicplayer/MusicPlayerPage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/showcase/musicplayer/MusicPlayerPage.java @@ -36,9 +36,6 @@ public class MusicPlayerPage extends ShowcasePage { } 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.")); aboutBox.setPadding(new Insets(5, 0, 5, 0)); aboutBox.getStyleClass().add("about"); @@ -52,6 +49,8 @@ public class MusicPlayerPage extends ShowcasePage { creditsBox.setPadding(new Insets(5, 0, 5, 0)); // ~ + var startScreen = new StartScreen(model); + var playerScreen = new PlayerScreen(model); var root = new BorderPane(); root.setCenter(startScreen);