Remove connection hashes and rename machines to shells

This commit is contained in:
Christopher Schnick 2022-12-14 17:40:16 +01:00
parent 1b77a7cc81
commit da1fe7a511
3 changed files with 23 additions and 11 deletions

View file

@ -45,8 +45,6 @@ public interface ShellProcessControl extends ProcessControl {
boolean isLocal();
int getConnectionHash();
OsType getOsType();
ShellProcessControl elevated(Predicate<ShellProcessControl> elevationFunction);

View file

@ -29,7 +29,7 @@ public interface DataStoreProvider {
}
if (FileSystemStore.class.isAssignableFrom(c) || ShellStore.class.isAssignableFrom(c)) {
return Category.MACHINE;
return Category.SHELL;
}
throw new ExtensionException("Provider " + getId() + " has no set category");
@ -99,7 +99,7 @@ public interface DataStoreProvider {
enum Category {
STREAM,
MACHINE,
SHELL,
DATABASE;
}
}

View file

@ -1,14 +1,17 @@
package io.xpipe.extension.fxcomps.impl;
import io.xpipe.extension.fxcomps.Comp;
import io.xpipe.extension.fxcomps.CompStructure;
import io.xpipe.extension.fxcomps.SimpleCompStructure;
import io.xpipe.extension.fxcomps.SimpleComp;
import io.xpipe.extension.fxcomps.util.PlatformThread;
import javafx.beans.binding.Bindings;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleStringProperty;
import javafx.scene.control.TextArea;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Region;
public class TextAreaComp extends Comp<CompStructure<TextArea>> {
import java.util.Objects;
public class TextAreaComp extends SimpleComp {
private final Property<String> value;
private final Property<String> lazyValue = new SimpleStringProperty();
@ -27,7 +30,7 @@ public class TextAreaComp extends Comp<CompStructure<TextArea>> {
}
@Override
public CompStructure<TextArea> createBase() {
protected Region createSimple() {
var text = new TextArea(value.getValue() != null ? value.getValue() : null);
text.textProperty().addListener((c, o, n) -> {
lazyValue.setValue(n != null && n.length() > 0 ? n : null);
@ -39,13 +42,24 @@ public class TextAreaComp extends Comp<CompStructure<TextArea>> {
});
});
text.focusedProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue) {
value.setValue(lazyValue.getValue());
}
});
return new SimpleCompStructure<>(text);
if (lazy) {
var isEqual = Bindings.createBooleanBinding(() -> Objects.equals(lazyValue.getValue(), value.getValue()), value, lazyValue);
var button = new IconButtonComp("mdi2c-checkbox-marked-outline").hide(isEqual).createRegion();
var anchorPane = new AnchorPane(text, button);
AnchorPane.setBottomAnchor(button, 5.0 );
AnchorPane.setRightAnchor(button, 5.0);
text.prefWidthProperty().bind(anchorPane.widthProperty());
return anchorPane;
}
return text;
}
}