Search in sources :

Example 16 with InputTextField

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

the class SendAlertMessageWindow method addContent.

private void addContent() {
    InputTextField keyInputTextField = addLabelInputTextField(gridPane, ++rowIndex, "Alert private key:", 10).second;
    Tuple2<Label, TextArea> labelTextAreaTuple2 = addLabelTextArea(gridPane, ++rowIndex, "Alert message:", "Enter message");
    TextArea alertMessageTextArea = labelTextAreaTuple2.second;
    Label first = labelTextAreaTuple2.first;
    first.setMinWidth(150);
    CheckBox isUpdateCheckBox = addLabelCheckBox(gridPane, ++rowIndex, "Is update notification:", "").second;
    isUpdateCheckBox.setSelected(true);
    InputTextField versionInputTextField = addLabelInputTextField(gridPane, ++rowIndex, "New version no.:").second;
    versionInputTextField.disableProperty().bind(isUpdateCheckBox.selectedProperty().not());
    sendButton = new Button("Send notification");
    sendButton.setOnAction(e -> {
        if (alertMessageTextArea.getText().length() > 0 && keyInputTextField.getText().length() > 0) {
            if (sendAlertMessageHandler.handle(new Alert(alertMessageTextArea.getText(), isUpdateCheckBox.isSelected(), versionInputTextField.getText()), keyInputTextField.getText()))
                hide();
            else
                new Popup().warning("The key you entered was not correct.").width(300).onClose(() -> blurAgain()).show();
        }
    });
    Button removeAlertMessageButton = new Button("Remove notification");
    removeAlertMessageButton.setOnAction(e -> {
        if (keyInputTextField.getText().length() > 0) {
            if (removeAlertMessageHandler.handle(keyInputTextField.getText()))
                hide();
            else
                new Popup().warning("The key you entered was not correct.").width(300).onClose(() -> blurAgain()).show();
        }
    });
    closeButton = new Button("Close");
    closeButton.setOnAction(e -> {
        hide();
        closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
    });
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    hBox.getChildren().addAll(sendButton, removeAlertMessageButton, closeButton);
    gridPane.getChildren().add(hBox);
    GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) TextArea(javafx.scene.control.TextArea) Button(javafx.scene.control.Button) InputTextField(io.bitsquare.gui.components.InputTextField) CheckBox(javafx.scene.control.CheckBox) Popup(io.bitsquare.gui.main.overlays.popups.Popup) Label(javafx.scene.control.Label) Alert(io.bitsquare.alert.Alert)

Aggregations

InputTextField (io.bitsquare.gui.components.InputTextField)16 Insets (javafx.geometry.Insets)8 Popup (io.bitsquare.gui.main.overlays.popups.Popup)6 FormBuilder.addLabelInputTextField (io.bitsquare.gui.util.FormBuilder.addLabelInputTextField)6 Button (javafx.scene.control.Button)6 Label (javafx.scene.control.Label)6 HBox (javafx.scene.layout.HBox)5 TextArea (javafx.scene.control.TextArea)2 Coin (org.bitcoinj.core.Coin)2 Transaction (org.bitcoinj.core.Transaction)2 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Alert (io.bitsquare.alert.Alert)1 PrivateNotification (io.bitsquare.alert.PrivateNotification)1 Dispute (io.bitsquare.arbitration.Dispute)1 AddressEntry (io.bitsquare.btc.AddressEntry)1 TransactionVerificationException (io.bitsquare.btc.exceptions.TransactionVerificationException)1 WalletException (io.bitsquare.btc.exceptions.WalletException)1 BalanceListener (io.bitsquare.btc.listeners.BalanceListener)1 PubKeyRing (io.bitsquare.common.crypto.PubKeyRing)1 Filter (io.bitsquare.filter.Filter)1