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;
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
public class StoreCreationComo extends MultiStepComp.Step<CompStructure<?>> {
MultiStepComp parent;
Property<DataStoreProvider> provider;
@ -55,17 +55,15 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
BooleanProperty changedSinceError = new SimpleBooleanProperty();
StringProperty name;
DataStoreEntry existingEntry;
boolean exists;
boolean staticDisplay;
public GuiDsStoreCreator(
public StoreCreationComo(
MultiStepComp parent,
Property<DataStoreProvider> provider,
Property<DataStore> store,
Predicate<DataStoreProvider> 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<CompStructure<?>> {
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<CompStructure<?>> {
});
},
true,
true,
e);
}
@ -169,7 +165,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
}
},
false,
false,
null);
}
@ -179,7 +174,6 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
DataStore s,
Predicate<DataStoreProvider> filter,
Consumer<DataStoreEntry> con,
boolean exists,
boolean staticDisplay,
DataStoreEntry existingEntry) {
var prop = new SimpleObjectProperty<>(provider);
@ -192,8 +186,8 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
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<Entry> setup() {

View file

@ -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();
});

View file

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

View file

@ -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();
}

View file

@ -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

View file

@ -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);
}
}

View file

@ -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);
}
}