Search in sources :

Example 31 with Tooltip

use of javafx.scene.control.Tooltip in project Gargoyle by callakrsos.

the class SystemLayoutViewController method loadNewSystemTab.

/********************************
	 * 작성일 : 2016. 4. 26. 작성자 : KYJ
	 *
	 * 새로운 탭을 로드한다.
	 *
	 * @param tableName
	 * @param parent
	 ********************************/
public void loadNewSystemTab(String tableName, CloseableParent<?> parent) {
    Platform.runLater(() -> {
        try {
            Parent _parent = parent.getParent();
            if (beforeParentLoad != null && beforeParentLoad.filter(_parent)) {
                beforeParentLoad.beforeLoad(_parent);
                if (beforeParentLoad.isUnloadParent()) {
                    return;
                }
            }
            DockTab tab = new DockTab(tableName, _parent);
            // 툴팁 처리 (클래스위치)
            tab.setTooltip(new Tooltip(parent.getClass().getName()));
            addTabItem(tab);
            tabPanWorkspace.getSelectionModel().select(tab);
            tab.setOnCloseRequest(ev -> {
                try {
                    LOGGER.debug("closeable parent on close request , tabName : {} ", tableName);
                    parent.close();
                } catch (Exception e) {
                    LOGGER.error(ValueUtil.toString(e));
                }
            });
            // 리스너 호출.
            onParentloaded.forEach(v -> v.onLoad(parent.getParent()));
            // tab.getTabPane().getSelectionModel().select(tab);
            // _parent.getScene().getStylesheets().clear();
            List<Node> findAllByNodes = FxUtil.findAllByNodes(_parent, n -> n instanceof Button);
            findAllByNodes.forEach(btn -> {
                btn.getStyleClass().add("button-gargoyle");
            });
        } catch (Exception e1) {
            DialogUtil.showExceptionDailog(e1);
        }
    });
}
Also used : DockTab(com.kyj.fx.voeditor.visual.component.dock.tab.DockTab) Parent(javafx.scene.Parent) Button(javafx.scene.control.Button) Tooltip(javafx.scene.control.Tooltip) Node(javafx.scene.Node) IOException(java.io.IOException) GargoyleException(com.kyj.fx.voeditor.visual.exceptions.GargoyleException)

Example 32 with Tooltip

use of javafx.scene.control.Tooltip in project bitsquare by bitsquare.

the class PeerInfoIcon method updatePeerInfoIcon.

private void updatePeerInfoIcon() {
    String tag;
    if (peerTagMap.containsKey(hostName)) {
        tag = peerTagMap.get(hostName);
        Tooltip.install(this, new Tooltip(tooltipText + "\nTag: " + tag));
    } else {
        tag = "";
        Tooltip.install(this, new Tooltip(tooltipText));
    }
    if (!tag.isEmpty())
        tagLabel.setText(tag.substring(0, 1));
    if (numTrades < 10)
        numTradesLabel.setText(String.valueOf(numTrades));
    else
        numTradesLabel.setText("★");
    numTradesPane.setVisible(numTrades > 0);
    tagPane.setVisible(!tag.isEmpty());
}
Also used : Tooltip(javafx.scene.control.Tooltip)

Example 33 with Tooltip

use of javafx.scene.control.Tooltip in project bitsquare by bitsquare.

the class OKPayForm method addCurrenciesGrid.

