This commit is contained in:
crschnick 2023-10-11 10:15:58 +00:00
parent a37821e22c
commit 09052de9ee
45 changed files with 146 additions and 240 deletions

View file

@ -67,10 +67,9 @@ final class BrowserBookmarkList extends SimpleComp {
.pseudoClassStateChanged( .pseudoClassStateChanged(
SELECTED, SELECTED,
newValue != null newValue != null
&& newValue.getEntry() && newValue.getEntry().get()
.equals(s.getWrapper() .equals(s.getWrapper()
.getEntry() .getEntry()));
.getStore()));
}); });
struc.get().setOnAction(event -> { struc.get().setOnAction(event -> {
ThreadHelper.runFailableAsync(() -> { ThreadHelper.runFailableAsync(() -> {

View file

@ -34,7 +34,7 @@ public class BrowserClipboard {
static { static {
Toolkit.getDefaultToolkit() Toolkit.getDefaultToolkit()
.getSystemClipboard() .getSystemClipboard()
.addFlavorListener(e -> ThreadHelper.runFailableAsync(new FailableRunnable<Throwable>() { .addFlavorListener(e -> ThreadHelper.runFailableAsync(new FailableRunnable<>() {
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void run() throws Throwable { public void run() throws Throwable {

View file

@ -19,6 +19,7 @@ import javafx.geometry.Pos;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import javafx.scene.layout.*; import javafx.scene.layout.*;
import lombok.Getter;
import java.util.List; import java.util.List;
@ -28,7 +29,9 @@ public abstract class MultiStepComp extends Comp<CompStructure<VBox>> {
private static final PseudoClass NEXT = PseudoClass.getPseudoClass("next"); private static final PseudoClass NEXT = PseudoClass.getPseudoClass("next");
private final Property<Boolean> completed = new SimpleBooleanProperty(); private final Property<Boolean> completed = new SimpleBooleanProperty();
private final Property<Step<?>> currentStep = new SimpleObjectProperty<>(); private final Property<Step<?>> currentStep = new SimpleObjectProperty<>();
@Getter
private List<Entry> entries; private List<Entry> entries;
@Getter
private int currentIndex = 0; private int currentIndex = 0;
private Step<?> getValue() { private Step<?> getValue() {
@ -94,10 +97,6 @@ public abstract class MultiStepComp extends Comp<CompStructure<VBox>> {
return entries.indexOf(e) == currentIndex; return entries.indexOf(e) == currentIndex;
} }
public int getCurrentIndex() {
return currentIndex;
}
public boolean isFirstPage() { public boolean isFirstPage() {
return currentIndex == 0; return currentIndex == 0;
} }
@ -260,10 +259,6 @@ public abstract class MultiStepComp extends Comp<CompStructure<VBox>> {
protected abstract void finish(); protected abstract void finish();
public List<Entry> getEntries() {
return entries;
}
public ReadOnlyProperty<Boolean> completedProperty() { public ReadOnlyProperty<Boolean> completedProperty() {
return completed; return completed;
} }

View file

@ -11,7 +11,7 @@ import java.util.stream.Stream;
public interface StoreSortMode { public interface StoreSortMode {
static StoreSortMode ALPHABETICAL_DESC = new StoreSortMode() { StoreSortMode ALPHABETICAL_DESC = new StoreSortMode() {
@Override @Override
public String getId() { public String getId() {
return "alphabetical-desc"; return "alphabetical-desc";
@ -19,12 +19,12 @@ public interface StoreSortMode {
@Override @Override
public Comparator<StoreSection> comparator() { public Comparator<StoreSection> comparator() {
return Comparator.<StoreSection, String>comparing( return Comparator.comparing(
e -> e.getWrapper().nameProperty().getValue().toLowerCase(Locale.ROOT)); e -> e.getWrapper().nameProperty().getValue().toLowerCase(Locale.ROOT));
} }
}; };
static StoreSortMode ALPHABETICAL_ASC = new StoreSortMode() { StoreSortMode ALPHABETICAL_ASC = new StoreSortMode() {
@Override @Override
public String getId() { public String getId() {
return "alphabetical-asc"; return "alphabetical-asc";
@ -38,7 +38,7 @@ public interface StoreSortMode {
} }
}; };
static StoreSortMode DATE_DESC = new StoreSortMode() { StoreSortMode DATE_DESC = new StoreSortMode() {
@Override @Override
public String getId() { public String getId() {
return "date-desc"; return "date-desc";
@ -55,7 +55,7 @@ public interface StoreSortMode {
} }
}; };
static StoreSortMode DATE_ASC = new StoreSortMode() { StoreSortMode DATE_ASC = new StoreSortMode() {
@Override @Override
public String getId() { public String getId() {
return "date-asc"; return "date-asc";
@ -78,7 +78,7 @@ public interface StoreSortMode {
section.getAllChildren().stream().flatMap(section1 -> flatten(section1))); section.getAllChildren().stream().flatMap(section1 -> flatten(section1)));
} }
static List<StoreSortMode> ALL = List.of(ALPHABETICAL_DESC, ALPHABETICAL_ASC, DATE_DESC, DATE_ASC); List<StoreSortMode> ALL = List.of(ALPHABETICAL_DESC, ALPHABETICAL_ASC, DATE_DESC, DATE_ASC);
static Optional<StoreSortMode> fromId(String id) { static Optional<StoreSortMode> fromId(String id) {
return ALL.stream() return ALL.stream()

View file

@ -12,10 +12,12 @@ import javafx.application.Application;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.stage.Stage; import javafx.stage.Stage;
import lombok.Getter;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.*; import java.awt.*;
@Getter
public class App extends Application { public class App extends Application {
private static App APP; private static App APP;
@ -116,7 +118,4 @@ public class App extends Application {
}); });
} }
public Stage getStage() {
return stage;
}
} }

View file

@ -8,6 +8,7 @@ import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.issue.TrackEvent;
import io.xpipe.core.util.ModuleHelper; import io.xpipe.core.util.ModuleHelper;
import io.xpipe.core.util.XPipeInstallation; import io.xpipe.core.util.XPipeInstallation;
import lombok.Getter;
import lombok.Value; import lombok.Value;
import java.io.IOException; import java.io.IOException;
@ -28,6 +29,7 @@ public class AppExtensionManager {
private final List<ModuleLayer> leafModuleLayers = new ArrayList<>(); private final List<ModuleLayer> leafModuleLayers = new ArrayList<>();
private final List<Path> extensionBaseDirectories = new ArrayList<>(); private final List<Path> extensionBaseDirectories = new ArrayList<>();
private ModuleLayer baseLayer = ModuleLayer.boot(); private ModuleLayer baseLayer = ModuleLayer.boot();
@Getter
private ModuleLayer extendedLayer; private ModuleLayer extendedLayer;
public AppExtensionManager(boolean loadedProviders) { public AppExtensionManager(boolean loadedProviders) {
@ -314,10 +316,6 @@ public class AppExtensionManager {
} }
} }
public ModuleLayer getExtendedLayer() {
return extendedLayer;
}
@Value @Value
private static class Extension { private static class Extension {
Path dir; Path dir;

View file

@ -3,6 +3,7 @@ package io.xpipe.app.core;
import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.issue.TrackEvent;
import io.xpipe.app.util.ThreadHelper; import io.xpipe.app.util.ThreadHelper;
import lombok.Getter;
import java.io.IOException; import java.io.IOException;
import java.nio.file.*; import java.nio.file.*;
@ -106,6 +107,7 @@ public class AppFileWatcher {
private class WatchedDirectory { private class WatchedDirectory {
private final BiConsumer<Path, WatchEvent.Kind<Path>> listener; private final BiConsumer<Path, WatchEvent.Kind<Path>> listener;
@Getter
private final Path baseDir; private final Path baseDir;
private WatchedDirectory(Path dir, BiConsumer<Path, WatchEvent.Kind<Path>> listener) { private WatchedDirectory(Path dir, BiConsumer<Path, WatchEvent.Kind<Path>> listener) {
@ -183,8 +185,5 @@ public class AppFileWatcher {
listener.accept(file, ev.kind()); listener.accept(file, ev.kind());
} }
public Path getBaseDir() {
return baseDir;
}
} }
} }

View file

@ -7,7 +7,6 @@ import javafx.css.SizeUnits;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.text.Font; import javafx.scene.text.Font;
import java.io.IOException;
import java.nio.file.FileVisitResult; import java.nio.file.FileVisitResult;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;

View file

@ -43,7 +43,9 @@ public class AppLogs {
DateTimeFormatter.ofPattern("HH:mm:ss:SSS").withZone(ZoneId.systemDefault()); DateTimeFormatter.ofPattern("HH:mm:ss:SSS").withZone(ZoneId.systemDefault());
private static AppLogs INSTANCE; private static AppLogs INSTANCE;
@Getter
private final PrintStream originalSysOut; private final PrintStream originalSysOut;
@Getter
private final PrintStream originalSysErr; private final PrintStream originalSysErr;
private final Path logDir; private final Path logDir;
@ -299,14 +301,6 @@ public class AppLogs {
} }
} }
public PrintStream getOriginalSysOut() {
return originalSysOut;
}
public PrintStream getOriginalSysErr() {
return originalSysErr;
}
public Path getLogsDirectory() { public Path getLogsDirectory() {
return logDir.getParent(); return logDir.getParent();
} }

View file

@ -164,7 +164,7 @@ public class AppTheme {
public String toTranslatedString() { public String toTranslatedString() {
return name; return name;
} }
}; }
@AllArgsConstructor @AllArgsConstructor
public static class Theme implements PrefsChoiceValue { public static class Theme implements PrefsChoiceValue {

View file

@ -6,6 +6,7 @@ import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.issue.ErrorHandler; import io.xpipe.app.issue.ErrorHandler;
import io.xpipe.core.process.OsType; import io.xpipe.core.process.OsType;
import javafx.application.Platform; import javafx.application.Platform;
import lombok.Getter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import javax.swing.*; import javax.swing.*;
@ -19,8 +20,9 @@ public class AppTray {
private static AppTray INSTANCE; private static AppTray INSTANCE;
private final FXTrayIcon icon; private final FXTrayIcon icon;
@Getter
private final ErrorHandler errorHandler; private final ErrorHandler errorHandler;
private TrayIcon privateTrayIcon = null; private TrayIcon privateTrayIcon;
@SneakyThrows @SneakyThrows
private AppTray() { private AppTray() {
@ -91,7 +93,7 @@ public class AppTray {
if (OsType.getLocal().equals(OsType.LINUX)) { if (OsType.getLocal().equals(OsType.LINUX)) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
try { try {
Field peerField = null; Field peerField;
peerField = TrayIcon.class.getDeclaredField("peer"); peerField = TrayIcon.class.getDeclaredField("peer");
peerField.setAccessible(true); peerField.setAccessible(true);
var peer = peerField.get(this.privateTrayIcon); var peer = peerField.get(this.privateTrayIcon);
@ -129,10 +131,6 @@ public class AppTray {
} }
} }
public ErrorHandler getErrorHandler() {
return errorHandler;
}
private class TrayErrorHandler implements ErrorHandler { private class TrayErrorHandler implements ErrorHandler {
private Instant lastErrorShown = Instant.MIN; private Instant lastErrorShown = Instant.MIN;

View file

@ -60,8 +60,4 @@ public class GuiMode extends PlatformMode {
}); });
} }
@Override
public ErrorHandler getErrorHandler() {
return new SyncErrorHandler(new GuiErrorHandler());
}
} }

View file

@ -12,6 +12,7 @@ import io.xpipe.core.util.XPipeDaemonMode;
import io.xpipe.core.util.XPipeInstallation; import io.xpipe.core.util.XPipeInstallation;
import io.xpipe.core.util.XPipeSystemId; import io.xpipe.core.util.XPipeSystemId;
import javafx.application.Platform; import javafx.application.Platform;
import lombok.Getter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -25,8 +26,11 @@ public abstract class OperationMode {
public static final OperationMode GUI = new GuiMode(); public static final OperationMode GUI = new GuiMode();
private static final Pattern PROPERTY_PATTERN = Pattern.compile("^-[DP](.+)=(.+)$"); private static final Pattern PROPERTY_PATTERN = Pattern.compile("^-[DP](.+)=(.+)$");
private static final List<OperationMode> ALL = List.of(BACKGROUND, TRAY, GUI); private static final List<OperationMode> ALL = List.of(BACKGROUND, TRAY, GUI);
@Getter
private static boolean inStartup; private static boolean inStartup;
@Getter
private static boolean inShutdown; private static boolean inShutdown;
@Getter
private static boolean inShutdownHook; private static boolean inShutdownHook;
private static OperationMode CURRENT = null; private static OperationMode CURRENT = null;
@ -116,14 +120,6 @@ public abstract class OperationMode {
DataStoreProviders.postInit(AppExtensionManager.getInstance().getExtendedLayer()); DataStoreProviders.postInit(AppExtensionManager.getInstance().getExtendedLayer());
} }
public static boolean isInStartup() {
return inStartup;
}
public static boolean isInShutdown() {
return inShutdown;
}
public static void switchToAsync(OperationMode newMode) { public static void switchToAsync(OperationMode newMode) {
ThreadHelper.createPlatformThread("mode switcher", false, () -> switchTo(newMode)).start(); ThreadHelper.createPlatformThread("mode switcher", false, () -> switchTo(newMode)).start();
} }
@ -285,10 +281,6 @@ public abstract class OperationMode {
return CURRENT; return CURRENT;
} }
public static boolean isInShutdownHook() {
return inShutdownHook;
}
public abstract boolean isSupported(); public abstract boolean isSupported();
public abstract String getId(); public abstract String getId();

View file

@ -4,12 +4,11 @@ import lombok.Getter;
import java.nio.file.Path; import java.nio.file.Path;
@Getter
public abstract class ModuleInstall { public abstract class ModuleInstall {
@Getter
private final String id; private final String id;
@Getter
private final String module; private final String module;
protected ModuleInstall(String id, String module) { protected ModuleInstall(String id, String module) {

View file

@ -1,9 +1,7 @@
package io.xpipe.app.fxcomps.augment; package io.xpipe.app.fxcomps.augment;
import io.xpipe.app.fxcomps.CompStructure; import io.xpipe.app.fxcomps.CompStructure;
import javafx.event.EventHandler;
import javafx.scene.Cursor; import javafx.scene.Cursor;
import javafx.scene.input.MouseEvent;
public class DraggableAugment<S extends CompStructure<?>> implements Augment<S> { public class DraggableAugment<S extends CompStructure<?>> implements Augment<S> {
@ -17,44 +15,32 @@ public class DraggableAugment<S extends CompStructure<?>> implements Augment<S>
public void augment(S struc) { public void augment(S struc) {
var circle = struc.get(); var circle = struc.get();
var oldDepth = struc.get().getViewOrder(); var oldDepth = struc.get().getViewOrder();
circle.setOnMousePressed(new EventHandler<MouseEvent>() { circle.setOnMousePressed(mouseEvent -> {
@Override public void handle(MouseEvent mouseEvent) { lastMouseX = mouseEvent.getSceneX();
lastMouseX = mouseEvent.getSceneX(); lastMouseY = mouseEvent.getSceneY();
lastMouseY = mouseEvent.getSceneY(); circle.getScene().setCursor(Cursor.MOVE);
circle.getScene().setCursor(Cursor.MOVE); circle.setViewOrder(1000);
circle.setViewOrder(1000);
}
}); });
circle.setOnMouseReleased(new EventHandler<MouseEvent>() { circle.setOnMouseReleased(mouseEvent -> circle.getScene().setCursor(Cursor.HAND));
@Override public void handle(MouseEvent mouseEvent) { circle.setOnMouseDragged(mouseEvent -> {
final double deltaX = mouseEvent.getSceneX() - lastMouseX;
final double deltaY = mouseEvent.getSceneY() - lastMouseY;
final double initialTranslateX = circle.getTranslateX();
final double initialTranslateY = circle.getTranslateY();
circle.setTranslateX(initialTranslateX + deltaX);
circle.setTranslateY(initialTranslateY + deltaY);
lastMouseX = mouseEvent.getSceneX();
lastMouseY = mouseEvent.getSceneY();
});
circle.setOnMouseEntered(mouseEvent -> {
if (!mouseEvent.isPrimaryButtonDown()) {
circle.getScene().setCursor(Cursor.HAND); circle.getScene().setCursor(Cursor.HAND);
} }
}); });
circle.setOnMouseDragged(new EventHandler<MouseEvent>() { circle.setOnMouseExited(mouseEvent -> {
@Override public void handle(MouseEvent mouseEvent) { if (!mouseEvent.isPrimaryButtonDown()) {
final double deltaX = mouseEvent.getSceneX() - lastMouseX; circle.getScene().setCursor(Cursor.DEFAULT);
final double deltaY = mouseEvent.getSceneY() - lastMouseY;
final double initialTranslateX = circle.getTranslateX();
final double initialTranslateY = circle.getTranslateY();
circle.setTranslateX(initialTranslateX + deltaX);
circle.setTranslateY(initialTranslateY + deltaY);
lastMouseX = mouseEvent.getSceneX();
lastMouseY = mouseEvent.getSceneY();
}
});
circle.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if (!mouseEvent.isPrimaryButtonDown()) {
circle.getScene().setCursor(Cursor.HAND);
}
}
});
circle.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if (!mouseEvent.isPrimaryButtonDown()) {
circle.getScene().setCursor(Cursor.DEFAULT);
}
} }
}); });
} }

View file

@ -43,11 +43,10 @@ public class DataStoreListChoiceComp<T extends DataStore> extends SimpleComp {
var delete = new IconButtonComp("mdal-delete_outline", () -> { var delete = new IconButtonComp("mdal-delete_outline", () -> {
selectedList.remove(t); selectedList.remove(t);
}); });
var hbox = new HorizontalComp(List.of(label, Comp.hspacer(), delete)).styleClass("entry"); return new HorizontalComp(List.of(label, Comp.hspacer(), delete)).styleClass("entry");
return hbox;
}).padding(new Insets(0)).apply(struc -> struc.get().setMinHeight(0)).apply(struc -> ((VBox) struc.get().getContent()).setSpacing(5)); }).padding(new Insets(0)).apply(struc -> struc.get().setMinHeight(0)).apply(struc -> ((VBox) struc.get().getContent()).setSpacing(5));
var selected = new SimpleObjectProperty<DataStoreEntryRef<T>>(); var selected = new SimpleObjectProperty<DataStoreEntryRef<T>>();
var add = new DataStoreChoiceComp<T>(DataStoreChoiceComp.Mode.OTHER, null, selected, storeClass, applicableCheck, initialCategory); var add = new DataStoreChoiceComp<>(DataStoreChoiceComp.Mode.OTHER, null, selected, storeClass, applicableCheck, initialCategory);
selected.addListener((observable, oldValue, newValue) -> { selected.addListener((observable, oldValue, newValue) -> {
if (newValue != null) { if (newValue != null) {
if (!selectedList.contains(newValue) if (!selectedList.contains(newValue)

View file

@ -18,10 +18,12 @@ import javafx.geometry.Pos;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.layout.*; import javafx.scene.layout.*;
import lombok.Getter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Getter
public class OptionsComp extends Comp<CompStructure<Pane>> { public class OptionsComp extends Comp<CompStructure<Pane>> {
private final List<OptionsComp.Entry> entries; private final List<OptionsComp.Entry> entries;
@ -46,7 +48,6 @@ public class OptionsComp extends Comp<CompStructure<Pane>> {
pane.getStyleClass().add("options-comp"); pane.getStyleClass().add("options-comp");
var nameRegions = new ArrayList<Region>(); var nameRegions = new ArrayList<Region>();
var compRegions = new ArrayList<Region>();
for (var entry : getEntries()) { for (var entry : getEntries()) {
Region compRegion = null; Region compRegion = null;
@ -135,7 +136,6 @@ public class OptionsComp extends Comp<CompStructure<Pane>> {
if (compRegion != null) { if (compRegion != null) {
compRegion.accessibleTextProperty().bind(name.textProperty()); compRegion.accessibleTextProperty().bind(name.textProperty());
compRegions.add(compRegion);
line.getChildren().add(compRegion); line.getChildren().add(compRegion);
HBox.setHgrow(compRegion, Priority.ALWAYS); HBox.setHgrow(compRegion, Priority.ALWAYS);
} }
@ -143,7 +143,6 @@ public class OptionsComp extends Comp<CompStructure<Pane>> {
pane.getChildren().add(line); pane.getChildren().add(line);
} else { } else {
if (compRegion != null) { if (compRegion != null) {
compRegions.add(compRegion);
pane.getChildren().add(compRegion); pane.getChildren().add(compRegion);
} }
} }
@ -165,10 +164,6 @@ public class OptionsComp extends Comp<CompStructure<Pane>> {
return new SimpleCompStructure<>(pane); return new SimpleCompStructure<>(pane);
} }
public List<OptionsComp.Entry> getEntries() {
return entries;
}
public record Entry( public record Entry(
String key, String key,
ObservableValue<String> description, ObservableValue<String> description,

View file

@ -21,7 +21,7 @@ public class SvgHelper {
} }
public static Point2D getDimensions(String val) { public static Point2D getDimensions(String val) {
var regularExpression = Pattern.compile("<svg[^>]+?width=\"([^\s]+)\"", Pattern.DOTALL); var regularExpression = Pattern.compile("<svg[^>]+?width=\"([^ ]+)\"", Pattern.DOTALL);
var matcher = regularExpression.matcher(val); var matcher = regularExpression.matcher(val);
if (!matcher.find()) { if (!matcher.find()) {
@ -36,7 +36,7 @@ public class SvgHelper {
} }
var width = matcher.group(1); var width = matcher.group(1);
regularExpression = Pattern.compile("<svg.+?height=\"([^\s]+)\"", Pattern.DOTALL); regularExpression = Pattern.compile("<svg.+?height=\"([^ ]+)\"", Pattern.DOTALL);
matcher = regularExpression.matcher(val); matcher = regularExpression.matcher(val);
matcher.find(); matcher.find();
var height = matcher.group(1); var height = matcher.group(1);

View file

@ -209,7 +209,7 @@ public class BindingsHelper {
public static <V> ObservableList<V> orderedContentBinding(ObservableList<V> l2, Comparator<V> comp, Observable... observables) { public static <V> ObservableList<V> orderedContentBinding(ObservableList<V> l2, Comparator<V> comp, Observable... observables) {
return orderedContentBinding(l2, Bindings.createObjectBinding(() -> { return orderedContentBinding(l2, Bindings.createObjectBinding(() -> {
return new Comparator<V>() { return new Comparator<>() {
@Override @Override
public int compare(V o1, V o2) { public int compare(V o1, V o2) {
return comp.compare(o1, o2); return comp.compare(o1, o2);
@ -240,7 +240,7 @@ public class BindingsHelper {
public static <V> ObservableList<V> filteredContentBinding(ObservableList<V> l2, Predicate<V> predicate, Observable... observables) { public static <V> ObservableList<V> filteredContentBinding(ObservableList<V> l2, Predicate<V> predicate, Observable... observables) {
return filteredContentBinding(l2, Bindings.createObjectBinding(() -> { return filteredContentBinding(l2, Bindings.createObjectBinding(() -> {
return new Predicate<V>() { return new Predicate<>() {
@Override @Override
public boolean test(V v) { public boolean test(V v) {
return predicate.test(v); return predicate.test(v);

View file

@ -125,9 +125,9 @@ public abstract class LauncherInput {
} }
} }
@Getter
public abstract static class ActionInput extends LauncherInput { public abstract static class ActionInput extends LauncherInput {
@Getter
private final List<String> args; private final List<String> args;
protected ActionInput(List<String> args) { protected ActionInput(List<String> args) {

View file

@ -31,6 +31,7 @@ import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Pos; import javafx.geometry.Pos;
import lombok.Getter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.kordamp.ikonli.javafx.FontIcon; import org.kordamp.ikonli.javafx.FontIcon;
@ -127,7 +128,9 @@ public class AppPrefs {
// Lock // Lock
// ==== // ====
@Getter
private final Property<SecretValue> lockPassword = new SimpleObjectProperty<>(); private final Property<SecretValue> lockPassword = new SimpleObjectProperty<>();
@Getter
private final StringProperty lockCrypt = typed(new SimpleStringProperty(""), String.class); private final StringProperty lockCrypt = typed(new SimpleStringProperty(""), String.class);
// Window opacity // Window opacity
@ -297,14 +300,6 @@ public class AppPrefs {
} }
} }
public StringProperty getLockCrypt() {
return lockCrypt;
}
public Property<SecretValue> getLockPassword() {
return lockPassword;
}
public final ReadOnlyIntegerProperty editorReloadTimeout() { public final ReadOnlyIntegerProperty editorReloadTimeout() {
return editorReloadTimeout; return editorReloadTimeout;
} }
@ -664,6 +659,7 @@ public class AppPrefs {
name, Arrays.stream(settings).filter(setting -> setting != null).toArray(Setting[]::new)); name, Arrays.stream(settings).filter(setting -> setting != null).toArray(Setting[]::new));
} }
@Getter
private class PrefsHandlerImpl implements PrefsHandler { private class PrefsHandlerImpl implements PrefsHandler {
private final List<Category> categories; private final List<Category> categories;
@ -710,8 +706,5 @@ public class AppPrefs {
categories.add(index, newCategory); categories.add(index, newCategory);
} }
public List<Category> getCategories() {
return categories;
}
} }
} }

View file

@ -507,7 +507,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
} }
@Value @Value
static class LaunchConfiguration { class LaunchConfiguration {
DataStoreColor color; DataStoreColor color;
String title; String title;

View file

@ -4,8 +4,7 @@ import com.dlsc.formsfx.model.util.ResourceBundleService;
import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppI18n;
import lombok.NonNull; import lombok.NonNull;
import java.util.Enumeration; import java.util.*;
import java.util.ResourceBundle;
public class QuietResourceBundleService extends ResourceBundleService { public class QuietResourceBundleService extends ResourceBundleService {
@ -17,8 +16,8 @@ public class QuietResourceBundleService extends ResourceBundleService {
} }
@Override @Override
public Enumeration<String> getKeys() { public @NonNull Enumeration<String> getKeys() {
return null; return Collections.emptyEnumeration();
} }
}); });
} }

View file

@ -75,7 +75,7 @@ public class UpdateCheckComp extends SimpleComp {
return "mdi2r-refresh"; return "mdi2r-refresh";
}, },
updateReady); updateReady);
var button = new TileButtonComp(name, description, graphic, actionEvent -> { return new TileButtonComp(name, description, graphic, actionEvent -> {
actionEvent.consume(); actionEvent.consume();
if (updateReady.getValue()) { if (updateReady.getValue()) {
restart(); restart();
@ -91,6 +91,5 @@ public class UpdateCheckComp extends SimpleComp {
.disable(PlatformThread.sync( .disable(PlatformThread.sync(
XPipeDistributionType.get().getUpdateHandler().getBusy())) XPipeDistributionType.get().getUpdateHandler().getBusy()))
.createRegion(); .createRegion();
return button;
} }
} }

View file

@ -62,8 +62,7 @@ public class VaultCategory extends AppPrefsCategory {
BooleanField enable = BooleanField.ofBooleanType(prefs.enableGitStorage) BooleanField enable = BooleanField.ofBooleanType(prefs.enableGitStorage)
.editable(pro) .editable(pro)
.render(() -> { .render(() -> {
var c = new CustomToggleControl(); return new CustomToggleControl();
return c;
}); });
StringField remote = StringField.ofStringType(prefs.storageGitRemote) StringField remote = StringField.ofStringType(prefs.storageGitRemote)
.editable(pro) .editable(pro)

View file

@ -45,7 +45,7 @@ public class DataStateProviderImpl extends DataStateProvider {
if (found == null) { if (found == null) {
entry.get().setStorePersistentState(def.get()); entry.get().setStorePersistentState(def.get());
} }
return (T) entry.get().getStorePersistentState(); return entry.get().getStorePersistentState();
} }
@Override @Override

View file

@ -8,7 +8,6 @@ public class DataStorageWriter {
public static JsonNode storeToNode(DataStore store) { public static JsonNode storeToNode(DataStore store) {
var mapper = JacksonMapper.getDefault(); var mapper = JacksonMapper.getDefault();
var tree = mapper.valueToTree(store); return mapper.valueToTree(store);
return tree;
} }
} }

View file

@ -227,7 +227,7 @@ public class DataStoreEntry extends StorageElement {
} }
public <T extends DataStore> DataStoreEntryRef<T> ref() { public <T extends DataStore> DataStoreEntryRef<T> ref() {
return new DataStoreEntryRef<T>(this); return new DataStoreEntryRef<>(this);
} }
public void setStoreCache(String key, Object value) { public void setStoreCache(String key, Object value) {

View file

@ -15,15 +15,20 @@ import java.util.UUID;
public abstract class StorageElement { public abstract class StorageElement {
@Getter
protected final UUID uuid; protected final UUID uuid;
protected final List<Listener> listeners = new ArrayList<>(); protected final List<Listener> listeners = new ArrayList<>();
@Getter @Getter
protected boolean dirty; protected boolean dirty;
@Getter
protected Path directory; protected Path directory;
@Getter
protected String name; protected String name;
@Getter
protected Instant lastUsed; protected Instant lastUsed;
@Getter
protected Instant lastModified; protected Instant lastModified;
public StorageElement( public StorageElement(
@ -67,22 +72,10 @@ public abstract class StorageElement {
return getLastUsed().isAfter(getLastModified()) ? getLastUsed() : getLastModified(); return getLastUsed().isAfter(getLastModified()) ? getLastUsed() : getLastModified();
} }
public Path getDirectory() {
return directory;
}
public void setDirectory(Path directory) { public void setDirectory(Path directory) {
this.directory = directory; this.directory = directory;
} }
public UUID getUuid() {
return uuid;
}
public String getName() {
return name;
}
public void setName(String name) { public void setName(String name) {
if (name.equals(this.name)) { if (name.equals(this.name)) {
return; return;
@ -94,14 +87,6 @@ public abstract class StorageElement {
notifyUpdate(); notifyUpdate();
} }
public Instant getLastUsed() {
return lastUsed;
}
public Instant getLastModified() {
return lastModified;
}
public interface Listener { public interface Listener {
void onUpdate(); void onUpdate();
} }

View file

@ -77,7 +77,7 @@ public class ScanAlert {
@Override @Override
protected List<Entry> setup() { protected List<Entry> setup() {
return List.of(new Entry(AppI18n.observable("a"), new Step<CompStructure<?>>() { return List.of(new Entry(AppI18n.observable("a"), new Step<>() {
@Override @Override
public CompStructure<?> createBase() { public CompStructure<?> createBase() {
var b = new OptionsBuilder() var b = new OptionsBuilder()
@ -88,9 +88,10 @@ public class ScanAlert {
null, null,
entry, entry,
ShellStore.class, ShellStore.class,
store1 -> true, store1 -> true,
StoreViewState.get().getAllConnectionsCategory()) StoreViewState.get().getAllConnectionsCategory()
.disable(new SimpleBooleanProperty(initialStore != null))) )
.disable(new SimpleBooleanProperty(initialStore != null)))
.name("scanAlertHeader") .name("scanAlertHeader")
.description("scanAlertHeaderDescription") .description("scanAlertHeaderDescription")
.addComp(Comp.of(() -> stackPane).vgrow()) .addComp(Comp.of(() -> stackPane).vgrow())
@ -99,7 +100,7 @@ public class ScanAlert {
.prefHeight(600) .prefHeight(600)
.styleClass("window-content") .styleClass("window-content")
.apply(struc -> { .apply(struc -> {
VBox.setVgrow(((VBox) struc.get().getChildren().get(1)), ALWAYS); VBox.setVgrow(struc.get().getChildren().get(1), ALWAYS);
}) })
.createStructure() .createStructure()
.get(); .get();
@ -123,16 +124,17 @@ public class ScanAlert {
} }
selected.setAll(a.stream() selected.setAll(a.stream()
.filter( .filter(
scanOperation -> scanOperation ->
scanOperation.isDefaultSelected()) scanOperation.isDefaultSelected())
.toList()); .toList());
var r = new ListSelectorComp<>( var r = new ListSelectorComp<>(
a, a,
scanOperation -> scanOperation ->
AppI18n.get(scanOperation.getNameKey()), AppI18n.get(scanOperation.getNameKey()),
selected, selected,
a.size() > 3) a.size() > 3
)
.createRegion(); .createRegion();
stackPane.getChildren().add(r); stackPane.getChildren().add(r);
}); });

View file

@ -6,6 +6,7 @@ import io.xpipe.beacon.util.QuietDialogHandler;
import io.xpipe.core.store.InternalStreamStore; import io.xpipe.core.store.InternalStreamStore;
import io.xpipe.core.util.FailableBiConsumer; import io.xpipe.core.util.FailableBiConsumer;
import io.xpipe.core.util.FailableConsumer; import io.xpipe.core.util.FailableConsumer;
import lombok.Getter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -13,6 +14,7 @@ import java.io.OutputStream;
public abstract class BeaconConnection implements AutoCloseable { public abstract class BeaconConnection implements AutoCloseable {
@Getter
protected BeaconClient beaconClient; protected BeaconClient beaconClient;
private InputStream bodyInput; private InputStream bodyInput;
@ -20,10 +22,6 @@ public abstract class BeaconConnection implements AutoCloseable {
protected abstract void constructSocket(); protected abstract void constructSocket();
public BeaconClient getBeaconClient() {
return beaconClient;
}
@Override @Override
public void close() { public void close() {
try { try {

View file

@ -16,7 +16,7 @@ public class MessageExchanges {
if (ALL == null) { if (ALL == null) {
ALL = ServiceLoader.load(MessageExchange.class).stream() ALL = ServiceLoader.load(MessageExchange.class).stream()
.map(s -> { .map(s -> {
return (MessageExchange) s.get(); return s.get();
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View file

@ -1,6 +1,7 @@
package io.xpipe.core.charsetter; package io.xpipe.core.charsetter;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import java.util.Arrays; import java.util.Arrays;
@ -11,6 +12,7 @@ public enum NewLine {
CRLF("\r\n", "crlf"); CRLF("\r\n", "crlf");
private final String newLine; private final String newLine;
@Getter
private final String id; private final String id;
NewLine(String newLine, String id) { NewLine(String newLine, String id) {
@ -36,7 +38,4 @@ public enum NewLine {
return newLine; return newLine;
} }
public String getId() {
return id;
}
} }

View file

@ -13,6 +13,7 @@ import lombok.ToString;
public class BaseQueryElement extends DialogElement { public class BaseQueryElement extends DialogElement {
private final String description; private final String description;
@Getter
private final boolean newLine; private final boolean newLine;
private final boolean required; private final boolean required;
private final boolean secret; private final boolean secret;
@ -35,10 +36,6 @@ public class BaseQueryElement extends DialogElement {
return required && value == null; return required && value == null;
} }
public boolean isNewLine() {
return newLine;
}
@Override @Override
public String toDisplayString() { public String toDisplayString() {
return description; return description;

View file

@ -14,11 +14,15 @@ import java.util.List;
@Getter @Getter
public class ChoiceElement extends DialogElement { public class ChoiceElement extends DialogElement {
@Getter
private final String description; private final String description;
@Getter
private final List<Choice> elements; private final List<Choice> elements;
@Getter
private final boolean required; private final boolean required;
private final boolean quiet; private final boolean quiet;
@Getter
private int selected; private int selected;
@JsonCreator @JsonCreator
@ -76,19 +80,4 @@ public class ChoiceElement extends DialogElement {
return false; return false;
} }
public List<Choice> getElements() {
return elements;
}
public int getSelected() {
return selected;
}
public String getDescription() {
return description;
}
public boolean isRequired() {
return required;
}
} }

View file

@ -2,10 +2,12 @@ package io.xpipe.core.dialog;
import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString; import lombok.ToString;
import java.util.UUID; import java.util.UUID;
@Getter
@EqualsAndHashCode @EqualsAndHashCode
@ToString @ToString
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@ -27,7 +29,4 @@ public abstract class DialogElement {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public String getId() {
return id;
}
} }

View file

@ -3,8 +3,10 @@ package io.xpipe.core.dialog;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString; import lombok.ToString;
@Getter
@JsonTypeName("header") @JsonTypeName("header")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString @ToString
@ -27,7 +29,4 @@ public class HeaderElement extends DialogElement {
return true; return true;
} }
public String getHeader() {
return header;
}
} }

View file

@ -44,7 +44,7 @@ public interface ShellControl extends ProcessControl {
s.setOsName(shellControl.getOsName()); s.setOsName(shellControl.getOsName());
store.setState(s); store.setState(s);
}); });
}; }
default ShellControl withSupportCheckInit(Predicate<ShellControl> predicate, String name) { default ShellControl withSupportCheckInit(Predicate<ShellControl> predicate, String name) {
return onInit(shellControl -> { return onInit(shellControl -> {
@ -52,7 +52,7 @@ public interface ShellControl extends ProcessControl {
} }
}); });
}; }
default <T extends ShellStoreState> ShellControl withShellStateFail(StatefulDataStore<T> store) { default <T extends ShellStoreState> ShellControl withShellStateFail(StatefulDataStore<T> store) {
return onFail(shellControl -> { return onFail(shellControl -> {
@ -60,7 +60,7 @@ public interface ShellControl extends ProcessControl {
s.setRunning(false); s.setRunning(false);
store.setState(s); store.setState(s);
}); });
}; }
ShellControl onExit(Consumer<ShellControl> pc); ShellControl onExit(Consumer<ShellControl> pc);

View file

@ -1,7 +1,9 @@
package io.xpipe.core.store; package io.xpipe.core.store;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
@Getter
public enum DataFlow { public enum DataFlow {
@JsonProperty("input") @JsonProperty("input")
INPUT("Input"), INPUT("Input"),
@ -28,7 +30,4 @@ public enum DataFlow {
return this == OUTPUT || this == INPUT_OUTPUT; return this == OUTPUT || this == INPUT_OUTPUT;
} }
public String getDisplayName() {
return displayName;
}
} }

View file

@ -8,11 +8,11 @@ import java.nio.ByteBuffer;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@Getter
@SuperBuilder @SuperBuilder
@EqualsAndHashCode @EqualsAndHashCode
public abstract class EncryptedSecretValue implements SecretValue { public abstract class EncryptedSecretValue implements SecretValue {
@Getter
String encryptedValue; String encryptedValue;
public EncryptedSecretValue(char[] c) { public EncryptedSecretValue(char[] c) {

View file

@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
import lombok.Getter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -16,6 +17,7 @@ public class JacksonMapper {
private static final ObjectMapper BASE = new ObjectMapper(); private static final ObjectMapper BASE = new ObjectMapper();
private static final ObjectMapper INSTANCE; private static final ObjectMapper INSTANCE;
@Getter
private static boolean init = false; private static boolean init = false;
public static <T> T parse(String s, Class<T> c) throws JsonProcessingException { public static <T> T parse(String s, Class<T> c) throws JsonProcessingException {
@ -85,7 +87,4 @@ public class JacksonMapper {
return INSTANCE; return INSTANCE;
} }
public static boolean isInit() {
return init;
}
} }

View file

@ -8,6 +8,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Getter
public enum XPipeDaemonMode { public enum XPipeDaemonMode {
@JsonProperty("background") @JsonProperty("background")
BACKGROUND("background", List.of("base", "background")), BACKGROUND("background", List.of("base", "background")),
@ -29,10 +30,8 @@ public enum XPipeDaemonMode {
.collect(Collectors.joining(", ")))); .collect(Collectors.joining(", "))));
} }
@Getter
private final String displayName; private final String displayName;
@Getter
private final List<String> nameAlternatives; private final List<String> nameAlternatives;
XPipeDaemonMode(String displayName, List<String> nameAlternatives) { XPipeDaemonMode(String displayName, List<String> nameAlternatives) {

View file

@ -90,28 +90,33 @@ public class XPipeUrlAction implements ActionProvider {
@Override @Override
public Action createAction(List<String> args) throws Exception { public Action createAction(List<String> args) throws Exception {
if (args.get(0).equals("addStore")) { switch (args.get(0)) {
var storeString = DefaultSecretValue.builder() case "addStore" -> {
.encryptedValue(args.get(1)) var storeString = DefaultSecretValue.builder()
.build(); .encryptedValue(args.get(1))
var store = JacksonMapper.parse(storeString.getSecretValue(), DataStore.class); .build();
return new AddStoreAction(store); var store = JacksonMapper.parse(storeString.getSecretValue(), DataStore.class);
} else if (args.get(0).equals("launch")) { return new AddStoreAction(store);
var entry = DataStorage.get() }
.getStoreEntryIfPresent(UUID.fromString(args.get(1))) case "launch" -> {
.orElseThrow(); var entry = DataStorage.get()
return new LaunchAction(entry); .getStoreEntryIfPresent(UUID.fromString(args.get(1)))
} else if (args.get(0).equals("action")) { .orElseThrow();
var id = args.get(1); return new LaunchAction(entry);
ActionProvider provider = ActionProvider.ALL.stream().filter(actionProvider -> { }
return actionProvider.getDataStoreCallSite() != null && id.equals(actionProvider.getId()); case "action" -> {
}).findFirst().orElseThrow(); var id = args.get(1);
var entry = DataStorage.get() ActionProvider provider = ActionProvider.ALL.stream().filter(actionProvider -> {
.getStoreEntryIfPresent(UUID.fromString(args.get(2))) return actionProvider.getDataStoreCallSite() != null && id.equals(actionProvider.getId());
.orElseThrow(); }).findFirst().orElseThrow();
return new CallAction(provider, entry); var entry = DataStorage.get()
} else { .getStoreEntryIfPresent(UUID.fromString(args.get(2)))
return null; .orElseThrow();
return new CallAction(provider, entry);
}
default -> {
return null;
}
} }
} }
}; };

View file

@ -2,7 +2,6 @@ package io.xpipe.ext.base.browser;
import io.xpipe.app.browser.BrowserEntry; import io.xpipe.app.browser.BrowserEntry;
import io.xpipe.app.browser.OpenFileSystemModel; import io.xpipe.app.browser.OpenFileSystemModel;
import io.xpipe.app.browser.action.BrowserAction;
import io.xpipe.app.browser.action.LeafAction; import io.xpipe.app.browser.action.LeafAction;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCode;

View file

@ -54,7 +54,7 @@ public class SimpleScriptStore extends ScriptStore {
} }
@Getter @Getter
public static enum ExecutionType { public enum ExecutionType {
@JsonProperty("dumbOnly") @JsonProperty("dumbOnly")
DUMB_ONLY("dumbOnly"), DUMB_ONLY("dumbOnly"),
@JsonProperty("terminalOnly") @JsonProperty("terminalOnly")