Search in sources :

Example 1 with PeerInfoIcon

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

the class ClosedTradesView method setAvatarColumnCellFactory.

@SuppressWarnings("UnusedReturnValue")
private TableColumn<ClosedTradableListItem, ClosedTradableListItem> setAvatarColumnCellFactory() {
    avatarColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    avatarColumn.setCellFactory(new Callback<TableColumn<ClosedTradableListItem, ClosedTradableListItem>, TableCell<ClosedTradableListItem, ClosedTradableListItem>>() {

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

                @Override
                public void updateItem(final ClosedTradableListItem newItem, boolean empty) {
                    super.updateItem(newItem, empty);
                    if (newItem != null && !empty && newItem.getTradable() instanceof Trade) {
                        Trade trade = (Trade) newItem.getTradable();
                        int numPastTrades = model.getNumPastTrades(trade);
                        final NodeAddress tradingPeerNodeAddress = trade.getTradingPeerNodeAddress();
                        final Offer offer = trade.getOffer();
                        String role = Res.get("peerInfoIcon.tooltip.tradePeer");
                        Node peerInfoIcon = new PeerInfoIcon(tradingPeerNodeAddress, role, numPastTrades, privateNotificationManager, offer, preferences, model.accountAgeWitnessService, formatter, useDevPrivilegeKeys);
                        setPadding(new Insets(1, 0, 0, 0));
                        setGraphic(peerInfoIcon);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });
    return avatarColumn;
}
Also used : Insets(javafx.geometry.Insets) Node(javafx.scene.Node) PeerInfoIcon(bisq.desktop.components.PeerInfoIcon) TableColumn(javafx.scene.control.TableColumn) Trade(bisq.core.trade.Trade) TableCell(javafx.scene.control.TableCell) OpenOffer(bisq.core.offer.OpenOffer) Offer(bisq.core.offer.Offer) NodeAddress(bisq.network.p2p.NodeAddress)

Example 2 with PeerInfoIcon

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

the class OfferBookView method getAvatarColumn.

private TableColumn<OfferBookListItem, OfferBookListItem> getAvatarColumn() {
    TableColumn<OfferBookListItem, OfferBookListItem> column = new AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem>(Res.get("offerbook.trader")) {

        {
            setMinWidth(80);
            setMaxWidth(80);
            setSortable(true);
        }
    };
    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>() {

                @Override
                public void updateItem(final OfferBookListItem newItem, boolean empty) {
                    super.updateItem(newItem, empty);
                    if (newItem != null && !empty) {
                        final Offer offer = newItem.getOffer();
                        final NodeAddress makersNodeAddress = offer.getOwnerNodeAddress();
                        String role = Res.get("peerInfoIcon.tooltip.maker");
                        int numTrades = model.getNumTrades(offer);
                        PeerInfoIcon peerInfoIcon = new PeerInfoIcon(makersNodeAddress, role, numTrades, privateNotificationManager, offer, model.preferences, model.accountAgeWitnessService, formatter, useDevPrivilegeKeys);
                        setGraphic(peerInfoIcon);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });
    return column;
}
Also used : PeerInfoIcon(bisq.desktop.components.PeerInfoIcon) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) Offer(bisq.core.offer.Offer) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) NodeAddress(bisq.network.p2p.NodeAddress)

Example 3 with PeerInfoIcon

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

the class PendingTradesView method setAvatarColumnCellFactory.

@SuppressWarnings("UnusedReturnValue")
private TableColumn<PendingTradesListItem, PendingTradesListItem> setAvatarColumnCellFactory() {
    avatarColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    avatarColumn.setCellFactory(new Callback<TableColumn<PendingTradesListItem, PendingTradesListItem>, TableCell<PendingTradesListItem, PendingTradesListItem>>() {

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

                @Override
                public void updateItem(final PendingTradesListItem newItem, boolean empty) {
                    super.updateItem(newItem, empty);
                    if (!empty && newItem != null) {
                        final Trade trade = newItem.getTrade();
                        final NodeAddress tradingPeerNodeAddress = trade.getTradingPeerNodeAddress();
                        int numPastTrades = model.getNumPastTrades(trade);
                        final Offer offer = trade.getOffer();
                        String role = Res.get("peerInfoIcon.tooltip.tradePeer");
                        Node peerInfoIcon = new PeerInfoIcon(tradingPeerNodeAddress, role, numPastTrades, privateNotificationManager, offer, preferences, model.accountAgeWitnessService, formatter, useDevPrivilegeKeys);
                        setPadding(new Insets(1, 0, 0, 0));
                        setGraphic(peerInfoIcon);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });
    return avatarColumn;
}
Also used : Insets(javafx.geometry.Insets) Node(javafx.scene.Node) PeerInfoIcon(bisq.desktop.components.PeerInfoIcon) TableColumn(javafx.scene.control.TableColumn) Trade(bisq.core.trade.Trade) TableCell(javafx.scene.control.TableCell) Offer(bisq.core.offer.Offer) NodeAddress(bisq.network.p2p.NodeAddress)

Aggregations

Offer (bisq.core.offer.Offer)3 PeerInfoIcon (bisq.desktop.components.PeerInfoIcon)3 NodeAddress (bisq.network.p2p.NodeAddress)3 TableCell (javafx.scene.control.TableCell)3 TableColumn (javafx.scene.control.TableColumn)3 Trade (bisq.core.trade.Trade)2 Insets (javafx.geometry.Insets)2 Node (javafx.scene.Node)2 OpenOffer (bisq.core.offer.OpenOffer)1 AutoTooltipTableColumn (bisq.desktop.components.AutoTooltipTableColumn)1