Search in sources :

Example 61 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.

the class WithdrawalView method initialize.

@Override
public void initialize() {
    inputsLabel.setText(Res.getWithCol("funds.withdrawal.inputs"));
    useAllInputsRadioButton.setText(Res.get("funds.withdrawal.useAllInputs"));
    useCustomInputsRadioButton.setText(Res.get("funds.withdrawal.useCustomInputs"));
    amountLabel.setText(Res.getWithCol("funds.withdrawal.receiverAmount", Res.getBaseCurrencyCode()));
    feeExcludedRadioButton.setText(Res.get("funds.withdrawal.feeExcluded"));
    feeIncludedRadioButton.setText(Res.get("funds.withdrawal.feeIncluded"));
    fromLabel.setText(Res.get("funds.withdrawal.fromLabel", Res.getBaseCurrencyCode()));
    toLabel.setText(Res.get("funds.withdrawal.toLabel", Res.getBaseCurrencyCode()));
    withdrawButton.setText(Res.get("funds.withdrawal.withdrawButton"));
    addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
    balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())));
    selectColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.select")));
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.withdrawal.noFundsAvailable")));
    tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    setAddressColumnCellFactory();
    setBalanceColumnCellFactory();
    setSelectColumnCellFactory();
    addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
    balanceColumn.setComparator((o1, o2) -> o1.getBalance().compareTo(o2.getBalance()));
    balanceColumn.setSortType(TableColumn.SortType.DESCENDING);
    tableView.getSortOrder().add(balanceColumn);
    balanceListener = new BalanceListener() {

        @Override
        public void onBalanceChanged(Coin balance, Transaction tx) {
            updateList();
        }
    };
    amountListener = (observable, oldValue, newValue) -> {
        if (amountTextField.focusedProperty().get()) {
            try {
                amountAsCoin = formatter.parseToCoin(amountTextField.getText());
            } catch (Throwable t) {
                log.error("Error at amountTextField input. " + t.toString());
            }
        }
    };
    amountFocusListener = (observable, oldValue, newValue) -> {
        if (oldValue && !newValue) {
            if (amountAsCoin.isPositive())
                amountTextField.setText(formatter.formatCoin(amountAsCoin));
            else
                amountTextField.setText("");
        }
    };
    feeToggleGroup = new ToggleGroup();
    feeExcludedRadioButton.setToggleGroup(feeToggleGroup);
    feeIncludedRadioButton.setToggleGroup(feeToggleGroup);
    feeToggleGroupListener = (observable, oldValue, newValue) -> {
        feeExcluded = newValue == feeExcludedRadioButton;
        amountLabel.setText(feeExcluded ? Res.getWithCol("funds.withdrawal.receiverAmount", Res.getBaseCurrencyCode()) : Res.getWithCol("funds.withdrawal.senderAmount", Res.getBaseCurrencyCode()));
    };
    inputsToggleGroup = new ToggleGroup();
    useAllInputsRadioButton.setToggleGroup(inputsToggleGroup);
    useCustomInputsRadioButton.setToggleGroup(inputsToggleGroup);
    inputsToggleGroupListener = (observable, oldValue, newValue) -> {
        useAllInputs.set(newValue == useAllInputsRadioButton);
        updateInputSelection();
    };
}
Also used : Coin(org.bitcoinj.core.Coin) BalanceListener(bisq.core.btc.listeners.BalanceListener) Transaction(org.bitcoinj.core.Transaction) ToggleGroup(javafx.scene.control.ToggleGroup) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 62 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.

the class BsqTxView method addInformationColumn.

