Skip to content

Commit

Permalink
Extract setupFieldFromPaymentAccountFiltersList method in FilterWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
lusarz committed Nov 15, 2019
1 parent 415648e commit 0c2639a
Showing 1 changed file with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,7 @@ private void addContent() {
if (filter != null) {
setupFieldFromList(offerIdsInputTextField, filter.getBannedOfferIds());
setupFieldFromList(nodesInputTextField, filter.getBannedNodeAddress());

if (filter.getBannedPaymentAccounts() != null) {
StringBuilder sb = new StringBuilder();
filter.getBannedPaymentAccounts().stream().forEach(e -> {
if (e != null && e.getPaymentMethodId() != null) {
sb.append(e.getPaymentMethodId())
.append("|")
.append(e.getGetMethodName())
.append("|")
.append(e.getValue())
.append(", ");
}
});
paymentAccountFilterInputTextField.setText(sb.toString());
}

setupFieldFromPaymentAccountFiltersList(paymentAccountFilterInputTextField, filter.getBannedPaymentAccounts());
setupFieldFromList(bannedCurrenciesInputTextField, filter.getBannedCurrencies());
setupFieldFromList(bannedPaymentMethodsInputTextField, filter.getBannedPaymentMethods());
setupFieldFromList(arbitratorsInputTextField, filter.getArbitrators());
Expand All @@ -174,9 +159,7 @@ private void addContent() {
setupFieldFromList(seedNodesInputTextField, filter.getSeedNodes());
setupFieldFromList(priceRelayNodesInputTextField, filter.getPriceRelayNodes());
setupFieldFromList(btcNodesInputTextField, filter.getBtcNodes());

preventPublicBtcNetworkCheckBox.setSelected(filter.isPreventPublicBtcNetwork());

disableDaoCheckBox.setSelected(filter.isDisableDao());
disableDaoBelowVersionInputTextField.setText(filter.getDisableDaoBelowVersion());
disableTradeBelowVersionInputTextField.setText(filter.getDisableTradeBelowVersion());
Expand Down Expand Up @@ -234,6 +217,24 @@ private void setupFieldFromList(InputTextField field, List<String> values) {
field.setText(values.stream().collect(Collectors.joining(", ")));
}

private void setupFieldFromPaymentAccountFiltersList(InputTextField field, List<PaymentAccountFilter> values) {
if (values != null) {
StringBuilder sb = new StringBuilder();
values.stream().forEach(e -> {
if (e != null && e.getPaymentMethodId() != null) {
sb
.append(e.getPaymentMethodId())
.append("|")
.append(e.getGetMethodName())
.append("|")
.append(e.getValue())
.append(", ");
}
});
field.setText(sb.toString());
}
}

private List<String> readAsList(InputTextField field) {
if (field.getText().isEmpty()) {
return Collections.emptyList();
Expand Down

0 comments on commit 0c2639a

Please sign in to comment.