use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class TraderDisputeView method getContractColumn.
private TableColumn<Dispute, Dispute> getContractColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<Dispute, Dispute>(Res.get("shared.details")) {
{
setMinWidth(80);
setSortable(false);
}
};
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
column.setCellFactory(new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {
@Override
public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
return new TableCell<Dispute, Dispute>() {
Button button;
@Override
public void updateItem(final Dispute item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
if (button == null) {
button = new AutoTooltipButton(Res.get("shared.details"));
setGraphic(button);
}
button.setOnAction(e -> onOpenContract(item));
} else {
setGraphic(null);
if (button != null) {
button.setOnAction(null);
button = null;
}
}
}
};
}
});
return column;
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class ArbitratorRegistrationView method buildUI.
private void buildUI() {
GridPane gridPane = new GridPane();
gridPane.setPadding(new Insets(30, 25, -1, 25));
gridPane.setHgap(5);
gridPane.setVgap(5);
ColumnConstraints columnConstraints1 = new ColumnConstraints();
columnConstraints1.setHalignment(HPos.RIGHT);
columnConstraints1.setHgrow(Priority.SOMETIMES);
columnConstraints1.setMinWidth(200);
ColumnConstraints columnConstraints2 = new ColumnConstraints();
columnConstraints2.setHgrow(Priority.ALWAYS);
gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
root.getChildren().add(gridPane);
addTitledGroupBg(gridPane, gridRow, 3, Res.get("account.tab.arbitratorRegistration"));
TextField pubKeyTextField = FormBuilder.addLabelTextField(gridPane, gridRow, Res.get("account.arbitratorRegistration.pubKey"), model.registrationPubKeyAsHex.get(), Layout.FIRST_ROW_DISTANCE).second;
pubKeyTextField.textProperty().bind(model.registrationPubKeyAsHex);
Tuple2<Label, ListView> tuple = addLabelListView(gridPane, ++gridRow, Res.get("shared.yourLanguage"));
GridPane.setValignment(tuple.first, VPos.TOP);
// noinspection unchecked
languagesListView = tuple.second;
languagesListView.disableProperty().bind(model.registrationEditDisabled);
languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
languagesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
languagesListView.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
@Override
public ListCell<String> call(ListView<String> list) {
return new ListCell<String>() {
final Label label = new AutoTooltipLabel();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new AutoTooltipButton("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
}
@Override
public void updateItem(final String item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(LanguageUtil.getDisplayName(item));
removeButton.setOnAction(e -> onRemoveLanguage(item));
setGraphic(pane);
} else {
setGraphic(null);
}
}
};
}
});
// noinspection unchecked
languageComboBox = addLabelComboBox(gridPane, ++gridRow).second;
languageComboBox.disableProperty().bind(model.registrationEditDisabled);
languageComboBox.setPromptText(Res.get("shared.addLanguage"));
languageComboBox.setConverter(new StringConverter<String>() {
@Override
public String toString(String code) {
return LanguageUtil.getDisplayName(code);
}
@Override
public String fromString(String s) {
return null;
}
});
languageComboBox.setOnAction(e -> onAddLanguage());
Button registerButton = addButtonAfterGroup(gridPane, ++gridRow, Res.get("account.arbitratorRegistration.register"));
registerButton.disableProperty().bind(model.registrationEditDisabled);
registerButton.setOnAction(e -> onRegister());
Button revokeButton = addButton(gridPane, ++gridRow, Res.get("account.arbitratorRegistration.revoke"));
revokeButton.setDefaultButton(false);
revokeButton.disableProperty().bind(model.revokeButtonDisabled);
revokeButton.setOnAction(e -> onRevoke());
addTitledGroupBg(gridPane, ++gridRow, 2, Res.get("shared.information"), Layout.GROUP_DISTANCE);
Label infoLabel = addMultilineLabel(gridPane, gridRow);
GridPane.setMargin(infoLabel, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
infoLabel.setText(Res.get("account.arbitratorRegistration.info.msg"));
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class ArbitratorSelectionView method addLanguageGroup.
// /////////////////////////////////////////////////////////////////////////////////////////
// UI builder
// /////////////////////////////////////////////////////////////////////////////////////////
private void addLanguageGroup() {
addTitledGroupBg(root, gridRow, 1, Res.get("account.arbitratorSelection.whichLanguages"));
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("shared.yourLanguage"), Layout.FIRST_ROW_DISTANCE);
GridPane.setValignment(tuple.first, VPos.TOP);
// noinspection unchecked
languagesListView = tuple.second;
languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
languagesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
languagesListView.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
@Override
public ListCell<String> call(ListView<String> list) {
return new ListCell<String>() {
final Label label = new AutoTooltipLabel();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new AutoTooltipButton("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
}
@Override
public void updateItem(final String item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(LanguageUtil.getDisplayName(item));
removeButton.setOnAction(e -> onRemoveLanguage(item));
setGraphic(pane);
} else {
setGraphic(null);
}
}
};
}
});
// noinspection unchecked
languageComboBox = addLabelComboBox(root, ++gridRow, "", 15).second;
languageComboBox.setPromptText(Res.get("shared.addLanguage"));
languageComboBox.setConverter(new StringConverter<String>() {
@Override
public String toString(String code) {
return LanguageUtil.getDisplayName(code);
}
@Override
public String fromString(String s) {
return null;
}
});
languageComboBox.setOnAction(e -> onAddLanguage());
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class OfferBookView method getActionColumn.
private TableColumn<OfferBookListItem, OfferBookListItem> getActionColumn() {
TableColumn<OfferBookListItem, OfferBookListItem> column = new AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem>("") {
{
setMinWidth(80);
setSortable(false);
}
};
column.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
column.setCellFactory(new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem, OfferBookListItem>>() {
@Override
public TableCell<OfferBookListItem, OfferBookListItem> call(TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<OfferBookListItem, OfferBookListItem>() {
final ImageView iconView = new ImageView();
final Button button = new AutoTooltipButton();
boolean isTradable, isPaymentAccountValidForOffer, hasMatchingArbitrator, hasSameProtocolVersion, isIgnored, isOfferBanned, isCurrencyBanned, isPaymentMethodBanned, isNodeAddressBanned, isInsufficientTradeLimit;
{
button.setGraphic(iconView);
button.setMinWidth(130);
button.setMaxWidth(130);
button.setGraphicTextGap(10);
}
@Override
public void updateItem(final OfferBookListItem newItem, boolean empty) {
super.updateItem(newItem, empty);
TableRow tableRow = getTableRow();
if (newItem != null && !empty) {
final Offer offer = newItem.getOffer();
boolean myOffer = model.isMyOffer(offer);
if (tableRow != null) {
isPaymentAccountValidForOffer = model.isAnyPaymentAccountValidForOffer(offer);
hasMatchingArbitrator = model.hasMatchingArbitrator(offer);
hasSameProtocolVersion = model.hasSameProtocolVersion(offer);
isIgnored = model.isIgnored(offer);
isOfferBanned = model.isOfferBanned(offer);
isCurrencyBanned = model.isCurrencyBanned(offer);
isPaymentMethodBanned = model.isPaymentMethodBanned(offer);
isNodeAddressBanned = model.isNodeAddressBanned(offer);
isInsufficientTradeLimit = model.isInsufficientTradeLimit(offer);
isTradable = isPaymentAccountValidForOffer && hasMatchingArbitrator && hasSameProtocolVersion && !isIgnored && !isOfferBanned && !isCurrencyBanned && !isPaymentMethodBanned && !isNodeAddressBanned && !isInsufficientTradeLimit;
tableRow.setOpacity(isTradable || myOffer ? 1 : 0.4);
if (isTradable) {
// set first row button as default
button.setDefaultButton(getIndex() == 0);
tableRow.setOnMousePressed(null);
} else {
button.setDefaultButton(false);
tableRow.setOnMousePressed(e -> {
// ugly hack to get the icon clickable when deactivated
if (!(e.getTarget() instanceof ImageView || e.getTarget() instanceof Canvas))
onShowInfo(offer, isPaymentAccountValidForOffer, hasMatchingArbitrator, hasSameProtocolVersion, isIgnored, isOfferBanned, isCurrencyBanned, isPaymentMethodBanned, isNodeAddressBanned, isInsufficientTradeLimit);
});
}
}
String title;
if (myOffer) {
iconView.setId("image-remove");
title = Res.get("shared.remove");
button.setId("cancel-button");
// does not take the font colors sometimes from the style
button.setStyle("-fx-text-fill: #444;");
button.setOnAction(e -> onRemoveOpenOffer(offer));
} else {
boolean isSellOffer = offer.getDirection() == OfferPayload.Direction.SELL;
iconView.setId(isSellOffer ? "image-buy-white" : "image-sell-white");
button.setId(isSellOffer ? "buy-button" : "sell-button");
// does not take the font colors sometimes from the style
button.setStyle("-fx-text-fill: white;");
title = Res.get("offerbook.takeOffer");
button.setTooltip(new Tooltip(Res.get("offerbook.takeOfferButton.tooltip", model.getDirectionLabelTooltip(offer))));
button.setOnAction(e -> onTakeOffer(offer));
}
if (!myOffer && !isTradable)
button.setOnAction(e -> onShowInfo(offer, isPaymentAccountValidForOffer, hasMatchingArbitrator, hasSameProtocolVersion, isIgnored, isOfferBanned, isCurrencyBanned, isPaymentMethodBanned, isNodeAddressBanned, isInsufficientTradeLimit));
button.setText(title);
setGraphic(button);
} else {
setGraphic(null);
if (button != null)
button.setOnAction(null);
if (tableRow != null) {
tableRow.setOpacity(1);
tableRow.setOnMousePressed(null);
}
}
}
};
}
});
return column;
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class TakeOfferView method addFundingGroup.
private void addFundingGroup() {
// don't increase gridRow as we removed button when this gets visible
payFundsPane = FormBuilder.addTitledGroupBg(gridPane, gridRow, 3, Res.get("takeOffer.fundsBox.title"), Layout.GROUP_DISTANCE);
GridPane.setColumnSpan(payFundsPane, 3);
payFundsPane.setVisible(false);
Tuple2<Label, FundsTextField> fundsTuple = addLabelFundsTextfield(gridPane, gridRow, Res.get("shared.totalsNeeded"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
totalToPayLabel = fundsTuple.first;
totalToPayLabel.setVisible(false);
totalToPayTextField = fundsTuple.second;
totalToPayTextField.setVisible(false);
qrCodeImageView = new ImageView();
qrCodeImageView.setVisible(false);
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, 2);
GridPane.setRowSpan(qrCodeImageView, 3);
GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE - 9, 0, 0, 5));
gridPane.getChildren().add(qrCodeImageView);
Tuple2<Label, AddressTextField> addressTuple = FormBuilder.addLabelAddressTextField(gridPane, ++gridRow, Res.get("shared.tradeWalletAddress"));
addressLabel = addressTuple.first;
addressLabel.setVisible(false);
addressTextField = addressTuple.second;
addressTextField.setVisible(false);
Tuple2<Label, BalanceTextField> balanceTuple = FormBuilder.addLabelBalanceTextField(gridPane, ++gridRow, Res.get("shared.tradeWalletBalance"));
balanceLabel = balanceTuple.first;
balanceLabel.setVisible(false);
balanceTextField = balanceTuple.second;
balanceTextField.setVisible(false);
fundingHBox = new HBox();
fundingHBox.setVisible(false);
fundingHBox.setManaged(false);
fundingHBox.setSpacing(10);
Button fundFromSavingsWalletButton = new AutoTooltipButton(Res.get("shared.fundFromSavingsWalletButton"));
fundFromSavingsWalletButton.setDefaultButton(true);
fundFromSavingsWalletButton.setDefaultButton(false);
fundFromSavingsWalletButton.setOnAction(e -> model.fundFromSavingsWallet());
Label label = new AutoTooltipLabel(Res.get("shared.OR"));
label.setPadding(new Insets(5, 0, 0, 0));
Button fundFromExternalWalletButton = new AutoTooltipButton(Res.get("shared.fundFromExternalWalletButton"));
fundFromExternalWalletButton.setDefaultButton(false);
fundFromExternalWalletButton.setOnAction(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet));
waitingForFundsBusyAnimation = new BusyAnimation(false);
waitingForFundsLabel = new AutoTooltipLabel();
waitingForFundsLabel.setPadding(new Insets(5, 0, 0, 0));
fundingHBox.getChildren().addAll(fundFromSavingsWalletButton, label, fundFromExternalWalletButton, waitingForFundsBusyAnimation, waitingForFundsLabel);
GridPane.setRowIndex(fundingHBox, ++gridRow);
GridPane.setColumnIndex(fundingHBox, 1);
GridPane.setMargin(fundingHBox, new Insets(15, 10, 0, 0));
gridPane.getChildren().add(fundingHBox);
takeOfferButton = FormBuilder.addButtonAfterGroup(gridPane, gridRow, "");
takeOfferButton.setVisible(false);
takeOfferButton.setManaged(false);
takeOfferButton.setMinHeight(40);
takeOfferButton.setPadding(new Insets(0, 20, 0, 20));
takeOfferButton.setOnAction(e -> onTakeOffer());
cancelButton2 = FormBuilder.addButton(gridPane, ++gridRow, Res.get("shared.cancel"));
cancelButton2.setOnAction(e -> {
if (model.dataModel.getIsBtcWalletFunded().get()) {
new Popup<>().warning(Res.get("takeOffer.alreadyFunded.askCancel")).closeButtonText(Res.get("shared.no")).actionButtonText(Res.get("shared.yesCancel")).onAction(() -> {
model.dataModel.swapTradeToSavings();
close();
}).show();
} else {
close();
model.dataModel.swapTradeToSavings();
}
});
cancelButton2.setDefaultButton(false);
cancelButton2.setVisible(false);
}
Aggregations