Search in sources :

Example 1 with AddressWithIconAndDirection

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

the class TransactionsView method setAddressColumnCellFactory.

private void setAddressColumnCellFactory() {
    addressColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
    addressColumn.setCellFactory(new Callback<TableColumn<TransactionsListItem, TransactionsListItem>, TableCell<TransactionsListItem, TransactionsListItem>>() {

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

                private AddressWithIconAndDirection field;

                @Override
                public void updateItem(final TransactionsListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        String addressString = item.getAddressString();
                        field = new AddressWithIconAndDirection(item.getDirection(), addressString, AwesomeIcon.EXTERNAL_LINK, item.getReceived());
                        field.setOnAction(event -> openAddressInBlockExplorer(item));
                        field.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", addressString)));
                        setGraphic(field);
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
}
Also used : Button(javafx.scene.control.Button) EventHandler(javafx.event.EventHandler) Transaction(org.bitcoinj.core.Transaction) OpenOffer(bisq.core.offer.OpenOffer) Utilities(bisq.common.util.Utilities) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) Coin(org.bitcoinj.core.Coin) Date(java.util.Date) CSVEntryConverter(com.googlecode.jcsv.writer.CSVEntryConverter) VBox(javafx.scene.layout.VBox) BSFormatter(bisq.desktop.util.BSFormatter) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) Res(bisq.core.locale.Res) Locale(java.util.Locale) Map(java.util.Map) TableView(javafx.scene.control.TableView) DateFormat(java.text.DateFormat) SortedList(javafx.collections.transformation.SortedList) Popup(bisq.desktop.main.overlays.popups.Popup) P2PService(bisq.network.p2p.P2PService) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) KeyEvent(javafx.scene.input.KeyEvent) Collectors(java.util.stream.Collectors) ECKey(org.bitcoinj.core.ECKey) FXML(javafx.fxml.FXML) List(java.util.List) Script(org.bitcoinj.script.Script) WalletsSetup(bisq.core.btc.wallet.WalletsSetup) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Preferences(bisq.core.user.Preferences) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) GUIUtil(bisq.desktop.util.GUIUtil) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) Scene(javafx.scene.Scene) WalletEventListener(org.bitcoinj.wallet.listeners.WalletEventListener) ActivatableView(bisq.desktop.common.view.ActivatableView) TransactionConfidence(org.bitcoinj.core.TransactionConfidence) OfferDetailsWindow(bisq.desktop.main.overlays.windows.OfferDetailsWindow) Wallet(org.bitcoinj.wallet.Wallet) HashMap(java.util.HashMap) Tradable(bisq.core.trade.Tradable) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) ArrayList(java.util.ArrayList) Tuple4(bisq.common.util.Tuple4) Inject(javax.inject.Inject) Tuple2(bisq.common.util.Tuple2) TableCell(javafx.scene.control.TableCell) AddressWithIconAndDirection(bisq.desktop.components.AddressWithIconAndDirection) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) Nullable(javax.annotation.Nullable) KeyCode(javafx.scene.input.KeyCode) TradeDetailsWindow(bisq.desktop.main.overlays.windows.TradeDetailsWindow) Trade(bisq.core.trade.Trade) Stage(javafx.stage.Stage) Comparator(java.util.Comparator) Tooltip(javafx.scene.control.Tooltip) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) AddressWithIconAndDirection(bisq.desktop.components.AddressWithIconAndDirection)

Example 2 with AddressWithIconAndDirection

use of bisq.desktop.components.AddressWithIconAndDirection 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)

Aggregations

BtcWalletService (bisq.core.btc.wallet.BtcWalletService)2 Res (bisq.core.locale.Res)2 Preferences (bisq.core.user.Preferences)2 ActivatableView (bisq.desktop.common.view.ActivatableView)2 FxmlView (bisq.desktop.common.view.FxmlView)2 AddressWithIconAndDirection (bisq.desktop.components.AddressWithIconAndDirection)2 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)2 HyperlinkWithIcon (bisq.desktop.components.HyperlinkWithIcon)2 GUIUtil (bisq.desktop.util.GUIUtil)2 AwesomeIcon (de.jensd.fx.fontawesome.AwesomeIcon)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 ReadOnlyObjectWrapper (javafx.beans.property.ReadOnlyObjectWrapper)2 ObservableList (javafx.collections.ObservableList)2 SortedList (javafx.collections.transformation.SortedList)2 Tuple2 (bisq.common.util.Tuple2)1 Tuple4 (bisq.common.util.Tuple4)1 Utilities (bisq.common.util.Utilities)1