Search in sources :

Example 26 with AutoTooltipLabel

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

the class FailedTradesView method initialize.

@Override
public void initialize() {
    priceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.price")));
    amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())));
    volumeColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amount")));
    marketColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.market")));
    directionColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.offerType")));
    dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime")));
    tradeIdColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.tradeId")));
    stateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.state")));
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noItems", Res.get("shared.trades"))));
    setTradeIdColumnCellFactory();
    setDirectionColumnCellFactory();
    setAmountColumnCellFactory();
    setPriceColumnCellFactory();
    setVolumeColumnCellFactory();
    setDateColumnCellFactory();
    setMarketColumnCellFactory();
    setStateColumnCellFactory();
    tradeIdColumn.setComparator((o1, o2) -> o1.getTrade().getId().compareTo(o2.getTrade().getId()));
    dateColumn.setComparator((o1, o2) -> o1.getTrade().getDate().compareTo(o2.getTrade().getDate()));
    priceColumn.setComparator((o1, o2) -> o1.getTrade().getTradePrice().compareTo(o2.getTrade().getTradePrice()));
    volumeColumn.setComparator((o1, o2) -> {
        if (o1.getTrade().getTradeVolume() != null && o2.getTrade().getTradeVolume() != null)
            return o1.getTrade().getTradeVolume().compareTo(o2.getTrade().getTradeVolume());
        else
            return 0;
    });
    amountColumn.setComparator((o1, o2) -> {
        if (o1.getTrade().getTradeAmount() != null && o2.getTrade().getTradeAmount() != null)
            return o1.getTrade().getTradeAmount().compareTo(o2.getTrade().getTradeAmount());
        else
            return 0;
    });
    stateColumn.setComparator((o1, o2) -> model.getState(o1).compareTo(model.getState(o2)));
    marketColumn.setComparator((o1, o2) -> model.getMarketLabel(o1).compareTo(model.getMarketLabel(o2)));
    dateColumn.setSortType(TableColumn.SortType.DESCENDING);
    tableView.getSortOrder().add(dateColumn);
}
Also used : AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 27 with AutoTooltipLabel

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

the class FailedTradesView method setStateColumnCellFactory.

private void setStateColumnCellFactory() {
    stateColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    stateColumn.setCellFactory(new Callback<TableColumn<FailedTradesListItem, FailedTradesListItem>, TableCell<FailedTradesListItem, FailedTradesListItem>>() {

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

                @Override
                public void updateItem(final FailedTradesListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null)
                        setGraphic(new AutoTooltipLabel(model.getState(item)));
                    else
                        setGraphic(null);
                }
            };
        }
    });
}
Also used : TableCell(javafx.scene.control.TableCell) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) TableColumn(javafx.scene.control.TableColumn)

Example 28 with AutoTooltipLabel

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

the class PendingTradesView method setRoleColumnCellFactory.

private void setRoleColumnCellFactory() {
    roleColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    roleColumn.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 item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty)
                        setGraphic(new AutoTooltipLabel(model.getMyRole(item)));
                    else
                        setGraphic(null);
                }
            };
        }
    });
}
Also used : TableCell(javafx.scene.control.TableCell) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) TableColumn(javafx.scene.control.TableColumn)

Example 29 with AutoTooltipLabel

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

the class PendingTradesView method setPaymentMethodColumnCellFactory.

private void setPaymentMethodColumnCellFactory() {
    paymentMethodColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    paymentMethodColumn.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 item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty)
                        setGraphic(new AutoTooltipLabel(model.getPaymentMethod(item)));
                    else
                        setGraphic(null);
                }
            };
        }
    });
}
Also used : TableCell(javafx.scene.control.TableCell) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) TableColumn(javafx.scene.control.TableColumn)

Example 30 with AutoTooltipLabel

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

the class PendingTradesView method setVolumeColumnCellFactory.

private void setVolumeColumnCellFactory() {
    volumeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
    volumeColumn.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 item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty)
                        setGraphic(new AutoTooltipLabel(formatter.formatVolumeWithCode(item.getTrade().getTradeVolume())));
                    else
                        setGraphic(null);
                }
            };
        }
    });
}
Also used : TableCell(javafx.scene.control.TableCell) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) TableColumn(javafx.scene.control.TableColumn)

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