use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class TakeOfferView method addButtons.
private void addButtons() {
nextButton = new AutoTooltipButton(Res.get("shared.nextStep"));
nextButton.setDefaultButton(true);
nextButton.setOnAction(e -> {
showNextStepAfterAmountIsSet();
});
cancelButton1 = new AutoTooltipButton(Res.get("shared.cancel"));
cancelButton1.setDefaultButton(false);
cancelButton1.setId("cancel-button");
cancelButton1.setOnAction(e -> {
model.dataModel.swapTradeToSavings();
close();
});
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class Overlay method addReportErrorButtons.
private void addReportErrorButtons() {
messageLabel.setText(Res.get("popup.reportError", truncatedMessage));
Button logButton = new AutoTooltipButton(Res.get("popup.reportError.log"));
GridPane.setMargin(logButton, new Insets(20, 0, 0, 0));
GridPane.setHalignment(logButton, HPos.RIGHT);
GridPane.setRowIndex(logButton, ++rowIndex);
GridPane.setColumnIndex(logButton, 1);
gridPane.getChildren().add(logButton);
logButton.setOnAction(event -> {
try {
File dataDir = new File(BisqEnvironment.getStaticAppDataDir());
File logFile = new File(Paths.get(dataDir.getPath(), "bisq.log").toString());
Utilities.openFile(logFile);
} catch (IOException e) {
e.printStackTrace();
log.error(e.getMessage());
}
});
Button gitHubButton = new AutoTooltipButton(Res.get("popup.reportError.gitHub"));
GridPane.setHalignment(gitHubButton, HPos.RIGHT);
GridPane.setRowIndex(gitHubButton, ++rowIndex);
GridPane.setColumnIndex(gitHubButton, 1);
gridPane.getChildren().add(gitHubButton);
gitHubButton.setOnAction(event -> {
if (message != null)
Utilities.copyToClipboard(message);
GUIUtil.openWebPage("https://github.com/bisq-network/exchange/issues");
hide();
});
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class EmptyWalletWindow method addContent.
private void addContent() {
addMultilineLabel(gridPane, ++rowIndex, Res.get("emptyWalletWindow.info"), 10);
Coin totalBalance = walletService.getAvailableBalance();
balanceTextField = addLabelTextField(gridPane, ++rowIndex, Res.get("emptyWalletWindow.balance"), formatter.formatCoinWithCode(totalBalance), 10).second;
Tuple2<Label, InputTextField> tuple = addLabelInputTextField(gridPane, ++rowIndex, Res.get("emptyWalletWindow.address"));
addressInputTextField = tuple.second;
emptyWalletButton = new AutoTooltipButton(Res.get("emptyWalletWindow.button"));
boolean isBalanceSufficient = Restrictions.isAboveDust(totalBalance);
emptyWalletButton.setDefaultButton(isBalanceSufficient);
emptyWalletButton.setDisable(!isBalanceSufficient && addressInputTextField.getText().length() > 0);
emptyWalletButton.setOnAction(e -> {
if (addressInputTextField.getText().length() > 0 && isBalanceSufficient) {
if (walletService.isEncrypted()) {
walletPasswordWindow.onAesKey(this::doEmptyWallet).onClose(this::blurAgain).show();
} else {
doEmptyWallet(null);
}
}
});
closeButton = new AutoTooltipButton(Res.get("shared.cancel"));
closeButton.setOnAction(e -> {
hide();
closeHandlerOptional.ifPresent(Runnable::run);
});
closeButton.setDefaultButton(!isBalanceSufficient);
HBox hBox = new HBox();
hBox.setSpacing(10);
GridPane.setRowIndex(hBox, ++rowIndex);
GridPane.setColumnIndex(hBox, 1);
hBox.getChildren().addAll(emptyWalletButton, closeButton);
gridPane.getChildren().add(hBox);
GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class FilterWindow method addContent.
private void addContent() {
InputTextField keyInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("shared.unlock"), 10).second;
if (useDevPrivilegeKeys)
keyInputTextField.setText(DevEnv.DEV_PRIVILEGE_PRIV_KEY);
InputTextField offerIdsInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.offers")).second;
InputTextField nodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.onions")).second;
// Do not translate
nodesInputTextField.setPromptText("E.g. zqnzx6o3nifef5df.onion:9999");
InputTextField paymentAccountFilterInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.accounts")).second;
GridPane.setHalignment(paymentAccountFilterInputTextField, HPos.RIGHT);
// Do not translate
paymentAccountFilterInputTextField.setPromptText("E.g. PERFECT_MONEY|getAccountNr|12345");
InputTextField bannedCurrenciesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.bannedCurrencies")).second;
InputTextField bannedPaymentMethodsInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.bannedPaymentMethods")).second;
// Do not translate
bannedPaymentMethodsInputTextField.setPromptText("E.g. PERFECT_MONEY");
InputTextField arbitratorsInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.arbitrators")).second;
InputTextField seedNodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.seedNode")).second;
InputTextField priceRelayNodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.priceRelayNode")).second;
InputTextField btcNodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.btcNode")).second;
CheckBox preventPublicBtcNetworkCheckBox = addLabelCheckBox(gridPane, ++rowIndex, Res.get("filterWindow.preventPublicBtcNetwork")).second;
final Filter filter = filterManager.getDevelopersFilter();
if (filter != null) {
offerIdsInputTextField.setText(filter.getBannedOfferIds().stream().collect(Collectors.joining(", ")));
nodesInputTextField.setText(filter.getBannedNodeAddress().stream().collect(Collectors.joining(", ")));
if (filter.getBannedPaymentAccounts() != null) {
StringBuilder sb = new StringBuilder();
filter.getBannedPaymentAccounts().stream().forEach(e -> {
if (e != null && e.getPaymentMethodId() != null) {
sb.append(e.getPaymentMethodId()).append("|").append(e.getGetMethodName()).append("|").append(e.getValue()).append(", ");
}
});
paymentAccountFilterInputTextField.setText(sb.toString());
}
if (filter.getBannedCurrencies() != null)
bannedCurrenciesInputTextField.setText(filter.getBannedCurrencies().stream().collect(Collectors.joining(", ")));
if (filter.getBannedPaymentMethods() != null)
bannedPaymentMethodsInputTextField.setText(filter.getBannedPaymentMethods().stream().collect(Collectors.joining(", ")));
if (filter.getArbitrators() != null)
arbitratorsInputTextField.setText(filter.getArbitrators().stream().collect(Collectors.joining(", ")));
if (filter.getSeedNodes() != null)
seedNodesInputTextField.setText(filter.getSeedNodes().stream().collect(Collectors.joining(", ")));
if (filter.getPriceRelayNodes() != null)
priceRelayNodesInputTextField.setText(filter.getPriceRelayNodes().stream().collect(Collectors.joining(", ")));
if (filter.getBtcNodes() != null)
btcNodesInputTextField.setText(filter.getBtcNodes().stream().collect(Collectors.joining(", ")));
preventPublicBtcNetworkCheckBox.setSelected(filter.isPreventPublicBtcNetwork());
}
Button sendButton = new AutoTooltipButton(Res.get("filterWindow.add"));
sendButton.setOnAction(e -> {
List<String> offerIds = new ArrayList<>();
List<String> nodes = new ArrayList<>();
List<PaymentAccountFilter> paymentAccountFilters = new ArrayList<>();
List<String> bannedCurrencies = new ArrayList<>();
List<String> bannedPaymentMethods = new ArrayList<>();
List<String> arbitrators = new ArrayList<>();
List<String> seedNodes = new ArrayList<>();
List<String> priceRelayNodes = new ArrayList<>();
List<String> btcNodes = new ArrayList<>();
if (!offerIdsInputTextField.getText().isEmpty()) {
offerIds = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(offerIdsInputTextField.getText()).split(",")));
}
if (!nodesInputTextField.getText().isEmpty()) {
nodes = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(nodesInputTextField.getText()).replace(":9999", "").replace(".onion", "").split(",")));
}
if (!paymentAccountFilterInputTextField.getText().isEmpty()) {
paymentAccountFilters = new ArrayList<>(Arrays.asList(paymentAccountFilterInputTextField.getText().replace(", ", ",").split(",")).stream().map(item -> {
String[] list = item.split("\\|");
if (list.length == 3)
return new PaymentAccountFilter(list[0], list[1], list[2]);
else
return new PaymentAccountFilter("", "", "");
}).collect(Collectors.toList()));
}
if (!bannedCurrenciesInputTextField.getText().isEmpty()) {
bannedCurrencies = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(bannedCurrenciesInputTextField.getText()).split(",")));
}
if (!bannedPaymentMethodsInputTextField.getText().isEmpty()) {
bannedPaymentMethods = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(bannedPaymentMethodsInputTextField.getText()).split(",")));
}
if (!arbitratorsInputTextField.getText().isEmpty()) {
arbitrators = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(arbitratorsInputTextField.getText()).replace(":9999", "").replace(".onion", "").split(",")));
}
if (!seedNodesInputTextField.getText().isEmpty()) {
seedNodes = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(seedNodesInputTextField.getText()).replace(":9999", "").replace(".onion", "").split(",")));
}
if (!priceRelayNodesInputTextField.getText().isEmpty()) {
priceRelayNodes = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(priceRelayNodesInputTextField.getText()).replace(":9999", "").replace(".onion", "").split(",")));
}
if (!btcNodesInputTextField.getText().isEmpty()) {
btcNodes = new ArrayList<>(Arrays.asList(StringUtils.deleteWhitespace(btcNodesInputTextField.getText()).split(",")));
}
if (sendFilterMessageHandler.handle(new Filter(offerIds, nodes, paymentAccountFilters, bannedCurrencies, bannedPaymentMethods, arbitrators, seedNodes, priceRelayNodes, preventPublicBtcNetworkCheckBox.isSelected(), btcNodes), keyInputTextField.getText()))
hide();
else
new Popup<>().warning(Res.get("shared.invalidKey")).width(300).onClose(this::blurAgain).show();
});
Button removeFilterMessageButton = new AutoTooltipButton(Res.get("filterWindow.remove"));
removeFilterMessageButton.setOnAction(e -> {
if (keyInputTextField.getText().length() > 0) {
if (removeFilterMessageHandler.handle(keyInputTextField.getText()))
hide();
else
new Popup<>().warning(Res.get("shared.invalidKey")).width(300).onClose(this::blurAgain).show();
}
});
closeButton = new AutoTooltipButton(Res.get("shared.close"));
closeButton.setOnAction(e -> {
hide();
closeHandlerOptional.ifPresent(Runnable::run);
});
HBox hBox = new HBox();
hBox.setSpacing(10);
GridPane.setRowIndex(hBox, ++rowIndex);
GridPane.setColumnIndex(hBox, 1);
hBox.getChildren().addAll(sendButton, removeFilterMessageButton, closeButton);
gridPane.getChildren().add(hBox);
GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class OpenOffersView method setDeactivateColumnCellFactory.
private void setDeactivateColumnCellFactory() {
deactivateItemColumn.setCellValueFactory((offerListItem) -> new ReadOnlyObjectWrapper<>(offerListItem.getValue()));
deactivateItemColumn.setCellFactory(new Callback<TableColumn<OpenOfferListItem, OpenOfferListItem>, TableCell<OpenOfferListItem, OpenOfferListItem>>() {
@Override
public TableCell<OpenOfferListItem, OpenOfferListItem> call(TableColumn<OpenOfferListItem, OpenOfferListItem> column) {
return new TableCell<OpenOfferListItem, OpenOfferListItem>() {
final ImageView iconView = new ImageView();
Button button;
private void updateState(@NotNull OpenOffer openOffer) {
if (openOffer.isDeactivated()) {
button.setText(Res.get("shared.activate"));
iconView.setId("image-alert-round");
button.setGraphic(iconView);
} else {
button.setText(Res.get("shared.deactivate"));
iconView.setId("image-green_circle");
button.setGraphic(iconView);
}
}
@Override
public void updateItem(final OpenOfferListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
if (button == null) {
button = new AutoTooltipButton();
button.setGraphic(iconView);
updateState(item.getOpenOffer());
button.setMinWidth(70);
setGraphic(button);
}
button.setOnAction(event -> {
if (item.getOpenOffer().isDeactivated()) {
onActivateOpenOffer(item.getOpenOffer());
} else {
onDeactivateOpenOffer(item.getOpenOffer());
}
updateState(item.getOpenOffer());
tableView.refresh();
});
} else {
setGraphic(null);
if (button != null) {
button.setOnAction(null);
button = null;
}
}
}
};
}
});
}
Aggregations