private void addInformationColumn() {
    TableColumn<BsqTxListItem, BsqTxListItem> column = new AutoTooltipTableColumn<>(Res.get("shared.information"));
    column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue()));
    column.setMinWidth(160);
    column.setCellFactory(new Callback<TableColumn<BsqTxListItem, BsqTxListItem>, TableCell<BsqTxListItem, BsqTxListItem>>() {

        @Override
        public TableCell<BsqTxListItem, BsqTxListItem> call(TableColumn<BsqTxListItem, BsqTxListItem> column) {
            return new TableCell<BsqTxListItem, BsqTxListItem>() {

                private AddressWithIconAndDirection field;

                @Override
                public void updateItem(final BsqTxListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        TxType txType = item.getTxType();
                        String labelString = Res.get("dao.tx.type.enum." + txType.name());
                        Label label;
                        if (item.getConfirmations() > 0 && txType.ordinal() > TxType.INVALID.ordinal()) {
                            if (item.isBurnedBsqTx() || item.getAmount().isZero()) {
                                if (field != null)
                                    field.setOnAction(null);
                                if (txType == TxType.TRANSFER_BSQ) {
                                    if (item.getAmount().isZero())
                                        labelString = Res.get("funds.tx.direction.self");
                                }
                                label = new AutoTooltipLabel(labelString);
                                setGraphic(label);
                            } else {
                                // Received
                                String addressString = item.getAddress();
                                field = new AddressWithIconAndDirection(item.getDirection(), addressString, AwesomeIcon.EXTERNAL_LINK, item.isReceived());
                                field.setOnAction(event -> openAddressInBlockExplorer(item));
                                field.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", addressString)));
                                setGraphic(field);
                            }
                        } else {
                            label = new AutoTooltipLabel(labelString);
                            setGraphic(label);
                        }
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
    tableView.getColumns().add(column);
}
Also used : Transaction(org.bitcoinj.core.Transaction) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) Coin(org.bitcoinj.core.Coin) Date(java.util.Date) ReadableBsqBlockChain(bisq.core.dao.blockchain.ReadableBsqBlockChain) VBox(javafx.scene.layout.VBox) BsqBalanceListener(bisq.core.btc.wallet.BsqBalanceListener) BsqNode(bisq.core.dao.node.BsqNode) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) Res(bisq.core.locale.Res) TableView(javafx.scene.control.TableView) Pane(javafx.scene.layout.Pane) SortedList(javafx.collections.transformation.SortedList) HBox(javafx.scene.layout.HBox) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder(bisq.desktop.util.FormBuilder) TxOutput(bisq.core.dao.blockchain.vo.TxOutput) Collectors(java.util.stream.Collectors) BsqWalletService(bisq.core.btc.wallet.BsqWalletService) BsqBalanceUtil(bisq.desktop.main.dao.wallet.BsqBalanceUtil) List(java.util.List) Preferences(bisq.core.user.Preferences) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) GUIUtil(bisq.desktop.util.GUIUtil) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) ActivatableView(bisq.desktop.common.view.ActivatableView) FXCollections(javafx.collections.FXCollections) DoubleProperty(javafx.beans.property.DoubleProperty) BsqNodeProvider(bisq.core.dao.node.BsqNodeProvider) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) TableCell(javafx.scene.control.TableCell) ProgressBar(javafx.scene.control.ProgressBar) Insets(javafx.geometry.Insets) AddressWithIconAndDirection(bisq.desktop.components.AddressWithIconAndDirection) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) GridPane(javafx.scene.layout.GridPane) Label(javafx.scene.control.Label) DaoPeriodService(bisq.core.dao.DaoPeriodService) Tx(bisq.core.dao.blockchain.vo.Tx) AwesomeDude(de.jensd.fx.fontawesome.AwesomeDude) BisqEnvironment(bisq.core.app.BisqEnvironment) TxType(bisq.core.dao.blockchain.vo.TxType) BsqFormatter(bisq.desktop.util.BsqFormatter) TxOutputType(bisq.core.dao.blockchain.vo.TxOutputType) ChangeListener(javafx.beans.value.ChangeListener) TxType(bisq.core.dao.blockchain.vo.TxType) Tooltip(javafx.scene.control.Tooltip) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) AddressWithIconAndDirection(bisq.desktop.components.AddressWithIconAndDirection) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 63 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.

the class ReservedView method setDetailsColumnCellFactory.

private void setDetailsColumnCellFactory() {
    detailsColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
    detailsColumn.setCellFactory(new Callback<TableColumn<ReservedListItem, ReservedListItem>, TableCell<ReservedListItem, ReservedListItem>>() {

        @Override
        public TableCell<ReservedListItem, ReservedListItem> call(TableColumn<ReservedListItem, ReservedListItem> column) {
            return new TableCell<ReservedListItem, ReservedListItem>() {

                private HyperlinkWithIcon field;

                @Override
                public void updateItem(final ReservedListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        Optional<Tradable> tradableOptional = getTradable(item);
                        if (tradableOptional.isPresent()) {
                            field = new HyperlinkWithIcon(Res.get("funds.reserved.reserved", item.getAddressEntry().getShortOfferId()), AwesomeIcon.INFO_SIGN);
                            field.setOnAction(event -> openDetailPopup(item));
                            field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
                            setGraphic(field);
                        } else if (item.getAddressEntry().getContext() == AddressEntry.Context.ARBITRATOR) {
                            setGraphic(new AutoTooltipLabel(Res.get("shared.arbitratorsFee")));
                        } else {
                            setGraphic(new AutoTooltipLabel(Res.get("shared.noDetailsAvailable")));
                        }
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
}
Also used : GUIUtil(bisq.desktop.util.GUIUtil) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) ActivatableView(bisq.desktop.common.view.ActivatableView) Transaction(org.bitcoinj.core.Transaction) OfferDetailsWindow(bisq.desktop.main.overlays.windows.OfferDetailsWindow) OpenOffer(bisq.core.offer.OpenOffer) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) Coin(org.bitcoinj.core.Coin) FXCollections(javafx.collections.FXCollections) Tradable(bisq.core.trade.Tradable) VBox(javafx.scene.layout.VBox) FxmlView(bisq.desktop.common.view.FxmlView) BSFormatter(bisq.desktop.util.BSFormatter) TableColumn(javafx.scene.control.TableColumn) Inject(javax.inject.Inject) BalanceListener(bisq.core.btc.listeners.BalanceListener) TableCell(javafx.scene.control.TableCell) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) Res(bisq.core.locale.Res) TableView(javafx.scene.control.TableView) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) SortedList(javafx.collections.transformation.SortedList) TradeDetailsWindow(bisq.desktop.main.overlays.windows.TradeDetailsWindow) Trade(bisq.core.trade.Trade) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Collectors(java.util.stream.Collectors) OpenOfferManager(bisq.core.offer.OpenOfferManager) FXML(javafx.fxml.FXML) AddressEntry(bisq.core.btc.AddressEntry) TradeManager(bisq.core.trade.TradeManager) Preferences(bisq.core.user.Preferences) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) Optional(java.util.Optional) Tooltip(javafx.scene.control.Tooltip) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon)

Example 64 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.

the class ReservedView method initialize.

@Override
public void initialize() {
    dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime")));
    detailsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.details")));
    addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
    balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())));
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.reserved.noFunds")));
    setDateColumnCellFactory();
    setDetailsColumnCellFactory();
    setAddressColumnCellFactory();
    setBalanceColumnCellFactory();
    addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
    detailsColumn.setComparator((o1, o2) -> o1.getOpenOffer().getId().compareTo(o2.getOpenOffer().getId()));
    balanceColumn.setComparator((o1, o2) -> o1.getBalance().compareTo(o2.getBalance()));
    dateColumn.setComparator((o1, o2) -> {
        if (getTradable(o1).isPresent() && getTradable(o2).isPresent())
            return getTradable(o2).get().getDate().compareTo(getTradable(o1).get().getDate());
        else
            return 0;
    });
    tableView.getSortOrder().add(dateColumn);
    dateColumn.setSortType(TableColumn.SortType.DESCENDING);
    balanceListener = new BalanceListener() {

        @Override
        public void onBalanceChanged(Coin balance, Transaction tx) {
            updateList();
        }
    };
    openOfferListChangeListener = c -> updateList();
    tradeListChangeListener = c -> updateList();
}
Also used : Coin(org.bitcoinj.core.Coin) BalanceListener(bisq.core.btc.listeners.BalanceListener) Transaction(org.bitcoinj.core.Transaction) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 65 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.

the class AwesomeFontDemo method start.

@Override
public void start(Stage primaryStage) {
    Pane root = new FlowPane();
    List<AwesomeIcon> values = new ArrayList<>(Arrays.asList(AwesomeIcon.values()));
    values.sort((o1, o2) -> o1.name().compareTo(o2.name()));
    for (AwesomeIcon icon : values) {
        Label label = new AutoTooltipLabel();
        Button button = new AutoTooltipButton(icon.name(), label);
        AwesomeDude.setIcon(label, icon);
        root.getChildren().add(button);
    }
    primaryStage.setScene(new Scene(root, 900, 850));
    primaryStage.show();
}
Also used : Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ArrayList(java.util.ArrayList) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FlowPane(javafx.scene.layout.FlowPane) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Scene(javafx.scene.Scene) FlowPane(javafx.scene.layout.FlowPane) Pane(javafx.scene.layout.Pane) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton)

Aggregations

AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)90 Label (javafx.scene.control.Label)55 Insets (javafx.geometry.Insets)45 HBox (javafx.scene.layout.HBox)29 TableCell (javafx.scene.control.TableCell)27 TableColumn (javafx.scene.control.TableColumn)27 VBox (javafx.scene.layout.VBox)23 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)22 Button (javafx.scene.control.Button)22 ImageView (javafx.scene.image.ImageView)19 Res (bisq.core.locale.Res)18 InputTextField (bisq.desktop.components.InputTextField)18 Popup (bisq.desktop.main.overlays.popups.Popup)17 FxmlView (bisq.desktop.common.view.FxmlView)16 Callback (javafx.util.Callback)16 Inject (javax.inject.Inject)16 Coin (org.bitcoinj.core.Coin)16 Tooltip (javafx.scene.control.Tooltip)15 TableView (javafx.scene.control.TableView)14 BSFormatter (bisq.desktop.util.BSFormatter)13