Search in sources :

Example 1 with HyperlinkWithIcon

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

the class FormBuilder method addHyperlinkWithIcon.

public static HyperlinkWithIcon addHyperlinkWithIcon(GridPane gridPane, int rowIndex, String title, String url, double top) {
    HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(title, AwesomeIcon.EXTERNAL_LINK);
    hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(url));
    GridPane.setRowIndex(hyperlinkWithIcon, rowIndex);
    GridPane.setColumnIndex(hyperlinkWithIcon, 0);
    GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, -4));
    GridPane.setHalignment(hyperlinkWithIcon, HPos.LEFT);
    gridPane.getChildren().add(hyperlinkWithIcon);
    return hyperlinkWithIcon;
}
Also used : Insets(javafx.geometry.Insets) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon)

Example 2 with HyperlinkWithIcon

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

the class FormBuilder method addLabelHyperlinkWithIcon.

public static Tuple2<Label, HyperlinkWithIcon> addLabelHyperlinkWithIcon(GridPane gridPane, int rowIndex, String labelTitle, String title, String url, double top) {
    Label label = addLabel(gridPane, rowIndex, labelTitle, top);
    HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(title, AwesomeIcon.EXTERNAL_LINK);
    hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(url));
    GridPane.setRowIndex(hyperlinkWithIcon, rowIndex);
    GridPane.setColumnIndex(hyperlinkWithIcon, 1);
    GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, -4));
    gridPane.getChildren().add(hyperlinkWithIcon);
    return new Tuple2<>(label, hyperlinkWithIcon);
}
Also used : Insets(javafx.geometry.Insets) Tuple2(bisq.common.util.Tuple2) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon)

Example 3 with HyperlinkWithIcon

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

the class BaseProposalView method createProposalColumns.

