diff --git a/README.md b/README.md index e58d9c3..fe84c34 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Check the [docs](https://mkpaz.github.io/atlantafx/) for more information. * SASS - JavaFX standard themes, namely Modena and Caspian, maintained as a huge single CSS file, which is an overwhelmingly hard task. This alone makes creating a new JavaFX theme from scratch hardly possible. Also, JavaFX styling is based on CSS v2.1 specification which does not provide, nor variables, nor mixins, nor modules nor any other goodies that are default for modern front-end development. AtlantaFX themes are written in SASS with each component in a separate module and use recent [Dart SASS](https://sass-lang.com/dart-sass) implementation for CSS compilation. It also follows [Github Primer](https://primer.style/design/foundations/color) color system to make creating new themes more simple. + JavaFX standard themes, namely Modena and Caspian, maintained as a huge single CSS file, which is an overwhelmingly hard task. This alone makes creating a new JavaFX theme from scratch hardly possible. Also, JavaFX styling is based on CSS v2.1 specification which does not provide, nor variables, nor mixins, nor modules nor any other goodies that are default for modern front-end development. AtlantaFX themes are written in SASS with each component in a separate module and use recent [Dart SASS](https://sass-lang.com/dart-sass) implementation for CSS compilation. It also follows [GitHub Primer](https://primer.style/design/foundations/color) color system to make creating new themes more simple. * Additional controls diff --git a/base/src/main/java/atlantafx/base/controls/BreadcrumbsSkin.java b/base/src/main/java/atlantafx/base/controls/BreadcrumbsSkin.java index 40b0940..aed37ef 100755 --- a/base/src/main/java/atlantafx/base/controls/BreadcrumbsSkin.java +++ b/base/src/main/java/atlantafx/base/controls/BreadcrumbsSkin.java @@ -120,7 +120,7 @@ public class BreadcrumbsSkin extends SkinBase> { if (i > 0) { // we have to position the bread crumbs slightly overlapping - double ins = n instanceof Breadcrumbs.BreadCrumbButton ? ((Breadcrumbs.BreadCrumbButton) n).getArrowWidth() : 0; + double ins = n instanceof Breadcrumbs.BreadCrumbButton d ? d.getArrowWidth() : 0; x = snapPositionX(x - ins); } diff --git a/base/src/main/java/atlantafx/base/controls/InlineDatePickerSkin.java b/base/src/main/java/atlantafx/base/controls/InlineDatePickerSkin.java index 1fcee16..9745fda 100755 --- a/base/src/main/java/atlantafx/base/controls/InlineDatePickerSkin.java +++ b/base/src/main/java/atlantafx/base/controls/InlineDatePickerSkin.java @@ -238,7 +238,7 @@ public class InlineDatePickerSkin extends BehaviorSkinBase behavior.moveBackward(e)); + backButton.setOnMouseClicked(behavior::moveBackward); StackPane leftArrow = new StackPane(); leftArrow.getStyleClass().add("left-arrow"); @@ -256,7 +256,7 @@ public class InlineDatePickerSkin extends BehaviorSkinBase behavior.moveForward(e)); + forwardButton.setOnMouseClicked(behavior::moveForward); StackPane rightArrow = new StackPane(); rightArrow.getStyleClass().add("right-arrow"); @@ -564,8 +564,8 @@ public class InlineDatePickerSkin extends BehaviorSkinBase fadeInDuration = new SimpleObjectProperty<>(DEFAULT_FADE_DURATION); private final ObjectProperty fadeOutDuration = new SimpleObjectProperty<>(DEFAULT_FADE_DURATION); - /** Creates a popover with a label as the content node. */ + /** + * Creates a popover with a label as the content node. + */ public Popover() { super(); @@ -134,7 +136,7 @@ public class Popover extends PopupControl { /** * The root pane stores the content node of the popover. It is accessible * via this method in order to support proper styling. - * + *

* Example: * *

@@ -151,7 +153,10 @@ public class Popover extends PopupControl {
     private final ObjectProperty contentNode = new SimpleObjectProperty<>(this, "contentNode") {
         @Override
         public void setValue(Node node) {
-            if (node == null) { throw new IllegalArgumentException("content node can not be null"); }
+            if (node == null) {
+                throw new NullPointerException("Node cannot be null!");
+            }
+            this.set(node);
         }
     };
 
@@ -168,7 +173,6 @@ public class Popover extends PopupControl {
      * Returns the value of the content property
      *
      * @return the content node
-     *
      * @see #contentNodeProperty()
      */
     public final Node getContentNode() {
@@ -179,7 +183,6 @@ public class Popover extends PopupControl {
      * Sets the value of the content property.
      *
      * @param content the new content node value
-     *
      * @see #contentNodeProperty()
      */
     public final void setContentNode(Node content) {
@@ -236,10 +239,10 @@ public class Popover extends PopupControl {
      * given owner. If the arrow points up then the popover will be placed
      * below the given owner node.
      *
-     * @param owner the owner of the popover
+     * @param owner  the owner of the popover
      * @param offset if negative specifies the distance to the owner node or when
-     * positive specifies the number of pixels that the arrow will
-     * overlap with the owner node (positive values are recommended)
+     *               positive specifies the number of pixels that the arrow will
+     *               overlap with the owner node (positive values are recommended)
      */
     public final void show(Node owner, double offset) {
         requireNonNull(owner);
@@ -262,7 +265,9 @@ public class Popover extends PopupControl {
         }
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public final void show(Window owner) {
         super.show(owner);
@@ -275,7 +280,9 @@ public class Popover extends PopupControl {
         ownerWindow.addEventFilter(WindowEvent.WINDOW_HIDING, closePopoverOnOwnerWindowClose);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public final void show(Window ownerWindow, double anchorX, double anchorY) {
         super.show(ownerWindow, anchorX, anchorY);
@@ -294,8 +301,8 @@ public class Popover extends PopupControl {
      * of the arrow of the popover and not the location of the window.
      *
      * @param owner the owning node
-     * @param x the x coordinate for the popover arrow tip
-     * @param y the y coordinate for the popover arrow tip
+     * @param x     the x coordinate for the popover arrow tip
+     * @param y     the y coordinate for the popover arrow tip
      */
     @Override
     public final void show(Node owner, double x, double y) {
@@ -307,11 +314,11 @@ public class Popover extends PopupControl {
      * the given owner node. The x and y coordinate will be the target location
      * of the arrow of the popover and not the location of the window.
      *
-     * @param owner the owning node
-     * @param x the x coordinate for the popover arrow tip
-     * @param y the y coordinate for the popover arrow tip
+     * @param owner          the owning node
+     * @param x              the x coordinate for the popover arrow tip
+     * @param y              the y coordinate for the popover arrow tip
      * @param fadeInDuration the time it takes for the popover to be fully visible.
-     * This duration takes precedence over the fade-in property without setting.
+     *                       This duration takes precedence over the fade-in property without setting.
      */
     public final void show(Node owner, double x, double y, Duration fadeInDuration) {
         /*
@@ -326,7 +333,7 @@ public class Popover extends PopupControl {
         targetY = y;
 
         if (owner == null) {
-            throw new IllegalArgumentException("owner can not be null");
+            throw new NullPointerException("Owner Node cannot be null!");
         }
 
         // this is all needed because children windows do not get their x and y
@@ -348,8 +355,8 @@ public class Popover extends PopupControl {
             // the user clicked somewhere into the transparent background,
             // if this is the case then hide the window (when attached)
             getScene().addEventHandler(MOUSE_CLICKED, mouseEvent -> {
-                if (mouseEvent.getTarget().equals(getScene().getRoot())) {
-                    if (!isDetached()) { hide(); }
+                if (mouseEvent.getTarget().equals(getScene().getRoot()) && !isDetached()) {
+                    hide();
                 }
             });
 
@@ -415,7 +422,7 @@ public class Popover extends PopupControl {
      * Hides the popover by quickly changing its opacity to 0.
      *
      * @param fadeOutDuration the duration of the fade transition that is being used to
-     * change the opacity of the popover
+     *                        change the opacity of the popover
      */
     public final void hide(Duration fadeOutDuration) {
         if (fadeOutDuration == null) {
@@ -488,7 +495,7 @@ public class Popover extends PopupControl {
             );
             case LEFT_BOTTOM, RIGHT_BOTTOM -> (
                     Math.max(prefContentHeight - getCornerRadius() - getArrowIndent() - getArrowSize(),
-                             getCornerRadius() + getArrowIndent() + getArrowSize()
+                            getCornerRadius() + getArrowIndent() + getArrowSize()
                     )
             );
             default -> 0;
@@ -519,7 +526,6 @@ public class Popover extends PopupControl {
      * Sets the value of the headerAlwaysVisible property.
      *
      * @param visible if true, then the header is visible even while attached
-     *
      * @see #headerAlwaysVisibleProperty()
      */
     public final void setHeaderAlwaysVisible(boolean visible) {
@@ -530,7 +536,6 @@ public class Popover extends PopupControl {
      * Returns the value of the detachable property.
      *
      * @return true if the header is visible even while attached
-     *
      * @see #headerAlwaysVisibleProperty()
      */
     public final boolean isHeaderAlwaysVisible() {
@@ -550,7 +555,6 @@ public class Popover extends PopupControl {
      * Sets the value of the closeButtonEnabled property.
      *
      * @param enabled if false, the popover will not be closeable by the header's close button
-     *
      * @see #closeButtonEnabledProperty()
      */
     public final void setCloseButtonEnabled(boolean enabled) {
@@ -561,7 +565,6 @@ public class Popover extends PopupControl {
      * Returns the value of the closeButtonEnabled property.
      *
      * @return true if the header's close button is enabled
-     *
      * @see #closeButtonEnabledProperty()
      */
     public final boolean isCloseButtonEnabled() {
@@ -581,7 +584,6 @@ public class Popover extends PopupControl {
      * Sets the value of the detachable property.
      *
      * @param detachable if true then the user can detach / tear off the popover
-     *
      * @see #detachableProperty()
      */
     public final void setDetachable(boolean detachable) {
@@ -592,7 +594,6 @@ public class Popover extends PopupControl {
      * Returns the value of the detachable property.
      *
      * @return true if the user is allowed to detach / tear off the popover
-     *
      * @see #detachableProperty()
      */
     public final boolean isDetachable() {
@@ -616,8 +617,7 @@ public class Popover extends PopupControl {
      * Sets the value of the detached property.
      *
      * @param detached if true the popover will change its appearance to "detached"
-     * mode
-     *
+     *                 mode
      * @see #detachedProperty()
      */
     public final void setDetached(boolean detached) {
@@ -628,7 +628,6 @@ public class Popover extends PopupControl {
      * Returns the value of the detached property.
      *
      * @return true if the popover is currently detached.
-     *
      * @see #detachedProperty()
      */
     public final boolean isDetached() {
@@ -650,7 +649,6 @@ public class Popover extends PopupControl {
      * Returns the value of the arrow size property.
      *
      * @return the arrow size property value
-     *
      * @see #arrowSizeProperty()
      */
     public final double getArrowSize() {
@@ -661,7 +659,6 @@ public class Popover extends PopupControl {
      * Sets the value of the arrow size property.
      *
      * @param size the new value of the arrow size property
-     *
      * @see #arrowSizeProperty()
      */
     public final void setArrowSize(double size) {
@@ -684,7 +681,6 @@ public class Popover extends PopupControl {
      * Returns the value of the arrow indent property.
      *
      * @return the arrow indent value
-     *
      * @see #arrowIndentProperty()
      */
     public final double getArrowIndent() {
@@ -695,7 +691,6 @@ public class Popover extends PopupControl {
      * Sets the value of the arrow indent property.
      *
      * @param size the arrow indent value
-     *
      * @see #arrowIndentProperty()
      */
     public final void setArrowIndent(double size) {
@@ -717,7 +712,6 @@ public class Popover extends PopupControl {
      * Returns the value of the corner radius property.
      *
      * @return the corner radius
-     *
      * @see #cornerRadiusProperty()
      */
     public final double getCornerRadius() {
@@ -728,7 +722,6 @@ public class Popover extends PopupControl {
      * Sets the value of the corner radius property.
      *
      * @param radius the corner radius
-     *
      * @see #cornerRadiusProperty()
      */
     public final void setCornerRadius(double radius) {
@@ -750,7 +743,6 @@ public class Popover extends PopupControl {
      * Returns the value of the title property.
      *
      * @return the detached title
-     *
      * @see #titleProperty()
      */
     public final String getTitle() {
@@ -761,12 +753,11 @@ public class Popover extends PopupControl {
      * Sets the value of the title property.
      *
      * @param title the title to use when detached
-     *
      * @see #titleProperty()
      */
     public final void setTitle(String title) {
         if (title == null) {
-            throw new IllegalArgumentException("title can not be null");
+            throw new NullPointerException("Title cannot be null!");
         }
         titleProperty().set(title);
     }
@@ -778,7 +769,6 @@ public class Popover extends PopupControl {
      * location of the arrow if auto fix is enabled.
      *
      * @return the arrow location property
-     *
      * @see #setAutoFix(boolean)
      */
     public final ObjectProperty arrowLocationProperty() {
@@ -789,7 +779,6 @@ public class Popover extends PopupControl {
      * Sets the value of the arrow location property.
      *
      * @param location the requested location
-     *
      * @see #arrowLocationProperty()
      */
     public final void setArrowLocation(ArrowLocation location) {
@@ -800,14 +789,15 @@ public class Popover extends PopupControl {
      * Returns the value of the arrow location property.
      *
      * @return the preferred arrow location
-     *
      * @see #arrowLocationProperty()
      */
     public final ArrowLocation getArrowLocation() {
         return arrowLocationProperty().get();
     }
 
-    /** All possible arrow locations */
+    /**
+     * All possible arrow locations
+     */
     public enum ArrowLocation {
         LEFT_TOP,
         LEFT_CENTER,
@@ -845,7 +835,6 @@ public class Popover extends PopupControl {
      * Returns the value of the fade-in duration property.
      *
      * @return the fade-in duration
-     *
      * @see #fadeInDurationProperty()
      */
     public final Duration getFadeInDuration() {
@@ -857,7 +846,6 @@ public class Popover extends PopupControl {
      * Popover.show(..).
      *
      * @param duration the requested fade-in duration
-     *
      * @see #fadeInDurationProperty()
      */
     public final void setFadeInDuration(Duration duration) {
@@ -868,7 +856,6 @@ public class Popover extends PopupControl {
      * Returns the value of the fade-out duration property.
      *
      * @return the fade-out duration
-     *
      * @see #fadeOutDurationProperty()
      */
     public final Duration getFadeOutDuration() {
@@ -879,7 +866,6 @@ public class Popover extends PopupControl {
      * Sets the value of the fade-out duration property.
      *
      * @param duration the requested fade-out duration
-     *
      * @see #fadeOutDurationProperty()
      */
     public final void setFadeOutDuration(Duration duration) {
@@ -900,7 +886,6 @@ public class Popover extends PopupControl {
      * Returns the value of the "animated" property.
      *
      * @return true if the Popover will be shown and hidden with a short fade animation
-     *
      * @see #animatedProperty()
      */
     public final boolean isAnimated() {
@@ -911,7 +896,6 @@ public class Popover extends PopupControl {
      * Sets the value of the "animated" property.
      *
      * @param animated if true the Popover will be shown and hidden with a short fade animation
-     *
      * @see #animatedProperty()
      */
     public final void setAnimated(boolean animated) {
diff --git a/base/src/main/java/atlantafx/base/controls/ProgressSliderSkin.java b/base/src/main/java/atlantafx/base/controls/ProgressSliderSkin.java
index 3b47a9b..22e0a22 100644
--- a/base/src/main/java/atlantafx/base/controls/ProgressSliderSkin.java
+++ b/base/src/main/java/atlantafx/base/controls/ProgressSliderSkin.java
@@ -31,17 +31,18 @@ public class ProgressSliderSkin extends SliderSkin {
     protected void layoutChildren(double x, double y, double w, double h) {
         super.layoutChildren(x, y, w, h);
 
-        double progressX, progressY, progressWidth, progressHeight;
+        double progressX = track.getLayoutX();
+        double progressY;
+        double progressWidth;
+        double progressHeight;
 
         // intentionally ignore background radius in calculation,
         // because slider looks better this way
         if (getSkinnable().getOrientation() == Orientation.HORIZONTAL) {
-            progressX = track.getLayoutX();
             progressY = track.getLayoutY();
             progressWidth = thumb.getLayoutX() - snappedLeftInset();
             progressHeight = track.getHeight();
         } else {
-            progressX = track.getLayoutX();
             progressY = thumb.getLayoutY();
             progressWidth = track.getWidth();
             progressHeight = track.getLayoutBounds().getMaxY() + track.getLayoutY() - thumb.getLayoutY() - snappedBottomInset();
diff --git a/base/src/main/java/atlantafx/base/theme/NordDark.java b/base/src/main/java/atlantafx/base/theme/NordDark.java
index bb2c45c..0985369 100755
--- a/base/src/main/java/atlantafx/base/theme/NordDark.java
+++ b/base/src/main/java/atlantafx/base/theme/NordDark.java
@@ -3,7 +3,12 @@ package atlantafx.base.theme;
 
 public final class NordDark implements Theme {
 
-    public NordDark() { }
+    /**
+     * Initialize a new NordDark
+     */
+    public NordDark() {
+        // Default constructor
+    }
 
     @Override
     public String getName() {
diff --git a/base/src/main/java/atlantafx/base/theme/NordLight.java b/base/src/main/java/atlantafx/base/theme/NordLight.java
index 8b40d32..8339a22 100755
--- a/base/src/main/java/atlantafx/base/theme/NordLight.java
+++ b/base/src/main/java/atlantafx/base/theme/NordLight.java
@@ -3,7 +3,12 @@ package atlantafx.base.theme;
 
 public final class NordLight implements Theme {
 
-    public NordLight() { }
+    /**
+     * Initialize a new NordLight
+     */
+    public NordLight() {
+        // Default constructor
+    }
 
     @Override
     public String getName() {
diff --git a/base/src/main/java/atlantafx/base/theme/PrimerDark.java b/base/src/main/java/atlantafx/base/theme/PrimerDark.java
index 4586bbd..64c4f10 100755
--- a/base/src/main/java/atlantafx/base/theme/PrimerDark.java
+++ b/base/src/main/java/atlantafx/base/theme/PrimerDark.java
@@ -3,7 +3,12 @@ package atlantafx.base.theme;
 
 public final class PrimerDark implements Theme {
 
-    public PrimerDark() { }
+    /**
+     * Initialize a new PrimerDark
+     */
+    public PrimerDark() {
+        // Default constructor
+    }
 
     @Override
     public String getName() {
diff --git a/base/src/main/java/atlantafx/base/theme/PrimerLight.java b/base/src/main/java/atlantafx/base/theme/PrimerLight.java
index 2b5adb8..9620a2e 100755
--- a/base/src/main/java/atlantafx/base/theme/PrimerLight.java
+++ b/base/src/main/java/atlantafx/base/theme/PrimerLight.java
@@ -3,7 +3,12 @@ package atlantafx.base.theme;
 
 public final class PrimerLight implements Theme {
 
-    public PrimerLight() { }
+    /**
+     * Initialize a new PrimerLight
+     */
+    public PrimerLight() {
+        // Default constructor
+    }
 
     @Override
     public String getName() {
diff --git a/base/src/main/java/atlantafx/base/theme/Styles.java b/base/src/main/java/atlantafx/base/theme/Styles.java
index a3cb715..0ed6a77 100644
--- a/base/src/main/java/atlantafx/base/theme/Styles.java
+++ b/base/src/main/java/atlantafx/base/theme/Styles.java
@@ -4,8 +4,6 @@ package atlantafx.base.theme;
 import javafx.css.PseudoClass;
 import javafx.scene.Node;
 
-import java.util.Objects;
-
 @SuppressWarnings("unused")
 public final class Styles {
 
@@ -13,49 +11,49 @@ public final class Styles {
 
     // Colors
 
-    public static final String ACCENT  = "accent";
+    public static final String ACCENT = "accent";
     public static final String SUCCESS = "success";
     public static final String WARNING = "warning";
-    public static final String DANGER  = "danger";
+    public static final String DANGER = "danger";
 
-    public static final PseudoClass STATE_ACCENT  = PseudoClass.getPseudoClass(ACCENT);
+    public static final PseudoClass STATE_ACCENT = PseudoClass.getPseudoClass(ACCENT);
     public static final PseudoClass STATE_SUCCESS = PseudoClass.getPseudoClass(SUCCESS);
     public static final PseudoClass STATE_WARNING = PseudoClass.getPseudoClass(WARNING);
-    public static final PseudoClass STATE_DANGER  = PseudoClass.getPseudoClass(DANGER);
+    public static final PseudoClass STATE_DANGER = PseudoClass.getPseudoClass(DANGER);
 
     // Controls
 
-    public static final String TEXT       = "text";
-    public static final String FONT_ICON  = "font-icon";
+    public static final String TEXT = "text";
+    public static final String FONT_ICON = "font-icon";
 
-    public static final String BUTTON_CIRCLE   = "button-circle";
-    public static final String BUTTON_ICON     = "button-icon";
+    public static final String BUTTON_CIRCLE = "button-circle";
+    public static final String BUTTON_ICON = "button-icon";
     public static final String BUTTON_OUTLINED = "button-outlined";
 
-    public static final String LEFT_PILL   = "left-pill";
+    public static final String LEFT_PILL = "left-pill";
     public static final String CENTER_PILL = "center-pill";
-    public static final String RIGHT_PILL  = "right-pill";
+    public static final String RIGHT_PILL = "right-pill";
 
-    public static final String SMALL  = "small";
+    public static final String SMALL = "small";
     public static final String MEDIUM = "medium";
-    public static final String LARGE  = "large";
+    public static final String LARGE = "large";
 
-    public static final String TOP    = "top";
-    public static final String RIGHT  = "right";
+    public static final String TOP = "top";
+    public static final String RIGHT = "right";
     public static final String BOTTOM = "bottom";
-    public static final String LEFT   = "left";
+    public static final String LEFT = "left";
     public static final String CENTER = "center";
 
-    public static final String FLAT        = "flat";
-    public static final String BORDERED    = "bordered";
-    public static final String DENSE       = "dense";
-    public static final String ELEVATED_1  = "elevated-1";
-    public static final String ELEVATED_2  = "elevated-2";
-    public static final String ELEVATED_3  = "elevated-3";
-    public static final String ELEVATED_4  = "elevated-4";
+    public static final String FLAT = "flat";
+    public static final String BORDERED = "bordered";
+    public static final String DENSE = "dense";
+    public static final String ELEVATED_1 = "elevated-1";
+    public static final String ELEVATED_2 = "elevated-2";
+    public static final String ELEVATED_3 = "elevated-3";
+    public static final String ELEVATED_4 = "elevated-4";
     public static final String INTERACTIVE = "interactive";
-    public static final String ROUNDED     = "rounded";
-    public static final String STRIPED     = "striped";
+    public static final String ROUNDED = "rounded";
+    public static final String STRIPED = "striped";
 
     // Text
 
@@ -64,24 +62,33 @@ public final class Styles {
     public static final String TITLE_3 = "title-3";
     public static final String TITLE_4 = "title-4";
     public static final String TEXT_CAPTION = "text-caption";
-    public static final String TEXT_SMALL   = "text-small";
+    public static final String TEXT_SMALL = "text-small";
 
-    public static final String TEXT_BOLD    = "text-bold";
-    public static final String TEXT_BOLDER  = "text-bolder";
-    public static final String TEXT_NORMAL  = "text-normal";
+    public static final String TEXT_BOLD = "text-bold";
+    public static final String TEXT_BOLDER = "text-bolder";
+    public static final String TEXT_NORMAL = "text-normal";
     public static final String TEXT_LIGHTER = "text-lighter";
 
-    public static final String TEXT_ITALIC        = "text-italic";
-    public static final String TEXT_OBLIQUE       = "text-oblique";
+    public static final String TEXT_ITALIC = "text-italic";
+    public static final String TEXT_OBLIQUE = "text-oblique";
     public static final String TEXT_STRIKETHROUGH = "text-strikethrough";
-    public static final String TEXT_UNDERLINED    = "text-underlined";
-    public static final String TEXT_MUTED         = "text-muted";
+    public static final String TEXT_UNDERLINED = "text-underlined";
+    public static final String TEXT_MUTED = "text-muted";
+
+    /**
+     * Initialize a new Styles
+     */
+    private Styles() {
+        // Default constructor
+    }
 
     // @formatter:on
 
     public static void toggleStyleClass(Node node, String styleClass) {
-        Objects.requireNonNull(node);
-        Objects.requireNonNull(styleClass);
+        if (node == null)
+            throw new NullPointerException("Node cannot be null!");
+        if (styleClass == null)
+            throw new NullPointerException("Style class cannot be null!");
 
         int idx = node.getStyleClass().indexOf(styleClass);
         if (idx > 0) {
@@ -92,8 +99,10 @@ public final class Styles {
     }
 
     public static void addStyleClass(Node node, String styleClass, String... excludes) {
-        Objects.requireNonNull(node);
-        Objects.requireNonNull(styleClass);
+        if (node == null)
+            throw new NullPointerException("Node cannot be null!");
+        if (styleClass == null)
+            throw new NullPointerException("Style class cannot be null!");
 
         if (excludes != null && excludes.length > 0) {
             node.getStyleClass().removeAll(excludes);
@@ -102,8 +111,10 @@ public final class Styles {
     }
 
     public static void activatePseudoClass(Node node, PseudoClass pseudoClass, PseudoClass... excludes) {
-        Objects.requireNonNull(node);
-        Objects.requireNonNull(pseudoClass);
+        if (node == null)
+            throw new NullPointerException("Node cannot be null!");
+        if (pseudoClass == null)
+            throw new NullPointerException("PseudoClass cannot be null!");
 
         if (excludes != null && excludes.length > 0) {
             for (PseudoClass exclude : excludes) {
diff --git a/base/src/main/java/atlantafx/base/theme/Theme.java b/base/src/main/java/atlantafx/base/theme/Theme.java
index e797b1d..25b450a 100755
--- a/base/src/main/java/atlantafx/base/theme/Theme.java
+++ b/base/src/main/java/atlantafx/base/theme/Theme.java
@@ -1,8 +1,6 @@
 /* SPDX-License-Identifier: MIT */
 package atlantafx.base.theme;
 
-import java.util.Objects;
-
 import static javafx.application.Application.STYLESHEET_CASPIAN;
 import static javafx.application.Application.STYLESHEET_MODENA;
 
@@ -17,9 +15,11 @@ public interface Theme {
 
     boolean isDarkMode();
 
-    static Theme of(String name, String userAgentStylesheet, boolean darkMode) {
-        Objects.requireNonNull(name);
-        Objects.requireNonNull(userAgentStylesheet);
+    static Theme of(final String name, final String userAgentStylesheet, final boolean darkMode) {
+        if (name == null)
+            throw new NullPointerException("Name cannot be null!");
+        if (userAgentStylesheet == null)
+            throw new NullPointerException("User agent stylesheet cannot be null!");
 
         return new Theme() {
 
diff --git a/base/src/main/java/atlantafx/base/theme/Tweaks.java b/base/src/main/java/atlantafx/base/theme/Tweaks.java
index c7290b0..ff783a5 100644
--- a/base/src/main/java/atlantafx/base/theme/Tweaks.java
+++ b/base/src/main/java/atlantafx/base/theme/Tweaks.java
@@ -7,17 +7,32 @@ package atlantafx.base.theme;
  */
 public final class Tweaks {
 
-    /** Removes or hides dropdown arrow button */
-    public static final String NO_ARROW  = "no-arrow";
+    /**
+     * Initialize a new Tweaks
+     */
+    private Tweaks() {
+        // Default constructor
+    }
 
-    /** Removes external control borders */
+    /**
+     * Removes or hides dropdown arrow button
+     */
+    public static final String NO_ARROW = "no-arrow";
+
+    /**
+     * Removes external control borders
+     */
     public static final String EDGE_TO_EDGE = "edge-to-edge";
 
-    /** Alignment */
+    /**
+     * Alignment
+     */
     public static final String ALIGN_LEFT = "align-left";
     public static final String ALIGN_CENTER = "align-center";
     public static final String ALIGN_RIGHT = "align-right";
 
-    /** Forces a control to use alternative icon, if available */
+    /**
+     * Forces a control to use alternative icon, if available
+     */
     public static final String ALT_ICON = "alt-icon";
 }
diff --git a/base/src/main/java/atlantafx/base/util/DoubleStringConverter.java b/base/src/main/java/atlantafx/base/util/DoubleStringConverter.java
index a77a357..fa979eb 100644
--- a/base/src/main/java/atlantafx/base/util/DoubleStringConverter.java
+++ b/base/src/main/java/atlantafx/base/util/DoubleStringConverter.java
@@ -26,15 +26,17 @@ import java.text.DecimalFormat;
  */
 public class DoubleStringConverter extends StringConverter {
 
-    private final DecimalFormat _format = new DecimalFormat("0.##");
-    private Runnable _reset;
+    private final DecimalFormat decimalFormat = new DecimalFormat("0.##");
+    private Runnable reset;
 
     /**
      * Creates a {@link DoubleStringConverter}.
      * Swallows {@link NumberFormatException} but does nothing
      * in response until {@link #setReset} is defined.
      */
-    public DoubleStringConverter() { }
+    public DoubleStringConverter() {
+        // Default constructor
+    }
 
     /**
      * Creates a {@link DoubleStringConverter} with an editor reset callback.
@@ -43,7 +45,7 @@ public class DoubleStringConverter extends StringConverter {
      * @param reset the {@link Runnable} to call upon {@link NumberFormatException}
      */
     public DoubleStringConverter(Runnable reset) {
-        _reset = reset;
+        this.reset = reset;
     }
 
     /**
@@ -59,10 +61,12 @@ public class DoubleStringConverter extends StringConverter {
      * @throws NullPointerException if {@code input} is {@code null}
      */
     public DoubleStringConverter(TextField input, double min, double max) {
-        if (input == null) { throw new NullPointerException("input"); }
+        if (input == null) {
+            throw new NullPointerException("Input cannot be null!");
+        }
 
         final double resetValue = Math.min(Math.max(0, min), max);
-        _reset = () -> input.setText(_format.format(resetValue));
+        reset = () -> input.setText(decimalFormat.format(resetValue));
 
         // bound JavaFX properties cannot be explicitly set
         // if (!input.tooltipProperty().isBound()) {
@@ -71,11 +75,15 @@ public class DoubleStringConverter extends StringConverter {
 
         // restrict direct input to valid numerical characters
         input.textProperty().addListener((ov, oldValue, newValue) -> {
-            if (newValue == null || newValue.isEmpty()) { return; }
+            if (newValue == null || newValue.isEmpty()) {
+                return;
+            }
 
             // special case: minus sign if negative values allowed
             if (min < 0 && newValue.endsWith("-")) {
-                if (newValue.length() > 1) { Platform.runLater(() -> input.setText("-")); }
+                if (newValue.length() > 1) {
+                    Platform.runLater(() -> input.setText("-"));
+                }
                 return;
             }
 
@@ -95,10 +103,14 @@ public class DoubleStringConverter extends StringConverter {
 
             // redundant for Spinner but not harmful
             final double restricted = Math.min(Math.max(value, min), max);
-            if (value != restricted) { input.setText(_format.format(restricted)); }
+            if (value != restricted) {
+                input.setText(decimalFormat.format(restricted));
+            }
 
             // required for Spinner which handles onAction
-            if (oldHandler != null) { oldHandler.handle(t); }
+            if (oldHandler != null) {
+                oldHandler.handle(t);
+            }
         });
     }
 
@@ -139,7 +151,7 @@ public class DoubleStringConverter extends StringConverter {
      * @see #fromString
      */
     public void setReset(Runnable reset) {
-        _reset = reset;
+        this.reset = reset;
     }
 
     /**
@@ -154,14 +166,18 @@ public class DoubleStringConverter extends StringConverter {
     @Override
     public Double fromString(String s) {
         if (s == null || s.isEmpty()) {
-            if (_reset != null) { _reset.run(); }
+            if (reset != null) {
+                reset.run();
+            }
             return 0.0;
         }
 
         try {
             return Double.valueOf(s);
         } catch (NumberFormatException e) {
-            if (_reset != null) { _reset.run(); }
+            if (reset != null) {
+                reset.run();
+            }
             return 0.0;
         }
     }
@@ -175,7 +191,9 @@ public class DoubleStringConverter extends StringConverter {
      */
     @Override
     public String toString(Double value) {
-        if (value == null) { return "0"; }
-        return _format.format(value);
+        if (value == null) {
+            return "0";
+        }
+        return decimalFormat.format(value);
     }
 }
diff --git a/base/src/main/java/atlantafx/base/util/IntegerStringConverter.java b/base/src/main/java/atlantafx/base/util/IntegerStringConverter.java
index 2bc5521..0c60c78 100644
--- a/base/src/main/java/atlantafx/base/util/IntegerStringConverter.java
+++ b/base/src/main/java/atlantafx/base/util/IntegerStringConverter.java
@@ -21,14 +21,15 @@ import javafx.util.StringConverter;
  */
 public class IntegerStringConverter extends StringConverter {
 
-    private Runnable _reset;
+    private Runnable reset;
 
     /**
      * Creates an {@link IntegerStringConverter}.
      * Swallows {@link NumberFormatException} but does nothing
      * in response until {@link #setReset} is defined.
      */
-    public IntegerStringConverter() { }
+    public IntegerStringConverter() {
+    }
 
     /**
      * Creates an {@link IntegerStringConverter} with an editor reset callback.
@@ -37,7 +38,7 @@ public class IntegerStringConverter extends StringConverter {
      * @param reset the {@link Runnable} to call upon {@link NumberFormatException}
      */
     public IntegerStringConverter(Runnable reset) {
-        _reset = reset;
+        this.reset = reset;
     }
 
     /**
@@ -53,10 +54,12 @@ public class IntegerStringConverter extends StringConverter {
      * @throws NullPointerException if {@code input} is {@code null}
      */
     public IntegerStringConverter(TextField input, int min, int max) {
-        if (input == null) { throw new NullPointerException("input"); }
+        if (input == null) {
+            throw new NullPointerException("Input cannot be null!");
+        }
 
         final int resetValue = Math.min(Math.max(0, min), max);
-        _reset = () -> input.setText(Integer.toString(resetValue));
+        reset = () -> input.setText(Integer.toString(resetValue));
 
         // bound JavaFX properties cannot be explicitly set
         // if (!input.tooltipProperty().isBound()) {
@@ -65,11 +68,15 @@ public class IntegerStringConverter extends StringConverter {
 
         // restrict direct input to valid numerical characters
         input.textProperty().addListener((ov, oldValue, newValue) -> {
-            if (newValue == null || newValue.isEmpty()) { return; }
+            if (newValue == null || newValue.isEmpty()) {
+                return;
+            }
 
             // special case: minus sign if negative values allowed
             if (min < 0 && newValue.endsWith("-")) {
-                if (newValue.length() > 1) { Platform.runLater(() -> input.setText("-")); }
+                if (newValue.length() > 1) {
+                    Platform.runLater(() -> input.setText("-"));
+                }
                 return;
             }
 
@@ -89,10 +96,14 @@ public class IntegerStringConverter extends StringConverter {
 
             // redundant for Spinner but not harmful
             final int restricted = Math.min(Math.max(value, min), max);
-            if (value != restricted) { input.setText(Integer.toString(restricted)); }
+            if (value != restricted) {
+                input.setText(Integer.toString(restricted));
+            }
 
             // required for Spinner which handles onAction
-            if (oldHandler != null) { oldHandler.handle(t); }
+            if (oldHandler != null) {
+                oldHandler.handle(t);
+            }
         });
     }
 
@@ -133,7 +144,7 @@ public class IntegerStringConverter extends StringConverter {
      * @see #fromString
      */
     public void setReset(Runnable reset) {
-        _reset = reset;
+        this.reset = reset;
     }
 
     /**
@@ -148,14 +159,18 @@ public class IntegerStringConverter extends StringConverter {
     @Override
     public Integer fromString(String s) {
         if (s == null || s.isEmpty()) {
-            if (_reset != null) { _reset.run(); }
+            if (reset != null) {
+                reset.run();
+            }
             return 0;
         }
 
         try {
             return Integer.valueOf(s);
         } catch (NumberFormatException e) {
-            if (_reset != null) { _reset.run(); }
+            if (reset != null) {
+                reset.run();
+            }
             return 0;
         }
     }
@@ -169,7 +184,9 @@ public class IntegerStringConverter extends StringConverter {
      */
     @Override
     public String toString(Integer value) {
-        if (value == null) { return "0"; }
+        if (value == null) {
+            return "0";
+        }
         return Integer.toString(value);
     }
 }
diff --git a/base/src/main/java/atlantafx/base/util/PasswordTextFormatter.java b/base/src/main/java/atlantafx/base/util/PasswordTextFormatter.java
index f9fbe1e..2481f38 100644
--- a/base/src/main/java/atlantafx/base/util/PasswordTextFormatter.java
+++ b/base/src/main/java/atlantafx/base/util/PasswordTextFormatter.java
@@ -27,9 +27,12 @@ public class PasswordTextFormatter extends TextFormatter {
                                     char bullet) {
         super(valueConverter, null, filter);
 
-        Objects.requireNonNull(valueConverter);
-        Objects.requireNonNull(filter);
-        Objects.requireNonNull(textField);
+        if (valueConverter == null)
+            throw new NullPointerException("StringConverter cannot be null!");
+        if (filter == null)
+            throw new NullPointerException("UnaryOperator cannot be null!");
+        if (textField == null)
+            throw new NullPointerException("TextField cannot be null!");
 
         PasswordFilter passwordFilter = (PasswordFilter) getFilter();
         passwordFilter.setBullet(bullet);
@@ -39,7 +42,9 @@ public class PasswordTextFormatter extends TextFormatter {
             // Force text field update, because converter is only called on focus
             // events by default. Don't use commitValue() here because caret position
             // won't be correct due to #javafx-bug (https://bugs.openjdk.org/browse/JDK-8248914).
-            if (val == null) { return; }
+            if (val == null) {
+                return;
+            }
             textField.setText(passwordProperty().get());
         });
 
@@ -90,7 +95,9 @@ public class PasswordTextFormatter extends TextFormatter {
 
         @Override
         public String toString(String s) {
-            if (s == null) { return ""; }
+            if (s == null) {
+                return "";
+            }
             return filter.revealPassword.get() ? filter.password.get() : filter.maskText(s.length());
         }
 
diff --git a/base/src/main/java/atlantafx/base/util/PlatformUtils.java b/base/src/main/java/atlantafx/base/util/PlatformUtils.java
index ed3691e..40be986 100755
--- a/base/src/main/java/atlantafx/base/util/PlatformUtils.java
+++ b/base/src/main/java/atlantafx/base/util/PlatformUtils.java
@@ -3,8 +3,15 @@ package atlantafx.base.util;
 
 public final class PlatformUtils {
 
-    private static final String OS = System.getProperty("os.name");
-    private static final boolean MAC = OS.startsWith("Mac");
+    /**
+     * Initialize a new PlatformUtils
+     */
+    private PlatformUtils() {
+        // Default constructor
+    }
+
+    private static final String OS = System.getProperty("os.name", "generic").toLowerCase();
+    private static final boolean MAC = OS.contains("mac") || OS.contains("darwin");
 
     public static boolean isMac() {
         return MAC;
diff --git a/docs/colors/global-variables.md b/docs/colors/global-variables.md
index ceaaece..c019802 100644
--- a/docs/colors/global-variables.md
+++ b/docs/colors/global-variables.md
@@ -4,29 +4,29 @@ parent: Colors
 nav_order: 2
 ---
 
-Global variables are defined at the Scene root level. You can preview all of the them in the Sampler app.
+Global variables are defined at the Scene root level. You can preview all of them in the Sampler app.
 
-AtlantaFX is based on GitHub Primer color system. You can check [GitHub Primer interface guidelines](https://primer.style/design/foundations/color) for more detailed instructions. There'are functional color variables and color scale variables.
+AtlantaFX is based on GitHub Primer color system. You can check [GitHub Primer interface guidelines](https://primer.style/design/foundations/color) for more detailed instructions. There are functional color variables and color scale variables.
 
 ## Functional colors
 
 Foreground colors.
 
-| Color | Usage |
-|-------|-------|
-| `-color-fg-default`  | Primary color for text and icons. It should be used for body content, titles and labels. |
+| Color                | Usage                                                                                                                            |
+|----------------------|----------------------------------------------------------------------------------------------------------------------------------|
+| `-color-fg-default`  | Primary color for text and icons. It should be used for body content, titles and labels.                                         |
 | `-color-fg-muted`    | For content that is secondary or that provides additional context but is not critical to understanding the flow of an interface. |
-| `-color-fg-subtle`   | For placeholders or decorative foregrounds. |
-| `-color-fg-emphasis` | The text color designed to combine with `*-emphasis` backgrounds for optimal contrast. |
+| `-color-fg-subtle`   | For placeholders or decorative foregrounds.                                                                                      |
+| `-color-fg-emphasis` | The text color designed to combine with `*-emphasis` backgrounds for optimal contrast.                                           |
 
 Background colors.
 
-| Color | Usage |
-|-------|-------|
-| `-color-bg-default`| Primary background color.                                          |
-| `-color-bg-overlay`| Background color for popup controls such as popovers and tooltips. |
-| `-color-bg-subtle` | Provides visual rest and contrast against the default background.  |
-| `-color-bg-inset`  | For a focal point, such as in conversations or activity feeds.     |
+| Color               | Usage                                                              |
+|---------------------|--------------------------------------------------------------------|
+| `-color-bg-default` | Primary background color.                                          |
+| `-color-bg-overlay` | Background color for popup controls such as popovers and tooltips. |
+| `-color-bg-subtle`  | Provides visual rest and contrast against the default background.  |
+| `-color-bg-inset`   | For a focal point, such as in conversations or activity feeds.     |
 
 Border colors.
 
diff --git a/sampler/pom.xml b/sampler/pom.xml
index 7925b73..c06121a 100755
--- a/sampler/pom.xml
+++ b/sampler/pom.xml
@@ -24,7 +24,8 @@
         
         ${project.build.directory}${file.separator}app-dir
         
-        ${project.build.directory}${file.separator}runtime-image
+        ${project.build.directory}${file.separator}runtime-image
+        
         
         ${project.build.directory}${file.separator}package-scripts
         
@@ -136,7 +137,9 @@
                 sass-cli-maven-plugin
                 
                     
-                        ${project.basedir}/src/main/resources/assets/styles/scss/index.scss:${project.build.directory}/classes/atlantafx/sampler/assets/styles/index.css
+                        
+                            ${project.basedir}/src/main/resources/assets/styles/scss/index.scss:${project.build.directory}/classes/atlantafx/sampler/assets/styles/index.css
+                        
                         --no-source-map
                     
                 
@@ -223,7 +226,9 @@
                         
                         
                             jlink
-                            java.base,java.logging,jdk.localedata,java.desktop,java.prefs,javafx.controls,javafx.swing,javafx.web
+                            
+                                java.base,java.logging,jdk.localedata,java.desktop,java.prefs,javafx.controls,javafx.swing,javafx.web
+                            
                             ${build.platformModulesDir}
                             ${build.package.runtimeImageDir}
                             
diff --git a/sampler/src/main/java/atlantafx/sampler/Launcher.java b/sampler/src/main/java/atlantafx/sampler/Launcher.java
index 22bb80a..5c91c3e 100755
--- a/sampler/src/main/java/atlantafx/sampler/Launcher.java
+++ b/sampler/src/main/java/atlantafx/sampler/Launcher.java
@@ -60,7 +60,9 @@ public class Launcher extends Application {
         var tm = ThemeManager.getInstance();
         tm.setScene(scene);
         tm.setTheme(tm.getDefaultTheme());
-        if (IS_DEV_MODE) { startCssFX(scene); }
+        if (IS_DEV_MODE) {
+            startCssFX(scene);
+        }
 
         scene.getStylesheets().addAll(Resources.resolve("assets/styles/index.css"));
 
@@ -89,9 +91,9 @@ public class Launcher extends Application {
     }
 
     private void loadApplicationProperties() {
-        try {
-            var properties = new Properties();
-            properties.load(new InputStreamReader(Resources.getResourceAsStream("application.properties"), UTF_8));
+        Properties properties = new Properties();
+        try (InputStreamReader in = new InputStreamReader(Resources.getResourceAsStream("application.properties"), UTF_8)) {
+            properties.load(in);
             properties.forEach((key, value) -> System.setProperty(
                     String.valueOf(key),
                     String.valueOf(value)
diff --git a/sampler/src/main/java/atlantafx/sampler/event/DefaultEventBus.java b/sampler/src/main/java/atlantafx/sampler/event/DefaultEventBus.java
index 30286ac..b9454b5 100644
--- a/sampler/src/main/java/atlantafx/sampler/event/DefaultEventBus.java
+++ b/sampler/src/main/java/atlantafx/sampler/event/DefaultEventBus.java
@@ -14,7 +14,7 @@ import java.util.function.Consumer;
  * Subscribe and publish events. Events are published in channels distinguished by event type.
  * Channels can be grouped using an event type hierarchy.
  * 

- * You can use the default event bus instance {@link #getInstance}, which is a singleton + * You can use the default event bus instance {@link #getInstance}, which is a singleton, * or you can create one or multiple instances of {@link DefaultEventBus}. */ @SuppressWarnings({"unchecked", "rawtypes"}) diff --git a/sampler/src/main/java/atlantafx/sampler/page/AbstractPage.java b/sampler/src/main/java/atlantafx/sampler/page/AbstractPage.java index b89efe4..66bae16 100755 --- a/sampler/src/main/java/atlantafx/sampler/page/AbstractPage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/AbstractPage.java @@ -12,7 +12,6 @@ import java.util.Arrays; import java.util.List; import java.util.Random; import java.util.function.Supplier; -import java.util.stream.Collectors; import java.util.stream.Stream; import static atlantafx.sampler.util.Containers.setScrollConstraints; @@ -66,6 +65,7 @@ public abstract class AbstractPage extends BorderPane implements Page { @Override public void reset() { } + @Override protected void layoutChildren() { super.layoutChildren(); if (isRendered) { return; } @@ -81,7 +81,7 @@ public abstract class AbstractPage extends BorderPane implements Page { } protected Overlay lookupOverlay() { - return getScene() != null && getScene().lookup("." + Overlay.STYLE_CLASS) instanceof Overlay overlay ? overlay : null; + return getScene() != null && getScene().lookup("." + Overlay.STYLE_CLASS) instanceof Overlay ov ? ov : null; } /////////////////////////////////////////////////////////////////////////// @@ -93,7 +93,7 @@ public abstract class AbstractPage extends BorderPane implements Page { } protected List generate(Supplier supplier, int count) { - return Stream.generate(supplier).limit(count).collect(Collectors.toList()); + return Stream.generate(supplier).limit(count).toList(); } protected Feather randomIcon() { 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 865a0d4..38a60d5 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/components/TablePage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/components/TablePage.java @@ -216,10 +216,10 @@ public class TablePage extends AbstractPage { var stockCol = new TableColumn("Stock"); stockCol.getColumns().setAll(stockCountCol, stockAvailCol); - var table = new TableView(); - table.getColumns().setAll(stateCol, indexCol, iconCol, brandCol, nameCol, priceCol, stockCol); + var tableView = new TableView(); + tableView.getColumns().setAll(stateCol, indexCol, iconCol, brandCol, nameCol, priceCol, stockCol); - return table; + return tableView; } private MenuButton createTablePropertiesMenu(TableView table) { diff --git a/sampler/src/main/java/atlantafx/sampler/page/general/ColorPaletteBlock.java b/sampler/src/main/java/atlantafx/sampler/page/general/ColorPaletteBlock.java index 635b4d1..6acba90 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/general/ColorPaletteBlock.java +++ b/sampler/src/main/java/atlantafx/sampler/page/general/ColorPaletteBlock.java @@ -73,16 +73,20 @@ class ColorPaletteBlock extends VBox { var bgFill = getBgColor(); // this happens when css isn't updated yet - if (bgFill == null) { return; } + if (bgFill == null) { + return; + } toggleHover(true); editIcon.setFill(getColorLuminance(flattenColor(bgBaseColor.get(), bgFill)) < LUMINANCE_THRESHOLD ? - Color.WHITE : Color.BLACK + Color.WHITE : Color.BLACK ); }); colorRectangle.setOnMouseExited(e -> toggleHover(false)); colorRectangle.setOnMouseClicked(e -> { - if (actionHandler != null) { actionHandler.accept(this); } + if (actionHandler != null) { + actionHandler.accept(this); + } }); getChildren().addAll( @@ -152,7 +156,10 @@ class ColorPaletteBlock extends VBox { } static String validateColorName(String colorName) { - if (colorName == null || !colorName.startsWith("-color")) { + if (colorName == null) { + throw new NullPointerException("Color name cannot be null!"); + } + if (!colorName.startsWith("-color")) { throw new IllegalArgumentException("Invalid color name: '" + colorName + "'."); } return colorName; 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 98e689f..1ddb417 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 @@ -4,7 +4,6 @@ package atlantafx.sampler.page.showcase.filemanager; import atlantafx.base.controls.Breadcrumbs; import atlantafx.base.controls.Spacer; import atlantafx.base.theme.Tweaks; -import atlantafx.sampler.page.components.BreadcrumbsPage; import atlantafx.sampler.page.showcase.ShowcasePage; import atlantafx.sampler.util.Containers; import javafx.geometry.Insets; diff --git a/sampler/src/main/java/atlantafx/sampler/page/showcase/filemanager/Utils.java b/sampler/src/main/java/atlantafx/sampler/page/showcase/filemanager/Utils.java index 4f3a692..eb2ce66 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/showcase/filemanager/Utils.java +++ b/sampler/src/main/java/atlantafx/sampler/page/showcase/filemanager/Utils.java @@ -7,13 +7,17 @@ import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.attribute.FileTime; -import java.text.CharacterIterator; -import java.text.StringCharacterIterator; final class Utils { + private Utils() { + // Default constructor + } + public static long fileSize(Path path) { - if (path == null) { return 0; } + if (path == null) { + return 0; + } try { return Files.size(path); } catch (IOException e) { @@ -22,7 +26,9 @@ final class Utils { } public static boolean isFileHidden(Path path) { - if (path == null) { return false; } + if (path == null) { + return false; + } try { return Files.isHidden(path); } catch (IOException e) { @@ -31,7 +37,9 @@ final class Utils { } public static FileTime fileMTime(Path path, LinkOption... options) { - if (path == null) { return null; } + if (path == null) { + return null; + } try { return Files.getLastModifiedTime(path, options); } catch (IOException e) { @@ -45,7 +53,7 @@ final class Utils { try { Desktop.getDesktop().open(path.toFile()); } catch (IOException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } }).start(); } diff --git a/sampler/src/main/java/atlantafx/sampler/util/ContrastLevel.java b/sampler/src/main/java/atlantafx/sampler/util/ContrastLevel.java index 76379dd..47276dd 100644 --- a/sampler/src/main/java/atlantafx/sampler/util/ContrastLevel.java +++ b/sampler/src/main/java/atlantafx/sampler/util/ContrastLevel.java @@ -28,12 +28,19 @@ public enum ContrastLevel { public boolean satisfies(double ratio) { switch (this) { - case AA_NORMAL -> { return ratio >= 4.5; } - case AA_LARGE -> { return ratio >= 3; } - case AAA_NORMAL -> { return ratio >= 7; } - case AAA_LARGE -> { return ratio >= 4.5; } + case AA_NORMAL, AAA_LARGE -> { + return ratio >= 4.5; + } + case AA_LARGE -> { + return ratio >= 3; + } + case AAA_NORMAL -> { + return ratio >= 7; + } + default -> { + return false; + } } - return false; } public static double getContrastRatio(Color color1, Color color2) { @@ -67,8 +74,10 @@ public enum ContrastLevel { return (tmp[0] * 0.2126) + (tmp[1] * 0.7152) + (tmp[2] * 0.0722); } - /** @see ContrastLevel#getColorLuminance(double[]) */ + /** + * @see ContrastLevel#getColorLuminance(double[]) + */ public static double getColorLuminance(Color color) { - return getColorLuminance(new double[] { color.getRed(), color.getGreen(), color.getBlue() }); + return getColorLuminance(new double[]{color.getRed(), color.getGreen(), color.getBlue()}); } } diff --git a/sampler/src/main/java/atlantafx/sampler/util/JColorUtils.java b/sampler/src/main/java/atlantafx/sampler/util/JColorUtils.java index 9dac1d7..47b40a2 100644 --- a/sampler/src/main/java/atlantafx/sampler/util/JColorUtils.java +++ b/sampler/src/main/java/atlantafx/sampler/util/JColorUtils.java @@ -219,7 +219,7 @@ public class JColorUtils { } /** - * Convert the hex single color to a RGB integer + * Convert the hex single color to an RGB integer * * @param color hex single color in format FF or F * @return integer color inclusively between 0 and 255 @@ -233,7 +233,7 @@ public class JColorUtils { } /** - * Convert the arithmetic RGB float to a RGB integer + * Convert the arithmetic RGB float to an RGB integer * * @param color float color inclusively between 0.0 and 1.0 * @return integer color inclusively between 0 and 255 diff --git a/styles/assembly.xml b/styles/assembly.xml index b81ec59..7fb9af8 100755 --- a/styles/assembly.xml +++ b/styles/assembly.xml @@ -17,4 +17,4 @@ - \ No newline at end of file + diff --git a/styles/src/components/_accordion.scss b/styles/src/components/_accordion.scss index 0287bd6..1ea6a93 100755 --- a/styles/src/components/_accordion.scss +++ b/styles/src/components/_accordion.scss @@ -21,4 +21,4 @@ -fx-background-radius: 0; } } -} \ No newline at end of file +} diff --git a/styles/src/components/_button.scss b/styles/src/components/_button.scss index 5b67161..b7d8905 100755 --- a/styles/src/components/_button.scss +++ b/styles/src/components/_button.scss @@ -384,4 +384,4 @@ $opacity-hover: 0.9 !default; &.rounded { -fx-background-radius: 10em; } -} \ No newline at end of file +} diff --git a/styles/src/components/_chart.scss b/styles/src/components/_chart.scss index 1060dce..12604c4 100755 --- a/styles/src/components/_chart.scss +++ b/styles/src/components/_chart.scss @@ -538,4 +538,4 @@ -fx-background-radius: 8px; -fx-padding: 8px; -fx-border-color: none; -} \ No newline at end of file +} diff --git a/styles/src/components/_checkbox.scss b/styles/src/components/_checkbox.scss index bddb8a5..69a0dc9 100755 --- a/styles/src/components/_checkbox.scss +++ b/styles/src/components/_checkbox.scss @@ -56,4 +56,4 @@ &:show-mnemonics>.mnemonic-underline { -fx-stroke: -color-fg-default; } -} \ No newline at end of file +} diff --git a/styles/src/components/_color-picker.scss b/styles/src/components/_color-picker.scss index 3a9df85..88546ee 100755 --- a/styles/src/components/_color-picker.scss +++ b/styles/src/components/_color-picker.scss @@ -219,4 +219,4 @@ -fx-background-size: auto; } } -} \ No newline at end of file +} diff --git a/styles/src/components/_combo-box.scss b/styles/src/components/_combo-box.scss index 2057885..0756c7c 100755 --- a/styles/src/components/_combo-box.scss +++ b/styles/src/components/_combo-box.scss @@ -220,4 +220,4 @@ $color-list-bg-selected: if(cfg.$darkMode, -color-base-6, -color-base-2) !defaul @include _alt-arrow(); } } -} \ No newline at end of file +} diff --git a/styles/src/components/_custom-text-field.scss b/styles/src/components/_custom-text-field.scss index 4284ff2..e2bbb74 100644 --- a/styles/src/components/_custom-text-field.scss +++ b/styles/src/components/_custom-text-field.scss @@ -41,4 +41,4 @@ $text-gap: 4px !default; -fx-fill: -color-danger-fg; } } -} \ No newline at end of file +} diff --git a/styles/src/components/_data.scss b/styles/src/components/_data.scss index 0eb56b4..e1c624f 100755 --- a/styles/src/components/_data.scss +++ b/styles/src/components/_data.scss @@ -530,4 +530,4 @@ $tree-cell-indent: 1em !default; } } } -} \ No newline at end of file +} diff --git a/styles/src/components/_date-picker.scss b/styles/src/components/_date-picker.scss index e52be69..d95c5a1 100755 --- a/styles/src/components/_date-picker.scss +++ b/styles/src/components/_date-picker.scss @@ -261,4 +261,4 @@ $chrono-cell-padding: 0.083333em $cell-padding-x 0.083333em 0.333333em !default; -fx-text-fill: -color-date-other-month-fg; -fx-fill: -color-date-other-month-fg; -fx-font-weight: normal; -} \ No newline at end of file +} diff --git a/styles/src/components/_dialog.scss b/styles/src/components/_dialog.scss index 6858f48..672fa9b 100755 --- a/styles/src/components/_dialog.scss +++ b/styles/src/components/_dialog.scss @@ -111,4 +111,4 @@ $image-confirm: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAA .text-input-dialog.dialog-pane, .choice-dialog.dialog-pane { -fx-graphic: $image-confirm; -} \ No newline at end of file +} diff --git a/styles/src/components/_html-editor.scss b/styles/src/components/_html-editor.scss index fad2a7a..9c4bbf5 100755 --- a/styles/src/components/_html-editor.scss +++ b/styles/src/components/_html-editor.scss @@ -145,4 +145,4 @@ $image-path: "/com/sun/javafx/scene/control/skin/modena" !default; .html-editor-hr { -fx-graphic: url("#{$image-path}/HTMLEditor-Break.png"); -} \ No newline at end of file +} diff --git a/styles/src/components/_hyperlink.scss b/styles/src/components/_hyperlink.scss index 778c8ba..1b1841e 100755 --- a/styles/src/components/_hyperlink.scss +++ b/styles/src/components/_hyperlink.scss @@ -32,4 +32,4 @@ $color-fg-armed: -color-fg-default !default; &:show-mnemonics>.mnemonic-underline { -fx-stroke: -fx-text-fill; } -} \ No newline at end of file +} diff --git a/styles/src/components/_index.scss b/styles/src/components/_index.scss index ded6d1f..30139cd 100755 --- a/styles/src/components/_index.scss +++ b/styles/src/components/_index.scss @@ -31,4 +31,4 @@ @use "toggle-button"; @use "toggle-switch"; @use "toolbar"; -@use "tooltip"; \ No newline at end of file +@use "tooltip"; diff --git a/styles/src/components/_label.scss b/styles/src/components/_label.scss index e5f47f9..c52adea 100755 --- a/styles/src/components/_label.scss +++ b/styles/src/components/_label.scss @@ -32,4 +32,4 @@ &.right-pill { -fx-background-radius: 0 cfg.$border-radius cfg.$border-radius 0; } -} \ No newline at end of file +} diff --git a/styles/src/components/_menu-button.scss b/styles/src/components/_menu-button.scss index 45f41c9..1145ed4 100644 --- a/styles/src/components/_menu-button.scss +++ b/styles/src/components/_menu-button.scss @@ -189,4 +189,4 @@ $separator-width: 0.75px !default; -fx-border-width: 0 0 0 $separator-width; -fx-border-insets: calc(cfg.$border-width + 6px) 0 calc(cfg.$border-width + 6px) 0; } -} \ No newline at end of file +} diff --git a/styles/src/components/_pagination.scss b/styles/src/components/_pagination.scss index 9a2f322..a48bb44 100755 --- a/styles/src/components/_pagination.scss +++ b/styles/src/components/_pagination.scss @@ -78,4 +78,4 @@ $button-radius: 10em !default; } } } -} \ No newline at end of file +} diff --git a/styles/src/components/_popover.scss b/styles/src/components/_popover.scss index 277cdb7..7c3bc63 100644 --- a/styles/src/components/_popover.scss +++ b/styles/src/components/_popover.scss @@ -44,4 +44,4 @@ $padding-y: 10px !default; } } } -} \ No newline at end of file +} diff --git a/styles/src/components/_progress.scss b/styles/src/components/_progress.scss index 291a1cd..0e70fe3 100755 --- a/styles/src/components/_progress.scss +++ b/styles/src/components/_progress.scss @@ -202,4 +202,4 @@ $size: ( } } } -} \ No newline at end of file +} diff --git a/styles/src/components/_radio.scss b/styles/src/components/_radio.scss index 89b72a2..dcbfe1f 100755 --- a/styles/src/components/_radio.scss +++ b/styles/src/components/_radio.scss @@ -48,4 +48,4 @@ &:show-mnemonics>.mnemonic-underline { -fx-stroke: -color-fg-default; } -} \ No newline at end of file +} diff --git a/styles/src/components/_separator.scss b/styles/src/components/_separator.scss index 14fd7ce..4f4c4d4 100755 --- a/styles/src/components/_separator.scss +++ b/styles/src/components/_separator.scss @@ -36,4 +36,4 @@ $line-width: cfg.$border-width !default; -fx-padding: 0 $padding 0 $padding; } } -} \ No newline at end of file +} diff --git a/styles/src/components/_slider.scss b/styles/src/components/_slider.scss index 7559980..f150a92 100755 --- a/styles/src/components/_slider.scss +++ b/styles/src/components/_slider.scss @@ -185,4 +185,4 @@ $tick-minor-size: 3px !default; 0 calc(map-get($thumb-size, "large-h") - map-get($track-size, "large")); } } -} \ No newline at end of file +} diff --git a/styles/src/components/_spinner.scss b/styles/src/components/_spinner.scss index a400b8d..ee257a0 100755 --- a/styles/src/components/_spinner.scss +++ b/styles/src/components/_spinner.scss @@ -182,4 +182,4 @@ $icon-padding-x: 0.25em !default; } } } -} \ No newline at end of file +} diff --git a/styles/src/components/_split-pane.scss b/styles/src/components/_split-pane.scss index b13c645..ec7e85e 100755 --- a/styles/src/components/_split-pane.scss +++ b/styles/src/components/_split-pane.scss @@ -58,4 +58,4 @@ $grabber-length: 10px !default; -fx-opacity: cfg.$scrollbar-opacity-disabled; } } -} \ No newline at end of file +} diff --git a/styles/src/components/_tab-pane.scss b/styles/src/components/_tab-pane.scss index cfc8670..ef5b3ae 100755 --- a/styles/src/components/_tab-pane.scss +++ b/styles/src/components/_tab-pane.scss @@ -229,4 +229,4 @@ $tab-float-width: 150px !default; } } } -} \ No newline at end of file +} diff --git a/styles/src/components/_text-input.scss b/styles/src/components/_text-input.scss index 05cf715..d3034b4 100755 --- a/styles/src/components/_text-input.scss +++ b/styles/src/components/_text-input.scss @@ -134,4 +134,4 @@ $color-fg-password: -color-fg-muted !default; .password-field { -fx-text-fill: $color-fg-password; -} \ No newline at end of file +} diff --git a/styles/src/components/_titled-pane.scss b/styles/src/components/_titled-pane.scss index 72c9ab3..24139db 100755 --- a/styles/src/components/_titled-pane.scss +++ b/styles/src/components/_titled-pane.scss @@ -92,4 +92,4 @@ $margin-content: 20px !default; &:show-mnemonics>.mnemonic-underline { -fx-stroke: -color-fg-default; } -} \ No newline at end of file +} diff --git a/styles/src/components/_toggle-button.scss b/styles/src/components/_toggle-button.scss index bb1a3ac..9fc0b37 100644 --- a/styles/src/components/_toggle-button.scss +++ b/styles/src/components/_toggle-button.scss @@ -40,4 +40,4 @@ &:selected.right-pill:focused { -fx-background-insets: 0, cfg.$border-width; } -} \ No newline at end of file +} diff --git a/styles/src/components/_toggle-switch.scss b/styles/src/components/_toggle-switch.scss index 8bb9672..05e6a4a 100644 --- a/styles/src/components/_toggle-switch.scss +++ b/styles/src/components/_toggle-switch.scss @@ -53,4 +53,4 @@ $thumb-area-padding: 0.85em 1.4em 0.85em 1.4em !default; &:disabled { -fx-opacity: cfg.$opacity-disabled; } -} \ No newline at end of file +} diff --git a/styles/src/components/_toolbar.scss b/styles/src/components/_toolbar.scss index d82f51f..15da490 100755 --- a/styles/src/components/_toolbar.scss +++ b/styles/src/components/_toolbar.scss @@ -76,4 +76,4 @@ $border-width: cfg.$border-width !default; &.bottom { -fx-background-insets: 0, $border-width 0 0 0; } -} \ No newline at end of file +} diff --git a/styles/src/components/_tooltip.scss b/styles/src/components/_tooltip.scss index 069d3fc..21f608f 100755 --- a/styles/src/components/_tooltip.scss +++ b/styles/src/components/_tooltip.scss @@ -19,4 +19,4 @@ $padding-y: cfg.$padding-y !default; -fx-padding: $padding-y $padding-x $padding-y $padding-x; -fx-opacity: $opacity; @include effects.shadow(-color-shadow-default, cfg.$popup-shadow-radius, cfg.$popup-shadow-spread); -} \ No newline at end of file +} diff --git a/styles/src/general/_index.scss b/styles/src/general/_index.scss index 2ade058..0e635f4 100644 --- a/styles/src/general/_index.scss +++ b/styles/src/general/_index.scss @@ -2,4 +2,4 @@ @forward "root"; @forward "text"; -@forward "extras"; \ No newline at end of file +@forward "extras"; diff --git a/styles/src/general/_root.scss b/styles/src/general/_root.scss index 0f118e8..77c6735 100755 --- a/styles/src/general/_root.scss +++ b/styles/src/general/_root.scss @@ -162,4 +162,4 @@ // that set mnemonicParsing = true. .mnemonic-underline { -fx-stroke: transparent; -} \ No newline at end of file +} diff --git a/styles/src/primer-light.scss b/styles/src/primer-light.scss index bdb2592..d4ba278 100755 --- a/styles/src/primer-light.scss +++ b/styles/src/primer-light.scss @@ -25,4 +25,4 @@ // ... // ); -@use "components"; \ No newline at end of file +@use "components"; diff --git a/styles/src/settings/_color-vars.scss b/styles/src/settings/_color-vars.scss index 5e19bf4..8494253 100644 --- a/styles/src/settings/_color-vars.scss +++ b/styles/src/settings/_color-vars.scss @@ -70,4 +70,4 @@ $chart-4-alpha20: color.change($chart-4, $alpha: 0.2) !default; $chart-5-alpha20: color.change($chart-5, $alpha: 0.2) !default; $chart-6-alpha20: color.change($chart-6, $alpha: 0.2) !default; $chart-7-alpha20: color.change($chart-7, $alpha: 0.2) !default; -$chart-8-alpha20: color.change($chart-8, $alpha: 0.2) !default; \ No newline at end of file +$chart-8-alpha20: color.change($chart-8, $alpha: 0.2) !default; diff --git a/styles/src/settings/_config.scss b/styles/src/settings/_config.scss index 7541a28..a45c80f 100644 --- a/styles/src/settings/_config.scss +++ b/styles/src/settings/_config.scss @@ -62,4 +62,4 @@ $separators: ("small": 0.25em, "medium": 0.75em, "large": 1.5em) !default; $scrollbar-color-track: -color-border-subtle !default; $scrollbar-color-thumb: -color-fg-muted !default; $scrollbar-opacity-inactive: 0.5 !default; -$scrollbar-opacity-disabled: 0.25 !default; \ No newline at end of file +$scrollbar-opacity-disabled: 0.25 !default; diff --git a/styles/src/settings/_icons.scss b/styles/src/settings/_icons.scss index 83df6d9..95eb2f8 100644 --- a/styles/src/settings/_icons.scss +++ b/styles/src/settings/_icons.scss @@ -24,4 +24,4 @@ $material-icons: ( -fx-shape: $shape; -fx-scale-shape: $scale; -} \ No newline at end of file +}