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

View file

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

View file

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

View file

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

View file

@ -343,14 +343,14 @@ public abstract class DataStorage {
} }
public boolean refreshChildren(DataStoreEntry e, boolean throwOnFail) throws Exception { public boolean refreshChildren(DataStoreEntry e, boolean throwOnFail) throws Exception {
if (!(e.getStore() instanceof FixedHierarchyStore)) { if (!(e.getStore() instanceof FixedHierarchyStore h)) {
return false; return false;
} }
e.incrementBusyCounter(); e.incrementBusyCounter();
List<? extends DataStoreEntryRef<? extends FixedChildStore>> newChildren; List<? extends DataStoreEntryRef<? extends FixedChildStore>> newChildren;
try { 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) { } catch (Exception ex) {
if (throwOnFail) { if (throwOnFail) {
throw ex; 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.base.SystemStateComp;
import io.xpipe.app.comp.store.StoreEntryWrapper; 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.comp.store.StoreViewState;
import io.xpipe.app.ext.*; import io.xpipe.app.ext.*;
import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.Comp;
@ -76,8 +77,8 @@ public class ScriptGroupStoreProvider implements EnabledStoreProvider, DataStore
} }
@Override @Override
public ObservableValue<String> informationString(StoreEntryWrapper wrapper) { public ObservableValue<String> informationString(StoreSection section) {
ScriptGroupStore scriptStore = wrapper.getEntry().getStore().asNeeded(); ScriptGroupStore scriptStore = section.getWrapper().getEntry().getStore().asNeeded();
return new SimpleStringProperty(scriptStore.getDescription()); 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.ListSelectorComp;
import io.xpipe.app.comp.base.SystemStateComp; import io.xpipe.app.comp.base.SystemStateComp;
import io.xpipe.app.comp.store.StoreEntryWrapper; 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.comp.store.StoreViewState;
import io.xpipe.app.core.AppExtensionManager; import io.xpipe.app.core.AppExtensionManager;
import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppI18n;
@ -206,8 +207,8 @@ public class SimpleScriptStoreProvider implements EnabledParentStoreProvider, Da
} }
@Override @Override
public ObservableValue<String> informationString(StoreEntryWrapper wrapper) { public ObservableValue<String> informationString(StoreSection section) {
SimpleScriptStore scriptStore = wrapper.getEntry().getStore().asNeeded(); SimpleScriptStore scriptStore = section.getWrapper().getEntry().getStore().asNeeded();
return new SimpleStringProperty((scriptStore.getMinimumDialect() != null return new SimpleStringProperty((scriptStore.getMinimumDialect() != null
? scriptStore.getMinimumDialect().getDisplayName() + " " ? 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.StoreEntryWrapper;
import io.xpipe.app.comp.store.StoreSection; import io.xpipe.app.comp.store.StoreSection;
import io.xpipe.app.comp.store.StoreViewState; import io.xpipe.app.comp.store.StoreViewState;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.ext.DataStoreProvider; import io.xpipe.app.ext.DataStoreProvider;
import io.xpipe.app.ext.DataStoreUsageCategory; import io.xpipe.app.ext.DataStoreUsageCategory;
import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.app.util.ThreadHelper; import io.xpipe.app.util.ThreadHelper;
@ -16,6 +18,7 @@ import io.xpipe.core.store.DataStore;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
public abstract class AbstractServiceGroupStoreProvider implements DataStoreProvider { public abstract class AbstractServiceGroupStoreProvider implements DataStoreProvider {
@ -27,7 +30,7 @@ public abstract class AbstractServiceGroupStoreProvider implements DataStoreProv
@Override @Override
public StoreEntryComp customEntryComp(StoreSection sec, boolean preferLarge) { public StoreEntryComp customEntryComp(StoreSection sec, boolean preferLarge) {
var t = createToggleComp(sec); var t = createToggleComp(sec);
return StoreEntryComp.create(sec.getWrapper(), t, preferLarge); return StoreEntryComp.create(sec, t, preferLarge);
} }
private StoreToggleComp createToggleComp(StoreSection sec) { private StoreToggleComp createToggleComp(StoreSection sec) {
@ -62,6 +65,16 @@ public abstract class AbstractServiceGroupStoreProvider implements DataStoreProv
return t; 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 @Override
public Comp<?> stateDisplay(StoreEntryWrapper w) { public Comp<?> stateDisplay(StoreEntryWrapper w) {
return new SystemStateComp(new SimpleObjectProperty<>(SystemStateComp.State.SUCCESS)); return new SystemStateComp(new SimpleObjectProperty<>(SystemStateComp.State.SUCCESS));

View file

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

View file

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

View file

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

View file

@ -167,3 +167,6 @@ customService.displayName=Service
customService.displayDescription=Tilføj en brugerdefineret tjeneste til tunnel og åben customService.displayDescription=Tilføj en brugerdefineret tjeneste til tunnel og åben
fixedService.displayName=Service fixedService.displayName=Service
fixedService.displayDescription=Brug en foruddefineret tjeneste 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 customService.displayDescription=Einen benutzerdefinierten Dienst zum Tunnel hinzufügen und öffnen
fixedService.displayName=Dienst fixedService.displayName=Dienst
fixedService.displayDescription=Einen vordefinierten Dienst verwenden 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 customService.displayDescription=Add a custom service to tunnel and open
fixedService.displayName=Service fixedService.displayName=Service
fixedService.displayDescription=Use a predefined 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 customService.displayDescription=Añade un servicio personalizado para tunelizar y abrir
fixedService.displayName=Servicio fixedService.displayName=Servicio
fixedService.displayDescription=Utilizar un servicio predefinido 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 customService.displayDescription=Ajouter un service personnalisé au tunnel et à l'ouverture
fixedService.displayName=Service fixedService.displayName=Service
fixedService.displayDescription=Utiliser un service prédéfini 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 customService.displayDescription=Aggiungi un servizio personalizzato per il tunnel e l'apertura
fixedService.displayName=Servizio fixedService.displayName=Servizio
fixedService.displayDescription=Utilizzare un servizio predefinito 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=トンネルとオープンにカスタムサービスを追加する customService.displayDescription=トンネルとオープンにカスタムサービスを追加する
fixedService.displayName=サービス fixedService.displayName=サービス
fixedService.displayDescription=定義済みのサービスを使う 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 customService.displayDescription=Een aangepaste service toevoegen aan tunnel en openen
fixedService.displayName=Service fixedService.displayName=Service
fixedService.displayDescription=Een vooraf gedefinieerde service gebruiken 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 customService.displayDescription=Adiciona um serviço personalizado ao túnel e abre
fixedService.displayName=Serviço fixedService.displayName=Serviço
fixedService.displayDescription=Utiliza um serviço predefinido 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=Добавьте пользовательский сервис для туннелирования и открытия customService.displayDescription=Добавьте пользовательский сервис для туннелирования и открытия
fixedService.displayName=Сервис fixedService.displayName=Сервис
fixedService.displayDescription=Использовать предопределенный сервис 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 customService.displayDescription=Tünele özel bir hizmet ekleyin ve açın
fixedService.displayName=Hizmet fixedService.displayName=Hizmet
fixedService.displayDescription=Önceden tanımlanmış bir hizmet kullanın 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=为隧道和开放添加自定义服务 customService.displayDescription=为隧道和开放添加自定义服务
fixedService.displayName=服务 fixedService.displayName=服务
fixedService.displayDescription=使用预定义服务 fixedService.displayDescription=使用预定义服务
noServices=无可用服务
hasServices=$COUNT$ 可用服务
hasService=$COUNT$ 可用服务