mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 06:41:41 +01:00
Merge pull request #2746 from ripcurlx/fix-styling-of-alert-message
Use existing styling for developer alert message
This commit is contained in:
commit
7adb3226a4
2 changed files with 16 additions and 22 deletions
|
@ -333,6 +333,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupCompleteList
|
||||||
.show());
|
.show());
|
||||||
bisqSetup.setDisplayAlertHandler(alert -> new DisplayAlertMessageWindow()
|
bisqSetup.setDisplayAlertHandler(alert -> new DisplayAlertMessageWindow()
|
||||||
.alertMessage(alert)
|
.alertMessage(alert)
|
||||||
|
.closeButtonText(Res.get("shared.close"))
|
||||||
.onClose(() -> {
|
.onClose(() -> {
|
||||||
user.setDisplayedAlert(alert);
|
user.setDisplayedAlert(alert);
|
||||||
})
|
})
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
package bisq.desktop.main.overlays.windows;
|
package bisq.desktop.main.overlays.windows;
|
||||||
|
|
||||||
import bisq.desktop.components.AutoTooltipButton;
|
|
||||||
import bisq.desktop.components.HyperlinkWithIcon;
|
import bisq.desktop.components.HyperlinkWithIcon;
|
||||||
import bisq.desktop.main.overlays.Overlay;
|
import bisq.desktop.main.overlays.Overlay;
|
||||||
import bisq.desktop.util.FormBuilder;
|
import bisq.desktop.util.FormBuilder;
|
||||||
|
@ -25,13 +24,10 @@ import bisq.desktop.util.FormBuilder;
|
||||||
import bisq.core.alert.Alert;
|
import bisq.core.alert.Alert;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import static bisq.desktop.util.FormBuilder.addMultilineLabel;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class DisplayAlertMessageWindow extends Overlay<DisplayAlertMessageWindow> {
|
public class DisplayAlertMessageWindow extends Overlay<DisplayAlertMessageWindow> {
|
||||||
|
@ -50,10 +46,22 @@ public class DisplayAlertMessageWindow extends Overlay<DisplayAlertMessageWindow
|
||||||
public void show() {
|
public void show() {
|
||||||
width = 768;
|
width = 768;
|
||||||
// need to set headLine, otherwise the fields will not be created in addHeadLine
|
// need to set headLine, otherwise the fields will not be created in addHeadLine
|
||||||
headLine = Res.get("displayAlertMessageWindow.headline");
|
|
||||||
createGridPane();
|
createGridPane();
|
||||||
|
|
||||||
|
checkNotNull(alert, "alertMessage must not be null");
|
||||||
|
|
||||||
|
if (alert.isUpdateInfo()) {
|
||||||
|
information("");
|
||||||
|
headLine = Res.get("displayAlertMessageWindow.update.headline");
|
||||||
|
} else {
|
||||||
|
error("");
|
||||||
|
headLine = Res.get("displayAlertMessageWindow.headline");
|
||||||
|
}
|
||||||
|
|
||||||
|
headLine = Res.get("displayAlertMessageWindow.headline");
|
||||||
addHeadLine();
|
addHeadLine();
|
||||||
addContent();
|
addContent();
|
||||||
|
addButtons();
|
||||||
applyStyles();
|
applyStyles();
|
||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
@ -69,28 +77,13 @@ public class DisplayAlertMessageWindow extends Overlay<DisplayAlertMessageWindow
|
||||||
|
|
||||||
private void addContent() {
|
private void addContent() {
|
||||||
checkNotNull(alert, "alertMessage must not be null");
|
checkNotNull(alert, "alertMessage must not be null");
|
||||||
FormBuilder.addMultilineLabel(gridPane, ++rowIndex, alert.getMessage(), 10);
|
addMultilineLabel(gridPane, ++rowIndex, alert.getMessage(), 10);
|
||||||
if (alert.isUpdateInfo()) {
|
if (alert.isUpdateInfo()) {
|
||||||
headLine = Res.get("displayAlertMessageWindow.update.headline");
|
|
||||||
headLineLabel.getStyleClass().addAll("headline-label", "highlight");
|
|
||||||
String url = "https://bisq.network/downloads";
|
String url = "https://bisq.network/downloads";
|
||||||
HyperlinkWithIcon hyperlinkWithIcon = FormBuilder.addLabelHyperlinkWithIcon(gridPane, ++rowIndex,
|
HyperlinkWithIcon hyperlinkWithIcon = FormBuilder.addLabelHyperlinkWithIcon(gridPane, ++rowIndex,
|
||||||
Res.get("displayAlertMessageWindow.update.download"), url, url).second;
|
Res.get("displayAlertMessageWindow.update.download"), url, url).second;
|
||||||
hyperlinkWithIcon.setMaxWidth(550);
|
hyperlinkWithIcon.setMaxWidth(550);
|
||||||
} else {
|
|
||||||
headLine = Res.get("displayAlertMessageWindow.headline");
|
|
||||||
headLineLabel.getStyleClass().addAll("headline-label", "error-text");
|
|
||||||
}
|
}
|
||||||
closeButton = new AutoTooltipButton(Res.get("shared.close"));
|
|
||||||
closeButton.setOnAction(e -> {
|
|
||||||
hide();
|
|
||||||
closeHandlerOptional.ifPresent(Runnable::run);
|
|
||||||
});
|
|
||||||
|
|
||||||
GridPane.setRowIndex(closeButton, ++rowIndex);
|
|
||||||
GridPane.setColumnIndex(closeButton, 1);
|
|
||||||
gridPane.getChildren().add(closeButton);
|
|
||||||
GridPane.setMargin(closeButton, new Insets(10, 0, 0, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue