mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 09:00:26 +00:00
Fix many small issues
This commit is contained in:
parent
5539eaa420
commit
44f7b4922d
15 changed files with 123 additions and 37 deletions
|
@ -55,8 +55,6 @@ public class DsStoreProviderChoiceComp extends Comp<CompStructure<ComboBox<Node>
|
|||
@Override
|
||||
public CompStructure<ComboBox<Node>> createBase() {
|
||||
var comboBox = new CustomComboBoxBuilder<>(provider, this::createGraphic, createDefaultNode(), v -> true);
|
||||
comboBox.add(null);
|
||||
comboBox.addSeparator();
|
||||
getProviders().stream()
|
||||
.filter(p -> AppPrefs.get().developerShowHiddenProviders().get() || p.shouldShow())
|
||||
.forEach(comboBox::add);
|
||||
|
|
|
@ -195,21 +195,14 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
|
|||
}
|
||||
|
||||
var d = n.guiDialog(input);
|
||||
|
||||
if (d == null || d.getComp() == null) {
|
||||
layout.setCenter(null);
|
||||
validator.setValue(new SimpleValidator());
|
||||
return;
|
||||
}
|
||||
|
||||
var propVal = new SimpleValidator();
|
||||
var propR = createStoreProperties(d.getComp(), propVal);
|
||||
var propR = createStoreProperties(d == null || d.getComp() == null ? null : d.getComp(), propVal);
|
||||
var box = new VBox(propR);
|
||||
box.setSpacing(7);
|
||||
|
||||
layout.setCenter(box);
|
||||
|
||||
validator.setValue(new ChainedValidator(List.of(d.getValidator(), propVal)));
|
||||
validator.setValue(new ChainedValidator(List.of(d != null && d.getValidator() != null ? d.getValidator() : new SimpleValidator(), propVal)));
|
||||
} else {
|
||||
layout.setCenter(null);
|
||||
validator.setValue(new SimpleValidator());
|
||||
|
|
|
@ -152,10 +152,15 @@ public class StoreEntryComp extends SimpleComp {
|
|||
button.setFocusTraversable(false);
|
||||
button.setOnAction(event -> {
|
||||
event.consume();
|
||||
if (entry.getEditable().get()) {
|
||||
entry.editDialog();
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
var found = entry.getDefaultActionProvider().getValue();
|
||||
if (found != null) {
|
||||
found.getDataStoreCallSite()
|
||||
.createAction(entry.getEntry().getStore().asNeeded())
|
||||
.execute();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return button;
|
||||
}
|
||||
|
@ -164,7 +169,7 @@ public class StoreEntryComp extends SimpleComp {
|
|||
var list = new ArrayList<Comp<?>>();
|
||||
for (var p : entry.getActionProviders().entrySet()) {
|
||||
var actionProvider = p.getKey().getDataStoreCallSite();
|
||||
if (!actionProvider.isMajor()) {
|
||||
if (!actionProvider.isMajor() || p.getKey().equals(entry.getDefaultActionProvider().getValue())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -213,7 +218,7 @@ public class StoreEntryComp extends SimpleComp {
|
|||
settingsButton.apply(s -> {
|
||||
s.get().prefWidthProperty().bind(Bindings.divide(s.get().heightProperty(), 1.35));
|
||||
});
|
||||
settingsButton.apply(new FancyTooltipAugment<>("entrySettings"));
|
||||
settingsButton.apply(new FancyTooltipAugment<>("more"));
|
||||
return settingsButton;
|
||||
}
|
||||
|
||||
|
@ -263,11 +268,6 @@ public class StoreEntryComp extends SimpleComp {
|
|||
});
|
||||
contextMenu.getItems().add(refresh);
|
||||
|
||||
var edit = new MenuItem(I18n.get("edit"), new FontIcon("mdal-edit"));
|
||||
edit.disableProperty().bind(entry.getEditable().not());
|
||||
edit.setOnAction(event -> entry.editDialog());
|
||||
contextMenu.getItems().add(edit);
|
||||
|
||||
var del = new MenuItem(I18n.get("delete"), new FontIcon("mdal-delete_outline"));
|
||||
del.disableProperty().bind(entry.getDeletable().not());
|
||||
del.setOnAction(event -> entry.delete());
|
||||
|
|
|
@ -9,7 +9,7 @@ import javafx.beans.binding.Bindings;
|
|||
import javafx.beans.value.ObservableBooleanValue;
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public class StoreEntryListComp extends SimpleComp {
|
||||
|
||||
|
@ -28,13 +28,14 @@ public class StoreEntryListComp extends SimpleComp {
|
|||
|
||||
@Override
|
||||
protected Region createSimple() {
|
||||
var map = Map.<Comp<?>, ObservableBooleanValue>of(
|
||||
var map = new LinkedHashMap<Comp<?>, ObservableBooleanValue>();
|
||||
map.put(
|
||||
createList(),
|
||||
BindingsHelper.persist(Bindings.and(
|
||||
Bindings.not(StoreViewState.get().emptyProperty()),
|
||||
Bindings.not(Bindings.isEmpty(StoreViewState.get().getShownEntries())))),
|
||||
new StoreStorageEmptyIntroComp(),
|
||||
StoreViewState.get().emptyProperty(),
|
||||
BindingsHelper.persist(
|
||||
Bindings.not(Bindings.isEmpty(StoreViewState.get().getShownEntries()))));
|
||||
|
||||
map.put(new StoreStorageEmptyIntroComp(), StoreViewState.get().emptyProperty());
|
||||
map.put(
|
||||
new StoreNotFoundComp(),
|
||||
BindingsHelper.persist(Bindings.and(
|
||||
Bindings.not(Bindings.isEmpty(StoreViewState.get().getAllEntries())),
|
||||
|
|
|
@ -8,9 +8,11 @@ import io.xpipe.app.storage.DataStoreEntry;
|
|||
import io.xpipe.extension.event.ErrorEvent;
|
||||
import io.xpipe.extension.fxcomps.util.PlatformThread;
|
||||
import io.xpipe.extension.util.ActionProvider;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.beans.value.ObservableBooleanValue;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.time.Duration;
|
||||
|
@ -30,6 +32,7 @@ public class StoreEntryWrapper implements StorageFilter.Filterable {
|
|||
private final StringProperty information = new SimpleStringProperty();
|
||||
private final StringProperty summary = new SimpleStringProperty();
|
||||
private final Map<ActionProvider, ObservableBooleanValue> actionProviders;
|
||||
private final ObservableValue<ActionProvider> defaultActionProvider;
|
||||
private final BooleanProperty editable = new SimpleBooleanProperty();
|
||||
private final BooleanProperty renamable = new SimpleBooleanProperty();
|
||||
private final BooleanProperty refreshable = new SimpleBooleanProperty();
|
||||
|
@ -65,6 +68,14 @@ public class StoreEntryWrapper implements StorageFilter.Filterable {
|
|||
lastAccess);
|
||||
actionProviders.put(dataStoreActionProvider, property);
|
||||
});
|
||||
this.defaultActionProvider = Bindings.createObjectBinding(() -> {
|
||||
var found = actionProviders.entrySet().stream()
|
||||
.filter(e -> e.getValue().get())
|
||||
.filter(e -> e.getKey().getDataStoreCallSite() != null
|
||||
&& e.getKey().getDataStoreCallSite().isDefault())
|
||||
.findFirst();
|
||||
return found.map(p -> p.getKey()).orElse(null);
|
||||
}, actionProviders.values().toArray(Observable[]::new));
|
||||
setupListeners();
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ public class StoreStorageEmptyIntroComp extends SimpleComp {
|
|||
|
||||
var sp = new StackPane(v);
|
||||
sp.setAlignment(Pos.CENTER);
|
||||
sp.setPickOnBounds(false);
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class AppPrefs {
|
|||
private static ObservableBooleanValue bindDeveloperTrue(ObservableBooleanValue o) {
|
||||
return Bindings.createBooleanBinding(
|
||||
() -> {
|
||||
return AppPrefs.get().developerMode().getValue() || o.get();
|
||||
return AppPrefs.get().developerMode().getValue() && o.get();
|
||||
},
|
||||
o,
|
||||
AppPrefs.get().developerMode());
|
||||
|
@ -39,7 +39,7 @@ public class AppPrefs {
|
|||
private static ObservableBooleanValue bindDeveloperFalse(ObservableBooleanValue o) {
|
||||
return Bindings.createBooleanBinding(
|
||||
() -> {
|
||||
return !AppPrefs.get().developerMode().getValue() || o.get();
|
||||
return !AppPrefs.get().developerMode().getValue() && o.get();
|
||||
},
|
||||
o,
|
||||
AppPrefs.get().developerMode());
|
||||
|
|
|
@ -7,6 +7,7 @@ errorTypeOccured=An exception of type $TYPE$ was thrown
|
|||
errorDetails=Show details
|
||||
target=Target
|
||||
data=Data
|
||||
more=More
|
||||
pipeDataSource=Pipe Data Source
|
||||
updateReadyTitle=Update Ready
|
||||
updateReadyHeader=An update is ready to be installed
|
||||
|
|
|
@ -39,8 +39,8 @@ granted by this EULA.
|
|||
|
||||
### Privacy Notices
|
||||
|
||||
The Software automatically communicates with its server for three purposes: (1) updating the Software; (2) sending error
|
||||
reports; and (3) sending anonymized usage data so we may improve the Software. If you would like to learn more about the
|
||||
The Software automatically communicates with its server for two purposes: (1) updating the Software; (2) sending error
|
||||
reports; If you would like to learn more about the
|
||||
specific information we send, please visit https://xpipe.io/privacy_policy. You may opt out of these features.
|
||||
|
||||
1. **Automatic Software Updates.** The Software communicates with its server (and sends information described at the URL
|
||||
|
@ -48,7 +48,7 @@ specific information we send, please visit https://xpipe.io/privacy_policy. You
|
|||
Software. You agree that the Software may automatically install any such improvements to the Software on your
|
||||
computer without providing any further notice or receiving any additional consent. This feature may be disabled.
|
||||
2. **Error Reports.** In order to help us improve the Software, when the Software encounters certain errors, it will
|
||||
automatically send some information to its server about the error (as described at the URL above). This feature may
|
||||
send some information to its server about the error (as described at the URL above). This feature may
|
||||
be disabled.
|
||||
|
||||
### Open-Source Notices
|
||||
|
|
|
@ -45,9 +45,10 @@ public class LocalStoreProvider implements DataStoreProvider {
|
|||
e.setConfiguration(StorageElement.Configuration.builder()
|
||||
.deletable(false)
|
||||
.editable(false)
|
||||
.refreshable(false)
|
||||
.refreshable(true)
|
||||
.renameable(false)
|
||||
.build());
|
||||
e.refresh(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package io.xpipe.ext.base.actions;
|
||||
|
||||
import io.xpipe.app.comp.source.store.GuiDsStoreCreator;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
import io.xpipe.extension.I18n;
|
||||
import io.xpipe.extension.util.ActionProvider;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import lombok.Value;
|
||||
|
||||
public class EditStoreAction implements ActionProvider {
|
||||
|
||||
@Value
|
||||
static class Action implements ActionProvider.Action {
|
||||
|
||||
DataStoreEntry store;
|
||||
|
||||
@Override
|
||||
public boolean requiresPlatform() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
GuiDsStoreCreator.showEdit(store);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataStoreCallSite<?> getDataStoreCallSite() {
|
||||
return new DataStoreCallSite<DataStore>() {
|
||||
|
||||
@Override
|
||||
public boolean isMajor() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showIfDisabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionProvider.Action createAction(DataStore store) {
|
||||
return new Action(DataStorage.get().getStore(store));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DataStore> getApplicableClass() {
|
||||
return DataStore.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(DataStore o) throws Exception {
|
||||
return DataStorage.get().getStore(o).getConfiguration().isEditable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(DataStore store) {
|
||||
return I18n.observable("base.edit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon(DataStore store) {
|
||||
return "mdal-edit";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ open module io.xpipe.ext.base {
|
|||
|
||||
provides ActionProvider with
|
||||
AddStoreAction,
|
||||
EditStoreAction,
|
||||
StreamExportAction,
|
||||
ShareStoreAction,
|
||||
FileBrowseAction,
|
||||
|
|
|
@ -53,3 +53,6 @@ waitingForProducer=Waiting for Producer
|
|||
open=Open
|
||||
closed=Closed
|
||||
internalStream.displayName=Internal Stream
|
||||
local.displayName=Local machine
|
||||
local.displayDescription=
|
||||
edit=Edit
|
|
@ -86,10 +86,12 @@ public class DynamicOptionsComp extends Comp<CompStructure<Pane>> {
|
|||
|
||||
pane.getChildren().add(line);
|
||||
} else {
|
||||
if (compRegion != null) {
|
||||
compRegions.add(compRegion);
|
||||
pane.getChildren().add(compRegion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wrap) {
|
||||
var compWidthBinding = Bindings.createDoubleBinding(
|
||||
|
|
|
@ -78,6 +78,10 @@ public interface ActionProvider {
|
|||
|
||||
Class<T> getApplicableClass();
|
||||
|
||||
default boolean isDefault() {
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean isMajor() {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue