Search in sources :

Example 6 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class MainViewModel method showFirstPopupIfResyncSPVRequested.

private void showFirstPopupIfResyncSPVRequested() {
    Popup firstPopup = new Popup<>();
    firstPopup.information(Res.get("settings.net.reSyncSPVAfterRestart")).show();
    if (btcSyncProgress.get() == 1) {
        showSecondPopupIfResyncSPVRequested(firstPopup);
    } else {
        btcSyncProgress.addListener((observable, oldValue, newValue) -> {
            if ((double) newValue == 1)
                showSecondPopupIfResyncSPVRequested(firstPopup);
        });
    }
}
Also used : Popup(bisq.desktop.main.overlays.popups.Popup)

Example 7 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class FiatAccountsView method onSaveNewAccount.

// /////////////////////////////////////////////////////////////////////////////////////////
// UI actions
// /////////////////////////////////////////////////////////////////////////////////////////
private void onSaveNewAccount(PaymentAccount paymentAccount) {
    Coin maxTradeLimitAsCoin = paymentAccount.getPaymentMethod().getMaxTradeLimitAsCoin("USD");
    Coin maxTradeLimitSecondMonth = maxTradeLimitAsCoin.divide(2L);
    Coin maxTradeLimitFirstMonth = maxTradeLimitAsCoin.divide(4L);
    new Popup<>().information(Res.get("payment.limits.info", formatter.formatCoinWithCode(maxTradeLimitFirstMonth), formatter.formatCoinWithCode(maxTradeLimitSecondMonth), formatter.formatCoinWithCode(maxTradeLimitAsCoin))).width(700).closeButtonText(Res.get("shared.cancel")).actionButtonText(Res.get("shared.iUnderstand")).onAction(() -> {
        final String currencyName = BisqEnvironment.getBaseCurrencyNetwork().getCurrencyName();
        if (paymentAccount instanceof ClearXchangeAccount) {
            new Popup<>().information(Res.get("payment.clearXchange.info", currencyName, currencyName)).width(900).closeButtonText(Res.get("shared.cancel")).actionButtonText(Res.get("shared.iConfirm")).onAction(() -> doSaveNewAccount(paymentAccount)).show();
        } else if (paymentAccount instanceof WesternUnionAccount) {
            new Popup<>().information(Res.get("payment.westernUnion.info")).width(700).closeButtonText(Res.get("shared.cancel")).actionButtonText(Res.get("shared.iUnderstand")).onAction(() -> doSaveNewAccount(paymentAccount)).show();
        } else {
            doSaveNewAccount(paymentAccount);
        }
    }).show();
}
Also used : Coin(org.bitcoinj.core.Coin) ClearXchangeAccount(bisq.core.payment.ClearXchangeAccount) Popup(bisq.desktop.main.overlays.popups.Popup) WesternUnionAccount(bisq.core.payment.WesternUnionAccount)

Example 8 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class PasswordView method onApplyPassword.

private void onApplyPassword(BusyAnimation busyAnimation, Label deriveStatusLabel) {
    String password = passwordField.getText();
    checkArgument(password.length() < 500, Res.get("password.tooLong"));
    pwButton.setDisable(true);
    deriveStatusLabel.setText(Res.get("password.deriveKey"));
    busyAnimation.play();
    KeyCrypterScrypt keyCrypterScrypt = walletsManager.getKeyCrypterScrypt();
    ScryptUtil.deriveKeyWithScrypt(keyCrypterScrypt, password, aesKey -> {
        deriveStatusLabel.setText("");
        busyAnimation.stop();
        if (walletsManager.areWalletsEncrypted()) {
            if (walletsManager.checkAESKey(aesKey)) {
                walletsManager.decryptWallets(aesKey);
                new Popup<>().feedback(Res.get("password.walletDecrypted")).show();
                passwordField.clear();
                repeatedPasswordField.clear();
                walletsManager.backupWallets();
            } else {
                pwButton.setDisable(false);
                new Popup<>().warning(Res.get("password.wrongPw")).show();
            }
        } else {
            try {
                walletsManager.encryptWallets(keyCrypterScrypt, aesKey);
                new Popup<>().feedback(Res.get("password.walletEncrypted")).show();
                passwordField.clear();
                repeatedPasswordField.clear();
                walletsManager.clearBackup();
                walletsManager.backupWallets();
            } catch (Throwable t) {
                new Popup<>().warning(Res.get("password.walletEncryptionFailed")).show();
            }
        }
        setText();
    });
}
Also used : Popup(bisq.desktop.main.overlays.popups.Popup) KeyCrypterScrypt(org.bitcoinj.crypto.KeyCrypterScrypt)

