use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class BindingTest method start.
@Override
public void start(Stage primaryStage) {
VBox root = new VBox();
root.setSpacing(20);
Label label = new AutoTooltipLabel();
StringProperty txt = new SimpleStringProperty();
txt.set("-");
label.textProperty().bind(txt);
Button button = new AutoTooltipButton("count up");
button.setOnAction(e -> txt.set("counter " + counter++));
root.getChildren().addAll(label, button);
primaryStage.setScene(new Scene(root, 400, 400));
primaryStage.show();
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class MainView method setupNotificationIcon.
private void setupNotificationIcon(Pane buttonHolder) {
Label label = new AutoTooltipLabel();
label.textProperty().bind(model.numPendingTradesAsString);
label.relocate(5, 1);
label.setId("nav-alert-label");
ImageView icon = new ImageView();
icon.setId("image-alert-round");
Pane notification = new Pane();
notification.relocate(30, 9);
notification.setMouseTransparent(true);
notification.setEffect(new DropShadow(4, 1, 2, Color.GREY));
notification.getChildren().addAll(icon, label);
notification.visibleProperty().bind(model.showPendingTradesNotification);
buttonHolder.getChildren().add(notification);
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class MainView method createFooter.
private AnchorPane createFooter() {
// line
Separator separator = new Separator();
separator.setId("footer-pane-line");
separator.setPrefHeight(1);
setLeftAnchor(separator, 0d);
setRightAnchor(separator, 0d);
setTopAnchor(separator, 0d);
// BTC
Label btcInfoLabel = new AutoTooltipLabel();
btcInfoLabel.setId("footer-pane");
btcInfoLabel.textProperty().bind(model.btcInfo);
ProgressBar blockchainSyncIndicator = new ProgressBar(-1);
blockchainSyncIndicator.setPrefWidth(120);
blockchainSyncIndicator.setMaxHeight(10);
blockchainSyncIndicator.progressProperty().bind(model.btcSyncProgress);
model.walletServiceErrorMsg.addListener((ov, oldValue, newValue) -> {
if (newValue != null) {
btcInfoLabel.setId("splash-error-state-msg");
btcInfoLabel.getStyleClass().add("error-text");
if (btcNetworkWarnMsgPopup == null) {
btcNetworkWarnMsgPopup = new Popup<>().warning(newValue);
btcNetworkWarnMsgPopup.show();
}
} else {
btcInfoLabel.setId("footer-pane");
if (btcNetworkWarnMsgPopup != null)
btcNetworkWarnMsgPopup.hide();
}
});
model.btcSyncProgress.addListener((ov, oldValue, newValue) -> {
if ((double) newValue >= 1) {
blockchainSyncIndicator.setVisible(false);
blockchainSyncIndicator.setManaged(false);
}
});
HBox blockchainSyncBox = new HBox();
blockchainSyncBox.setSpacing(10);
blockchainSyncBox.setAlignment(Pos.CENTER);
blockchainSyncBox.getChildren().addAll(btcInfoLabel, blockchainSyncIndicator);
setLeftAnchor(blockchainSyncBox, 10d);
setBottomAnchor(blockchainSyncBox, 7d);
// version
versionLabel = new AutoTooltipLabel();
versionLabel.setId("footer-pane");
versionLabel.setTextAlignment(TextAlignment.CENTER);
versionLabel.setAlignment(Pos.BASELINE_CENTER);
versionLabel.setText("v" + Version.VERSION);
root.widthProperty().addListener((ov, oldValue, newValue) -> {
versionLabel.setLayoutX(((double) newValue - versionLabel.getWidth()) / 2);
});
setBottomAnchor(versionLabel, 7d);
model.newVersionAvailableProperty.addListener((observable, oldValue, newValue) -> {
versionLabel.getStyleClass().removeAll("version-new", "version");
if (newValue) {
versionLabel.getStyleClass().add("version-new");
versionLabel.setOnMouseClicked(e -> model.openDownloadWindow());
versionLabel.setText("v" + Version.VERSION + " " + Res.get("mainView.version.update"));
} else {
versionLabel.getStyleClass().add("version");
versionLabel.setOnMouseClicked(null);
versionLabel.setText("v" + Version.VERSION);
}
});
// P2P Network
Label p2PNetworkLabel = new AutoTooltipLabel();
p2PNetworkLabel.setId("footer-pane");
setRightAnchor(p2PNetworkLabel, 33d);
setBottomAnchor(p2PNetworkLabel, 7d);
p2PNetworkLabel.textProperty().bind(model.p2PNetworkInfo);
ImageView p2PNetworkIcon = new ImageView();
setRightAnchor(p2PNetworkIcon, 10d);
setBottomAnchor(p2PNetworkIcon, 7d);
p2PNetworkIcon.setOpacity(0.4);
p2PNetworkIcon.idProperty().bind(model.p2PNetworkIconId);
p2PNetworkLabel.idProperty().bind(model.p2pNetworkLabelId);
model.p2pNetworkWarnMsg.addListener((ov, oldValue, newValue) -> {
if (newValue != null) {
p2PNetworkWarnMsgPopup = new Popup<>().warning(newValue);
p2PNetworkWarnMsgPopup.show();
} else if (p2PNetworkWarnMsgPopup != null) {
p2PNetworkWarnMsgPopup.hide();
}
});
model.bootstrapComplete.addListener((observable, oldValue, newValue) -> {
p2PNetworkIcon.setOpacity(1);
});
return new AnchorPane(separator, blockchainSyncBox, versionLabel, p2PNetworkLabel, p2PNetworkIcon) {
{
setId("footer-pane");
setMinHeight(30);
setMaxHeight(30);
}
};
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class FiatAccountsView method initialize.
@Override
public void initialize() {
buildForm();
paymentAccountChangeListener = (observable, oldValue, newValue) -> {
if (newValue != null)
onSelectAccount(newValue);
};
Label placeholder = new AutoTooltipLabel(Res.get("shared.noAccountsSetupYet"));
placeholder.setWrapText(true);
paymentAccountsListView.setPlaceholder(placeholder);
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class BisqApp method showFPSWindow.
private void showFPSWindow() {
Label label = new AutoTooltipLabel();
EventStreams.animationTicks().latestN(100).map(ticks -> {
int n = ticks.size() - 1;
return n * 1_000_000_000.0 / (ticks.get(n) - ticks.get(0));
}).map(// Don't translate, just for dev
d -> String.format("FPS: %.3f", d)).feedTo(label.textProperty());
Pane root = new StackPane();
root.getChildren().add(label);
Stage stage = new Stage();
stage.setScene(new Scene(root));
// Don't translate, just for dev
stage.setTitle("FPS");
stage.initModality(Modality.NONE);
stage.initStyle(StageStyle.UTILITY);
stage.initOwner(scene.getWindow());
stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10);
stage.setY(primaryStage.getY());
stage.setWidth(200);
stage.setHeight(100);
stage.show();
}
Aggregations