use of io.bitsquare.gui.components.InputTextField 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());
}
use of io.bitsquare.gui.components.InputTextField in project bitsquare by bitsquare.
the class TraderDisputeView method initialize.
@Override
public void initialize() {
Label label = new Label("Filter list:");
HBox.setMargin(label, new Insets(5, 0, 0, 0));
filterTextField = new InputTextField();
filterTextField.setText("open");
filterTextFieldListener = (observable, oldValue, newValue) -> applyFilteredListPredicate(filterTextField.getText());
filterBox = new HBox();
filterBox.setSpacing(5);
filterBox.getChildren().addAll(label, filterTextField);
VBox.setVgrow(filterBox, Priority.NEVER);
filterBox.setVisible(false);
filterBox.setManaged(false);
tableView = new TableView<>();
VBox.setVgrow(tableView, Priority.SOMETIMES);
tableView.setMinHeight(150);
root.getChildren().addAll(filterBox, tableView);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
Label placeholder = new Label("There are no open tickets");
placeholder.setWrapText(true);
tableView.setPlaceholder(placeholder);
tableView.getSelectionModel().clearSelection();
tableView.getColumns().add(getSelectColumn());
TableColumn<Dispute, Dispute> contractColumn = getContractColumn();
tableView.getColumns().add(contractColumn);
TableColumn<Dispute, Dispute> dateColumn = getDateColumn();
tableView.getColumns().add(dateColumn);
TableColumn<Dispute, Dispute> tradeIdColumn = getTradeIdColumn();
tableView.getColumns().add(tradeIdColumn);
TableColumn<Dispute, Dispute> buyerOnionAddressColumn = getBuyerOnionAddressColumn();
tableView.getColumns().add(buyerOnionAddressColumn);
TableColumn<Dispute, Dispute> sellerOnionAddressColumn = getSellerOnionAddressColumn();
tableView.getColumns().add(sellerOnionAddressColumn);
TableColumn<Dispute, Dispute> marketColumn = getMarketColumn();
tableView.getColumns().add(marketColumn);
TableColumn<Dispute, Dispute> roleColumn = getRoleColumn();
tableView.getColumns().add(roleColumn);
TableColumn<Dispute, Dispute> stateColumn = getStateColumn();
tableView.getColumns().add(stateColumn);
tradeIdColumn.setComparator((o1, o2) -> o1.getTradeId().compareTo(o2.getTradeId()));
dateColumn.setComparator((o1, o2) -> o1.getOpeningDate().compareTo(o2.getOpeningDate()));
buyerOnionAddressColumn.setComparator((o1, o2) -> getBuyerOnionAddressColumnLabel(o1).compareTo(getBuyerOnionAddressColumnLabel(o2)));
sellerOnionAddressColumn.setComparator((o1, o2) -> getSellerOnionAddressColumnLabel(o1).compareTo(getSellerOnionAddressColumnLabel(o2)));
marketColumn.setComparator((o1, o2) -> formatter.getCurrencyPair(o1.getContract().offer.getCurrencyCode()).compareTo(o2.getContract().offer.getCurrencyCode()));
dateColumn.setSortType(TableColumn.SortType.DESCENDING);
tableView.getSortOrder().add(dateColumn);
/*inputTextAreaListener = (observable, oldValue, newValue) ->
sendButton.setDisable(newValue.length() == 0
&& tempAttachments.size() == 0 &&
selectedDispute.disputeResultProperty().get() == null);*/
selectedDisputeClosedPropertyListener = (observable, oldValue, newValue) -> {
messagesInputBox.setVisible(!newValue);
messagesInputBox.setManaged(!newValue);
AnchorPane.setBottomAnchor(messageListView, newValue ? 0d : 120d);
};
disputeDirectMessageListListener = c -> scrollToBottom();
keyEventEventHandler = event -> {
if (new KeyCodeCombination(KeyCode.L, KeyCombination.ALT_DOWN).match(event)) {
Map<String, List<Dispute>> map = new HashMap<>();
disputeManager.getDisputesAsObservableList().stream().forEach(dispute -> {
String tradeId = dispute.getTradeId();
List<Dispute> list;
if (!map.containsKey(tradeId))
map.put(tradeId, new ArrayList<>());
list = map.get(tradeId);
list.add(dispute);
});
List<List<Dispute>> disputeGroups = new ArrayList<>();
map.entrySet().stream().forEach(entry -> {
disputeGroups.add(entry.getValue());
});
disputeGroups.sort((o1, o2) -> !o1.isEmpty() && !o2.isEmpty() ? o1.get(0).getOpeningDate().compareTo(o2.get(0).getOpeningDate()) : 0);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Summary of all disputes (No. of disputes: " + disputeGroups.size() + ")\n\n");
disputeGroups.stream().forEach(disputeGroup -> {
Dispute dispute0 = disputeGroup.get(0);
stringBuilder.append("##########################################################################################/\n").append("## Trade ID: ").append(dispute0.getTradeId()).append("\n").append("## Date: ").append(formatter.formatDateTime(dispute0.getOpeningDate())).append("\n").append("## Is support ticket: ").append(dispute0.isSupportTicket()).append("\n");
if (dispute0.disputeResultProperty().get() != null && dispute0.disputeResultProperty().get().getReason() != null) {
stringBuilder.append("## Reason: ").append(dispute0.disputeResultProperty().get().getReason()).append("\n");
}
stringBuilder.append("##########################################################################################/\n").append("\n");
disputeGroup.stream().forEach(dispute -> {
stringBuilder.append("*******************************************************************************************\n").append("** Trader's ID: ").append(dispute.getTraderId()).append("\n*******************************************************************************************\n").append("\n");
dispute.getDisputeCommunicationMessagesAsObservableList().stream().forEach(m -> {
String role = m.isSenderIsTrader() ? ">> Trader's msg: " : "<< Arbitrator's msg: ";
stringBuilder.append(role).append(m.getMessage()).append("\n");
});
stringBuilder.append("\n");
});
stringBuilder.append("\n");
});
String message = stringBuilder.toString();
new Popup().headLine("All disputes (" + disputeGroups.size() + ")").information(message).width(1000).actionButtonText("Copy").onAction(() -> Utilities.copyToClipboard(message)).show();
} else if (new KeyCodeCombination(KeyCode.U, KeyCombination.ALT_DOWN).match(event)) {
if (selectedDispute != null) {
if (selectedDisputeClosedPropertyListener != null)
selectedDispute.isClosedProperty().removeListener(selectedDisputeClosedPropertyListener);
selectedDispute.setIsClosed(false);
}
} else if (new KeyCodeCombination(KeyCode.R, KeyCombination.ALT_DOWN).match(event)) {
if (selectedDispute != null) {
PubKeyRing pubKeyRing = selectedDispute.getTraderPubKeyRing();
NodeAddress nodeAddress;
if (pubKeyRing.equals(selectedDispute.getContract().getBuyerPubKeyRing()))
nodeAddress = selectedDispute.getContract().getBuyerNodeAddress();
else
nodeAddress = selectedDispute.getContract().getSellerNodeAddress();
new SendPrivateNotificationWindow(pubKeyRing, nodeAddress).onAddAlertMessage(privateNotificationManager::sendPrivateNotificationMessageIfKeyIsValid).show();
}
}
};
}
use of io.bitsquare.gui.components.InputTextField in project bitsquare by bitsquare.
the class DepositView method initialize.
@Override
public void initialize() {
// trigger creation of at least 1 savings address
walletService.getOrCreateAddressEntry(AddressEntry.Context.AVAILABLE);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new Label("No deposit addresses have been generated yet"));
tableViewSelectionListener = (observableValue, oldValue, newValue) -> {
if (newValue != null)
fillForm(newValue.getAddressString());
};
setSelectColumnCellFactory();
setAddressColumnCellFactory();
setBalanceColumnCellFactory();
setUsageColumnCellFactory();
setConfidenceColumnCellFactory();
addressColumn.setComparator((o1, o2) -> o1.getAddressString().compareTo(o2.getAddressString()));
balanceColumn.setComparator((o1, o2) -> o1.getBalanceAsCoin().compareTo(o2.getBalanceAsCoin()));
confidenceColumn.setComparator((o1, o2) -> Double.valueOf(o1.getTxConfidenceIndicator().getProgress()).compareTo(o2.getTxConfidenceIndicator().getProgress()));
usageColumn.setComparator((a, b) -> (a.getNumTxOutputs() < b.getNumTxOutputs()) ? -1 : ((a.getNumTxOutputs() == b.getNumTxOutputs()) ? 0 : 1));
tableView.getSortOrder().add(usageColumn);
tableView.setItems(sortedList);
titledGroupBg = addTitledGroupBg(gridPane, gridRow, 3, "Fund your wallet");
qrCodeLabel = addLabel(gridPane, gridRow, "", 0);
//GridPane.setMargin(qrCodeLabel, new Insets(Layout.FIRST_ROW_DISTANCE - 9, 0, 0, 5));
qrCodeImageView = new ImageView();
qrCodeImageView.setStyle("-fx-cursor: hand;");
Tooltip.install(qrCodeImageView, new Tooltip("Open large QR-Code window"));
qrCodeImageView.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> UserThread.runAfter(() -> new QRCodeWindow(getBitcoinURI()).show(), 200, TimeUnit.MILLISECONDS)));
GridPane.setRowIndex(qrCodeImageView, gridRow);
GridPane.setColumnIndex(qrCodeImageView, 1);
GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
gridPane.getChildren().add(qrCodeImageView);
Tuple2<Label, AddressTextField> addressTuple = addLabelAddressTextField(gridPane, ++gridRow, "Address:");
addressLabel = addressTuple.first;
//GridPane.setValignment(addressLabel, VPos.TOP);
//GridPane.setMargin(addressLabel, new Insets(3, 0, 0, 0));
addressTextField = addressTuple.second;
addressTextField.setPaymentLabel(paymentLabelString);
Tuple2<Label, InputTextField> amountTuple = addLabelInputTextField(gridPane, ++gridRow, "Amount in BTC (optional):");
amountLabel = amountTuple.first;
amountTextField = amountTuple.second;
if (DevFlags.DEV_MODE)
amountTextField.setText("10");
titledGroupBg.setVisible(false);
titledGroupBg.setManaged(false);
qrCodeLabel.setVisible(false);
qrCodeLabel.setManaged(false);
qrCodeImageView.setVisible(false);
qrCodeImageView.setManaged(false);
addressLabel.setVisible(false);
addressLabel.setManaged(false);
addressTextField.setVisible(false);
addressTextField.setManaged(false);
amountLabel.setVisible(false);
amountTextField.setManaged(false);
generateNewAddressButton = addButton(gridPane, ++gridRow, "Generate new address", -20);
GridPane.setColumnIndex(generateNewAddressButton, 0);
GridPane.setHalignment(generateNewAddressButton, HPos.LEFT);
generateNewAddressButton.setOnAction(event -> {
boolean hasUnUsedAddress = observableList.stream().filter(e -> e.getNumTxOutputs() == 0).findAny().isPresent();
if (hasUnUsedAddress) {
new Popup().warning("Please select an unused address from the table above rather than generating a new one.").show();
} else {
AddressEntry newSavingsAddressEntry = walletService.getOrCreateUnusedAddressEntry(AddressEntry.Context.AVAILABLE);
updateList();
observableList.stream().filter(depositListItem -> depositListItem.getAddressString().equals(newSavingsAddressEntry.getAddressString())).findAny().ifPresent(depositListItem -> tableView.getSelectionModel().select(depositListItem));
}
});
balanceListener = new BalanceListener() {
@Override
public void onBalanceChanged(Coin balance, Transaction tx) {
updateList();
}
};
}
use of io.bitsquare.gui.components.InputTextField in project bitsquare by bitsquare.
the class EnterPrivKeyWindow method addInputFields.
private void addInputFields() {
Label label = new Label("Enter private key:");
label.setWrapText(true);
GridPane.setMargin(label, new Insets(3, 0, 0, 0));
GridPane.setRowIndex(label, ++rowIndex);
keyInputTextField = new InputTextField();
GridPane.setMargin(keyInputTextField, new Insets(3, 0, 0, 0));
GridPane.setRowIndex(keyInputTextField, rowIndex);
GridPane.setColumnIndex(keyInputTextField, 1);
changeListener = (observable, oldValue, newValue) -> {
unlockButton.setDisable(newValue.length() == 0);
};
keyInputTextField.textProperty().addListener(changeListener);
gridPane.getChildren().addAll(label, keyInputTextField);
}
use of io.bitsquare.gui.components.InputTextField in project bitsquare by bitsquare.
the class FilterWindow method addContent.
private void addContent() {
InputTextField keyInputTextField = addLabelInputTextField(gridPane, ++rowIndex, "Private key to unlock:", 10).second;
InputTextField offerIdsInputTextField = addLabelInputTextField(gridPane, ++rowIndex, "Filtered offers (comma sep.):").second;
InputTextField nodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, "Filtered onion addresses (comma sep.):").second;
InputTextField paymentAccountFilterInputTextField = addLabelInputTextField(gridPane, ++rowIndex, "Filtered trading account data:\nFormat: comma sep. list of [payment method id | data field | value]").second;
GridPane.setHalignment(paymentAccountFilterInputTextField, HPos.RIGHT);
final Filter filter = filterManager.getDevelopersFilter();
if (filter != null) {
offerIdsInputTextField.setText(filter.bannedOfferIds.stream().collect(Collectors.joining(", ")));
nodesInputTextField.setText(filter.bannedNodeAddress.stream().collect(Collectors.joining(", ")));
if (filter.bannedPaymentAccounts != null) {
StringBuilder sb = new StringBuilder();
filter.bannedPaymentAccounts.stream().forEach(e -> {
if (e != null && e.paymentMethodId != null) {
sb.append(e.paymentMethodId).append("|").append(e.getMethodName).append("|").append(e.value).append(", ");
}
});
paymentAccountFilterInputTextField.setText(sb.toString());
}
}
sendButton = new Button("Add filter");
sendButton.setOnAction(e -> {
ArrayList<String> offerIds = new ArrayList<>();
ArrayList<String> nodes = new ArrayList<>();
ArrayList<PaymentAccountFilter> paymentAccountFilters = new ArrayList<>();
if (!offerIdsInputTextField.getText().isEmpty())
offerIds = new ArrayList<>(Arrays.asList(offerIdsInputTextField.getText().replace(" ", "").replace(", ", ",").split(",")));
if (!nodesInputTextField.getText().isEmpty())
nodes = new ArrayList<>(Arrays.asList(nodesInputTextField.getText().replace(":9999", "").replace(".onion", "").replace(" ", "").replace(", ", ",").split(",")));
if (!paymentAccountFilterInputTextField.getText().isEmpty())
paymentAccountFilters = new ArrayList<>(Arrays.asList(paymentAccountFilterInputTextField.getText().replace(", ", ",").split(",")).stream().map(item -> {
String[] list = item.split("\\|");
if (list.length == 3)
return new PaymentAccountFilter(list[0], list[1], list[2]);
else
return new PaymentAccountFilter("", "", "");
}).collect(Collectors.toList()));
if (sendFilterMessageHandler.handle(new Filter(offerIds, nodes, paymentAccountFilters), keyInputTextField.getText()))
hide();
else
new Popup().warning("The key you entered was not correct.").width(300).onClose(() -> blurAgain()).show();
});
Button removeFilterMessageButton = new Button("Remove filter");
removeFilterMessageButton.setOnAction(e -> {
if (keyInputTextField.getText().length() > 0) {
if (removeFilterMessageHandler.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, removeFilterMessageButton, closeButton);
gridPane.getChildren().add(hBox);
GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
Aggregations