Search in sources :

Example 1 with HyperlinkWithIcon

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

the class TraderDisputeView method getTradeIdColumn.

private TableColumn<Dispute, Dispute> getTradeIdColumn() {
    TableColumn<Dispute, Dispute> column = new TableColumn<Dispute, Dispute>("Trade ID") {

        {
            setMinWidth(110);
        }
    };
    column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
    column.setCellFactory(new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {

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

                private HyperlinkWithIcon field;

                @Override
                public void updateItem(final Dispute item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        field = new HyperlinkWithIcon(item.getShortTradeId(), true);
                        Optional<Trade> tradeOptional = tradeManager.getTradeById(item.getTradeId());
                        if (tradeOptional.isPresent()) {
                            field.setMouseTransparent(false);
                            field.setTooltip(new Tooltip("Open popup for details"));
                            field.setOnAction(event -> tradeDetailsWindow.show(tradeOptional.get()));
                        } else {
                            field.setMouseTransparent(true);
                        }
                        setGraphic(field);
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
    return column;
}
Also used : EventHandler(javafx.event.EventHandler) PubKeyRing(io.bitsquare.common.crypto.PubKeyRing) Popup(io.bitsquare.gui.main.overlays.popups.Popup) javafx.scene.layout(javafx.scene.layout) javafx.scene.control(javafx.scene.control) URL(java.net.URL) ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) DisputeManager(io.bitsquare.arbitration.DisputeManager) Trade(io.bitsquare.trade.Trade) ActivatableView(io.bitsquare.gui.common.view.ActivatableView) DisputeCommunicationMessage(io.bitsquare.arbitration.messages.DisputeCommunicationMessage) GUIUtil(io.bitsquare.gui.util.GUIUtil) KeyCombination(javafx.scene.input.KeyCombination) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) KeyRing(io.bitsquare.common.crypto.KeyRing) DisputeSummaryWindow(io.bitsquare.gui.main.overlays.windows.DisputeSummaryWindow) ParseException(java.text.ParseException) DateFormat(java.text.DateFormat) SortedList(javafx.collections.transformation.SortedList) TableGroupHeadline(io.bitsquare.gui.components.TableGroupHeadline) Contract(io.bitsquare.trade.Contract) FilteredList(javafx.collections.transformation.FilteredList) KeyEvent(javafx.scene.input.KeyEvent) Subscription(org.fxmisc.easybind.Subscription) PrivateNotificationManager(io.bitsquare.alert.PrivateNotificationManager) Attachment(io.bitsquare.arbitration.payload.Attachment) Paint(javafx.scene.paint.Paint) ByteStreams(com.google.common.io.ByteStreams) Dispute(io.bitsquare.arbitration.Dispute) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) Version(io.bitsquare.app.Version) Scene(javafx.scene.Scene) java.util(java.util) P2PService(io.bitsquare.p2p.P2PService) SimpleDateFormat(java.text.SimpleDateFormat) Connection(io.bitsquare.p2p.network.Connection) Timer(io.bitsquare.common.Timer) Inject(javax.inject.Inject) TradeManager(io.bitsquare.trade.TradeManager) Lists(com.google.common.collect.Lists) Insets(javafx.geometry.Insets) TradeDetailsWindow(io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow) TextAlignment(javafx.scene.text.TextAlignment) Callback(javafx.util.Callback) Nullable(javax.annotation.Nullable) BSFormatter(io.bitsquare.gui.util.BSFormatter) KeyCode(javafx.scene.input.KeyCode) InputTextField(io.bitsquare.gui.components.InputTextField) Utilities(io.bitsquare.common.util.Utilities) ContractWindow(io.bitsquare.gui.main.overlays.windows.ContractWindow) MalformedURLException(java.net.MalformedURLException) UserThread(io.bitsquare.common.UserThread) AwesomeDude(de.jensd.fx.fontawesome.AwesomeDude) NodeAddress(io.bitsquare.p2p.NodeAddress) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) TimeUnit(java.util.concurrent.TimeUnit) FileChooser(javafx.stage.FileChooser) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon) Stage(javafx.stage.Stage) EasyBind(org.fxmisc.easybind.EasyBind) ImageView(javafx.scene.image.ImageView) BusyAnimation(io.bitsquare.gui.components.BusyAnimation) SendPrivateNotificationWindow(io.bitsquare.gui.main.overlays.windows.SendPrivateNotificationWindow) FxmlView(io.bitsquare.gui.common.view.FxmlView) ChangeListener(javafx.beans.value.ChangeListener) InputStream(java.io.InputStream) Dispute(io.bitsquare.arbitration.Dispute) HyperlinkWithIcon(io.bitsquare.gui.components.HyperlinkWithIcon)

Example 2 with HyperlinkWithIcon

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

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

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

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

the class AddBitcoinNodesWindow method addContent.

private void addContent() {
    Label label = addLabel(gridPane, ++rowIndex, "For the best protection of your privacy is it recommended that you run your own Bitcoin core node.\n" + "You can run it locally (127.0.0.1) or hosted on a VPS.\n" + "You can edit that settings in \"Settings/Network info\".\n\n" + "If you prefer to use the public Bitcoin network your Bitcoin transactions might get de-anonymized by chain analysis companies operating full nodes to spy on Bitcoin users.\n\n" + "To learn more about that topic please read our FAQ on Bitsquare.io.");
    label.setWrapText(true);
    GridPane.setColumnSpan(label, 2);
    GridPane.setHalignment(label, HPos.LEFT);
    HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon("Open Bitsquare FAQ", AwesomeIcon.EXTERNAL_LINK);
    hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage("https://bitsquare.io/faq/#privacy_btc"));
    GridPane.setRowIndex(hyperlinkWithIcon, ++rowIndex);
    GridPane.setColumnIndex(hyperlinkWithIcon, 0);
    GridPane.setMargin(hyperlinkWithIcon, new Insets(0, 0, 0, -4));
    GridPane.setHalignment(hyperlinkWithIcon, HPos.LEFT);
    gridPane.getChildren().add(hyperlinkWithIcon);
    Tuple2<Label, InputTextField> labelInputTextFieldTuple2 = addLabelInputTextField(gridPane, ++rowIndex, "Add custom Bitcoin nodes:", 20);
    InputTextField input = labelInputTextFieldTuple2.second;
    input.setPromptText("Add comma separated IP addresses");
    if (!preferences.getBitcoinNodes().isEmpty())
        input.setText(preferences.getBitcoinNodes());
    Tuple2<Button, Button> tuple = add2Buttons(gridPane, ++rowIndex, "Save", "Ignore and use public Bitcoin network nodes");
    saveButton = tuple.first;
    saveButton.setOnAction(e -> {
        preferences.setBitcoinNodes(input.getText());
        hide();
        closeHandlerOptional.ifPresent(Runnable::run);
    });
    closeButton = tuple.second;
    closeButton.setOnAction(e -> {
        preferences.setBitcoinNodes("");
        hide();
        closeHandlerOptional.ifPresent(Runnable::run);
    });
    // Add some space
    ++rowIndex;
}
Also used : Insets(javafx.geometry.Insets) Button(javafx.scene.control.Button) InputTextField(io.bitsquare.gui.components.InputTextField) Label(javafx.scene.control.Label) 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