Rework information string for services

This commit is contained in:
crschnick 2024-07-15 19:01:06 +00:00
parent d67e2c813d
commit 2d07615f5e
26 changed files with 152 additions and 98 deletions

View file

@ -17,8 +17,8 @@ public class DenseStoreEntryComp extends StoreEntryComp {
private final boolean showIcon;
public DenseStoreEntryComp(StoreEntryWrapper entry, boolean showIcon, Comp<?> content) {
super(entry, content);
public DenseStoreEntryComp(StoreSection section, boolean showIcon, Comp<?> content) {
super(section, content);
this.showIcon = showIcon;
}
@ -28,14 +28,14 @@ public class DenseStoreEntryComp extends StoreEntryComp {
information.getStyleClass().add("information");
AppFont.header(information);
var state = wrapper.getEntry().getProvider() != null
? wrapper.getEntry().getProvider().stateDisplay(wrapper)
var state = getWrapper().getEntry().getProvider() != null
? getWrapper().getEntry().getProvider().stateDisplay(getWrapper())
: Comp.empty();
information.setGraphic(state.createRegion());
var info = wrapper.getEntry().getProvider() != null ? wrapper.getEntry().getProvider().informationString(wrapper) : new SimpleStringProperty();
var summary = wrapper.getSummary();
if (wrapper.getEntry().getProvider() != null) {
var info = getWrapper().getEntry().getProvider() != null ? getWrapper().getEntry().getProvider().informationString(section) : new SimpleStringProperty();
var summary = getWrapper().getSummary();
if (getWrapper().getEntry().getProvider() != null) {
information
.textProperty()
.bind(PlatformThread.sync(Bindings.createStringBinding(
@ -43,7 +43,7 @@ public class DenseStoreEntryComp extends StoreEntryComp {
var val = summary.getValue();
if (val != null
&& grid.isHover()
&& wrapper.getEntry().getProvider().alwaysShowSummary()) {
&& getWrapper().getEntry().getProvider().alwaysShowSummary()) {
return val;
} else {
return info.getValue();
@ -73,7 +73,7 @@ public class DenseStoreEntryComp extends StoreEntryComp {
return grid.getWidth() / 2.5;
},
grid.widthProperty()));
var notes = new StoreNotesComp(wrapper).createRegion();
var notes = new StoreNotesComp(getWrapper()).createRegion();
if (showIcon) {
var storeIcon = createIcon(30, 24);

View file

@ -9,8 +9,8 @@ import javafx.scene.layout.*;
public class StandardStoreEntryComp extends StoreEntryComp {
public StandardStoreEntryComp(StoreEntryWrapper entry, Comp<?> content) {
super(entry, content);
public StandardStoreEntryComp(StoreSection section, Comp<?> content) {
super(section, content);
}
@Override
@ -20,7 +20,7 @@ public class StandardStoreEntryComp extends StoreEntryComp {
protected Region createContent() {
var name = createName().createRegion();
var notes = new StoreNotesComp(wrapper).createRegion();
var notes = new StoreNotesComp(getWrapper()).createRegion();
var grid = new GridPane();
grid.setHgap(7);

View file

@ -51,21 +51,25 @@ public abstract class StoreEntryComp extends SimpleComp {
App.getApp().getStage().widthProperty().divide(2.1).add(-100);
public static final ObservableDoubleValue INFO_WITH_CONTENT_WIDTH =
App.getApp().getStage().widthProperty().divide(2.1).add(-200);
protected final StoreEntryWrapper wrapper;
protected final StoreSection section;
protected final Comp<?> content;
public StoreEntryComp(StoreEntryWrapper wrapper, Comp<?> content) {
this.wrapper = wrapper;
public StoreEntryComp(StoreSection section, Comp<?> content) {
this.section = section;
this.content = content;
}
public StoreEntryWrapper getWrapper() {
return section.getWrapper();
}
public static StoreEntryComp create(StoreEntryWrapper entry, Comp<?> content, boolean preferLarge) {
public static StoreEntryComp create(StoreSection section, Comp<?> content, boolean preferLarge) {
var forceCondensed = AppPrefs.get() != null
&& AppPrefs.get().condenseConnectionDisplay().get();
if (!preferLarge || forceCondensed) {
return new DenseStoreEntryComp(entry, true, content);
return new DenseStoreEntryComp(section, true, content);
} else {
return new StandardStoreEntryComp(entry, content);
return new StandardStoreEntryComp(section, content);
}
}
@ -77,8 +81,8 @@ public abstract class StoreEntryComp extends SimpleComp {
var forceCondensed = AppPrefs.get() != null
&& AppPrefs.get().condenseConnectionDisplay().get();
return forceCondensed
? new DenseStoreEntryComp(e.getWrapper(), true, null)
: new StandardStoreEntryComp(e.getWrapper(), null);
? new DenseStoreEntryComp(e, true, null)
: new StandardStoreEntryComp(e, null);
}
}
@ -95,11 +99,11 @@ public abstract class StoreEntryComp extends SimpleComp {
button.setPadding(Insets.EMPTY);
button.setMaxWidth(5000);
button.setFocusTraversable(true);
button.accessibleTextProperty().bind(wrapper.nameProperty());
button.accessibleTextProperty().bind(getWrapper().nameProperty());
button.setOnAction(event -> {
event.consume();
ThreadHelper.runFailableAsync(() -> {
wrapper.executeDefaultAction();
getWrapper().executeDefaultAction();
});
});
button.addEventFilter(MouseEvent.MOUSE_CLICKED, event -> {
@ -132,9 +136,9 @@ public abstract class StoreEntryComp extends SimpleComp {
var loading = LoadingOverlayComp.noProgress(
Comp.of(() -> button),
wrapper.getEntry().getValidity().isUsable()
? wrapper.getBusy().or(wrapper.getEntry().getProvider().busy(wrapper))
: wrapper.getBusy());
getWrapper().getEntry().getValidity().isUsable()
? getWrapper().getBusy().or(getWrapper().getEntry().getProvider().busy(getWrapper()))
: getWrapper().getBusy());
return loading.createRegion();
}
@ -146,15 +150,15 @@ public abstract class StoreEntryComp extends SimpleComp {
information
.textProperty()
.bind(
wrapper.getEntry().getProvider() != null
getWrapper().getEntry().getProvider() != null
? PlatformThread.sync(
wrapper.getEntry().getProvider().informationString(wrapper))
getWrapper().getEntry().getProvider().informationString(section))
: new SimpleStringProperty());
information.getStyleClass().add("information");
AppFont.header(information);
var state = wrapper.getEntry().getProvider() != null
? wrapper.getEntry().getProvider().stateDisplay(wrapper)
var state = getWrapper().getEntry().getProvider() != null
? getWrapper().getEntry().getProvider().stateDisplay(getWrapper())
: Comp.empty();
information.setGraphic(state.createRegion());
@ -163,14 +167,14 @@ public abstract class StoreEntryComp extends SimpleComp {
protected Label createSummary() {
var summary = new Label();
summary.textProperty().bind(wrapper.getSummary());
summary.textProperty().bind(getWrapper().getSummary());
summary.getStyleClass().add("summary");
AppFont.small(summary);
return summary;
}
protected void applyState(Node node) {
PlatformThread.sync(wrapper.getValidity()).subscribe(val -> {
PlatformThread.sync(getWrapper().getValidity()).subscribe(val -> {
switch (val) {
case LOAD_FAILED -> {
node.pseudoClassStateChanged(FAILED, true);
@ -189,7 +193,7 @@ public abstract class StoreEntryComp extends SimpleComp {
}
protected Comp<?> createName() {
LabelComp name = new LabelComp(wrapper.nameProperty());
LabelComp name = new LabelComp(getWrapper().nameProperty());
name.apply(struc -> struc.get().setTextOverrun(OverrunStyle.CENTER_ELLIPSIS))
.apply(struc -> struc.get().setPadding(new Insets(5, 5, 5, 0)));
name.apply(s -> AppFont.header(s.get()));
@ -198,15 +202,15 @@ public abstract class StoreEntryComp extends SimpleComp {
}
protected Node createIcon(int w, int h) {
var img = wrapper.disabledProperty().get()
var img = getWrapper().disabledProperty().get()
? "disabled_icon.png"
: wrapper.getEntry()
: getWrapper().getEntry()
.getProvider()
.getDisplayIconFileName(wrapper.getEntry().getStore());
.getDisplayIconFileName(getWrapper().getEntry().getStore());
var imageComp = PrettyImageHelper.ofFixedSize(img, w, h);
var storeIcon = imageComp.createRegion();
if (wrapper.getValidity().getValue().isUsable()) {
new TooltipAugment<>(wrapper.getEntry().getProvider().displayName(), null).augment(storeIcon);
if (getWrapper().getValidity().getValue().isUsable()) {
new TooltipAugment<>(getWrapper().getEntry().getProvider().displayName(), null).augment(storeIcon);
}
var stack = new StackPane(storeIcon);
@ -220,7 +224,7 @@ public abstract class StoreEntryComp extends SimpleComp {
}
protected Region createButtonBar() {
var list = new DerivedObservableList<>(wrapper.getActionProviders(), false);
var list = new DerivedObservableList<>(getWrapper().getActionProviders(), false);
var buttons = list.mapped(actionProvider -> {
var button = buildButton(actionProvider);
return button != null ? button.createRegion() : null;
@ -249,17 +253,17 @@ public abstract class StoreEntryComp extends SimpleComp {
var branch = p.getBranchDataStoreCallSite();
var cs = leaf != null ? leaf : branch;
if (cs == null || !cs.isMajor(wrapper.getEntry().ref())) {
if (cs == null || !cs.isMajor(getWrapper().getEntry().ref())) {
return null;
}
var button = new IconButtonComp(
cs.getIcon(wrapper.getEntry().ref()),
cs.getIcon(getWrapper().getEntry().ref()),
leaf != null
? () -> {
ThreadHelper.runFailableAsync(() -> {
wrapper.runAction(
leaf.createAction(wrapper.getEntry().ref()), leaf.showBusy());
getWrapper().runAction(
leaf.createAction(getWrapper().getEntry().ref()), leaf.showBusy());
});
}
: null);
@ -276,8 +280,8 @@ public abstract class StoreEntryComp extends SimpleComp {
return cm;
}));
}
button.accessibleText(cs.getName(wrapper.getEntry().ref()).getValue());
button.apply(new TooltipAugment<>(cs.getName(wrapper.getEntry().ref()), null));
button.accessibleText(cs.getName(getWrapper().getEntry().ref()).getValue());
button.apply(new TooltipAugment<>(cs.getName(getWrapper().getEntry().ref()), null));
return button;
}
@ -298,7 +302,7 @@ public abstract class StoreEntryComp extends SimpleComp {
AppFont.normal(contextMenu.getStyleableNode());
var hasSep = false;
for (var p : wrapper.getActionProviders()) {
for (var p : getWrapper().getActionProviders()) {
var item = buildMenuItemForAction(p);
if (item == null) {
continue;
@ -321,36 +325,36 @@ public abstract class StoreEntryComp extends SimpleComp {
var notes = new MenuItem(AppI18n.get("addNotes"), new FontIcon("mdi2n-note-text"));
notes.setOnAction(event -> {
wrapper.getNotes().setValue(new StoreNotes(null, getDefaultNotes()));
getWrapper().getNotes().setValue(new StoreNotes(null, getDefaultNotes()));
event.consume();
});
notes.visibleProperty().bind(BindingsHelper.map(wrapper.getNotes(), s -> s.getCommited() == null));
notes.visibleProperty().bind(BindingsHelper.map(getWrapper().getNotes(), s -> s.getCommited() == null));
contextMenu.getItems().add(notes);
if (AppPrefs.get().developerMode().getValue()) {
var browse = new MenuItem(AppI18n.get("browseInternalStorage"), new FontIcon("mdi2f-folder-open-outline"));
browse.setOnAction(
event -> DesktopHelper.browsePathLocal(wrapper.getEntry().getDirectory()));
event -> DesktopHelper.browsePathLocal(getWrapper().getEntry().getDirectory()));
contextMenu.getItems().add(browse);
var copyId = new MenuItem(AppI18n.get("copyId"), new FontIcon("mdi2c-content-copy"));
copyId.setOnAction(event ->
ClipboardHelper.copyText(wrapper.getEntry().getUuid().toString()));
ClipboardHelper.copyText(getWrapper().getEntry().getUuid().toString()));
contextMenu.getItems().add(copyId);
}
if (DataStorage.get().isRootEntry(wrapper.getEntry())) {
if (DataStorage.get().isRootEntry(getWrapper().getEntry())) {
var color = new Menu(AppI18n.get("color"), new FontIcon("mdi2f-format-color-fill"));
var none = new MenuItem("None");
none.setOnAction(event -> {
wrapper.getEntry().setColor(null);
getWrapper().getEntry().setColor(null);
event.consume();
});
color.getItems().add(none);
Arrays.stream(DataStoreColor.values()).forEach(dataStoreColor -> {
MenuItem m = new MenuItem(DataStoreFormatter.capitalize(dataStoreColor.getId()));
m.setOnAction(event -> {
wrapper.getEntry().setColor(dataStoreColor);
getWrapper().getEntry().setColor(dataStoreColor);
event.consume();
});
color.getItems().add(m);
@ -358,10 +362,10 @@ public abstract class StoreEntryComp extends SimpleComp {
contextMenu.getItems().add(color);
}
if (wrapper.getEntry().getProvider() != null) {
if (getWrapper().getEntry().getProvider() != null) {
var move = new Menu(AppI18n.get("moveTo"), new FontIcon("mdi2f-folder-move-outline"));
StoreViewState.get()
.getSortedCategories(wrapper.getCategory().getValue().getRoot())
.getSortedCategories(getWrapper().getCategory().getValue().getRoot())
.getList()
.forEach(storeCategoryWrapper -> {
MenuItem m = new MenuItem();
@ -369,12 +373,12 @@ public abstract class StoreEntryComp extends SimpleComp {
.setValue(" ".repeat(storeCategoryWrapper.getDepth())
+ storeCategoryWrapper.getName().getValue());
m.setOnAction(event -> {
wrapper.moveTo(storeCategoryWrapper.getCategory());
getWrapper().moveTo(storeCategoryWrapper.getCategory());
event.consume();
});
if (storeCategoryWrapper.getParent() == null
|| storeCategoryWrapper.equals(
wrapper.getCategory().getValue())) {
getWrapper().getCategory().getValue())) {
m.setDisable(true);
}
@ -386,10 +390,10 @@ public abstract class StoreEntryComp extends SimpleComp {
var order = new Menu(AppI18n.get("order"), new FontIcon("mdal-bookmarks"));
var noOrder = new MenuItem(AppI18n.get("none"), new FontIcon("mdi2r-reorder-horizontal"));
noOrder.setOnAction(event -> {
wrapper.setOrder(null);
getWrapper().setOrder(null);
event.consume();
});
if (wrapper.getEntry().getExplicitOrder() == null) {
if (getWrapper().getEntry().getExplicitOrder() == null) {
noOrder.setDisable(true);
}
order.getItems().add(noOrder);
@ -397,20 +401,20 @@ public abstract class StoreEntryComp extends SimpleComp {
var top = new MenuItem(AppI18n.get("stickToTop"), new FontIcon("mdi2o-order-bool-descending"));
top.setOnAction(event -> {
wrapper.setOrder(DataStoreEntry.Order.TOP);
getWrapper().setOrder(DataStoreEntry.Order.TOP);
event.consume();
});
if (DataStoreEntry.Order.TOP.equals(wrapper.getEntry().getExplicitOrder())) {
if (DataStoreEntry.Order.TOP.equals(getWrapper().getEntry().getExplicitOrder())) {
top.setDisable(true);
}
order.getItems().add(top);
var bottom = new MenuItem(AppI18n.get("stickToBottom"), new FontIcon("mdi2o-order-bool-ascending"));
bottom.setOnAction(event -> {
wrapper.setOrder(DataStoreEntry.Order.BOTTOM);
getWrapper().setOrder(DataStoreEntry.Order.BOTTOM);
event.consume();
});
if (DataStoreEntry.Order.BOTTOM.equals(wrapper.getEntry().getExplicitOrder())) {
if (DataStoreEntry.Order.BOTTOM.equals(getWrapper().getEntry().getExplicitOrder())) {
bottom.setDisable(true);
}
order.getItems().add(bottom);
@ -423,14 +427,14 @@ public abstract class StoreEntryComp extends SimpleComp {
del.disableProperty()
.bind(Bindings.createBooleanBinding(
() -> {
return !wrapper.getDeletable().get()
return !getWrapper().getDeletable().get()
&& !AppPrefs.get()
.developerDisableGuiRestrictions()
.get();
},
wrapper.getDeletable(),
getWrapper().getDeletable(),
AppPrefs.get().developerDisableGuiRestrictions()));
del.setOnAction(event -> wrapper.delete());
del.setOnAction(event -> getWrapper().delete());
contextMenu.getItems().add(del);
return contextMenu;
@ -441,12 +445,12 @@ public abstract class StoreEntryComp extends SimpleComp {
var branch = p.getBranchDataStoreCallSite();
var cs = leaf != null ? leaf : branch;
if (cs == null || cs.isMajor(wrapper.getEntry().ref())) {
if (cs == null || cs.isMajor(getWrapper().getEntry().ref())) {
return null;
}
var name = cs.getName(wrapper.getEntry().ref());
var icon = cs.getIcon(wrapper.getEntry().ref());
var name = cs.getName(getWrapper().getEntry().ref());
var icon = cs.getIcon(getWrapper().getEntry().ref());
var item = (leaf != null && leaf.canLinkTo()) || branch != null
? new Menu(null, new FontIcon(icon))
: new MenuItem(null, new FontIcon(icon));
@ -472,21 +476,21 @@ public abstract class StoreEntryComp extends SimpleComp {
run.textProperty().bind(AppI18n.observable("base.execute"));
run.setOnAction(event -> {
ThreadHelper.runFailableAsync(() -> {
wrapper.runAction(leaf.createAction(wrapper.getEntry().ref()), leaf.showBusy());
getWrapper().runAction(leaf.createAction(getWrapper().getEntry().ref()), leaf.showBusy());
});
});
menu.getItems().add(run);
var sc = new MenuItem(null, new FontIcon("mdi2c-code-greater-than"));
var url = "xpipe://action/" + p.getId() + "/" + wrapper.getEntry().getUuid();
var url = "xpipe://action/" + p.getId() + "/" + getWrapper().getEntry().getUuid();
sc.textProperty().bind(AppI18n.observable("base.createShortcut"));
sc.setOnAction(event -> {
ThreadHelper.runFailableAsync(() -> {
DesktopShortcuts.create(
url,
wrapper.nameProperty().getValue() + " ("
getWrapper().nameProperty().getValue() + " ("
+ p.getLeafDataStoreCallSite()
.getName(wrapper.getEntry().ref())
.getName(getWrapper().getEntry().ref())
.getValue() + ")");
});
});
@ -516,7 +520,7 @@ public abstract class StoreEntryComp extends SimpleComp {
event.consume();
ThreadHelper.runFailableAsync(() -> {
wrapper.runAction(leaf.createAction(wrapper.getEntry().ref()), leaf.showBusy());
getWrapper().runAction(leaf.createAction(getWrapper().getEntry().ref()), leaf.showBusy());
});
});

View file

@ -87,7 +87,7 @@ public interface DataStoreProvider {
}
default StoreEntryComp customEntryComp(StoreSection s, boolean preferLarge) {
return StoreEntryComp.create(s.getWrapper(), null, preferLarge);
return StoreEntryComp.create(s, null, preferLarge);
}
default StoreSectionComp customSectionComp(StoreSection section, boolean topLevel) {
@ -193,7 +193,7 @@ public interface DataStoreProvider {
return null;
}
default ObservableValue<String> informationString(StoreEntryWrapper wrapper) {
default ObservableValue<String> informationString(StoreSection section) {
return new SimpleStringProperty(null);
}

View file

@ -15,7 +15,7 @@ public interface EnabledParentStoreProvider extends DataStoreProvider {
@Override
default StoreEntryComp customEntryComp(StoreSection sec, boolean preferLarge) {
if (sec.getWrapper().getValidity().getValue() != DataStoreEntry.Validity.COMPLETE) {
return StoreEntryComp.create(sec.getWrapper(), null, preferLarge);
return StoreEntryComp.create(sec, null, preferLarge);
}
var enabled = StoreToggleComp.<StatefulDataStore<EnabledStoreState>>enableToggle(
@ -35,6 +35,6 @@ public interface EnabledParentStoreProvider extends DataStoreProvider {
}));
}
return StoreEntryComp.create(sec.getWrapper(), enabled, preferLarge);
return StoreEntryComp.create(sec, enabled, preferLarge);
}
}

View file

@ -12,7 +12,7 @@ public interface EnabledStoreProvider extends DataStoreProvider {
@Override
default StoreEntryComp customEntryComp(StoreSection sec, boolean preferLarge) {
if (sec.getWrapper().getValidity().getValue() != DataStoreEntry.Validity.COMPLETE) {
return StoreEntryComp.create(sec.getWrapper(), null, preferLarge);
return StoreEntryComp.create(sec, null, preferLarge);
}
var enabled = StoreToggleComp.<StatefulDataStore<EnabledStoreState>>enableToggle(
@ -20,6 +20,6 @@ public interface EnabledStoreProvider extends DataStoreProvider {
var state = s.getState().toBuilder().enabled(aBoolean).build();
s.setState(state);
});
return StoreEntryComp.create(sec.getWrapper(), enabled, preferLarge);
return StoreEntryComp.create(sec, enabled, preferLarge);
}
}

View file

@ -30,7 +30,7 @@ public interface SingletonSessionStoreProvider extends DataStoreProvider {
@Override
default StoreEntryComp customEntryComp(StoreSection sec, boolean preferLarge) {
var t = createToggleComp(sec);
return StoreEntryComp.create(sec.getWrapper(), t, preferLarge);
return StoreEntryComp.create(sec, t, preferLarge);
}
default StoreToggleComp createToggleComp(StoreSection sec) {

View file

@ -343,14 +343,14 @@ public abstract class DataStorage {
}
public boolean refreshChildren(DataStoreEntry e, boolean throwOnFail) throws Exception {
if (!(e.getStore() instanceof FixedHierarchyStore)) {
if (!(e.getStore() instanceof FixedHierarchyStore h)) {
return false;
}
e.incrementBusyCounter();
List<? extends DataStoreEntryRef<? extends FixedChildStore>> newChildren;
try {
newChildren = ((FixedHierarchyStore) (e.getStore())).listChildren(e).stream().filter(dataStoreEntryRef -> dataStoreEntryRef != null && dataStoreEntryRef.get() != null).toList();
newChildren = h.listChildren(e).stream().filter(dataStoreEntryRef -> dataStoreEntryRef != null && dataStoreEntryRef.get() != null).toList();
} catch (Exception ex) {
if (throwOnFail) {
throw ex;

View file

@ -2,6 +2,7 @@ package io.xpipe.ext.base.script;
import io.xpipe.app.comp.base.SystemStateComp;
import io.xpipe.app.comp.store.StoreEntryWrapper;
import io.xpipe.app.comp.store.StoreSection;
import io.xpipe.app.comp.store.StoreViewState;
import io.xpipe.app.ext.*;
import io.xpipe.app.fxcomps.Comp;
@ -76,8 +77,8 @@ public class ScriptGroupStoreProvider implements EnabledStoreProvider, DataStore
}
@Override
public ObservableValue<String> informationString(StoreEntryWrapper wrapper) {
ScriptGroupStore scriptStore = wrapper.getEntry().getStore().asNeeded();
public ObservableValue<String> informationString(StoreSection section) {
ScriptGroupStore scriptStore = section.getWrapper().getEntry().getStore().asNeeded();
return new SimpleStringProperty(scriptStore.getDescription());
}

View file

@ -4,6 +4,7 @@ import io.xpipe.app.comp.base.IntegratedTextAreaComp;
import io.xpipe.app.comp.base.ListSelectorComp;
import io.xpipe.app.comp.base.SystemStateComp;
import io.xpipe.app.comp.store.StoreEntryWrapper;
import io.xpipe.app.comp.store.StoreSection;
import io.xpipe.app.comp.store.StoreViewState;
import io.xpipe.app.core.AppExtensionManager;
import io.xpipe.app.core.AppI18n;
@ -206,8 +207,8 @@ public class SimpleScriptStoreProvider implements EnabledParentStoreProvider, Da
}
@Override
public ObservableValue<String> informationString(StoreEntryWrapper wrapper) {
SimpleScriptStore scriptStore = wrapper.getEntry().getStore().asNeeded();
public ObservableValue<String> informationString(StoreSection section) {
SimpleScriptStore scriptStore = section.getWrapper().getEntry().getStore().asNeeded();
return new SimpleStringProperty((scriptStore.getMinimumDialect() != null
? scriptStore.getMinimumDialect().getDisplayName() + " "
: "")

View file

@ -6,9 +6,11 @@ import io.xpipe.app.comp.store.StoreEntryComp;
import io.xpipe.app.comp.store.StoreEntryWrapper;
import io.xpipe.app.comp.store.StoreSection;
import io.xpipe.app.comp.store.StoreViewState;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.ext.DataStoreProvider;
import io.xpipe.app.ext.DataStoreUsageCategory;
import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.app.util.ThreadHelper;
@ -16,6 +18,7 @@ import io.xpipe.core.store.DataStore;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
public abstract class AbstractServiceGroupStoreProvider implements DataStoreProvider {
@ -27,7 +30,7 @@ public abstract class AbstractServiceGroupStoreProvider implements DataStoreProv
@Override
public StoreEntryComp customEntryComp(StoreSection sec, boolean preferLarge) {
var t = createToggleComp(sec);
return StoreEntryComp.create(sec.getWrapper(), t, preferLarge);
return StoreEntryComp.create(sec, t, preferLarge);
}
private StoreToggleComp createToggleComp(StoreSection sec) {
@ -62,6 +65,16 @@ public abstract class AbstractServiceGroupStoreProvider implements DataStoreProv
return t;
}
@Override
public ObservableValue<String> informationString(StoreSection section) {
return Bindings.createStringBinding(() -> {
var all = section.getAllChildren().getList();
var shown = section.getShownChildren().getList();
var string = all.size() == shown.size() ? all.size() : shown.size() + "/" + all.size();
return all.size() > 0 ? (all.size() == 1 ? AppI18n.get("hasService", string) : AppI18n.get("hasServices", string)) : AppI18n.get("noServices");
}, section.getShownChildren().getList(), section.getAllChildren().getList(), AppPrefs.get().language());
}
@Override
public Comp<?> stateDisplay(StoreEntryWrapper w) {
return new SystemStateComp(new SimpleObjectProperty<>(SystemStateComp.State.SUCCESS));

View file

@ -80,7 +80,7 @@ public abstract class AbstractServiceStoreProvider implements SingletonSessionSt
return true;
},
sec.getWrapper().getCache()));
return StoreEntryComp.create(sec.getWrapper(), toggle, preferLarge);
return StoreEntryComp.create(sec, toggle, preferLarge);
}
@Override
@ -98,8 +98,8 @@ public abstract class AbstractServiceStoreProvider implements SingletonSessionSt
}
@Override
public ObservableValue<String> informationString(StoreEntryWrapper wrapper) {
AbstractServiceStore s = wrapper.getEntry().getStore().asNeeded();
public ObservableValue<String> informationString(StoreSection section) {
AbstractServiceStore s = section.getWrapper().getEntry().getStore().asNeeded();
if (s.getLocalPort() != null) {
return new SimpleStringProperty("Port " + s.getLocalPort() + " <- " + s.getRemotePort());
} else {

View file

@ -1,6 +1,6 @@
package io.xpipe.ext.base.service;
import io.xpipe.app.comp.store.StoreEntryWrapper;
import io.xpipe.app.comp.store.StoreSection;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry;
@ -29,8 +29,8 @@ public class FixedServiceStoreProvider extends AbstractServiceStoreProvider {
}
@Override
public ObservableValue<String> informationString(StoreEntryWrapper wrapper) {
FixedServiceStore s = wrapper.getEntry().getStore().asNeeded();
public ObservableValue<String> informationString(StoreSection section) {
FixedServiceStore s = section.getWrapper().getEntry().getStore().asNeeded();
return new SimpleStringProperty("Port " + s.getRemotePort());
}

View file

@ -1,7 +1,6 @@
package io.xpipe.ext.base.service;
import io.xpipe.app.comp.store.StoreEntryWrapper;
import io.xpipe.app.comp.store.StoreSection;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
@ -15,9 +14,9 @@ public class MappedServiceStoreProvider extends FixedServiceStoreProvider {
}
@Override
public ObservableValue<String> informationString(StoreEntryWrapper wrapper) {
MappedServiceStore s = wrapper.getEntry().getStore().asNeeded();
return new SimpleStringProperty("Port " + s.getContainerPort() + " -> " + s.getRemotePort());
public ObservableValue<String> informationString(StoreSection section) {
MappedServiceStore s = section.getWrapper().getEntry().getStore().asNeeded();
return new SimpleStringProperty("Port " + s.getRemotePort() + " -> " + s.getContainerPort());
}
@Override

View file

@ -167,3 +167,6 @@ customService.displayName=Service
customService.displayDescription=Tilføj en brugerdefineret tjeneste til tunnel og åben
fixedService.displayName=Service
fixedService.displayDescription=Brug en foruddefineret tjeneste
noServices=Ingen tilgængelige tjenester
hasServices=$COUNT$ tilgængelige tjenester
hasService=$COUNT$ tilgængelig tjeneste

View file

@ -158,3 +158,6 @@ customService.displayName=Dienst
customService.displayDescription=Einen benutzerdefinierten Dienst zum Tunnel hinzufügen und öffnen
fixedService.displayName=Dienst
fixedService.displayDescription=Einen vordefinierten Dienst verwenden
noServices=Keine verfügbaren Dienste
hasServices=$COUNT$ verfügbare Dienste
hasService=$COUNT$ verfügbarer Dienst

View file

@ -156,5 +156,8 @@ customService.displayName=Service
customService.displayDescription=Add a custom service to tunnel and open
fixedService.displayName=Service
fixedService.displayDescription=Use a predefined service
noServices=No available services
hasServices=$COUNT$ available services
hasService=$COUNT$ available service

View file

@ -156,3 +156,6 @@ customService.displayName=Servicio
customService.displayDescription=Añade un servicio personalizado para tunelizar y abrir
fixedService.displayName=Servicio
fixedService.displayDescription=Utilizar un servicio predefinido
noServices=No hay servicios disponibles
hasServices=$COUNT$ servicios disponibles
hasService=$COUNT$ servicio disponible

View file

@ -156,3 +156,6 @@ customService.displayName=Service
customService.displayDescription=Ajouter un service personnalisé au tunnel et à l'ouverture
fixedService.displayName=Service
fixedService.displayDescription=Utiliser un service prédéfini
noServices=Aucun service disponible
hasServices=$COUNT$ services disponibles
hasService=$COUNT$ service disponible

View file

@ -156,3 +156,6 @@ customService.displayName=Servizio
customService.displayDescription=Aggiungi un servizio personalizzato per il tunnel e l'apertura
fixedService.displayName=Servizio
fixedService.displayDescription=Utilizzare un servizio predefinito
noServices=Nessun servizio disponibile
hasServices=$COUNT$ servizi disponibili
hasService=$COUNT$ servizio disponibile

View file

@ -156,3 +156,6 @@ customService.displayName=サービス
customService.displayDescription=トンネルとオープンにカスタムサービスを追加する
fixedService.displayName=サービス
fixedService.displayDescription=定義済みのサービスを使う
noServices=利用可能なサービスはない
hasServices=$COUNT$ 利用可能なサービス
hasService=$COUNT$ 利用可能なサービス

View file

@ -156,3 +156,6 @@ customService.displayName=Service
customService.displayDescription=Een aangepaste service toevoegen aan tunnel en openen
fixedService.displayName=Service
fixedService.displayDescription=Een vooraf gedefinieerde service gebruiken
noServices=Geen beschikbare diensten
hasServices=$COUNT$ beschikbare diensten
hasService=$COUNT$ beschikbare dienst

View file

@ -156,3 +156,6 @@ customService.displayName=Serviço
customService.displayDescription=Adiciona um serviço personalizado ao túnel e abre
fixedService.displayName=Serviço
fixedService.displayDescription=Utiliza um serviço predefinido
noServices=Não há serviços disponíveis
hasServices=$COUNT$ serviços disponíveis
hasService=$COUNT$ serviço disponível

View file

@ -156,3 +156,6 @@ customService.displayName=Сервис
customService.displayDescription=Добавьте пользовательский сервис для туннелирования и открытия
fixedService.displayName=Сервис
fixedService.displayDescription=Использовать предопределенный сервис
noServices=Нет доступных сервисов
hasServices=$COUNT$ доступные сервисы
hasService=$COUNT$ доступный сервис

View file

@ -156,3 +156,6 @@ customService.displayName=Hizmet
customService.displayDescription=Tünele özel bir hizmet ekleyin ve açın
fixedService.displayName=Hizmet
fixedService.displayDescription=Önceden tanımlanmış bir hizmet kullanın
noServices=Mevcut hizmet yok
hasServices=$COUNT$ mevcut hi̇zmetler
hasService=$COUNT$ mevcut hizmet

View file

@ -156,3 +156,6 @@ customService.displayName=服务
customService.displayDescription=为隧道和开放添加自定义服务
fixedService.displayName=服务
fixedService.displayDescription=使用预定义服务
noServices=无可用服务
hasServices=$COUNT$ 可用服务
hasService=$COUNT$ 可用服务