From ab9059881cd0829cca88dd74a485dbf081d99016 Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 17 Jan 2024 17:06:10 +0000 Subject: [PATCH] Rename store creation comp and apply state on entry update --- ...iDsStoreCreator.java => StoreCreationComo.java} | 14 ++++---------- .../io/xpipe/app/comp/store/StoreCreationMenu.java | 6 +++--- .../io/xpipe/app/comp/store/StoreEntryWrapper.java | 2 +- .../java/io/xpipe/app/storage/DataStoreEntry.java | 2 ++ dist/changelogs/1.7.15.md | 1 + .../io/xpipe/ext/base/action/EditStoreAction.java | 4 ++-- .../io/xpipe/ext/base/action/XPipeUrlAction.java | 4 ++-- 7 files changed, 15 insertions(+), 18 deletions(-) rename app/src/main/java/io/xpipe/app/comp/store/{GuiDsStoreCreator.java => StoreCreationComo.java} (97%) diff --git a/app/src/main/java/io/xpipe/app/comp/store/GuiDsStoreCreator.java b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComo.java similarity index 97% rename from app/src/main/java/io/xpipe/app/comp/store/GuiDsStoreCreator.java rename to app/src/main/java/io/xpipe/app/comp/store/StoreCreationComo.java index 8aef2cd53..24f933d4e 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/GuiDsStoreCreator.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationComo.java @@ -41,7 +41,7 @@ import java.util.function.Consumer; import java.util.function.Predicate; @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) -public class GuiDsStoreCreator extends MultiStepComp.Step> { +public class StoreCreationComo extends MultiStepComp.Step> { MultiStepComp parent; Property provider; @@ -55,17 +55,15 @@ public class GuiDsStoreCreator extends MultiStepComp.Step> { BooleanProperty changedSinceError = new SimpleBooleanProperty(); StringProperty name; DataStoreEntry existingEntry; - boolean exists; boolean staticDisplay; - public GuiDsStoreCreator( + public StoreCreationComo( MultiStepComp parent, Property provider, Property store, Predicate filter, String initialName, DataStoreEntry existingEntry, - boolean exists, boolean staticDisplay) { this.parent = parent; this.provider = provider; @@ -73,7 +71,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step> { this.filter = filter; this.name = new SimpleStringProperty(initialName != null && !initialName.isEmpty() ? initialName : null); this.existingEntry = existingEntry; - this.exists = exists; this.staticDisplay = staticDisplay; this.store.addListener((c, o, n) -> { changedSinceError.setValue(true); @@ -148,7 +145,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step> { }); }, true, - true, e); } @@ -169,7 +165,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step> { } }, false, - false, null); } @@ -179,7 +174,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step> { DataStore s, Predicate filter, Consumer con, - boolean exists, boolean staticDisplay, DataStoreEntry existingEntry) { var prop = new SimpleObjectProperty<>(provider); @@ -192,8 +186,8 @@ public class GuiDsStoreCreator extends MultiStepComp.Step> { window -> { return new MultiStepComp() { - private final GuiDsStoreCreator creator = new GuiDsStoreCreator( - this, prop, store, filter, initialName, existingEntry, exists, staticDisplay); + private final StoreCreationComo creator = new StoreCreationComo( + this, prop, store, filter, initialName, existingEntry, staticDisplay); @Override protected List setup() { diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java index 3e81430ff..188a028d0 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java @@ -50,7 +50,7 @@ public class StoreCreationMenu { item.setGraphic(new FontIcon(graphic)); item.textProperty().bind(AppI18n.observable(name)); item.setOnAction(event -> { - GuiDsStoreCreator.showCreation(defaultProvider != null ? DataStoreProviders.byName(defaultProvider).orElseThrow() : null, + StoreCreationComo.showCreation(defaultProvider != null ? DataStoreProviders.byName(defaultProvider).orElseThrow() : null, v -> category.equals(v.getCreationCategory())); event.consume(); }); @@ -65,7 +65,7 @@ public class StoreCreationMenu { return; } - GuiDsStoreCreator.showCreation(defaultProvider != null ? DataStoreProviders.byName(defaultProvider).orElseThrow() : null, + StoreCreationComo.showCreation(defaultProvider != null ? DataStoreProviders.byName(defaultProvider).orElseThrow() : null, v -> category.equals(v.getCreationCategory())); event.consume(); }); @@ -73,7 +73,7 @@ public class StoreCreationMenu { var item = new MenuItem(dataStoreProvider.getDisplayName()); item.setGraphic(PrettyImageHelper.ofFixedSmallSquare(dataStoreProvider.getDisplayIconFileName(null)).createRegion()); item.setOnAction(event -> { - GuiDsStoreCreator.showCreation(dataStoreProvider, + StoreCreationComo.showCreation(dataStoreProvider, v -> category.equals(v.getCreationCategory())); event.consume(); }); diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java index 0446b0d87..07cf3ac85 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java @@ -73,7 +73,7 @@ public class StoreEntryWrapper { } public void editDialog() { - GuiDsStoreCreator.showEdit(entry); + StoreCreationComo.showEdit(entry); } public void delete() { diff --git a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java index 907073da4..a50543cfa 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java @@ -364,6 +364,8 @@ public class DataStoreEntry extends StorageElement { provider = e.provider; childrenCache = null; validity = store == null ? Validity.LOAD_FAILED : store.isComplete() ? Validity.COMPLETE : Validity.INCOMPLETE; + storePersistentState = e.storePersistentState; + storePersistentStateNode = e.storePersistentStateNode; notifyUpdate(); } diff --git a/dist/changelogs/1.7.15.md b/dist/changelogs/1.7.15.md index ebe22a563..33a7cead4 100644 --- a/dist/changelogs/1.7.15.md +++ b/dist/changelogs/1.7.15.md @@ -19,6 +19,7 @@ ## Fixes +- Fix application windows on Linux not initializing with the correct size - Fix connections to pfSense systems not working (This time properly) - Fix NullPointerException when a Linux system did not provide any release name - Fix startup errors when operating system reported invalid window sizes diff --git a/ext/base/src/main/java/io/xpipe/ext/base/action/EditStoreAction.java b/ext/base/src/main/java/io/xpipe/ext/base/action/EditStoreAction.java index a758eed4c..b22cdb43b 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/action/EditStoreAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/action/EditStoreAction.java @@ -1,6 +1,6 @@ package io.xpipe.ext.base.action; -import io.xpipe.app.comp.store.GuiDsStoreCreator; +import io.xpipe.app.comp.store.StoreCreationComo; import io.xpipe.app.core.AppI18n; import io.xpipe.app.ext.ActionProvider; import io.xpipe.app.storage.DataStoreEntry; @@ -23,7 +23,7 @@ public class EditStoreAction implements ActionProvider { @Override public void execute() { - GuiDsStoreCreator.showEdit(store); + StoreCreationComo.showEdit(store); } } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/action/XPipeUrlAction.java b/ext/base/src/main/java/io/xpipe/ext/base/action/XPipeUrlAction.java index af096e3af..e5302b943 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/action/XPipeUrlAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/action/XPipeUrlAction.java @@ -1,7 +1,7 @@ package io.xpipe.ext.base.action; import io.xpipe.app.comp.store.StoreViewState; -import io.xpipe.app.comp.store.GuiDsStoreCreator; +import io.xpipe.app.comp.store.StoreCreationComo; import io.xpipe.app.ext.ActionProvider; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntry; @@ -75,7 +75,7 @@ public class XPipeUrlAction implements ActionProvider { } var entry = DataStoreEntry.createNew(UUID.randomUUID(), StoreViewState.get().getActiveCategory().getValue().getCategory().getUuid(), "", store); - GuiDsStoreCreator.showEdit(entry); + StoreCreationComo.showEdit(entry); } }