// /////////////////////////////////////////////////////////////////////////////////////////
// TableColumns
// /////////////////////////////////////////////////////////////////////////////////////////
protected void createProposalColumns(TableView<ProposalListItem> tableView) {
    TableColumn<ProposalListItem, ProposalListItem> dateColumn = new AutoTooltipTableColumn<ProposalListItem, ProposalListItem>(Res.get("shared.dateTime")) {

        {
            setMinWidth(190);
            setMaxWidth(190);
        }
    };
    dateColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
    dateColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {

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

                @Override
                public void updateItem(final ProposalListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null)
                        setText(bsqFormatter.formatDateTime(item.getProposal().getProposalPayload().getCreationDate()));
                    else
                        setText("");
                }
            };
        }
    });
    dateColumn.setComparator(Comparator.comparing(o3 -> o3.getProposal().getProposalPayload().getCreationDate()));
    dateColumn.setSortType(TableColumn.SortType.DESCENDING);
    tableView.getColumns().add(dateColumn);
    tableView.getSortOrder().add(dateColumn);
    TableColumn<ProposalListItem, ProposalListItem> nameColumn = new AutoTooltipTableColumn<>(Res.get("shared.name"));
    nameColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
    nameColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {

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

                @Override
                public void updateItem(final ProposalListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null)
                        setText(item.getProposal().getProposalPayload().getName());
                    else
                        setText("");
                }
            };
        }
    });
    nameColumn.setComparator(Comparator.comparing(o2 -> o2.getProposal().getProposalPayload().getName()));
    tableView.getColumns().add(nameColumn);
    TableColumn<ProposalListItem, ProposalListItem> titleColumn = new AutoTooltipTableColumn<>(Res.get("dao.proposal.title"));
    titleColumn.setPrefWidth(100);
    titleColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
    titleColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {

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

                @Override
                public void updateItem(final ProposalListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null)
                        setText(item.getProposal().getProposalPayload().getTitle());
                    else
                        setText("");
                }
            };
        }
    });
    titleColumn.setComparator(Comparator.comparing(o2 -> o2.getProposal().getProposalPayload().getTitle()));
    tableView.getColumns().add(titleColumn);
    TableColumn<ProposalListItem, ProposalListItem> uidColumn = new AutoTooltipTableColumn<>(Res.get("shared.id"));
    uidColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
    uidColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {

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

                private HyperlinkWithIcon field;

                @Override
                public void updateItem(final ProposalListItem item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        final Proposal proposal = item.getProposal();
                        final ProposalPayload proposalPayload = proposal.getProposalPayload();
                        field = new HyperlinkWithIcon(proposalPayload.getShortId());
                        field.setOnAction(event -> {
                            new ProposalDetailsWindow(bsqFormatter, bsqWalletService, proposalPayload).show();
                        });
                        field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
                        setGraphic(field);
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
    uidColumn.setComparator(Comparator.comparing(o -> o.getProposal().getProposalPayload().getUid()));
    tableView.getColumns().add(uidColumn);
}
Also used : TableGroupHeadline(bisq.desktop.components.TableGroupHeadline) ActivatableView(bisq.desktop.common.view.ActivatableView) BsqBlockChainChangeDispatcher(bisq.core.dao.blockchain.BsqBlockChainChangeDispatcher) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) FXCollections(javafx.collections.FXCollections) BsqNode(bisq.core.dao.node.BsqNode) Proposal(bisq.core.dao.proposal.Proposal) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) TableCell(javafx.scene.control.TableCell) ScrollPane(javafx.scene.control.ScrollPane) Insets(javafx.geometry.Insets) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) Res(bisq.core.locale.Res) TableView(javafx.scene.control.TableView) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) BsqBlockChain(bisq.core.dao.blockchain.BsqBlockChain) GridPane(javafx.scene.layout.GridPane) SortedList(javafx.collections.transformation.SortedList) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) DaoPeriodService(bisq.core.dao.DaoPeriodService) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Node(javafx.scene.Node) Subscription(org.fxmisc.easybind.Subscription) Collectors(java.util.stream.Collectors) BsqFormatter(bisq.desktop.util.BsqFormatter) BsqWalletService(bisq.core.btc.wallet.BsqWalletService) Priority(javafx.scene.layout.Priority) ProposalPayload(bisq.core.dao.proposal.ProposalPayload) List(java.util.List) EasyBind(org.fxmisc.easybind.EasyBind) ObservableList(javafx.collections.ObservableList) ChangeListener(javafx.beans.value.ChangeListener) Comparator(java.util.Comparator) ProposalCollectionsService(bisq.core.dao.proposal.ProposalCollectionsService) Tooltip(javafx.scene.control.Tooltip) TableColumn(javafx.scene.control.TableColumn) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) TableCell(javafx.scene.control.TableCell) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) ProposalPayload(bisq.core.dao.proposal.ProposalPayload) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) Proposal(bisq.core.dao.proposal.Proposal)

Example 4 with HyperlinkWithIcon

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

the class TraderDisputeView method getTradeIdColumn.

