Search in sources :

Example 6 with HyperlinkWithIcon

use of io.bitsquare.gui.components.HyperlinkWithIcon in project bitsquare by bitsquare.

the class DisplayAlertMessageWindow method addContent.

///////////////////////////////////////////////////////////////////////////////////////////
// Protected
///////////////////////////////////////////////////////////////////////////////////////////
private void addContent() {
    checkNotNull(alert, "alertMessage must not be null");
    addMultilineLabel(gridPane, ++rowIndex, alert.message, 10);
    if (alert.isUpdateInfo) {
        headLine = "Important update information!";
        headLineLabel.setStyle("-fx-text-fill: -fx-accent;  -fx-font-weight: bold;  -fx-font-size: 22;");
        String url = "https://bitsquare.io/downloads";
        HyperlinkWithIcon hyperlinkWithIcon = addLabelHyperlinkWithIcon(gridPane, ++rowIndex, "Download:", url, url).second;
        hyperlinkWithIcon.setMaxWidth(550);
    } else {
        headLine = "Important information!";
        headLineLabel.setStyle("-fx-text-fill: -bs-error-red;  -fx-font-weight: bold;  -fx-font-size: 22;");
    }
    closeButton = new Button("Close");
    closeButton.setOnAction(e -> {
        hide();
        closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
    });
    GridPane.setRowIndex(closeButton, ++rowIndex);
    GridPane.setColumnIndex(closeButton, 1);
    gridPane.getChildren().add(closeButton);
    GridPane.setMargin(closeButton, new Insets(10, 0, 0, 0));
}
Also used : Insets(javafx.geometry.Insets) Button(javafx.scene.control.Button) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) FormBuilder.addLabelHyperlinkWithIcon(io.bitsquare.gui.util.FormBuilder.addLabelHyperlinkWithIcon)

Example 7 with HyperlinkWithIcon

use of io.bitsquare.gui.components.HyperlinkWithIcon 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)

Example 8 with HyperlinkWithIcon

use of io.bitsquare.gui.components.HyperlinkWithIcon in project bitsquare by bitsquare.

the class WithdrawalView method setAddressColumnCellFactory.

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

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

                private HyperlinkWithIcon hyperlinkWithIcon;

                @Override
                public void updateItem(final WithdrawalListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        String address = item.getAddressString();
                        hyperlinkWithIcon = new HyperlinkWithIcon(address, AwesomeIcon.EXTERNAL_LINK);
                        hyperlinkWithIcon.setOnAction(event -> openBlockExplorer(item));
                        hyperlinkWithIcon.setTooltip(new Tooltip("Open external blockchain explorer for " + "address: " + address));
                        setGraphic(hyperlinkWithIcon);
                    } else {
                        setGraphic(null);
                        if (hyperlinkWithIcon != null)
                            hyperlinkWithIcon.setOnAction(null);
                    }
                }
            };
        }
    });
}
Also used : MathUtils(io.bitsquare.common.util.MathUtils) BtcAddressValidator(io.bitsquare.gui.util.validation.BtcAddressValidator) Popup(io.bitsquare.gui.main.overlays.popups.Popup) java.util(java.util) javafx.scene.control(javafx.scene.control) FXCollections(javafx.collections.FXCollections) Trade(io.bitsquare.trade.Trade) ActivatableView(io.bitsquare.gui.common.view.ActivatableView) VBox(javafx.scene.layout.VBox) BalanceListener(io.bitsquare.btc.listeners.BalanceListener) Tradable(io.bitsquare.trade.Tradable) StringUtils(org.apache.commons.lang3.StringUtils) GUIUtil(io.bitsquare.gui.util.GUIUtil) Inject(javax.inject.Inject) DevFlags(io.bitsquare.app.DevFlags) TradeManager(io.bitsquare.trade.TradeManager) FailedTradesManager(io.bitsquare.trade.failed.FailedTradesManager) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) Callback(javafx.util.Callback) KeyParameter(org.spongycastle.crypto.params.KeyParameter) BSFormatter(io.bitsquare.gui.util.BSFormatter) SortedList(javafx.collections.transformation.SortedList) WalletPasswordWindow(io.bitsquare.gui.main.overlays.windows.WalletPasswordWindow) ObjectProperty(javafx.beans.property.ObjectProperty) UserThread(io.bitsquare.common.UserThread) ClosedTradableManager(io.bitsquare.trade.closed.ClosedTradableManager) Collectors(java.util.stream.Collectors) FutureCallback(com.google.common.util.concurrent.FutureCallback) org.bitcoinj.core(org.bitcoinj.core) FXML(javafx.fxml.FXML) TimeUnit(java.util.concurrent.TimeUnit) Preferences(io.bitsquare.user.Preferences) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) io.bitsquare.btc(io.bitsquare.btc) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) FxmlView(io.bitsquare.gui.common.view.FxmlView) ChangeListener(javafx.beans.value.ChangeListener) NotNull(org.jetbrains.annotations.NotNull) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon)

Example 9 with HyperlinkWithIcon

