use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class FormBuilder method addButtonBusyAnimationLabel.
public static Tuple3<Button, BusyAnimation, Label> addButtonBusyAnimationLabel(GridPane gridPane, int rowIndex, String buttonTitle, double top) {
HBox hBox = new HBox();
hBox.setSpacing(10);
Button button = new AutoTooltipButton(buttonTitle);
button.setDefaultButton(true);
BusyAnimation busyAnimation = new BusyAnimation(false);
Label label = new AutoTooltipLabel();
hBox.setAlignment(Pos.CENTER_LEFT);
hBox.getChildren().addAll(button, busyAnimation, label);
GridPane.setRowIndex(hBox, rowIndex);
GridPane.setColumnIndex(hBox, 1);
GridPane.setMargin(hBox, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(hBox);
return new Tuple3<>(button, busyAnimation, label);
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class FormBuilder method getAmountCurrencyBox.
public static Tuple3<HBox, InputTextField, Label> getAmountCurrencyBox(String promptText) {
InputTextField input = new InputTextField();
input.setPrefWidth(190);
input.setAlignment(Pos.CENTER_RIGHT);
input.setId("text-input-with-currency-text-field");
input.setPromptText(promptText);
Label currency = new AutoTooltipLabel(Res.getBaseCurrencyCode());
currency.setId("currency-info-label");
HBox box = new HBox();
box.getChildren().addAll(input, currency);
return new Tuple3<>(box, input, currency);
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class FormBuilder method addLabelInputTextFieldLabelInputTextField.
// /////////////////////////////////////////////////////////////////////////////////////////
// Label + InputTextField + Label + InputTextField
// /////////////////////////////////////////////////////////////////////////////////////////
public static Tuple4<Label, InputTextField, Label, InputTextField> addLabelInputTextFieldLabelInputTextField(GridPane gridPane, int rowIndex, String title1, String title2) {
Label label1 = addLabel(gridPane, rowIndex, title1, 0);
InputTextField inputTextField1 = new InputTextField();
Label label2 = new AutoTooltipLabel(title2);
HBox.setMargin(label2, new Insets(5, 0, 0, 0));
InputTextField inputTextField2 = new InputTextField();
HBox hBox = new HBox();
hBox.setSpacing(10);
hBox.getChildren().addAll(inputTextField1, label2, inputTextField2);
GridPane.setRowIndex(hBox, rowIndex);
GridPane.setColumnIndex(hBox, 1);
gridPane.getChildren().add(hBox);
return new Tuple4<>(label1, inputTextField1, label2, inputTextField2);
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class TraderDisputeView method onSelectDispute.
private void onSelectDispute(Dispute dispute) {
removeListenersOnSelectDispute();
if (dispute == null) {
if (root.getChildren().size() > 2)
root.getChildren().remove(2);
selectedDispute = null;
} else if (selectedDispute != dispute) {
this.selectedDispute = dispute;
boolean isTrader = disputeManager.isTrader(selectedDispute);
tableGroupHeadline = new TableGroupHeadline();
tableGroupHeadline.setText(Res.get("support.messages"));
AnchorPane.setTopAnchor(tableGroupHeadline, 10d);
AnchorPane.setRightAnchor(tableGroupHeadline, 0d);
AnchorPane.setBottomAnchor(tableGroupHeadline, 0d);
AnchorPane.setLeftAnchor(tableGroupHeadline, 0d);
disputeCommunicationMessages = selectedDispute.getDisputeCommunicationMessages();
SortedList<DisputeCommunicationMessage> sortedList = new SortedList<>(disputeCommunicationMessages);
sortedList.setComparator((o1, o2) -> new Date(o1.getDate()).compareTo(new Date(o2.getDate())));
messageListView = new ListView<>(sortedList);
messageListView.setId("message-list-view");
messageListView.setMinHeight(150);
AnchorPane.setTopAnchor(messageListView, 30d);
AnchorPane.setRightAnchor(messageListView, 0d);
AnchorPane.setLeftAnchor(messageListView, 0d);
messagesAnchorPane = new AnchorPane();
VBox.setVgrow(messagesAnchorPane, Priority.ALWAYS);
inputTextArea = new TextArea();
inputTextArea.setPrefHeight(70);
inputTextArea.setWrapText(true);
if (!(this instanceof ArbitratorDisputeView))
inputTextArea.setPromptText(Res.get("support.input.prompt"));
sendButton = new AutoTooltipButton(Res.get("support.send"));
sendButton.setDefaultButton(true);
sendButton.setOnAction(e -> onTrySendMessage());
inputTextAreaTextSubscription = EasyBind.subscribe(inputTextArea.textProperty(), t -> sendButton.setDisable(t.isEmpty()));
Button uploadButton = new AutoTooltipButton(Res.get("support.addAttachments"));
uploadButton.setOnAction(e -> onRequestUpload());
sendMsgInfoLabel = new AutoTooltipLabel();
sendMsgInfoLabel.setVisible(false);
sendMsgInfoLabel.setManaged(false);
sendMsgInfoLabel.setPadding(new Insets(5, 0, 0, 0));
sendMsgBusyAnimation = new BusyAnimation(false);
if (!selectedDispute.isClosed()) {
HBox buttonBox = new HBox();
buttonBox.setSpacing(10);
buttonBox.getChildren().addAll(sendButton, uploadButton, sendMsgBusyAnimation, sendMsgInfoLabel);
if (!isTrader) {
Button closeDisputeButton = new AutoTooltipButton(Res.get("support.closeTicket"));
closeDisputeButton.setOnAction(e -> onCloseDispute(selectedDispute));
closeDisputeButton.setDefaultButton(true);
Pane spacer = new Pane();
HBox.setHgrow(spacer, Priority.ALWAYS);
buttonBox.getChildren().addAll(spacer, closeDisputeButton);
}
messagesInputBox = new VBox();
messagesInputBox.setSpacing(10);
messagesInputBox.getChildren().addAll(inputTextArea, buttonBox);
VBox.setVgrow(buttonBox, Priority.ALWAYS);
AnchorPane.setRightAnchor(messagesInputBox, 0d);
AnchorPane.setBottomAnchor(messagesInputBox, 5d);
AnchorPane.setLeftAnchor(messagesInputBox, 0d);
AnchorPane.setBottomAnchor(messageListView, 120d);
messagesAnchorPane.getChildren().addAll(tableGroupHeadline, messageListView, messagesInputBox);
} else {
AnchorPane.setBottomAnchor(messageListView, 0d);
messagesAnchorPane.getChildren().addAll(tableGroupHeadline, messageListView);
}
messageListView.setCellFactory(new Callback<ListView<DisputeCommunicationMessage>, ListCell<DisputeCommunicationMessage>>() {
@Override
public ListCell<DisputeCommunicationMessage> call(ListView<DisputeCommunicationMessage> list) {
return new ListCell<DisputeCommunicationMessage>() {
public ChangeListener<Boolean> sendMsgBusyAnimationListener;
final Pane bg = new Pane();
final ImageView arrow = new ImageView();
final Label headerLabel = new AutoTooltipLabel();
final Label messageLabel = new AutoTooltipLabel();
final Label copyIcon = new Label();
final HBox attachmentsBox = new HBox();
final AnchorPane messageAnchorPane = new AnchorPane();
final Label statusIcon = new Label();
final double arrowWidth = 15d;
final double attachmentsBoxHeight = 20d;
final double border = 10d;
final double bottomBorder = 25d;
final double padding = border + 10d;
final double msgLabelPaddingRight = padding + 20d;
{
bg.setMinHeight(30);
messageLabel.setWrapText(true);
headerLabel.setTextAlignment(TextAlignment.CENTER);
attachmentsBox.setSpacing(5);
statusIcon.getStyleClass().add("small-text");
copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard")));
messageAnchorPane.getChildren().addAll(bg, arrow, headerLabel, messageLabel, copyIcon, attachmentsBox, statusIcon);
messageLabel.setOnMouseClicked(event -> {
if (2 > event.getClickCount()) {
return;
}
GUIUtil.showSelectableTextModal(headerLabel.getText(), messageLabel.getText());
});
}
@Override
public void updateItem(final DisputeCommunicationMessage item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
copyIcon.setOnMouseClicked(e -> Utilities.copyToClipboard(messageLabel.getText()));
/* messageAnchorPane.prefWidthProperty().bind(EasyBind.map(messageListView.widthProperty(),
w -> (double) w - padding - GUIUtil.getScrollbarWidth(messageListView)));*/
if (!messageAnchorPane.prefWidthProperty().isBound())
messageAnchorPane.prefWidthProperty().bind(messageListView.widthProperty().subtract(padding + GUIUtil.getScrollbarWidth(messageListView)));
AnchorPane.setTopAnchor(bg, 15d);
AnchorPane.setBottomAnchor(bg, bottomBorder);
AnchorPane.setTopAnchor(headerLabel, 0d);
AnchorPane.setBottomAnchor(arrow, bottomBorder + 5d);
AnchorPane.setTopAnchor(messageLabel, 25d);
AnchorPane.setTopAnchor(copyIcon, 25d);
AnchorPane.setBottomAnchor(attachmentsBox, bottomBorder + 10);
boolean senderIsTrader = item.isSenderIsTrader();
boolean isMyMsg = isTrader ? senderIsTrader : !senderIsTrader;
arrow.setVisible(!item.isSystemMessage());
arrow.setManaged(!item.isSystemMessage());
statusIcon.setVisible(false);
headerLabel.getStyleClass().removeAll("message-header", "success-text", "highlight-static");
messageLabel.getStyleClass().removeAll("my-message", "message");
copyIcon.getStyleClass().removeAll("my-message", "message");
if (item.isSystemMessage()) {
headerLabel.getStyleClass().addAll("message-header", "success-text");
bg.setId("message-bubble-green");
messageLabel.getStyleClass().add("my-message");
copyIcon.getStyleClass().add("my-message");
} else if (isMyMsg) {
headerLabel.getStyleClass().add("highlight-static");
bg.setId("message-bubble-blue");
messageLabel.getStyleClass().add("my-message");
copyIcon.getStyleClass().add("my-message");
if (isTrader)
arrow.setId("bubble_arrow_blue_left");
else
arrow.setId("bubble_arrow_blue_right");
if (sendMsgBusyAnimationListener != null)
sendMsgBusyAnimation.isRunningProperty().removeListener(sendMsgBusyAnimationListener);
sendMsgBusyAnimationListener = (observable, oldValue, newValue) -> {
if (!newValue) {
if (item.arrivedProperty().get())
showArrivedIcon();
else if (item.storedInMailboxProperty().get())
showMailboxIcon();
}
};
sendMsgBusyAnimation.isRunningProperty().addListener(sendMsgBusyAnimationListener);
if (item.arrivedProperty().get())
showArrivedIcon();
else if (item.storedInMailboxProperty().get())
showMailboxIcon();
// TODO show that icon on error
/*else if (sendMsgProgressIndicator.getProgress() == 0)
showNotArrivedIcon();*/
} else {
headerLabel.getStyleClass().add("message-header");
bg.setId("message-bubble-grey");
messageLabel.getStyleClass().add("message");
copyIcon.getStyleClass().add("message");
if (isTrader)
arrow.setId("bubble_arrow_grey_right");
else
arrow.setId("bubble_arrow_grey_left");
}
if (item.isSystemMessage()) {
AnchorPane.setLeftAnchor(headerLabel, padding);
AnchorPane.setRightAnchor(headerLabel, padding);
AnchorPane.setLeftAnchor(bg, border);
AnchorPane.setRightAnchor(bg, border);
AnchorPane.setLeftAnchor(messageLabel, padding);
AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight);
AnchorPane.setRightAnchor(copyIcon, padding);
AnchorPane.setLeftAnchor(attachmentsBox, padding);
AnchorPane.setRightAnchor(attachmentsBox, padding);
} else if (senderIsTrader) {
AnchorPane.setLeftAnchor(headerLabel, padding + arrowWidth);
AnchorPane.setLeftAnchor(bg, border + arrowWidth);
AnchorPane.setRightAnchor(bg, border);
AnchorPane.setLeftAnchor(arrow, border);
AnchorPane.setLeftAnchor(messageLabel, padding + arrowWidth);
AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight);
AnchorPane.setRightAnchor(copyIcon, padding);
AnchorPane.setLeftAnchor(attachmentsBox, padding + arrowWidth);
AnchorPane.setRightAnchor(attachmentsBox, padding);
AnchorPane.setRightAnchor(statusIcon, padding);
} else {
AnchorPane.setRightAnchor(headerLabel, padding + arrowWidth);
AnchorPane.setLeftAnchor(bg, border);
AnchorPane.setRightAnchor(bg, border + arrowWidth);
AnchorPane.setRightAnchor(arrow, border);
AnchorPane.setLeftAnchor(messageLabel, padding);
AnchorPane.setRightAnchor(messageLabel, msgLabelPaddingRight + arrowWidth);
AnchorPane.setRightAnchor(copyIcon, padding + arrowWidth);
AnchorPane.setLeftAnchor(attachmentsBox, padding);
AnchorPane.setRightAnchor(attachmentsBox, padding + arrowWidth);
AnchorPane.setLeftAnchor(statusIcon, padding);
}
AnchorPane.setBottomAnchor(statusIcon, 7d);
headerLabel.setText(formatter.formatDateTime(new Date(item.getDate())));
messageLabel.setText(item.getMessage());
attachmentsBox.getChildren().clear();
if (item.getAttachments() != null && item.getAttachments().size() > 0) {
AnchorPane.setBottomAnchor(messageLabel, bottomBorder + attachmentsBoxHeight + 10);
attachmentsBox.getChildren().add(new AutoTooltipLabel(Res.get("support.attachments") + " ") {
{
setPadding(new Insets(0, 0, 3, 0));
if (isMyMsg)
getStyleClass().add("my-message");
else
getStyleClass().add("message");
}
});
item.getAttachments().stream().forEach(attachment -> {
final Label icon = new Label();
setPadding(new Insets(0, 0, 3, 0));
if (isMyMsg)
icon.getStyleClass().add("attachment-icon");
else
icon.getStyleClass().add("attachment-icon-black");
AwesomeDude.setIcon(icon, AwesomeIcon.FILE_TEXT);
icon.setPadding(new Insets(-2, 0, 0, 0));
icon.setTooltip(new Tooltip(attachment.getFileName()));
icon.setOnMouseClicked(event -> onOpenAttachment(attachment));
attachmentsBox.getChildren().add(icon);
});
} else {
AnchorPane.setBottomAnchor(messageLabel, bottomBorder + 10);
}
// Need to set it here otherwise style is not correct
AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY, "16.0");
copyIcon.getStyleClass().addAll("icon", "copy-icon-disputes");
// TODO There are still some cell rendering issues on updates
setGraphic(messageAnchorPane);
} else {
if (sendMsgBusyAnimation != null && sendMsgBusyAnimationListener != null)
sendMsgBusyAnimation.isRunningProperty().removeListener(sendMsgBusyAnimationListener);
messageAnchorPane.prefWidthProperty().unbind();
AnchorPane.clearConstraints(bg);
AnchorPane.clearConstraints(headerLabel);
AnchorPane.clearConstraints(arrow);
AnchorPane.clearConstraints(messageLabel);
AnchorPane.clearConstraints(copyIcon);
AnchorPane.clearConstraints(statusIcon);
AnchorPane.clearConstraints(attachmentsBox);
copyIcon.setOnMouseClicked(null);
setGraphic(null);
}
}
/* private void showNotArrivedIcon() {
statusIcon.setVisible(true);
AwesomeDude.setIcon(statusIcon, AwesomeIcon.WARNING_SIGN, "14");
Tooltip.install(statusIcon, new Tooltip("Message did not arrive. Please try to send again."));
statusIcon.setTextFill(Paint.valueOf("#dd0000"));
}*/
private void showMailboxIcon() {
statusIcon.setVisible(true);
AwesomeDude.setIcon(statusIcon, AwesomeIcon.ENVELOPE_ALT, "14");
statusIcon.setTooltip(new Tooltip(Res.get("support.savedInMailbox")));
statusIcon.setTextFill(Paint.valueOf("#0f87c3"));
}
private void showArrivedIcon() {
statusIcon.setVisible(true);
AwesomeDude.setIcon(statusIcon, AwesomeIcon.OK, "14");
statusIcon.setTooltip(new Tooltip(Res.get("support.arrived")));
statusIcon.setTextFill(Paint.valueOf("#0f87c3"));
}
};
}
});
if (root.getChildren().size() > 2)
root.getChildren().remove(2);
root.getChildren().add(2, messagesAnchorPane);
scrollToBottom();
}
addListenersOnSelectDispute();
}
use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.
the class DepositView method initialize.
@Override
public void initialize() {
paymentLabelString = Res.get("funds.deposit.fundBisqWallet");
selectColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.select")));
addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())));
confirmationsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.confirmations")));
usageColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.usage")));
// trigger creation of at least 1 savings address
walletService.getOrCreateAddressEntry(AddressEntry.Context.AVAILABLE);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.deposit.noAddresses")));
tableViewSelectionListener = (observableValue, oldValue, newValue) -> {
if (newValue != null) {
fillForm(newValue.getAddressString());
GUIUtil.requestFocus(amountTextField);
}
};
setSelectColumnCellFactory();
setAddressColumnCellFactory();
setBalanceColumnCellFactory();
setUsageColumnCellFactory();
setConfidenceColumnCellFactory();
addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
balanceColumn.setComparator((o1, o2) -> o1.getBalanceAsCoin().compareTo(o2.getBalanceAsCoin()));
confirmationsColumn.setComparator((o1, o2) -> Double.valueOf(o1.getTxConfidenceIndicator().getProgress()).compareTo(o2.getTxConfidenceIndicator().getProgress()));
usageColumn.setComparator((a, b) -> (a.getNumTxOutputs() < b.getNumTxOutputs()) ? -1 : ((a.getNumTxOutputs() == b.getNumTxOutputs()) ? 0 : 1));
tableView.getSortOrder().add(usageColumn);
tableView.setItems(sortedList);
titledGroupBg = addTitledGroupBg(gridPane, gridRow, 3, Res.get("funds.deposit.fundWallet"));
qrCodeImageView = new ImageView();
qrCodeImageView.getStyleClass().add("qr-code");
Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow")));
qrCodeImageView.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> UserThread.runAfter(() -> new QRCodeWindow(getBitcoinURI()).show(), 200, TimeUnit.MILLISECONDS)));
GridPane.setRowIndex(qrCodeImageView, gridRow);
GridPane.setColumnIndex(qrCodeImageView, 1);
GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
gridPane.getChildren().add(qrCodeImageView);
Tuple2<Label, AddressTextField> addressTuple = addLabelAddressTextField(gridPane, ++gridRow, Res.getWithCol("shared.address"));
addressLabel = addressTuple.first;
// GridPane.setValignment(addressLabel, VPos.TOP);
// GridPane.setMargin(addressLabel, new Insets(3, 0, 0, 0));
addressTextField = addressTuple.second;
addressTextField.setPaymentLabel(paymentLabelString);
Tuple2<Label, InputTextField> amountTuple = addLabelInputTextField(gridPane, ++gridRow, Res.get("funds.deposit.amount"));
amountLabel = amountTuple.first;
amountTextField = amountTuple.second;
if (DevEnv.isDevMode())
amountTextField.setText("10");
titledGroupBg.setVisible(false);
titledGroupBg.setManaged(false);
qrCodeImageView.setVisible(false);
qrCodeImageView.setManaged(false);
addressLabel.setVisible(false);
addressLabel.setManaged(false);
addressTextField.setVisible(false);
addressTextField.setManaged(false);
amountLabel.setVisible(false);
amountTextField.setManaged(false);
generateNewAddressButton = addButton(gridPane, ++gridRow, Res.get("funds.deposit.generateAddress"), -20);
GridPane.setColumnIndex(generateNewAddressButton, 0);
GridPane.setHalignment(generateNewAddressButton, HPos.LEFT);
generateNewAddressButton.setOnAction(event -> {
boolean hasUnUsedAddress = observableList.stream().filter(e -> e.getNumTxOutputs() == 0).findAny().isPresent();
if (hasUnUsedAddress) {
new Popup<>().warning(Res.get("funds.deposit.selectUnused")).show();
} else {
AddressEntry newSavingsAddressEntry = walletService.getOrCreateUnusedAddressEntry(AddressEntry.Context.AVAILABLE);
updateList();
observableList.stream().filter(depositListItem -> depositListItem.getAddressString().equals(newSavingsAddressEntry.getAddressString())).findAny().ifPresent(depositListItem -> tableView.getSelectionModel().select(depositListItem));
}
});
balanceListener = new BalanceListener() {
@Override
public void onBalanceChanged(Coin balance, Transaction tx) {
updateList();
}
};
GUIUtil.focusWhenAddedToScene(amountTextField);
}
Aggregations