private TableColumn<Dispute, Dispute> getTradeIdColumn() {
    TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<Dispute, Dispute>(Res.get("shared.tradeId")) {

        {
            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());
                        Optional<Trade> tradeOptional = tradeManager.getTradeById(item.getTradeId());
                        if (tradeOptional.isPresent()) {
                            field.setMouseTransparent(false);
                            field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
                            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 : Button(javafx.scene.control.Button) EventHandler(javafx.event.EventHandler) PubKeyRing(bisq.common.crypto.PubKeyRing) BusyAnimation(bisq.desktop.components.BusyAnimation) Utilities(bisq.common.util.Utilities) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) ListCell(javafx.scene.control.ListCell) URL(java.net.URL) Date(java.util.Date) ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) DisputeManager(bisq.core.arbitration.DisputeManager) VBox(javafx.scene.layout.VBox) BSFormatter(bisq.desktop.util.BSFormatter) Contract(bisq.core.trade.Contract) InputTextField(bisq.desktop.components.InputTextField) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) Res(bisq.core.locale.Res) Map(java.util.Map) TableView(javafx.scene.control.TableView) ParseException(java.text.ParseException) DateFormat(java.text.DateFormat) Pane(javafx.scene.layout.Pane) SortedList(javafx.collections.transformation.SortedList) HBox(javafx.scene.layout.HBox) Popup(bisq.desktop.main.overlays.popups.Popup) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) P2PService(bisq.network.p2p.P2PService) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FilteredList(javafx.collections.transformation.FilteredList) KeyEvent(javafx.scene.input.KeyEvent) Subscription(org.fxmisc.easybind.Subscription) SendPrivateNotificationWindow(bisq.desktop.main.overlays.windows.SendPrivateNotificationWindow) Priority(javafx.scene.layout.Priority) List(java.util.List) TradeManager(bisq.core.trade.TradeManager) AnchorPane(javafx.scene.layout.AnchorPane) Paint(javafx.scene.paint.Paint) NodeAddress(bisq.network.p2p.NodeAddress) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) AppOptionKeys(bisq.core.app.AppOptionKeys) UserThread(bisq.common.UserThread) ByteStreams(com.google.common.io.ByteStreams) Optional(java.util.Optional) Attachment(bisq.core.arbitration.Attachment) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) TableGroupHeadline(bisq.desktop.components.TableGroupHeadline) GUIUtil(bisq.desktop.util.GUIUtil) Scene(javafx.scene.Scene) ActivatableView(bisq.desktop.common.view.ActivatableView) ListView(javafx.scene.control.ListView) DisputeSummaryWindow(bisq.desktop.main.overlays.windows.DisputeSummaryWindow) TextArea(javafx.scene.control.TextArea) SimpleDateFormat(java.text.SimpleDateFormat) Timer(bisq.common.Timer) HashMap(java.util.HashMap) Dispute(bisq.core.arbitration.Dispute) ContractWindow(bisq.desktop.main.overlays.windows.ContractWindow) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) TableCell(javafx.scene.control.TableCell) Lists(com.google.common.collect.Lists) Insets(javafx.geometry.Insets) Connection(bisq.network.p2p.network.Connection) TextAlignment(javafx.scene.text.TextAlignment) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) PrivateNotificationManager(bisq.core.alert.PrivateNotificationManager) Nullable(javax.annotation.Nullable) KeyCode(javafx.scene.input.KeyCode) Version(bisq.common.app.Version) Label(javafx.scene.control.Label) TradeDetailsWindow(bisq.desktop.main.overlays.windows.TradeDetailsWindow) MalformedURLException(java.net.MalformedURLException) Trade(bisq.core.trade.Trade) AwesomeDude(de.jensd.fx.fontawesome.AwesomeDude) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) FileChooser(javafx.stage.FileChooser) DisputeCommunicationMessage(bisq.core.arbitration.messages.DisputeCommunicationMessage) Stage(javafx.stage.Stage) EasyBind(org.fxmisc.easybind.EasyBind) ImageView(javafx.scene.image.ImageView) ArbitratorDisputeView(bisq.desktop.main.disputes.arbitrator.ArbitratorDisputeView) Named(com.google.inject.name.Named) KeyRing(bisq.common.crypto.KeyRing) ChangeListener(javafx.beans.value.ChangeListener) InputStream(java.io.InputStream) Optional(java.util.Optional) Tooltip(javafx.scene.control.Tooltip) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) AutoTooltipTableColumn(bisq.desktop.components.AutoTooltipTableColumn) Dispute(bisq.core.arbitration.Dispute) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon)