Example 9 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class TraderDisputeView method initialize.

@Override
public void initialize() {
    Label label = new AutoTooltipLabel(Res.get("support.filter"));
    HBox.setMargin(label, new Insets(5, 0, 0, 0));
    filterTextField = new InputTextField();
    filterTextField.setText("open");
    filterTextFieldListener = (observable, oldValue, newValue) -> applyFilteredListPredicate(filterTextField.getText());
    filterBox = new HBox();
    filterBox.setSpacing(5);
    filterBox.getChildren().addAll(label, filterTextField);
    VBox.setVgrow(filterBox, Priority.NEVER);
    filterBox.setVisible(false);
    filterBox.setManaged(false);
    tableView = new TableView<>();
    VBox.setVgrow(tableView, Priority.SOMETIMES);
    tableView.setMinHeight(150);
    root.getChildren().addAll(filterBox, tableView);
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    Label placeholder = new AutoTooltipLabel(Res.get("support.noTickets"));
    placeholder.setWrapText(true);
    tableView.setPlaceholder(placeholder);
    tableView.getSelectionModel().clearSelection();
    tableView.getColumns().add(getSelectColumn());
    TableColumn<Dispute, Dispute> contractColumn = getContractColumn();
    tableView.getColumns().add(contractColumn);
    TableColumn<Dispute, Dispute> dateColumn = getDateColumn();
    tableView.getColumns().add(dateColumn);
    TableColumn<Dispute, Dispute> tradeIdColumn = getTradeIdColumn();
    tableView.getColumns().add(tradeIdColumn);
    TableColumn<Dispute, Dispute> buyerOnionAddressColumn = getBuyerOnionAddressColumn();
    tableView.getColumns().add(buyerOnionAddressColumn);
    TableColumn<Dispute, Dispute> sellerOnionAddressColumn = getSellerOnionAddressColumn();
    tableView.getColumns().add(sellerOnionAddressColumn);
    TableColumn<Dispute, Dispute> marketColumn = getMarketColumn();
    tableView.getColumns().add(marketColumn);
    TableColumn<Dispute, Dispute> roleColumn = getRoleColumn();
    tableView.getColumns().add(roleColumn);
    TableColumn<Dispute, Dispute> stateColumn = getStateColumn();
    tableView.getColumns().add(stateColumn);
    tradeIdColumn.setComparator((o1, o2) -> o1.getTradeId().compareTo(o2.getTradeId()));
    dateColumn.setComparator((o1, o2) -> o1.getOpeningDate().compareTo(o2.getOpeningDate()));
    buyerOnionAddressColumn.setComparator((o1, o2) -> getBuyerOnionAddressColumnLabel(o1).compareTo(getBuyerOnionAddressColumnLabel(o2)));
    sellerOnionAddressColumn.setComparator((o1, o2) -> getSellerOnionAddressColumnLabel(o1).compareTo(getSellerOnionAddressColumnLabel(o2)));
    marketColumn.setComparator((o1, o2) -> formatter.getCurrencyPair(o1.getContract().getOfferPayload().getCurrencyCode()).compareTo(o2.getContract().getOfferPayload().getCurrencyCode()));
    dateColumn.setSortType(TableColumn.SortType.DESCENDING);
    tableView.getSortOrder().add(dateColumn);
    /*inputTextAreaListener = (observable, oldValue, newValue) ->
                sendButton.setDisable(newValue.length() == 0
                        && tempAttachments.size() == 0 &&
                        selectedDispute.disputeResultProperty().get() == null);*/
    selectedDisputeClosedPropertyListener = (observable, oldValue, newValue) -> {
        messagesInputBox.setVisible(!newValue);
        messagesInputBox.setManaged(!newValue);
        AnchorPane.setBottomAnchor(messageListView, newValue ? 0d : 120d);
    };
    disputeDirectMessageListListener = c -> scrollToBottom();
    keyEventEventHandler = event -> {
        if (Utilities.isAltOrCtrlPressed(KeyCode.L, event)) {
            Map<String, List<Dispute>> map = new HashMap<>();
            disputeManager.getDisputesAsObservableList().stream().forEach(dispute -> {
                String tradeId = dispute.getTradeId();
                List<Dispute> list;
                if (!map.containsKey(tradeId))
                    map.put(tradeId, new ArrayList<>());
                list = map.get(tradeId);
                list.add(dispute);
            });
            List<List<Dispute>> disputeGroups = new ArrayList<>();
            map.entrySet().stream().forEach(entry -> disputeGroups.add(entry.getValue()));
            disputeGroups.sort((o1, o2) -> !o1.isEmpty() && !o2.isEmpty() ? o1.get(0).getOpeningDate().compareTo(o2.get(0).getOpeningDate()) : 0);
            StringBuilder stringBuilder = new StringBuilder();
            // We don't translate that as it is not intended for the public
            stringBuilder.append("Summary of all disputes (No. of disputes: ").append(disputeGroups.size()).append(")\n\n");
            disputeGroups.stream().forEach(disputeGroup -> {
                Dispute dispute0 = disputeGroup.get(0);
                stringBuilder.append("##########################################################################################/\n").append("## Trade ID: ").append(dispute0.getTradeId()).append("\n").append("## Date: ").append(formatter.formatDateTime(dispute0.getOpeningDate())).append("\n").append("## Is support ticket: ").append(dispute0.isSupportTicket()).append("\n");
                if (dispute0.disputeResultProperty().get() != null && dispute0.disputeResultProperty().get().getReason() != null) {
                    stringBuilder.append("## Reason: ").append(dispute0.disputeResultProperty().get().getReason()).append("\n");
                }
                stringBuilder.append("##########################################################################################/\n").append("\n");
                disputeGroup.stream().forEach(dispute -> {
                    stringBuilder.append("*******************************************************************************************\n").append("** Trader's ID: ").append(dispute.getTraderId()).append("\n*******************************************************************************************\n").append("\n");
                    dispute.getDisputeCommunicationMessages().stream().forEach(m -> {
                        String role = m.isSenderIsTrader() ? ">> Trader's msg: " : "<< Arbitrator's msg: ";
                        stringBuilder.append(role).append(m.getMessage()).append("\n");
                    });
                    stringBuilder.append("\n");
                });
                stringBuilder.append("\n");
            });
            String message = stringBuilder.toString();
            // We don't translate that as it is not intended for the public
            new Popup<>().headLine("All disputes (" + disputeGroups.size() + ")").information(message).width(1000).actionButtonText("Copy").onAction(() -> Utilities.copyToClipboard(message)).show();
        } else if (Utilities.isAltOrCtrlPressed(KeyCode.U, event)) {
            // Hidden shortcut to re-open a dispute. Allow it also for traders not only arbitrator.
            if (selectedDispute != null) {
                if (selectedDisputeClosedPropertyListener != null)
                    selectedDispute.isClosedProperty().removeListener(selectedDisputeClosedPropertyListener);
                selectedDispute.setIsClosed(false);
            }
        } else if (Utilities.isAltOrCtrlPressed(KeyCode.R, event)) {
            if (selectedDispute != null) {
                PubKeyRing pubKeyRing = selectedDispute.getTraderPubKeyRing();
                NodeAddress nodeAddress;
                if (pubKeyRing.equals(selectedDispute.getContract().getBuyerPubKeyRing()))
                    nodeAddress = selectedDispute.getContract().getBuyerNodeAddress();
                else
                    nodeAddress = selectedDispute.getContract().getSellerNodeAddress();
                new SendPrivateNotificationWindow(pubKeyRing, nodeAddress, useDevPrivilegeKeys).onAddAlertMessage(privateNotificationManager::sendPrivateNotificationMessageIfKeyIsValid).show();
            }
        } else if (Utilities.isAltOrCtrlPressed(KeyCode.ENTER, event)) {
            if (selectedDispute != null && messagesInputBox.isVisible() && inputTextArea.isFocused())
                onTrySendMessage();
        }
    };
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) HashMap(java.util.HashMap) InputTextField(bisq.desktop.components.InputTextField) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) ArrayList(java.util.ArrayList) SendPrivateNotificationWindow(bisq.desktop.main.overlays.windows.SendPrivateNotificationWindow) Popup(bisq.desktop.main.overlays.popups.Popup) PubKeyRing(bisq.common.crypto.PubKeyRing) Dispute(bisq.core.arbitration.Dispute) SortedList(javafx.collections.transformation.SortedList) FilteredList(javafx.collections.transformation.FilteredList) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) NodeAddress(bisq.network.p2p.NodeAddress) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 10 with Popup

