Browse Source

Make helper classes final.

pull/235/head
weisj 4 years ago
parent
commit
029be4f873
  1. 2
      core/src/main/java/com/github/weisj/darklaf/components/ComponentHelper.java
  2. 2
      core/src/main/java/com/github/weisj/darklaf/components/DynamicUI.java
  3. 2
      core/src/main/java/com/github/weisj/darklaf/components/iconeditor/IconEditorPanel.java
  4. 2
      core/src/main/java/com/github/weisj/darklaf/focus/FocusParentHelper.java
  5. 2
      core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java
  6. 6
      core/src/main/java/com/github/weisj/darklaf/graphics/StringPainter.java
  7. 2
      core/src/main/java/com/github/weisj/darklaf/layout/LayoutHelper.java
  8. 4
      core/src/main/java/com/github/weisj/darklaf/transfer/TransferUtil.java
  9. 2
      core/src/main/java/com/github/weisj/darklaf/ui/DividedWidgetPainter.java
  10. 2
      core/src/main/java/com/github/weisj/darklaf/ui/WidgetPopupHelper.java
  11. 2
      core/src/main/java/com/github/weisj/darklaf/ui/cell/CellUtil.java
  12. 2
      core/src/main/java/com/github/weisj/darklaf/ui/popupmenu/EventHelperUtil.java
  13. 2
      core/src/main/java/com/github/weisj/darklaf/ui/popupmenu/MouseGrabberUtil.java
  14. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameUtil.java
  15. 2
      core/src/main/java/com/github/weisj/darklaf/ui/text/StyleConstantsEx.java
  16. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tooltip/ToolTipUtil.java
  17. 2
      core/src/main/java/com/github/weisj/darklaf/util/DnDUtil.java
  18. 2
      core/src/main/java/com/github/weisj/darklaf/util/ResourceUtil.java
  19. 2
      core/src/main/java/com/github/weisj/darklaf/util/SwingXUtil.java
  20. 2
      core/src/main/java/com/github/weisj/darklaf/util/WindowUtil.java
  21. 8
      core/src/test/java/test/TestUtils.java
  22. 2
      core/src/test/java/ui/DemoResources.java
  23. 2
      core/src/test/java/util/ClassFinder.java
  24. 2
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/JNIDecorationsMacOS.java
  25. 2
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/JNIThemeInfoMacOS.java
  26. 2
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/theme/MacOSColors.java
  27. 2
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSDecorationsUtil.java
  28. 8
      native-utils/src/main/java/com/github/weisj/darklaf/platform/NativeUtil.java
  29. 2
      property-loader/src/main/java/com/github/weisj/darklaf/icons/IconUtil.java
  30. 2
      utils/src/main/java/com/github/weisj/darklaf/util/Actions.java
  31. 2
      utils/src/main/java/com/github/weisj/darklaf/util/FontUtil.java
  32. 2
      utils/src/main/java/com/github/weisj/darklaf/util/Lambdas.java
  33. 2
      utils/src/main/java/com/github/weisj/darklaf/util/LogUtil.java
  34. 2
      utils/src/main/java/com/github/weisj/darklaf/util/PropertyKey.java
  35. 2
      utils/src/main/java/com/github/weisj/darklaf/util/PropertyUtil.java
  36. 2
      utils/src/main/java/com/github/weisj/darklaf/util/PropertyValue.java
  37. 4
      utils/src/main/java/com/github/weisj/darklaf/util/Scale.java
  38. 2
      utils/src/main/java/com/github/weisj/darklaf/util/StreamUtil.java
  39. 2
      utils/src/main/java/com/github/weisj/darklaf/util/SystemInfo.java
  40. 2
      utils/src/main/java/com/github/weisj/darklaf/util/Types.java
  41. 2
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/JNIDecorationsWindows.java
  42. 2
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/JNIThemeInfoWindows.java
  43. 2
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/PointerUtil.java

2
core/src/main/java/com/github/weisj/darklaf/components/ComponentHelper.java