Example 5 with HyperlinkWithIcon

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

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 address = item.getAddressString();
                        field = new HyperlinkWithIcon(address, AwesomeIcon.EXTERNAL_LINK);
                        field.setOnAction(event -> {
                            openBlockExplorer(item);
                            tableView.getSelectionModel().select(item);
                        });
                        field.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", address)));
                        setGraphic(field);
                    } else {
                        setGraphic(null);
                        if (field != null)
                            field.setOnAction(null);
                    }
                }
            };
        }
    });
}
Also used : Button(javafx.scene.control.Button) HPos(javafx.geometry.HPos) Transaction(org.bitcoinj.core.Transaction) QRCodeWindow(bisq.desktop.main.overlays.windows.QRCodeWindow) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon) Coin(org.bitcoinj.core.Coin) Layout(bisq.desktop.util.Layout) VBox(javafx.scene.layout.VBox) BSFormatter(bisq.desktop.util.BSFormatter) InputTextField(bisq.desktop.components.InputTextField) QRCode(net.glxn.qrgen.QRCode) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ByteArrayInputStream(java.io.ByteArrayInputStream) Res(bisq.core.locale.Res) ImageType(net.glxn.qrgen.image.ImageType) TableView(javafx.scene.control.TableView) SortedList(javafx.collections.transformation.SortedList) Popup(bisq.desktop.main.overlays.popups.Popup) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg) Subscription(org.fxmisc.easybind.Subscription) FXML(javafx.fxml.FXML) AddressEntry(bisq.core.btc.AddressEntry) DevEnv(bisq.common.app.DevEnv) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Preferences(bisq.core.user.Preferences) UserThread(bisq.common.UserThread) FeeService(bisq.core.provider.fee.FeeService) ObservableList(javafx.collections.ObservableList) AwesomeIcon(de.jensd.fx.fontawesome.AwesomeIcon) NotNull(org.jetbrains.annotations.NotNull) GUIUtil(bisq.desktop.util.GUIUtil) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) ActivatableView(bisq.desktop.common.view.ActivatableView) FXCollections(javafx.collections.FXCollections) FormBuilder.addLabelInputTextField(bisq.desktop.util.FormBuilder.addLabelInputTextField) FxmlView(bisq.desktop.common.view.FxmlView) TableColumn(javafx.scene.control.TableColumn) Inject(javax.inject.Inject) BalanceListener(bisq.core.btc.listeners.BalanceListener) Tuple2(bisq.common.util.Tuple2) TableCell(javafx.scene.control.TableCell) Insets(javafx.geometry.Insets) Callback(javafx.util.Callback) Tooltip(javafx.scene.control.Tooltip) TitledGroupBg(bisq.desktop.components.TitledGroupBg) GridPane(javafx.scene.layout.GridPane) Label(javafx.scene.control.Label) AddressTextField(bisq.desktop.components.AddressTextField) TimeUnit(java.util.concurrent.TimeUnit) FormBuilder.addButton(bisq.desktop.util.FormBuilder.addButton) EasyBind(org.fxmisc.easybind.EasyBind) FormBuilder.addLabelAddressTextField(bisq.desktop.util.FormBuilder.addLabelAddressTextField) ImageView(javafx.scene.image.ImageView) ChangeListener(javafx.beans.value.ChangeListener) Image(javafx.scene.image.Image) Tooltip(javafx.scene.control.Tooltip) TableColumn(javafx.scene.control.TableColumn) TableCell(javafx.scene.control.TableCell) HyperlinkWithIcon(bisq.desktop.components.HyperlinkWithIcon)

Aggregations

HyperlinkWithIcon (bisq.desktop.components.HyperlinkWithIcon)23 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)19 Tooltip (javafx.scene.control.Tooltip)18 Res (bisq.core.locale.Res)17 FxmlView (bisq.desktop.common.view.FxmlView)17 ReadOnlyObjectWrapper (javafx.beans.property.ReadOnlyObjectWrapper)17 TableCell (javafx.scene.control.TableCell)17 TableColumn (javafx.scene.control.TableColumn)17 TableView (javafx.scene.control.TableView)17 Callback (javafx.util.Callback)17 Inject (javax.inject.Inject)17 SortedList (javafx.collections.transformation.SortedList)16 VBox (javafx.scene.layout.VBox)14 GUIUtil (bisq.desktop.util.GUIUtil)13 ObservableList (javafx.collections.ObservableList)13 Insets (javafx.geometry.Insets)13 Preferences (bisq.core.user.Preferences)12 BSFormatter (bisq.desktop.util.BSFormatter)12 FXML (javafx.fxml.FXML)12 ActivatableView (bisq.desktop.common.view.ActivatableView)11