private void addCurrenciesGrid(boolean isEditable) {
    Label label = addLabel(gridPane, ++gridRow, "Supported currencies:", 0);
    GridPane.setValignment(label, VPos.TOP);
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);
    flowPane.setHgap(10);
    if (isEditable)
        flowPane.setId("flow-pane-checkboxes-bg");
    else
        flowPane.setId("flow-pane-checkboxes-non-editable-bg");
    CurrencyUtil.getAllOKPayCurrencies().stream().forEach(e -> {
        CheckBox checkBox = new CheckBox(e.getCode());
        checkBox.setMouseTransparent(!isEditable);
        checkBox.setSelected(okPayAccount.getTradeCurrencies().contains(e));
        checkBox.setMinWidth(60);
        checkBox.setMaxWidth(checkBox.getMinWidth());
        checkBox.setTooltip(new Tooltip(e.getName()));
        checkBox.setOnAction(event -> {
            if (checkBox.isSelected())
                okPayAccount.addCurrency(e);
            else
                okPayAccount.removeCurrency(e);
            updateAllInputsValid();
        });
        flowPane.getChildren().add(checkBox);
    });
    GridPane.setRowIndex(flowPane, gridRow);
    GridPane.setColumnIndex(flowPane, 1);
    gridPane.getChildren().add(flowPane);
}
Also used : Insets(javafx.geometry.Insets) CheckBox(javafx.scene.control.CheckBox) Tooltip(javafx.scene.control.Tooltip) Label(javafx.scene.control.Label) FlowPane(javafx.scene.layout.FlowPane)

Example 34 with Tooltip

use of javafx.scene.control.Tooltip in project bitsquare by bitsquare.

the class SpecificBankForm method addAcceptedBanksForAddAccount.

@Override
protected void addAcceptedBanksForAddAccount() {
    Tuple3<Label, InputTextField, Button> addBankTuple = addLabelInputTextFieldButton(gridPane, ++gridRow, "Name of accepted bank:", "Add accepted bank");
    InputTextField addBankInputTextField = addBankTuple.second;
    Button addButton = addBankTuple.third;
    addButton.setMinWidth(200);
    addButton.disableProperty().bind(Bindings.createBooleanBinding(() -> addBankInputTextField.getText().isEmpty(), addBankInputTextField.textProperty()));
    Tuple3<Label, TextField, Button> acceptedBanksTuple = addLabelTextFieldButton(gridPane, ++gridRow, "Accepted banks:", "Clear accepted banks");
    acceptedBanksTextField = acceptedBanksTuple.second;
    acceptedBanksTextField.setMouseTransparent(false);
    acceptedBanksTooltip = new Tooltip();
    acceptedBanksTextField.setTooltip(acceptedBanksTooltip);
    Button clearButton = acceptedBanksTuple.third;
    clearButton.setMinWidth(200);
    clearButton.setDefaultButton(false);
    clearButton.disableProperty().bind(Bindings.createBooleanBinding(() -> acceptedBanksTextField.getText().isEmpty(), acceptedBanksTextField.textProperty()));
    addButton.setOnAction(e -> {
        specificBanksAccountContractData.addAcceptedBank(addBankInputTextField.getText());
        addBankInputTextField.setText("");
        String value = Joiner.on(", ").join(specificBanksAccountContractData.getAcceptedBanks());
        acceptedBanksTextField.setText(value);
        acceptedBanksTooltip.setText(value);
        updateAllInputsValid();
    });
    clearButton.setOnAction(e -> resetAcceptedBanks());
}
Also used : Button(javafx.scene.control.Button) InputTextField(io.bitsquare.gui.components.InputTextField) Tooltip(javafx.scene.control.Tooltip) Label(javafx.scene.control.Label) InputTextField(io.bitsquare.gui.components.InputTextField) TextField(javafx.scene.control.TextField)

Example 35 with Tooltip

use of javafx.scene.control.Tooltip in project bitsquare by bitsquare.

the class ContractWindow method addContent.