use of io.bitsquare.gui.components.HyperlinkWithIcon in project bitsquare by bitsquare.

the class DepositView method setAddressColumnCellFactory.

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

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

                private HyperlinkWithIcon field;

                @Override
                public void updateItem(final DepositListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        String addressString = item.getAddressString();
                        field = new HyperlinkWithIcon(addressString, AwesomeIcon.EXTERNAL_LINK);
                        field.setOnAction(event -> {
                            openBlockExplorer(item);
                            tableView.getSelectionModel().select(item);
                        });
                        field.setTooltip(new Tooltip("Open external blockchain explorer for " + "address: " + addressString));
                        setGraphic(field);
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
}
Also used : QRCodeWindow(io.bitsquare.gui.main.overlays.windows.QRCodeWindow) HPos(javafx.geometry.HPos) Popup(io.bitsquare.gui.main.overlays.popups.Popup) Transaction(org.bitcoinj.core.Transaction) javafx.scene.control(javafx.scene.control) Coin(org.bitcoinj.core.Coin) Restrictions(io.bitsquare.btc.Restrictions) FXCollections(javafx.collections.FXCollections) Tuple2(io.bitsquare.common.util.Tuple2) ActivatableView(io.bitsquare.gui.common.view.ActivatableView) VBox(javafx.scene.layout.VBox) BalanceListener(io.bitsquare.btc.listeners.BalanceListener) GUIUtil(io.bitsquare.gui.util.GUIUtil) Inject(javax.inject.Inject) DevFlags(io.bitsquare.app.DevFlags) Insets(javafx.geometry.Insets) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) QRCode(net.glxn.qrgen.QRCode) ByteArrayInputStream(java.io.ByteArrayInputStream) WalletService(io.bitsquare.btc.WalletService) Layout(io.bitsquare.gui.util.Layout) ImageType(net.glxn.qrgen.image.ImageType) Callback(javafx.util.Callback) AddressEntry(io.bitsquare.btc.AddressEntry) GridPane(javafx.scene.layout.GridPane) BSFormatter(io.bitsquare.gui.util.BSFormatter) SortedList(javafx.collections.transformation.SortedList) InputTextField(io.bitsquare.gui.components.InputTextField) UserThread(io.bitsquare.common.UserThread) Subscription(org.fxmisc.easybind.Subscription) BitcoinURI(org.bitcoinj.uri.BitcoinURI) FXML(javafx.fxml.FXML) TimeUnit(java.util.concurrent.TimeUnit) Preferences(io.bitsquare.user.Preferences) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) FormBuilder(io.bitsquare.gui.util.FormBuilder) EasyBind(org.fxmisc.easybind.EasyBind) ImageView(javafx.scene.image.ImageView) AddressTextField(io.bitsquare.gui.components.AddressTextField) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) FxmlView(io.bitsquare.gui.common.view.FxmlView) ChangeListener(javafx.beans.value.ChangeListener) NotNull(org.jetbrains.annotations.NotNull) Image(javafx.scene.image.Image) TitledGroupBg(io.bitsquare.gui.components.TitledGroupBg) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon)

Example 10 with HyperlinkWithIcon

use of io.bitsquare.gui.components.HyperlinkWithIcon in project bitsquare by bitsquare.

the class TransactionsView method setDetailsColumnCellFactory.

private void setDetailsColumnCellFactory() {
    detailsColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
    detailsColumn.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 field;

                @Override
                public void updateItem(final TransactionsListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        if (item.getDetailsAvailable()) {
                            field = new HyperlinkWithIcon(item.getDetails(), AwesomeIcon.INFO_SIGN);
                            field.setOnAction(event -> openDetailPopup(item));
                            field.setTooltip(new Tooltip("Open popup for details"));
                            setGraphic(field);
                        } else {
                            setGraphic(new Label(item.getDetails()));
                        }
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.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

HyperlinkWithIcon (io.bitsquare.gui.components.HyperlinkWithIcon)17 FxmlView (io.bitsquare.gui.common.view.FxmlView)14 ReadOnlyObjectWrapper (javafx.beans.property.ReadOnlyObjectWrapper)14 javafx.scene.control (javafx.scene.control)14 Callback (javafx.util.Callback)14 Inject (javax.inject.Inject)14 SortedList (javafx.collections.transformation.SortedList)13 Popup (io.bitsquare.gui.main.overlays.popups.Popup)12 BSFormatter (io.bitsquare.gui.util.BSFormatter)12 FXML (javafx.fxml.FXML)12 VBox (javafx.scene.layout.VBox)12 GUIUtil (io.bitsquare.gui.util.GUIUtil)11 TradeDetailsWindow (io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow)10 ObservableList (javafx.collections.ObservableList)10 AwesomeIcon (de.jensd.fx.fontawesome.AwesomeIcon)9 ActivatableView (io.bitsquare.gui.common.view.ActivatableView)9 OfferDetailsWindow (io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow)9 Trade (io.bitsquare.trade.Trade)9 Tradable (io.bitsquare.trade.Tradable)8 TradeManager (io.bitsquare.trade.TradeManager)8