Various small improvements

This commit is contained in:
crschnick 2023-05-27 13:35:47 +00:00
parent 59d0706129
commit e7b5d7e9ee
7 changed files with 29 additions and 20 deletions

View file

@ -109,11 +109,11 @@ final class BrowserBookmarkList extends SimpleComp {
mouseEvent.consume();
});
addEventHandler(MouseEvent.MOUSE_CLICKED, event -> {
if (getItem() == null || event.getButton() != MouseButton.PRIMARY) {
if (getItem() == null || event.getButton() != MouseButton.PRIMARY || (!getItem().getState().getValue().isUsable()) || !(getItem().getEntry()
.getStore() instanceof ShellStore fileSystem)) {
return;
}
var fileSystem = ((ShellStore) getItem().getEntry().getStore());
model.openFileSystemAsync(null, fileSystem, null, busy);
event.consume();
});

View file

@ -18,7 +18,7 @@ import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.scene.control.Label;
import javafx.scene.control.Separator;
import javafx.scene.control.TextField;
import javafx.scene.control.TextArea;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
@ -160,24 +160,28 @@ public class ErrorHandlerComp extends SimpleComp {
var header = new Label(AppI18n.get(headerId));
AppFont.header(header);
var descriptionField = new TextField(limitedDescription);
var descriptionField = new TextArea(limitedDescription);
descriptionField.setPrefRowCount(4);
descriptionField.setWrapText(true);
descriptionField.setEditable(false);
descriptionField.setPadding(Insets.EMPTY);
AppFont.small(descriptionField);
var text = new VBox(header, descriptionField);
text.setFillWidth(true);
text.setSpacing(2);
var graphic = new FontIcon("mdomz-warning");
graphic.setIconColor(Color.RED);
var pane = new StackPane(graphic);
var hbox = new HBox(pane, text);
var graphicPane = new StackPane(graphic);
var hbox = new HBox(graphicPane, text);
HBox.setHgrow(text, Priority.ALWAYS);
hbox.setSpacing(8);
pane.prefHeightProperty()
graphicPane.prefHeightProperty()
.bind(Bindings.createDoubleBinding(
() -> header.getHeight() + descriptionField.getHeight() + 2,
header.heightProperty(),
descriptionField.heightProperty()));
pane.prefHeightProperty().addListener((c, o, n) -> {
graphicPane.prefHeightProperty().addListener((c, o, n) -> {
var size = Math.min(n.intValue(), 100);
graphic.setIconSize(size);
});

View file

@ -27,7 +27,7 @@ deleteAlertTitle=Confirm deletion
deleteAlertHeader=Do you want to delete the ($COUNT$) selected elements?
selectedElements=Selected elements:
mustNotBeEmpty=$NAME$ must not be empty
download=Drop to download
download=Drop to transfer
dragFiles=Drag files from here
null=$VALUE$ must be not null
hostFeatureUnsupported=$FEATURE$ is not available on the host

View file

@ -26,14 +26,7 @@
-fx-border-radius: 1px;
}
.bookmark-list .button {
-fx-border-width: 0;
-fx-border-radius: 0;
-fx-background-radius: 0;
-fx-background-insets: 0;
}
.bookmark-list .button:hover {
.bookmark-list .tree-cell:hover {
-fx-background-color: -color-accent-muted;
}
@ -41,11 +34,11 @@
-fx-background-color: -color-success-muted;
}
.bookmark-list .button:drag-over {
.bookmark-list .tree-cell:drag-over {
-fx-background-color: -color-success-muted;
}
.bookmark-list > *:disabled {
.bookmark-list .tree-cell:disabled {
-fx-opacity: 0.5;
}

View file

@ -3,7 +3,11 @@
-fx-spacing: 1em;
}
.error-handler-comp .text-field {
.error-handler-comp .text-area * {
-fx-padding: 0;
}
.error-handler-comp .text-area {
-fx-padding: 0;
-fx-border-width: 0;
-fx-border-radius: 0;

View file

@ -80,6 +80,8 @@ public interface CommandControl extends ProcessControl {
void accumulateStderr(Consumer<String> con);
public byte[] readRawBytesOrThrow() throws Exception;
public String readOrThrow() throws Exception;
public default boolean discardAndCheckExit() throws ProcessOutputException {

View file

@ -48,6 +48,12 @@ public interface ShellControl extends ProcessControl {
""", script));
}
default byte[] executeSimpleRawBytesCommand(String command) throws Exception {
try (CommandControl c = command(command).start()) {
return c.readRawBytesOrThrow();
}
}
default String executeSimpleStringCommand(String command) throws Exception {
try (CommandControl c = command(command).start()) {
return c.readOrThrow();