Checkstyle: fix wrapping [OperatorWrap]

This commit is contained in:
mkpaz 2023-02-09 20:39:57 +04:00
parent bb7b37caf6
commit c294addb36
27 changed files with 114 additions and 114 deletions

@ -619,9 +619,8 @@ public class InlineDatePickerSkin extends BehaviorSkinBase<InlineDatePicker, Inl
if (word.length() > 0) {
int firstChar = word.codePointAt(0);
if (!Character.isTitleCase(firstChar)) {
word = new String(new int[] {
Character.toTitleCase(firstChar)}, 0, 1) +
word.substring(Character.offsetByCodePoints(word, 0, 1));
word = new String(new int[] {Character.toTitleCase(firstChar)}, 0, 1)
+ word.substring(Character.offsetByCodePoints(word, 0, 1));
}
}
return word;

@ -235,8 +235,8 @@ public class RingProgressIndicatorSkin extends SkinBase<RingProgressIndicator> {
@Override
public boolean isSettable(RingProgressIndicator n) {
return n.getSkin() instanceof RingProgressIndicatorSkin s &&
(s.indeterminateAnimationTime == null || !s.indeterminateAnimationTime.isBound());
return n.getSkin() instanceof RingProgressIndicatorSkin s
&& (s.indeterminateAnimationTime == null || !s.indeterminateAnimationTime.isBound());
}
@Override

@ -44,7 +44,7 @@ public interface Theme {
}
default boolean isDefault() {
return STYLESHEET_MODENA.equals(getUserAgentStylesheet()) ||
STYLESHEET_CASPIAN.equals(getUserAgentStylesheet());
return STYLESHEET_MODENA.equals(getUserAgentStylesheet())
|| STYLESHEET_CASPIAN.equals(getUserAgentStylesheet());
}
}

@ -18,8 +18,8 @@ public class BrowseEvent extends Event {
@Override
public String toString() {
return "BrowseEvent{" +
"uri=" + uri +
"} " + super.toString();
return "BrowseEvent{"
+ "uri=" + uri
+ "} " + super.toString();
}
}

@ -33,8 +33,8 @@ public abstract class Event {
@Override
public String toString() {
return "Event{" +
"id=" + id +
'}';
return "Event{"
+ "id=" + id
+ '}';
}
}

@ -18,8 +18,8 @@ public class HotkeyEvent extends Event {
@Override
public String toString() {
return "HotkeyEvent{" +
"keys=" + keys +
"} " + super.toString();
return "HotkeyEvent{"
+ "keys=" + keys
+ "} " + super.toString();
}
}

@ -26,8 +26,8 @@ public class ThemeEvent extends Event {
@Override
public String toString() {
return "ThemeEvent{" +
"eventType=" + eventType +
"} " + super.toString();
return "ThemeEvent{"
+ "eventType=" + eventType
+ "} " + super.toString();
}
}

