Skip to content

Commit

Permalink
Overlay style fixes [release]
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Mar 24, 2024
1 parent ce8c97d commit e90c6f3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.control.TextArea;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
import org.kordamp.ikonli.javafx.FontIcon;

@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
public class ErrorOverlayComp extends SimpleComp {
Expand All @@ -34,7 +37,11 @@ protected Region createSimple() {
l.setEditable(false);
return l;
});
content.set(new ModalOverlayComp.OverlayContent("error", comp, null, () -> {}));
content.set(new ModalOverlayComp.OverlayContent("error", comp, Comp.of(() -> {
var graphic = new FontIcon("mdomz-warning");
graphic.setIconColor(Color.RED);
return new StackPane(graphic);
}), null, () -> {}));
});
});
content.addListener((observable, oldValue, newValue) -> {
Expand Down
10 changes: 3 additions & 7 deletions app/src/main/java/io/xpipe/app/comp/base/ModalOverlayComp.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import atlantafx.base.controls.ModalPane;
import atlantafx.base.layout.ModalBox;
import atlantafx.base.theme.Styles;
import io.xpipe.app.core.AppFont;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.fxcomps.Comp;
Expand All @@ -17,9 +16,7 @@
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import lombok.Value;
import org.kordamp.ikonli.javafx.FontIcon;

public class ModalOverlayComp extends SimpleComp {

Expand All @@ -35,6 +32,7 @@ public ModalOverlayComp(Comp<?> background, Property<OverlayContent> overlayCont
protected Region createSimple() {
var bgRegion = background.createRegion();
var modal = new ModalPane();
AppFont.small(modal);
modal.getStyleClass().add("modal-overlay-comp");
var pane = new StackPane(bgRegion, modal);
pane.setPickOnBounds(false);
Expand All @@ -45,9 +43,7 @@ protected Region createSimple() {
}

if (newValue != null) {
var graphic = new FontIcon("mdomz-warning");
graphic.setIconColor(Color.RED);
var l = new Label(AppI18n.get(newValue.titleKey), graphic);
var l = new Label(AppI18n.get(newValue.titleKey), newValue.graphic != null ? newValue.graphic.createRegion() : null);
l.setGraphicTextGap(6);
AppFont.normal(l);
var r = newValue.content.createRegion();
Expand All @@ -58,7 +54,6 @@ protected Region createSimple() {
if (newValue.finishKey != null) {
var finishButton = new Button(AppI18n.get(newValue.finishKey));
finishButton.setDefaultButton(true);
Styles.toggleStyleClass(finishButton, Styles.FLAT);
finishButton.setOnAction(event -> {
newValue.onFinish.run();
overlayContent.setValue(null);
Expand Down Expand Up @@ -97,6 +92,7 @@ public static class OverlayContent {

String titleKey;
Comp<?> content;
Comp<?> graphic;
String finishKey;
Runnable onFinish;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
-fx-background-radius: 6;
}

.modal-overlay-comp {
-fx-border-radius: 0;
-fx-background-radius: 0;
}

.modal-overlay-comp .titled-pane > * {
-fx-border-radius: 0;
}

.modal-overlay-comp .titled-pane > * {
-fx-background-radius: 0;
.modal-overlay-comp .modal-box .button {
-fx-padding: 6 12 6 12;
-fx-border-width: 1px;
-fx-border-radius: 2px;
-fx-background-radius: 2px;
}

Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
creationName.textProperty().bindBidirectional(name);
return creationName;
}),
null,
"finish",
() -> {
model.createFileAsync(name.getValue());
Expand Down Expand Up @@ -91,6 +92,7 @@ public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
creationName.textProperty().bindBidirectional(name);
return creationName;
}),
null,
"finish",
() -> {
model.createDirectoryAsync(name.getValue());
Expand All @@ -116,15 +118,13 @@ public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
.setValue(new ModalOverlayComp.OverlayContent(
"base.newLink",
new OptionsBuilder()
.spacer(10)
.name("linkName")
.addString(linkName)
.spacer(10)
.name("targetPath")
.addString(target)
.buildComp()
.prefWidth(400)
.prefHeight(130),
.prefWidth(350),
null,
"finish",
() -> {
model.createLinkAsync(linkName.getValue(), target.getValue());
Expand Down

0 comments on commit e90c6f3

Please sign in to comment.