Rename store creation comp and apply state on entry update

This commit is contained in:
crschnick 2024-01-17 17:06:10 +00:00
parent 37ed575266
commit ab9059881c
7 changed files with 15 additions and 18 deletions

View file

@ -41,7 +41,7 @@ import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> { public class StoreCreationComo extends MultiStepComp.Step<CompStructure<?>> {
MultiStepComp parent; MultiStepComp parent;
Property<DataStoreProvider> provider; Property<DataStoreProvider> provider;
@ -55,17 +55,15 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
BooleanProperty changedSinceError = new SimpleBooleanProperty(); BooleanProperty changedSinceError = new SimpleBooleanProperty();
StringProperty name; StringProperty name;
DataStoreEntry existingEntry; DataStoreEntry existingEntry;
boolean exists;
boolean staticDisplay; boolean staticDisplay;
public GuiDsStoreCreator( public StoreCreationComo(
MultiStepComp parent, MultiStepComp parent,
Property<DataStoreProvider> provider, Property<DataStoreProvider> provider,
Property<DataStore> store, Property<DataStore> store,
Predicate<DataStoreProvider> filter, Predicate<DataStoreProvider> filter,
String initialName, String initialName,
DataStoreEntry existingEntry, DataStoreEntry existingEntry,
boolean exists,
boolean staticDisplay) { boolean staticDisplay) {
this.parent = parent; this.parent = parent;
this.provider = provider; this.provider = provider;
@ -73,7 +71,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
this.filter = filter; this.filter = filter;
this.name = new SimpleStringProperty(initialName != null && !initialName.isEmpty() ? initialName : null); this.name = new SimpleStringProperty(initialName != null && !initialName.isEmpty() ? initialName : null);
this.existingEntry = existingEntry; this.existingEntry = existingEntry;
this.exists = exists;
this.staticDisplay = staticDisplay; this.staticDisplay = staticDisplay;
this.store.addListener((c, o, n) -> { this.store.addListener((c, o, n) -> {
changedSinceError.setValue(true); changedSinceError.setValue(true);
@ -148,7 +145,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
}); });
}, },
true, true,
true,
e); e);
} }
@ -169,7 +165,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
} }
}, },
false, false,
false,
null); null);
} }
@ -179,7 +174,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
DataStore s, DataStore s,
Predicate<DataStoreProvider> filter, Predicate<DataStoreProvider> filter,
Consumer<DataStoreEntry> con, Consumer<DataStoreEntry> con,
boolean exists,
boolean staticDisplay, boolean staticDisplay,
DataStoreEntry existingEntry) { DataStoreEntry existingEntry) {
var prop = new SimpleObjectProperty<>(provider); var prop = new SimpleObjectProperty<>(provider);
@ -192,8 +186,8 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
window -> { window -> {
return new MultiStepComp() { return new MultiStepComp() {
private final GuiDsStoreCreator creator = new GuiDsStoreCreator( private final StoreCreationComo creator = new StoreCreationComo(
this, prop, store, filter, initialName, existingEntry, exists, staticDisplay); this, prop, store, filter, initialName, existingEntry, staticDisplay);
@Override @Override
protected List<Entry> setup() { protected List<Entry> setup() {

View file

@ -50,7 +50,7 @@ public class StoreCreationMenu {
item.setGraphic(new FontIcon(graphic)); item.setGraphic(new FontIcon(graphic));
item.textProperty().bind(AppI18n.observable(name)); item.textProperty().bind(AppI18n.observable(name));
item.setOnAction(event -> { 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())); v -> category.equals(v.getCreationCategory()));
event.consume(); event.consume();
}); });
@ -65,7 +65,7 @@ public class StoreCreationMenu {
return; return;
} }
GuiDsStoreCreator.showCreation(defaultProvider != null ? DataStoreProviders.byName(defaultProvider).orElseThrow() : null, StoreCreationComo.showCreation(defaultProvider != null ? DataStoreProviders.byName(defaultProvider).orElseThrow() : null,
v -> category.equals(v.getCreationCategory())); v -> category.equals(v.getCreationCategory()));
event.consume(); event.consume();
}); });
@ -73,7 +73,7 @@ public class StoreCreationMenu {
var item = new MenuItem(dataStoreProvider.getDisplayName()); var item = new MenuItem(dataStoreProvider.getDisplayName());
item.setGraphic(PrettyImageHelper.ofFixedSmallSquare(dataStoreProvider.getDisplayIconFileName(null)).createRegion()); item.setGraphic(PrettyImageHelper.ofFixedSmallSquare(dataStoreProvider.getDisplayIconFileName(null)).createRegion());
item.setOnAction(event -> { item.setOnAction(event -> {
GuiDsStoreCreator.showCreation(dataStoreProvider, StoreCreationComo.showCreation(dataStoreProvider,
v -> category.equals(v.getCreationCategory())); v -> category.equals(v.getCreationCategory()));
event.consume(); event.consume();
}); });

View file

@ -73,7 +73,7 @@ public class StoreEntryWrapper {
} }
public void editDialog() { public void editDialog() {
GuiDsStoreCreator.showEdit(entry); StoreCreationComo.showEdit(entry);
} }
public void delete() { public void delete() {

View file

@ -364,6 +364,8 @@ public class DataStoreEntry extends StorageElement {
provider = e.provider; provider = e.provider;
childrenCache = null; childrenCache = null;
validity = store == null ? Validity.LOAD_FAILED : store.isComplete() ? Validity.COMPLETE : Validity.INCOMPLETE; validity = store == null ? Validity.LOAD_FAILED : store.isComplete() ? Validity.COMPLETE : Validity.INCOMPLETE;
storePersistentState = e.storePersistentState;
storePersistentStateNode = e.storePersistentStateNode;
notifyUpdate(); notifyUpdate();
} }

View file

@ -19,6 +19,7 @@
## Fixes ## Fixes
- Fix application windows on Linux not initializing with the correct size
- Fix connections to pfSense systems not working (This time properly) - Fix connections to pfSense systems not working (This time properly)
- Fix NullPointerException when a Linux system did not provide any release name - Fix NullPointerException when a Linux system did not provide any release name
- Fix startup errors when operating system reported invalid window sizes - Fix startup errors when operating system reported invalid window sizes

View file

@ -1,6 +1,6 @@
package io.xpipe.ext.base.action; 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.core.AppI18n;
import io.xpipe.app.ext.ActionProvider; import io.xpipe.app.ext.ActionProvider;
import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntry;
@ -23,7 +23,7 @@ public class EditStoreAction implements ActionProvider {
@Override @Override
public void execute() { public void execute() {
GuiDsStoreCreator.showEdit(store); StoreCreationComo.showEdit(store);
} }
} }

View file

@ -1,7 +1,7 @@
package io.xpipe.ext.base.action; package io.xpipe.ext.base.action;
import io.xpipe.app.comp.store.StoreViewState; 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.ext.ActionProvider;
import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry; 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); var entry = DataStoreEntry.createNew(UUID.randomUUID(), StoreViewState.get().getActiveCategory().getValue().getCategory().getUuid(), "", store);
GuiDsStoreCreator.showEdit(entry); StoreCreationComo.showEdit(entry);
} }
} }