use of bisq.desktop.main.overlays.popups.Popup in project bisq-desktop by bisq-network.

the class TraderDisputeView method onRequestUpload.

private void onRequestUpload() {
    int totalSize = tempAttachments.stream().mapToInt(a -> a.getBytes().length).sum();
    if (tempAttachments.size() < 3) {
        FileChooser fileChooser = new FileChooser();
        int maxMsgSize = Connection.getPermittedMessageSize();
        int maxSizeInKB = maxMsgSize / 1024;
        fileChooser.setTitle(Res.get("support.openFile", maxSizeInKB));
        /* if (Utilities.isUnix())
                fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));*/
        File result = fileChooser.showOpenDialog(stage);
        if (result != null) {
            try {
                URL url = result.toURI().toURL();
                try (InputStream inputStream = url.openStream()) {
                    byte[] filesAsBytes = ByteStreams.toByteArray(inputStream);
                    int size = filesAsBytes.length;
                    int newSize = totalSize + size;
                    if (newSize > maxMsgSize) {
                        new Popup<>().warning(Res.get("support.attachmentTooLarge", (newSize / 1024), maxSizeInKB)).show();
                    } else if (size > maxMsgSize) {
                        new Popup<>().warning(Res.get("support.maxSize", maxSizeInKB)).show();
                    } else {
                        tempAttachments.add(new Attachment(result.getName(), filesAsBytes));
                        inputTextArea.setText(inputTextArea.getText() + "\n[" + Res.get("support.attachment") + " " + result.getName() + "]");
                    }
                } catch (java.io.IOException e) {
                    e.printStackTrace();
                    log.error(e.getMessage());
                }
            } catch (MalformedURLException e2) {
                e2.printStackTrace();
                log.error(e2.getMessage());
            }
        }
    } else {
        new Popup<>().warning(Res.get("support.tooManyAttachments")).show();
    }
}
Also used : Button(javafx.scene.control.Button) EventHandler(javafx.event.EventHandler) PubKeyRing(bisq.common.crypto.PubKeyRing) BusyAnimation(bisq.desktop.components.BusyAnimation) Utilities(bisq.common.util.Utilities) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) ListCell(javafx.scene.control.ListCell) URL(java.net.URL) Date(java.util.Date) ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) DisputeManager(bisq.core.arbitration.DisputeManager) VBox(javafx.scene.layout.VBox) BSFormatter(bisq.desktop.util.BSFormatter) Contract(bisq.core.trade.Contract) InputTextField(bisq.desktop.components.InputTextField) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) Res(bisq.core.locale.Res) Map(java.util.Map) TableView(javafx.scene.control.TableView) ParseException(java.text.ParseException) DateFormat(java.text.DateFormat) Pane(javafx.scene.layout.Pane) SortedList(javafx.collections.transformation.SortedList) HBox(javafx.scene.layout.HBox) Popup(bisq.desktop.main.overlays.popups.Popup) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) P2PService(bisq.network.p2p.P2PService) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FilteredList(javafx.collections.transformation.FilteredList) KeyEvent(javafx.scene.input.KeyEvent) Subscription(org.fxmisc.easybind.Subscription) SendPrivateNotificationWindow(bisq.desktop.main.overlays.windows.SendPrivateNotificationWindow) Priority(javafx.scene.layout.Priority) List(java.util.List) TradeManager(bisq.core.trade.TradeManager) AnchorPane(javafx.scene.layout.AnchorPane) Paint(javafx.scene.paint.Paint) NodeAddress(bisq.network.p2p.NodeAddress) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) AppOptionKeys(bisq.core.app.AppOptionKeys) UserThread(bisq.common.UserThread) ByteStreams(com.google.common.io.ByteStreams) Optional(java.util.Optional) Attachment(bisq.core.arbitration.Attachment) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) TableGroupHeadline(bisq.desktop.components.TableGroupHeadline) GUIUtil(bisq.desktop.util.GUIUtil) Scene(javafx.scene.Scene) ActivatableView(bisq.desktop.common.view.ActivatableView) ListView(javafx.scene.control.ListView) DisputeSummaryWindow(bisq.desktop.main.overlays.windows.DisputeSummaryWindow) TextArea(javafx.scene.control.TextArea) SimpleDateFormat(java.text.SimpleDateFormat) Timer(bisq.common.Timer) HashMap(java.util.HashMap) Dispute(bisq.core.arbitration.Dispute) ContractWindow(bisq.desktop.main.overlays.windows.ContractWindow) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) TableCell(javafx.scene.control.TableCell) Lists(com.google.common.collect.Lists) Insets(javafx.geometry.Insets) Connection(bisq.network.p2p.network.Connection) TextAlignment(javafx.scene.text.TextAlignment) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) PrivateNotificationManager(bisq.core.alert.PrivateNotificationManager) Nullable(javax.annotation.Nullable) KeyCode(javafx.scene.input.KeyCode) Version(bisq.common.app.Version) Label(javafx.scene.control.Label) TradeDetailsWindow(bisq.desktop.main.overlays.windows.TradeDetailsWindow) MalformedURLException(java.net.MalformedURLException) Trade(bisq.core.trade.Trade) AwesomeDude(de.jensd.fx.fontawesome.AwesomeDude) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) FileChooser(javafx.stage.FileChooser) DisputeCommunicationMessage(bisq.core.arbitration.messages.DisputeCommunicationMessage) Stage(javafx.stage.Stage) EasyBind(org.fxmisc.easybind.EasyBind) ImageView(javafx.scene.image.ImageView) ArbitratorDisputeView(bisq.desktop.main.disputes.arbitrator.ArbitratorDisputeView) Named(com.google.inject.name.Named) KeyRing(bisq.common.crypto.KeyRing) ChangeListener(javafx.beans.value.ChangeListener) InputStream(java.io.InputStream) MalformedURLException(java.net.MalformedURLException) InputStream(java.io.InputStream) Attachment(bisq.core.arbitration.Attachment) IOException(java.io.IOException) Paint(javafx.scene.paint.Paint) URL(java.net.URL) Popup(bisq.desktop.main.overlays.popups.Popup) FileChooser(javafx.stage.FileChooser) File(java.io.File)

Aggregations

Popup (bisq.desktop.main.overlays.popups.Popup)57 Label (javafx.scene.control.Label)22 Coin (org.bitcoinj.core.Coin)17 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)16 Button (javafx.scene.control.Button)16 Res (bisq.core.locale.Res)13 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)13 Insets (javafx.geometry.Insets)13 InputTextField (bisq.desktop.components.InputTextField)12 BSFormatter (bisq.desktop.util.BSFormatter)12 Transaction (org.bitcoinj.core.Transaction)12 List (java.util.List)11 UserThread (bisq.common.UserThread)10 ChangeListener (javafx.beans.value.ChangeListener)9 BusyAnimation (bisq.desktop.components.BusyAnimation)8 ObservableList (javafx.collections.ObservableList)8 HBox (javafx.scene.layout.HBox)8 Tuple2 (bisq.common.util.Tuple2)7 FxmlView (bisq.desktop.common.view.FxmlView)7 TradeCurrency (bisq.core.locale.TradeCurrency)6