@ -29,7 +29,7 @@ import javax.swing.*;
import com.github.weisj.darklaf.components.button.JSplitButton;
import com.github.weisj.darklaf.ui.button.ButtonConstants;
public class ComponentHelper {
public final class ComponentHelper {
private ComponentHelper() {
throw new IllegalStateException("Utility class");

2
core/src/main/java/com/github/weisj/darklaf/components/DynamicUI.java

@ -28,7 +28,7 @@ import java.util.function.Consumer;
import javax.swing.*;
public class DynamicUI {
public final class DynamicUI {
private static final Map<Component, List<Consumer<Component>>> listeners = new WeakHashMap<>();

2
core/src/main/java/com/github/weisj/darklaf/components/iconeditor/IconEditorPanel.java

@ -348,7 +348,7 @@ public class IconEditorPanel extends JPanel {
}
}
static class IconValues {
static final class IconValues {
private static final Map<Theme, SharedComponent<ColorPaletteChooser>> chooserMap = new HashMap<>();
private static final Map<Theme, SharedComponent<OpacityChooser>> opacityChooserMap = new HashMap<>();

2
core/src/main/java/com/github/weisj/darklaf/focus/FocusParentHelper.java

@ -31,7 +31,7 @@ import javax.swing.*;
import com.github.weisj.darklaf.util.PropertyUtil;
public class FocusParentHelper {
public final class FocusParentHelper {
public static final String KEY_FOCUS_PARENT = "focusParent";
public static final String KEY_FOCUS_ACTION = "focusOnParentChangedAction";

2
core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java

@ -29,7 +29,7 @@ import java.awt.geom.RoundRectangle2D;
import com.github.weisj.darklaf.util.Scale;
public class PaintUtil {
public final class PaintUtil {
public static final Color TRANSPARENT_COLOR = new Color(0x0, true);
private static final AlphaComposite transparentComposite =

6
core/src/main/java/com/github/weisj/darklaf/graphics/StringPainter.java

@ -37,7 +37,7 @@ import sun.swing.SwingUtilities2;
import com.github.weisj.darklaf.ui.OpacityBufferedUI;
import com.github.weisj.darklaf.util.*;
public class StringPainter {
public final class StringPainter {
private static final Logger LOGGER = LogUtil.getLogger(StringPainter.class);
@ -214,7 +214,7 @@ public class StringPainter {
Field imgField;
try {
imgField = surfaceDataValue.getClass().getDeclaredField("bufImg"); // BufImgSurfaceData
} catch (Exception ignored) {
} catch (final Exception ignored) {
imgField = surfaceDataValue.getClass().getField("offscreenImage"); // CGLSurfaceData
}
imgField.setAccessible(true);
@ -222,7 +222,7 @@ public class StringPainter {
if (img instanceof BufferedImage) {
return (BufferedImage) img;
}
} catch (Exception e) {
} catch (final Exception e) {
e.printStackTrace();
}
return null;

2
core/src/main/java/com/github/weisj/darklaf/layout/LayoutHelper.java

@ -36,7 +36,7 @@ import com.github.weisj.darklaf.components.border.DarkBorders;
import com.github.weisj.darklaf.util.Alignment;
import com.github.weisj.darklaf.util.DarkUIUtil;
public class LayoutHelper {
public final class LayoutHelper {
private LayoutHelper() {
throw new IllegalArgumentException("Utility class");

4
core/src/main/java/com/github/weisj/darklaf/transfer/TransferUtil.java

@ -37,7 +37,7 @@ import javax.swing.*;
import com.github.weisj.darklaf.icons.IconUtil;
import com.github.weisj.darklaf.util.Pair;
public class TransferUtil {
public final class TransferUtil {
private TransferUtil() {
throw new IllegalStateException("Utility class");
@ -94,7 +94,7 @@ public class TransferUtil {
try {
// noinspection unchecked
importer.accept((T) support.getTransferable().getTransferData(flavor));
} catch (Exception ignored) {
} catch (final Exception ignored) {
}
return false;
}

2
core/src/main/java/com/github/weisj/darklaf/ui/DividedWidgetPainter.java

@ -28,7 +28,7 @@ import javax.swing.*;
import com.github.weisj.darklaf.graphics.PaintUtil;
import com.github.weisj.darklaf.ui.cell.CellUtil;
public class DividedWidgetPainter {
public final class DividedWidgetPainter {
public static void paintBackground(final Graphics2D g, final JComponent c, final int arc,
final Rectangle splitBounds, final Color bg, final Color splitBg, final boolean isCellEditor) {

2
core/src/main/java/com/github/weisj/darklaf/ui/WidgetPopupHelper.java

@ -27,7 +27,7 @@ import javax.swing.*;
import com.github.weisj.darklaf.util.DarkUIUtil;
public class WidgetPopupHelper {
public final class WidgetPopupHelper {
public static Rectangle getPopupBounds(final JComponent parent, final Dimension popupSize,
final Dimension parentSize) {

2
core/src/main/java/com/github/weisj/darklaf/ui/cell/CellUtil.java

@ -35,7 +35,7 @@ import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.PropertyKey;
import com.github.weisj.darklaf.util.PropertyUtil;
public class CellUtil {
public final class CellUtil {
public static final String KEY_SELECTED_CELL_RENDERER = "JComponent.selectedCellRenderer";

2
core/src/main/java/com/github/weisj/darklaf/ui/popupmenu/EventHelperUtil.java

@ -23,7 +23,7 @@ package com.github.weisj.darklaf.ui.popupmenu;
import javax.swing.plaf.basic.BasicLookAndFeel;
public class EventHelperUtil {
public final class EventHelperUtil {
private static boolean eventHelperInstallerFlagSet;

2
core/src/main/java/com/github/weisj/darklaf/ui/popupmenu/MouseGrabberUtil.java

@ -32,7 +32,7 @@ import javax.swing.event.ChangeListener;
import com.github.weisj.darklaf.util.DarkUIUtil;
public class MouseGrabberUtil {
public final class MouseGrabberUtil {
private MouseGrabberUtil() {}

2
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameUtil.java

@ -31,7 +31,7 @@ import com.github.weisj.darklaf.util.Actions;
import com.github.weisj.darklaf.util.Alignment;
import com.github.weisj.darklaf.util.DarkUIUtil;
public class TabFrameUtil {
public final class TabFrameUtil {
private static final String ACCELERATOR_PREFIX = "accelerator_";

2
core/src/main/java/com/github/weisj/darklaf/ui/text/StyleConstantsEx.java

@ -21,6 +21,6 @@
*/
package com.github.weisj.darklaf.ui.text;
public class StyleConstantsEx {
public final class StyleConstantsEx {
public static final Object SelectedForeground = "selectedForeground";
}

2
core/src/main/java/com/github/weisj/darklaf/ui/tooltip/ToolTipUtil.java

@ -32,7 +32,7 @@ import com.github.weisj.darklaf.util.Alignment;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.WindowUtil;
public class ToolTipUtil {
public final class ToolTipUtil {
public static void applyContext(final JToolTip toolTip) {
JComponent target = toolTip.getComponent();

2
core/src/main/java/com/github/weisj/darklaf/util/DnDUtil.java

@ -25,7 +25,7 @@ import java.awt.*;
import com.github.weisj.darklaf.graphics.PaintUtil;
public class DnDUtil {
public final class DnDUtil {
public static Image createDragImage(final Component c, final int lw, final Color borderColor) {
return createDragImage(c, new Rectangle(0, 0, c.getWidth(), c.getHeight()), lw, borderColor);

2
core/src/main/java/com/github/weisj/darklaf/util/ResourceUtil.java

@ -25,7 +25,7 @@ import java.awt.*;
import com.github.weisj.darklaf.DarkLaf;
public class ResourceUtil {
public final class ResourceUtil {
private static final String BUNDLE_DIR = "bundles";

2
core/src/main/java/com/github/weisj/darklaf/util/SwingXUtil.java

@ -29,7 +29,7 @@ import javax.swing.*;
import org.jdesktop.jxlayer.JXLayer;
import org.pbjar.jxlayer.plaf.ext.TransformUI;
public class SwingXUtil {
public final class SwingXUtil {
@SuppressWarnings("unchecked")
public static Point convertPointToParent(final Component source, final Point p) {

2
core/src/main/java/com/github/weisj/darklaf/util/WindowUtil.java

@ -28,7 +28,7 @@ import javax.swing.event.AncestorEvent;
import com.github.weisj.darklaf.listener.AncestorAdapter;
public class WindowUtil {
public final class WindowUtil {
public static void moveWindow(final Window w, final JComponent content, final int x, final int y) {
w.setLocation(x, y);

8
core/src/test/java/test/TestUtils.java

@ -28,7 +28,7 @@ import javax.swing.*;
import org.junit.jupiter.api.Assertions;
class TestUtils {
final class TestUtils {
private TestUtils() {}
@ -38,14 +38,14 @@ class TestUtils {
SwingUtilities.invokeAndWait(() -> {
try {
action.run();
} catch (Exception e) {
} catch (final Exception e) {
exceptionRef.set(e);
}
});
} catch (InterruptedException e) {
} catch (final InterruptedException e) {
e.printStackTrace();
Assertions.fail(e.getMessage(), e);
} catch (InvocationTargetException e) {
} catch (final InvocationTargetException e) {
e.getTargetException().printStackTrace();
Throwable target = e.getTargetException();
Assertions.fail(target.getMessage(), target);

2
core/src/test/java/ui/DemoResources.java

@ -25,7 +25,7 @@ import javax.swing.*;
import com.github.weisj.darklaf.util.DarkUIUtil;
public class DemoResources {
public final class DemoResources {
public static final String LOREM_IPSUM =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tempor quis nibh a semper. Nullam\n"
+ " auctor, erat non viverra commodo, libero orci aliquam quam, ac interdum nunc est sed\n "

2
core/src/test/java/util/ClassFinder.java

@ -29,7 +29,7 @@ import java.util.stream.Collectors;
import com.github.weisj.darklaf.util.Lambdas;
public class ClassFinder {
public final class ClassFinder {
public static <T> List<T> getInstancesOfType(final Class<T> type, final String... packages) {
try (ResourceWalker walker = ResourceWalker.walkResources(packages)) {

2
macos/src/main/java/com/github/weisj/darklaf/platform/macos/JNIDecorationsMacOS.java

@ -23,7 +23,7 @@ package com.github.weisj.darklaf.platform.macos;
import java.awt.*;
public class JNIDecorationsMacOS {
public final class JNIDecorationsMacOS {
public static native long getComponentPointer(final Window window);

2
macos/src/main/java/com/github/weisj/darklaf/platform/macos/JNIThemeInfoMacOS.java

@ -25,7 +25,7 @@ import java.awt.*;
import com.github.weisj.darklaf.platform.macos.theme.MacOSColors;
public class JNIThemeInfoMacOS {
public final class JNIThemeInfoMacOS {
/**
* Returns whether dark mode is enabled.

2
macos/src/main/java/com/github/weisj/darklaf/platform/macos/theme/MacOSColors.java

@ -23,7 +23,7 @@ package com.github.weisj.darklaf.platform.macos.theme;
import java.awt.*;
public class MacOSColors {
public final class MacOSColors {
// 0.000000 0.478431 1.000000
public static final Color ACCENT_BLUE = color(0.000000f, 0.478431f, 1.000000f);

2
macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSDecorationsUtil.java

@ -29,7 +29,7 @@ import com.github.weisj.darklaf.platform.macos.JNIDecorationsMacOS;
import com.github.weisj.darklaf.util.PropertyUtil;
import com.github.weisj.darklaf.util.SystemInfo;
public class MacOSDecorationsUtil {
public final class MacOSDecorationsUtil {
private static final String FULL_WINDOW_CONTENT_KEY = "apple.awt.fullWindowContent";
private static final String TRANSPARENT_TITLE_BAR_KEY = "apple.awt.transparentTitleBar";

8
native-utils/src/main/java/com/github/weisj/darklaf/platform/NativeUtil.java

@ -37,7 +37,7 @@ import java.nio.file.*;
* @see <a href=
* "https://github.com/adamheinrich/native-utils">https://github.com/adamheinrich/native-utils</a>
*/
public class NativeUtil {
public final class NativeUtil {
public static final String NATIVE_FOLDER_PATH_PREFIX = "nativeutils";
/**
@ -93,10 +93,10 @@ public class NativeUtil {
try (InputStream is = NativeUtil.class.getResourceAsStream(path)) {
if (!temporaryDir.toFile().canWrite()) throw new IOException("Can't write to temporary directory.");
Files.copy(is, temp.toAbsolutePath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
} catch (final IOException e) {
delete(temp);
throw e;
} catch (NullPointerException e) {
} catch (final NullPointerException e) {
delete(temp);
throw new FileNotFoundException("File " + path + " was not found inside JAR.");
}
@ -117,7 +117,7 @@ public class NativeUtil {
private static void delete(final Path path) {
try {
Files.deleteIfExists(path);
} catch (IOException ignored) {
} catch (final IOException ignored) {
}
}

2
property-loader/src/main/java/com/github/weisj/darklaf/icons/IconUtil.java

@ -33,7 +33,7 @@ import com.github.weisj.darklaf.util.ImageUtil;
import com.github.weisj.darklaf.util.PropertyKey;
import com.github.weisj.darklaf.util.Scale;
public class IconUtil {
public final class IconUtil {
private static final int FRAME_ICON_SIZE = 32;
private static final Map<Window, Icon> windowIconSet = new WeakHashMap<>();

2
utils/src/main/java/com/github/weisj/darklaf/util/Actions.java

@ -26,7 +26,7 @@ import java.awt.event.ActionListener;
import javax.swing.*;
public class Actions {
public final class Actions {
public static Action create(final ActionListener action) {
return new AbstractAction() {

2
utils/src/main/java/com/github/weisj/darklaf/util/FontUtil.java

@ -27,7 +27,7 @@ import javax.swing.*;
import javax.swing.text.StyleContext;
public class FontUtil {
public final class FontUtil {
public static Font createFont(final String family, final int style, final int size) {
// This method calls FontUtilities.getCompositeFontUIResource(Font) internally which

2
utils/src/main/java/com/github/weisj/darklaf/util/Lambdas.java

@ -26,7 +26,7 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
public class Lambdas {
public final class Lambdas {
private Lambdas() {}

2
utils/src/main/java/com/github/weisj/darklaf/util/LogUtil.java

@ -28,7 +28,7 @@ import java.util.logging.Logger;
import com.github.weisj.darklaf.log.DarkLogHandler;
import com.github.weisj.darklaf.log.LogFormatter;
public class LogUtil {
public final class LogUtil {
private static final Logger PARENT = Logger.getLogger("com.github.weisj.darklaf");
private static final Handler LOG_HANDLER = new DarkLogHandler();

2
utils/src/main/java/com/github/weisj/darklaf/util/PropertyKey.java

@ -23,7 +23,7 @@ package com.github.weisj.darklaf.util;
import javax.swing.*;
public class PropertyKey {
public final class PropertyKey {
public static final String UI = "UI";
public static final String COMPONENT_ORIENTATION = "componentOrientation";
public static final String LAYOUT_ORIENTATION = "layoutOrientation";

2
utils/src/main/java/com/github/weisj/darklaf/util/PropertyUtil.java

@ -32,7 +32,7 @@ import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.plaf.UIResource;
public class PropertyUtil {
public final class PropertyUtil {
public static void installSystemProperty(final String key, final String value) {
String current = System.getProperty(key);

2
utils/src/main/java/com/github/weisj/darklaf/util/PropertyValue.java

@ -21,7 +21,7 @@
*/
package com.github.weisj.darklaf.util;
public class PropertyValue {
public final class PropertyValue {
public static final String TRUE = "true";
public static final String FALSE = "false";
public static final String NULL = "null";

4
utils/src/main/java/com/github/weisj/darklaf/util/Scale.java

@ -25,7 +25,7 @@ import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
public class Scale {
public final class Scale {
public static final double SCALE;
public static final double SCALE_X;
public static final double SCALE_Y;
@ -151,7 +151,7 @@ public class Scale {
public static Point inverseScale(final GraphicsConfiguration gc, final Point p) {
try {
return (Point) gc.getDefaultTransform().inverseTransform(p, p);
} catch (NoninvertibleTransformException e) {
} catch (final NoninvertibleTransformException e) {
return p;
}
}

2
utils/src/main/java/com/github/weisj/darklaf/util/StreamUtil.java

@ -28,7 +28,7 @@ import java.util.Spliterators;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class StreamUtil {
public final class StreamUtil {
private StreamUtil() {}

2
utils/src/main/java/com/github/weisj/darklaf/util/SystemInfo.java

@ -25,7 +25,7 @@ import java.util.Locale;
import java.util.regex.Pattern;
/** @author Konstantin Bulenkov */
public class SystemInfo {
public final class SystemInfo {
public static final String X86 = "32";
public static final String X64 = "64";
public static final String OS_NAME = System.getProperty("os.name");

2
utils/src/main/java/com/github/weisj/darklaf/util/Types.java

@ -21,7 +21,7 @@
*/
package com.github.weisj.darklaf.util;
public class Types {
public final class Types {
private Types() {
throw new IllegalStateException("Utility class");

2
windows/src/main/java/com/github/weisj/darklaf/platform/windows/JNIDecorationsWindows.java

@ -22,7 +22,7 @@
package com.github.weisj.darklaf.platform.windows;
/** @author Jannis Weis */
public class JNIDecorationsWindows {
public final class JNIDecorationsWindows {
public static native void updateValues(final long hwnd, final int left, final int right, final int height);

2
windows/src/main/java/com/github/weisj/darklaf/platform/windows/JNIThemeInfoWindows.java

@ -21,7 +21,7 @@
*/
package com.github.weisj.darklaf.platform.windows;
public class JNIThemeInfoWindows {
public final class JNIThemeInfoWindows {
/**
* Returns whether dark mode is enabled.

2
windows/src/main/java/com/github/weisj/darklaf/platform/windows/PointerUtil.java

@ -27,7 +27,7 @@ import javax.swing.*;
import com.sun.jna.Native;
public class PointerUtil {
public final class PointerUtil {
/**
* Get the window handle for the window the given component descends from.

Loading…
Cancel
Save