private void addContent() {
    Contract contract = dispute.getContract();
    Offer offer = contract.offer;
    List<String> acceptedBanks = offer.getAcceptedBankIds();
    boolean showAcceptedBanks = acceptedBanks != null && !acceptedBanks.isEmpty();
    List<String> acceptedCountryCodes = offer.getAcceptedCountryCodes();
    boolean showAcceptedCountryCodes = acceptedCountryCodes != null && !acceptedCountryCodes.isEmpty();
    int rows = 16;
    if (dispute.getDepositTxSerialized() != null)
        rows++;
    if (dispute.getPayoutTxSerialized() != null)
        rows++;
    if (showAcceptedCountryCodes)
        rows++;
    if (showAcceptedBanks)
        rows++;
    PaymentAccountContractData sellerPaymentAccountContractData = contract.getSellerPaymentAccountContractData();
    addTitledGroupBg(gridPane, ++rowIndex, rows, "Dispute details");
    addLabelTextFieldWithCopyIcon(gridPane, rowIndex, "Offer ID:", offer.getId(), Layout.FIRST_ROW_DISTANCE).second.setMouseTransparent(false);
    addLabelTextField(gridPane, ++rowIndex, "Offer date / Trade date:", formatter.formatDateTime(offer.getDate()) + " / " + formatter.formatDateTime(dispute.getTradeDate()));
    String currencyCode = offer.getCurrencyCode();
    addLabelTextField(gridPane, ++rowIndex, "Trade type:", formatter.getDirectionBothSides(offer.getDirection(), currencyCode));
    addLabelTextField(gridPane, ++rowIndex, "Trade price:", formatter.formatPrice(contract.getTradePrice()));
    addLabelTextField(gridPane, ++rowIndex, "Trade amount:", formatter.formatCoinWithCode(contract.getTradeAmount()));
    addLabelTextField(gridPane, ++rowIndex, formatter.formatVolumeLabel(currencyCode, ":"), formatter.formatVolumeWithCode(new ExchangeRate(contract.getTradePrice()).coinToFiat(contract.getTradeAmount())));
    addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Bitcoin address BTC buyer / BTC seller:", contract.getBuyerPayoutAddressString() + " / " + contract.getSellerPayoutAddressString()).second.setMouseTransparent(false);
    addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Network address BTC buyer / BTC seller:", contract.getBuyerNodeAddress().getFullAddress() + " / " + contract.getSellerNodeAddress().getFullAddress());
    addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "No. of disputes BTC buyer / BTC seller:", disputeManager.getNrOfDisputes(true, contract) + " / " + disputeManager.getNrOfDisputes(false, contract));
    addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "BTC buyer payment details:", BSResources.get(contract.getBuyerPaymentAccountContractData().getPaymentDetails())).second.setMouseTransparent(false);
    addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "BTC seller payment details:", BSResources.get(sellerPaymentAccountContractData.getPaymentDetails())).second.setMouseTransparent(false);
    addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Selected arbitrator:", contract.arbitratorNodeAddress.getFullAddress());
    if (showAcceptedCountryCodes) {
        String countries;
        Tooltip tooltip = null;
        if (CountryUtil.containsAllSepaEuroCountries(acceptedCountryCodes)) {
            countries = "All Euro countries";
        } else {
            countries = CountryUtil.getCodesString(acceptedCountryCodes);
            tooltip = new Tooltip(CountryUtil.getNamesByCodesString(acceptedCountryCodes));
        }
        TextField acceptedCountries = addLabelTextField(gridPane, ++rowIndex, "Accepted taker countries:", countries).second;
        if (tooltip != null)
            acceptedCountries.setTooltip(new Tooltip());
    }
    if (showAcceptedBanks) {
        if (offer.getPaymentMethod().equals(PaymentMethod.SAME_BANK)) {
            addLabelTextField(gridPane, ++rowIndex, "Bank name:", acceptedBanks.get(0));
        } else if (offer.getPaymentMethod().equals(PaymentMethod.SPECIFIC_BANKS)) {
            String value = Joiner.on(", ").join(acceptedBanks);
            Tooltip tooltip = new Tooltip("Accepted banks: " + value);
            TextField acceptedBanksTextField = addLabelTextField(gridPane, ++rowIndex, "Accepted banks:", value).second;
            acceptedBanksTextField.setMouseTransparent(false);
            acceptedBanksTextField.setTooltip(tooltip);
        }
    }
    addLabelTxIdTextField(gridPane, ++rowIndex, "Offer fee transaction ID:", offer.getOfferFeePaymentTxID());
    addLabelTxIdTextField(gridPane, ++rowIndex, "Trading fee transaction ID:", contract.takeOfferFeeTxID);
    if (dispute.getDepositTxSerialized() != null)
        addLabelTxIdTextField(gridPane, ++rowIndex, "Deposit transaction ID:", dispute.getDepositTxId());
    if (dispute.getPayoutTxSerialized() != null)
        addLabelTxIdTextField(gridPane, ++rowIndex, "Payout transaction ID:", dispute.getPayoutTxId());
    addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Contract hash:", Utils.HEX.encode(dispute.getContractHash())).second.setMouseTransparent(false);
    if (contract != null) {
        Button viewContractButton = addLabelButton(gridPane, ++rowIndex, "Contract in JSON format:", "View contract in JSON format", 0).second;
        viewContractButton.setDefaultButton(false);
        viewContractButton.setOnAction(e -> {
            TextArea textArea = new TextArea();
            String contractAsJson = dispute.getContractAsJson();
            contractAsJson += "\n\nBuyerMultiSigPubKeyHex: " + Utils.HEX.encode(dispute.getContract().getBuyerMultiSigPubKey());
            contractAsJson += "\nSellerMultiSigPubKeyHex: " + Utils.HEX.encode(dispute.getContract().getSellerMultiSigPubKey());
            textArea.setText(contractAsJson);
            textArea.setPrefHeight(50);
            textArea.setEditable(false);
            textArea.setWrapText(true);
            textArea.setPrefSize(800, 600);
            Scene viewContractScene = new Scene(textArea);
            Stage viewContractStage = new Stage();
            viewContractStage.setTitle("Contract for trade with ID: " + dispute.getShortTradeId());
            viewContractStage.setScene(viewContractScene);
            if (owner == null)
                owner = MainView.getRootContainer();
            Scene rootScene = owner.getScene();
            viewContractStage.initOwner(rootScene.getWindow());
            viewContractStage.initModality(Modality.NONE);
            viewContractStage.initStyle(StageStyle.UTILITY);
            viewContractStage.show();
            Window window = rootScene.getWindow();
            double titleBarHeight = window.getHeight() - rootScene.getHeight();
            viewContractStage.setX(Math.round(window.getX() + (owner.getWidth() - viewContractStage.getWidth()) / 2) + 200);
            viewContractStage.setY(Math.round(window.getY() + titleBarHeight + (owner.getHeight() - viewContractStage.getHeight()) / 2) + 50);
        });
    }
    Button cancelButton = addButtonAfterGroup(gridPane, ++rowIndex, "Close");
    //TODO app wide focus
    //cancelButton.requestFocus();
    cancelButton.setOnAction(e -> {
        closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
        hide();
    });
}
Also used : Window(javafx.stage.Window) PaymentAccountContractData(io.bitsquare.payment.PaymentAccountContractData) ExchangeRate(org.bitcoinj.utils.ExchangeRate) TextArea(javafx.scene.control.TextArea) Tooltip(javafx.scene.control.Tooltip) Scene(javafx.scene.Scene) Offer(io.bitsquare.trade.offer.Offer) Button(javafx.scene.control.Button) TextField(javafx.scene.control.TextField) Stage(javafx.stage.Stage) Contract(io.bitsquare.trade.Contract)

Aggregations

Tooltip (javafx.scene.control.Tooltip)38 Button (javafx.scene.control.Button)12 Label (javafx.scene.control.Label)9 IOException (java.io.IOException)5 Node (javafx.scene.Node)5 Account (jgnash.engine.Account)4 DockTab (com.kyj.fx.voeditor.visual.component.dock.tab.DockTab)3 GargoyleException (com.kyj.fx.voeditor.visual.exceptions.GargoyleException)3 MaterialIconView (de.jensd.fx.glyphs.materialicons.MaterialIconView)3 Contract (io.bitsquare.trade.Contract)3 BigDecimal (java.math.BigDecimal)3 SimpleDateFormat (java.text.SimpleDateFormat)3 KeyFrame (javafx.animation.KeyFrame)3 Timeline (javafx.animation.Timeline)3 Platform (javafx.application.Platform)3 Insets (javafx.geometry.Insets)3 Scene (javafx.scene.Scene)3 PieChart (javafx.scene.chart.PieChart)3 TextField (javafx.scene.control.TextField)3 NotNull (org.jetbrains.annotations.NotNull)3