@ -88,8 +88,8 @@ class MainLayer extends BorderPane {
// update code view color theme on app theme change
DefaultEventBus.getInstance().subscribe(ThemeEvent.class, e -> {
if (ThemeManager.getInstance().getTheme() != null &&
model.currentSubLayerProperty().get() == SubLayer.SOURCE_CODE) {
if (ThemeManager.getInstance().getTheme() != null
&& model.currentSubLayerProperty().get() == SubLayer.SOURCE_CODE) {
showSourceCode();
}
});

@ -77,8 +77,8 @@ public class Overlay extends StackPane {
setOnMouseClicked(e -> {
Pane content = getContent();
Node eventSource = e.getPickResult().getIntersectedNode();
if (e.getButton() == MouseButton.PRIMARY && content != null &&
!NodeUtils.isDescendant(content, eventSource)) {
if (e.getButton() == MouseButton.PRIMARY && content != null
&& !NodeUtils.isDescendant(content, eventSource)) {
hideAndConsume.accept(e);
}
});
@ -128,9 +128,9 @@ public class Overlay extends StackPane {
}
public boolean contains(Pane content) {
return content != null &&
getContentWrapper().getChildren().size() > 0 &&
getContentWrapper().getChildren().get(0).equals(content);
return content != null
&& getContentWrapper().getChildren().size() > 0
&& getContentWrapper().getChildren().get(0).equals(content);
}
@Override

@ -321,8 +321,8 @@ class Sidebar extends StackPane {
public boolean matches(String filter) {
Objects.requireNonNull(filter);
return contains(getText(), filter) ||
searchKeywords.stream().anyMatch(keyword -> contains(keyword, filter));
return contains(getText(), filter)
|| searchKeywords.stream().anyMatch(keyword -> contains(keyword, filter));
}
private boolean contains(String text, String filter) {

@ -91,8 +91,8 @@ public abstract class OverlayDialog<T extends Region> extends VBox {
// overwrite existing content
getChildren().set(CONTENT_CHILD_INDEX, content);
} else {
throw new UnsupportedOperationException("Content cannot be placed because of unexpected children size. " +
"You should override 'OverlayDialog#setContent()' and place it manually.");
throw new UnsupportedOperationException("Content cannot be placed because of unexpected children size. "
+ "You should override 'OverlayDialog#setContent()' and place it manually.");
}
}

@ -108,9 +108,9 @@ public class ChartPage extends AbstractPage {
}
private Optional<Chart> findDisplayedChart() {
return chartWrapper.getChildren().size() > 0 ?
Optional.of((Chart) chartWrapper.getChildren().get(0)) :
Optional.empty();
return chartWrapper.getChildren().size() > 0
? Optional.of((Chart) chartWrapper.getChildren().get(0))
: Optional.empty();
}
private Chart createChart(Example example) {

@ -49,9 +49,9 @@ public class HTMLEditorPage extends AbstractPage {
private SampleBlock editorSample() {
var description = new Text(
"HTMLEditor toolbar buttons use images from 'com/sun/javafx/scene/control/skin/modena'. " +
"In opposite, since AtlantaFX themes are also distributed as single CSS files, it contains no images. " +
"Unfortunately reusing Modena resources isn't possible, because the package isn't opened in OpenJFX 'module-info'."
"HTMLEditor toolbar buttons use images from 'com/sun/javafx/scene/control/skin/modena'. "
+ "In opposite, since AtlantaFX themes are also distributed as single CSS files, it contains no images. "
+ "Unfortunately reusing Modena resources isn't possible, because the package isn't opened in OpenJFX 'module-info'."
);
var fixToggle = new ToggleSwitch("Apply Fix");
@ -86,16 +86,16 @@ public class HTMLEditorPage extends AbstractPage {
var tm = ThemeManager.getInstance();
Theme samplerTheme = tm.getTheme();
HighlightJSTheme hlTheme = tm.getMatchingSourceCodeHighlightTheme(samplerTheme);
return "<!DOCTYPE html>" +
"<html>" +
"<body style=\"" +
"background-color:" + hlTheme.getBackground() + ";" +
"color:" + hlTheme.getForeground() + ";" +
"font-family:" + tm.getFontFamily() + ";" +
"font-size:" + tm.getFontSize() + "px;" +
"\">" +
String.join("<br/><br/>", FAKER.lorem().paragraphs(10)) +
"</body>" +
"</html>";
return "<!DOCTYPE html>"
+ "<html>"
+ "<body style=\""
+ "background-color:" + hlTheme.getBackground() + ";"
+ "color:" + hlTheme.getForeground() + ";"
+ "font-family:" + tm.getFontFamily() + ";"
+ "font-size:" + tm.getFontSize() + "px;"
+ "\">"
+ String.join("<br/><br/>", FAKER.lorem().paragraphs(10))
+ "</body>"
+ "</html>";
}
}

@ -149,9 +149,9 @@ public class ListPage extends AbstractPage {
}
private Optional<ListView<?>> findDisplayedList() {
return listWrapper.getChildren().size() > 0 ?
Optional.of((ListView<?>) listWrapper.getChildren().get(0)) :
Optional.empty();
return listWrapper.getChildren().size() > 0
? Optional.of((ListView<?>) listWrapper.getChildren().get(0))
: Optional.empty();
}
private void toggleListProperty(Consumer<ListView<?>> consumer) {

@ -150,9 +150,9 @@ public class TreePage extends AbstractPage {
}
private Optional<TreeView<?>> findDisplayedTree() {
return treeWrapper.getChildren().size() > 0 ?
Optional.of((TreeView<?>) treeWrapper.getChildren().get(0)) :
Optional.empty();
return treeWrapper.getChildren().size() > 0
? Optional.of((TreeView<?>) treeWrapper.getChildren().get(0))
: Optional.empty();
}
private TreeView<String> createTree(Example example) {

@ -78,8 +78,8 @@ class ColorPaletteBlock extends VBox {
}
toggleHover(true);
editIcon.setFill(getColorLuminance(flattenColor(bgBaseColor.get(), bgFill)) < LUMINANCE_THRESHOLD ?
Color.WHITE : Color.BLACK
editIcon.setFill(getColorLuminance(flattenColor(bgBaseColor.get(), bgFill)) < LUMINANCE_THRESHOLD
? Color.WHITE : Color.BLACK
);
});
colorRectangle.setOnMouseExited(e -> toggleHover(false));
@ -129,8 +129,8 @@ class ColorPaletteBlock extends VBox {
}
public Color getBgColor() {
return colorRectangle.getBackground() != null && !colorRectangle.getBackground().isEmpty() ?
(Color) colorRectangle.getBackground().getFills().get(0).getFill() : null;
return colorRectangle.getBackground() != null && !colorRectangle.getBackground().isEmpty()
? (Color) colorRectangle.getBackground().getFills().get(0).getFill() : null;
}
public String getFgColorName() {

@ -67,8 +67,8 @@ class ColorScaleBlock extends VBox {
}
private Color getBgColor(Label label) {
return label.getBackground() != null && !label.getBackground().isEmpty() ?
(Color) label.getBackground().getFills().get(0).getFill() : Color.WHITE;
return label.getBackground() != null && !label.getBackground().isEmpty()
? (Color) label.getBackground().getFills().get(0).getFill() : Color.WHITE;
}
///////////////////////////////////////////////////////////////////////////

@ -124,8 +124,8 @@ class ContrastChecker extends GridPane {
// Returns fg color that guaranteed to be visible on the current bg.
public Color getSafeFgColor() {
if (contrastRatio.get() <= CONTRAST_RATIO_THRESHOLD) {
return getColorLuminance(flattenColor(bgBaseColor.get(), bgColor.getColor())) < LUMINANCE_THRESHOLD ?
Color.WHITE : Color.BLACK;
return getColorLuminance(flattenColor(bgBaseColor.get(), bgColor.getColor())) < LUMINANCE_THRESHOLD
? Color.WHITE : Color.BLACK;
} else {
return fgColor.getColor();
}
@ -511,9 +511,8 @@ class ContrastChecker extends GridPane {
hexItem.setOnAction(e -> {
var c = JColor.color(
new float[] {color.getHue(), color.getSaturation(), color.getLightness(), color.getAlpha()});
PlatformUtils.copyToClipboard(color.getAlpha() < 1 ?
toHexWithAlpha(color.getColor()) :
c.getColorHex()
PlatformUtils.copyToClipboard(color.getAlpha() < 1
? toHexWithAlpha(color.getColor()) : c.getColorHex()
);
});
@ -521,10 +520,11 @@ class ContrastChecker extends GridPane {
rgbItem.setOnAction(e -> {
var c = JColor.color(
new float[] {color.getHue(), color.getSaturation(), color.getLightness(), color.getAlpha()});
PlatformUtils.copyToClipboard(color.getAlpha() < 1 ?
String.format("rgba(%d,%d,%d, %.1f)", c.getGreen(), c.getGreen(), c.getBlue(),
c.getAlphaArithmetic()) :
String.format("rgb(%d,%d,%d)", c.getGreen(), c.getGreen(), c.getBlue())
PlatformUtils.copyToClipboard(color.getAlpha() < 1
? String.format(
"rgba(%d,%d,%d, %.1f)", c.getGreen(), c.getGreen(), c.getBlue(), c.getAlphaArithmetic()
)
: String.format("rgb(%d,%d,%d)", c.getGreen(), c.getGreen(), c.getBlue())
);
});
@ -532,10 +532,11 @@ class ContrastChecker extends GridPane {
hslItem.setOnAction(e -> {
var c = JColor.color(
new float[] {color.getHue(), color.getSaturation(), color.getLightness(), color.getAlpha()});
PlatformUtils.copyToClipboard(color.getAlpha() < 1 ?
String.format("hsla(%.0f,%.2f,%.2f, %.1f)", c.getHue(), c.getSaturation(), c.getLightness(),
c.getAlphaArithmetic()) :
String.format("hsl(%.0f,%.2f,%.2f)", c.getHue(), c.getSaturation(), c.getLightness())
PlatformUtils.copyToClipboard(color.getAlpha() < 1
? String.format(
"hsla(%.0f,%.2f,%.2f, %.1f)", c.getHue(), c.getSaturation(), c.getLightness(), c.getAlphaArithmetic()
)
: String.format("hsl(%.0f,%.2f,%.2f)", c.getHue(), c.getSaturation(), c.getLightness())
);
});

@ -174,8 +174,8 @@ class ThemeRepoManager extends VBox {
});
task.setOnFailed(
e -> System.err.println("[ERROR] Unable to parse \"" + theme.getName() +
"\" theme colors. Either CSS not valid or file isn't readable.")
e -> System.err.println("[ERROR] Unable to parse \"" + theme.getName()
+ "\" theme colors. Either CSS not valid or file isn't readable.")
);
THREAD_POOL.execute(task);

@ -36,9 +36,9 @@ final class FileList {
var sortedList = new SortedList<>(filteredList);
sortedList.comparatorProperty().bind(Bindings.createObjectBinding(() -> {
Comparator<Path> tableComparator = table.comparatorProperty().get();
return tableComparator != null ?
FILE_TYPE_COMPARATOR.thenComparing(tableComparator) :
FILE_TYPE_COMPARATOR;
return tableComparator != null
? FILE_TYPE_COMPARATOR.thenComparing(tableComparator)
: FILE_TYPE_COMPARATOR;
}, table.comparatorProperty()));
table.setItems(sortedList);
}

@ -195,9 +195,9 @@ final class TableDirectoryView extends AnchorPane implements DirectoryView {
if (empty) {
setText(null);
} else {
setText(fileTime != null ?
HumanReadableFormat.date(fileTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()) :
UNKNOWN
setText(fileTime != null
? HumanReadableFormat.date(fileTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime())
: UNKNOWN
);
}
}

@ -316,9 +316,9 @@ final class ColorThief {
int numVBoxes = vboxes.size();
for (VBox vbox : vboxes) {
int[] vbColor = vbox.avg(false);
d2 = Math.sqrt(Math.pow(color[0] - vbColor[0], 2) +
Math.pow(color[1] - vbColor[1], 2) +
Math.pow(color[2] - vbColor[2], 2)
d2 = Math.sqrt(Math.pow(color[0] - vbColor[0], 2)
+ Math.pow(color[1] - vbColor[1], 2)
+ Math.pow(color[2] - vbColor[2], 2)
);
if (d2 < d1) {
d1 = d2;

@ -28,23 +28,23 @@ final class PlayerScreen extends SplitPane {
getItems().setAll(player, playlist);
model.backgroundColorProperty().addListener((obs, old, val) -> {
var domColor = Objects.equals(Color.TRANSPARENT, val) ?
Color.TRANSPARENT :
Color.color(val.getRed(), val.getGreen(), val.getBlue(), 1);
var domColor20 = Objects.equals(Color.TRANSPARENT, val) ?
Color.TRANSPARENT :
Color.color(val.getRed(), val.getGreen(), val.getBlue(), 0.2);
var domColor50 = Objects.equals(Color.TRANSPARENT, val) ?
Color.TRANSPARENT :
Color.color(val.getRed(), val.getGreen(), val.getBlue(), 0.5);
var domColor70 = Objects.equals(Color.TRANSPARENT, val) ?
Color.TRANSPARENT :
Color.color(val.getRed(), val.getGreen(), val.getBlue(), 0.7);
setStyle("-color-dominant:" + toHexWithAlpha(domColor) + ";" +
"-color-dominant-20:" + toHexWithAlpha(domColor20) + ";" +
"-color-dominant-50:" + toHexWithAlpha(domColor50) + ";" +
"-color-dominant-70:" + toHexWithAlpha(domColor70) + ";" +
"-color-dominant-border:" + toHexWithAlpha(domColor70) + ";"
var domColor = Objects.equals(Color.TRANSPARENT, val)
? Color.TRANSPARENT
: Color.color(val.getRed(), val.getGreen(), val.getBlue(), 1);
var domColor20 = Objects.equals(Color.TRANSPARENT, val)
? Color.TRANSPARENT
: Color.color(val.getRed(), val.getGreen(), val.getBlue(), 0.2);
var domColor50 = Objects.equals(Color.TRANSPARENT, val)
? Color.TRANSPARENT
: Color.color(val.getRed(), val.getGreen(), val.getBlue(), 0.5);
var domColor70 = Objects.equals(Color.TRANSPARENT, val)
? Color.TRANSPARENT
: Color.color(val.getRed(), val.getGreen(), val.getBlue(), 0.7);
setStyle("-color-dominant:" + toHexWithAlpha(domColor) + ";"
+ "-color-dominant-20:" + toHexWithAlpha(domColor20) + ";"
+ "-color-dominant-50:" + toHexWithAlpha(domColor50) + ";"
+ "-color-dominant-70:" + toHexWithAlpha(domColor70) + ";"
+ "-color-dominant-border:" + toHexWithAlpha(domColor70) + ";"
);
});
}

@ -36,8 +36,8 @@ final class Utils {
public static String formatDuration(Duration duration) {
long seconds = (long) duration.toSeconds();
return seconds < 3600 ?
String.format("%02d:%02d", (seconds % 3600) / 60, seconds % 60) :
String.format("%d:%02d:%02d", seconds / 3600, (seconds % 3600) / 60, seconds % 60);
return seconds < 3600
? String.format("%02d:%02d", (seconds % 3600) / 60, seconds % 60)
: String.format("%d:%02d:%02d", seconds / 3600, (seconds % 3600) / 60, seconds % 60);
}
}

@ -92,10 +92,10 @@ public final class ThemeRepository {
public boolean isFileValid(Path path) {
Objects.requireNonNull(path);
return !Files.isDirectory(path, NOFOLLOW_LINKS) &&
Files.isRegularFile(path, NOFOLLOW_LINKS) &&
Files.isReadable(path) &&
path.getFileName().toString().endsWith(".css");
return !Files.isDirectory(path, NOFOLLOW_LINKS)
&& Files.isRegularFile(path, NOFOLLOW_LINKS)
&& Files.isReadable(path)
&& path.getFileName().toString().endsWith(".css");
}
public boolean isUnique(SamplerTheme theme) {

@ -48,9 +48,9 @@ public enum ContrastLevel {
}
public static double getContrastRatio(double luminance1, double luminance2) {
return 1 / (luminance1 > luminance2 ?
(luminance2 + 0.05) / (luminance1 + 0.05) :
(luminance1 + 0.05) / (luminance2 + 0.05)
return 1 / (luminance1 > luminance2
? (luminance2 + 0.05) / (luminance1 + 0.05)
: (luminance1 + 0.05) / (luminance2 + 0.05)
);
}

@ -798,13 +798,13 @@ public class JColorUtils {
*/
public static double[] flattenColor(Color bg, Color fgColor) {
var opacity = fgColor.getOpacity();
return opacity < 1 ?
new double[] {
return opacity < 1
? new double[] {
opacity * fgColor.getRed() + (1 - opacity) * bg.getRed(),
opacity * fgColor.getGreen() + (1 - opacity) * bg.getGreen(),
opacity * fgColor.getBlue() + (1 - opacity) * bg.getBlue(),
} :
new double[] {
}
: new double[] {
fgColor.getRed(),
fgColor.getGreen(),
fgColor.getBlue(),