Search in sources :

Example 6 with ReadOnlyObjectWrapper

use of javafx.beans.property.ReadOnlyObjectWrapper in project bitsquare by bitsquare.

the class PendingTradesView method setTradeIdColumnCellFactory.

///////////////////////////////////////////////////////////////////////////////////////////
// CellFactories
///////////////////////////////////////////////////////////////////////////////////////////
private void setTradeIdColumnCellFactory() {
    idColumn.setCellValueFactory((pendingTradesListItem) -> new ReadOnlyObjectWrapper<>(pendingTradesListItem.getValue()));
    idColumn.setCellFactory(new Callback<TableColumn<PendingTradesListItem, PendingTradesListItem>, TableCell<PendingTradesListItem, PendingTradesListItem>>() {

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

                private HyperlinkWithIcon field;

                @Override
                public void updateItem(final PendingTradesListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        field = new HyperlinkWithIcon(item.getTrade().getShortId(), true);
                        field.setOnAction(event -> tradeDetailsWindow.show(item.getTrade()));
                        field.setTooltip(new Tooltip("Open popup for details"));
                        setGraphic(field);
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
}
Also used : EventHandler(javafx.event.EventHandler) Scene(javafx.scene.Scene) Popup(io.bitsquare.gui.main.overlays.popups.Popup) javafx.scene.control(javafx.scene.control) PeerInfoIcon(io.bitsquare.gui.components.PeerInfoIcon) VBox(javafx.scene.layout.VBox) KeyCombination(javafx.scene.input.KeyCombination) Inject(javax.inject.Inject) Insets(javafx.geometry.Insets) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) TradeDetailsWindow(io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow) Callback(javafx.util.Callback) BSFormatter(io.bitsquare.gui.util.BSFormatter) SortedList(javafx.collections.transformation.SortedList) KeyCode(javafx.scene.input.KeyCode) UserThread(io.bitsquare.common.UserThread) Node(javafx.scene.Node) KeyEvent(javafx.scene.input.KeyEvent) Subscription(org.fxmisc.easybind.Subscription) ActivatableViewAndModel(io.bitsquare.gui.common.view.ActivatableViewAndModel) PrivateNotificationManager(io.bitsquare.alert.PrivateNotificationManager) FXML(javafx.fxml.FXML) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) Priority(javafx.scene.layout.Priority) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) EasyBind(org.fxmisc.easybind.EasyBind) FxmlView(io.bitsquare.gui.common.view.FxmlView) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon)

Example 7 with ReadOnlyObjectWrapper

use of javafx.beans.property.ReadOnlyObjectWrapper in project bitsquare by bitsquare.

the class FailedTradesView method setTradeIdColumnCellFactory.

private void setTradeIdColumnCellFactory() {
    tradeIdColumn.setCellValueFactory((offerListItem) -> new ReadOnlyObjectWrapper<>(offerListItem.getValue()));
    tradeIdColumn.setCellFactory(new Callback<TableColumn<FailedTradesListItem, FailedTradesListItem>, TableCell<FailedTradesListItem, FailedTradesListItem>>() {

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

                private HyperlinkWithIcon field;

                @Override
                public void updateItem(final FailedTradesListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        field = new HyperlinkWithIcon(model.getTradeId(item), true);
                        field.setOnAction(event -> tradeDetailsWindow.show(item.getTrade()));
                        field.setTooltip(new Tooltip("Open popup for details"));
                        setGraphic(field);
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
}
Also used : FXML(javafx.fxml.FXML) Inject(javax.inject.Inject) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) javafx.scene.control(javafx.scene.control) TradeDetailsWindow(io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow) ActivatableViewAndModel(io.bitsquare.gui.common.view.ActivatableViewAndModel) FxmlView(io.bitsquare.gui.common.view.FxmlView) VBox(javafx.scene.layout.VBox) Callback(javafx.util.Callback) SortedList(javafx.collections.transformation.SortedList) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon)

Example 8 with ReadOnlyObjectWrapper

use of javafx.beans.property.ReadOnlyObjectWrapper in project bitsquare by bitsquare.

the class OpenOffersView method setRemoveColumnCellFactory.

private void setRemoveColumnCellFactory() {
    removeItemColumn.setCellValueFactory((offerListItem) -> new ReadOnlyObjectWrapper<>(offerListItem.getValue()));
    removeItemColumn.setCellFactory(new Callback<TableColumn<OpenOfferListItem, OpenOfferListItem>, TableCell<OpenOfferListItem, OpenOfferListItem>>() {

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

                final ImageView iconView = new ImageView();

                final Button button = new Button();

                {
                    iconView.setId("image-remove");
                    button.setText("Remove");
                    button.setGraphic(iconView);
                    button.setMinWidth(70);
                }

                @Override
                public void updateItem(final OpenOfferListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null) {
                        button.setOnAction(event -> onRemoveOpenOffer(item.getOpenOffer()));
                        setGraphic(button);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });
}
Also used : OpenOffer(io.bitsquare.trade.offer.OpenOffer) WithdrawalView(io.bitsquare.gui.main.funds.withdrawal.WithdrawalView) Popup(io.bitsquare.gui.main.overlays.popups.Popup) MainView(io.bitsquare.gui.main.MainView) javafx.scene.control(javafx.scene.control) Fiat(org.bitcoinj.utils.Fiat) OfferDetailsWindow(io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow) ActivatableViewAndModel(io.bitsquare.gui.common.view.ActivatableViewAndModel) VBox(javafx.scene.layout.VBox) FundsView(io.bitsquare.gui.main.funds.FundsView) FXML(javafx.fxml.FXML) Inject(javax.inject.Inject) Preferences(io.bitsquare.user.Preferences) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) Navigation(io.bitsquare.gui.Navigation) ImageView(javafx.scene.image.ImageView) FeePolicy(io.bitsquare.btc.FeePolicy) FxmlView(io.bitsquare.gui.common.view.FxmlView) Callback(javafx.util.Callback) SortedList(javafx.collections.transformation.SortedList) ImageView(javafx.scene.image.ImageView)

Example 9 with ReadOnlyObjectWrapper

use of javafx.beans.property.ReadOnlyObjectWrapper in project bitsquare by bitsquare.

the class ClosedTradesView method setTradeIdColumnCellFactory.

private void setTradeIdColumnCellFactory() {
    tradeIdColumn.setCellValueFactory((offerListItem) -> new ReadOnlyObjectWrapper<>(offerListItem.getValue()));
    tradeIdColumn.setCellFactory(new Callback<TableColumn<ClosedTradableListItem, ClosedTradableListItem>, TableCell<ClosedTradableListItem, ClosedTradableListItem>>() {

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

                private HyperlinkWithIcon field;

                @Override
                public void updateItem(final ClosedTradableListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        field = new HyperlinkWithIcon(model.getTradeId(item), true);
                        field.setOnAction(event -> {
                            Tradable tradable = item.getTradable();
                            if (tradable instanceof Trade)
                                tradeDetailsWindow.show((Trade) tradable);
                            else if (tradable instanceof OpenOffer)
                                offerDetailsWindow.show(tradable.getOffer());
                        });
                        field.setTooltip(new Tooltip("Open popup for details"));
                        setGraphic(field);
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
}
Also used : OpenOffer(io.bitsquare.trade.offer.OpenOffer) javafx.scene.control(javafx.scene.control) PeerInfoIcon(io.bitsquare.gui.components.PeerInfoIcon) Coin(org.bitcoinj.core.Coin) Trade(io.bitsquare.trade.Trade) CSVEntryConverter(com.googlecode.jcsv.writer.CSVEntryConverter) VBox(javafx.scene.layout.VBox) Tradable(io.bitsquare.trade.Tradable) GUIUtil(io.bitsquare.gui.util.GUIUtil) Inject(javax.inject.Inject) Insets(javafx.geometry.Insets) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) TradeDetailsWindow(io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow) Callback(javafx.util.Callback) BSFormatter(io.bitsquare.gui.util.BSFormatter) SortedList(javafx.collections.transformation.SortedList) Node(javafx.scene.Node) NodeAddress(io.bitsquare.p2p.NodeAddress) Fiat(org.bitcoinj.utils.Fiat) OfferDetailsWindow(io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow) ActivatableViewAndModel(io.bitsquare.gui.common.view.ActivatableViewAndModel) PrivateNotificationManager(io.bitsquare.alert.PrivateNotificationManager) FXML(javafx.fxml.FXML) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) Stage(javafx.stage.Stage) ObservableList(javafx.collections.ObservableList) FxmlView(io.bitsquare.gui.common.view.FxmlView) Tradable(io.bitsquare.trade.Tradable) OpenOffer(io.bitsquare.trade.offer.OpenOffer) Trade(io.bitsquare.trade.Trade) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon)

Example 10 with ReadOnlyObjectWrapper

use of javafx.beans.property.ReadOnlyObjectWrapper in project bitsquare by bitsquare.

the class TransactionsView method setTransactionColumnCellFactory.

private void setTransactionColumnCellFactory() {
    transactionColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
    transactionColumn.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 HyperlinkWithIcon hyperlinkWithIcon;

                @Override
                public void updateItem(final TransactionsListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        String transactionId = item.getTxId();
                        hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, AwesomeIcon.EXTERNAL_LINK);
                        hyperlinkWithIcon.setOnAction(event -> openTxInBlockExplorer(item));
                        hyperlinkWithIcon.setTooltip(new Tooltip("Open external blockchain explorer for " + "transaction: " + transactionId));
                        setGraphic(hyperlinkWithIcon);
                    } else {
                        setGraphic(null);
                        if (hyperlinkWithIcon != null)
                            hyperlinkWithIcon.setOnAction(null);
                    }
                }
            };
        }
    });
}
Also used : EventHandler(javafx.event.EventHandler) OpenOffer(io.bitsquare.trade.offer.OpenOffer) Scene(javafx.scene.Scene) Popup(io.bitsquare.gui.main.overlays.popups.Popup) java.util(java.util) javafx.scene.control(javafx.scene.control) AddressWithIconAndDirection(io.bitsquare.gui.components.AddressWithIconAndDirection) FXCollections(javafx.collections.FXCollections) DisputeManager(io.bitsquare.arbitration.DisputeManager) Trade(io.bitsquare.trade.Trade) CSVEntryConverter(com.googlecode.jcsv.writer.CSVEntryConverter) Tuple2(io.bitsquare.common.util.Tuple2) ActivatableView(io.bitsquare.gui.common.view.ActivatableView) VBox(javafx.scene.layout.VBox) Tradable(io.bitsquare.trade.Tradable) GUIUtil(io.bitsquare.gui.util.GUIUtil) KeyCombination(javafx.scene.input.KeyCombination) Inject(javax.inject.Inject) TradeManager(io.bitsquare.trade.TradeManager) FailedTradesManager(io.bitsquare.trade.failed.FailedTradesManager) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) WalletService(io.bitsquare.btc.WalletService) TradeDetailsWindow(io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow) FeePolicy(io.bitsquare.btc.FeePolicy) Callback(javafx.util.Callback) Nullable(javax.annotation.Nullable) DateFormat(java.text.DateFormat) BSFormatter(io.bitsquare.gui.util.BSFormatter) SortedList(javafx.collections.transformation.SortedList) KeyCode(javafx.scene.input.KeyCode) Utilities(io.bitsquare.common.util.Utilities) OfferDetailsWindow(io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow) ClosedTradableManager(io.bitsquare.trade.closed.ClosedTradableManager) KeyEvent(javafx.scene.input.KeyEvent) Collectors(java.util.stream.Collectors) org.bitcoinj.core(org.bitcoinj.core) FXML(javafx.fxml.FXML) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) Preferences(io.bitsquare.user.Preferences) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) Script(org.bitcoinj.script.Script) Stream(java.util.stream.Stream) Stage(javafx.stage.Stage) Tuple4(io.bitsquare.common.util.Tuple4) OpenOfferManager(io.bitsquare.trade.offer.OpenOfferManager) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) FxmlView(io.bitsquare.gui.common.view.FxmlView) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon)

Aggregations

ReadOnlyObjectWrapper (javafx.beans.property.ReadOnlyObjectWrapper)59 Callback (javafx.util.Callback)52 Inject (javax.inject.Inject)49 SortedList (javafx.collections.transformation.SortedList)44 VBox (javafx.scene.layout.VBox)39 ObservableList (javafx.collections.ObservableList)37 FXML (javafx.fxml.FXML)34 TableColumn (javafx.scene.control.TableColumn)34 TableView (javafx.scene.control.TableView)34 Res (bisq.core.locale.Res)30 FxmlView (bisq.desktop.common.view.FxmlView)30 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)30 AwesomeIcon (de.jensd.fx.fontawesome.AwesomeIcon)30 TableCell (javafx.scene.control.TableCell)30 Tooltip (javafx.scene.control.Tooltip)30 HyperlinkWithIcon (bisq.desktop.components.HyperlinkWithIcon)29 ListChangeListener (javafx.collections.ListChangeListener)25 Insets (javafx.geometry.Insets)25 Coin (org.bitcoinj.core.Coin)24 GUIUtil (bisq.desktop.util.GUIUtil)23