Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import haveno.desktop.main.overlays.popups.Popup;
import haveno.desktop.util.GUIUtil;
import haveno.desktop.util.ImageUtil;
import haveno.desktop.util.Layout;
import javafx.beans.value.ChangeListener;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.EventHandler;
import javafx.scene.Node;
Expand Down Expand Up @@ -67,6 +69,10 @@ public void initialize() {
Label placeholder = new AutoTooltipLabel(Res.get("shared.noAccountsSetupYet"));
placeholder.setWrapText(true);
paymentAccountsListView.setPlaceholder(placeholder);

getPaymentAccounts().addListener((ListChangeListener<PaymentAccount>) change -> {
setPaymentAccountsListHeight();
});
}

@Override
Expand Down Expand Up @@ -153,6 +159,13 @@ public void updateItem(final PaymentAccount item, boolean empty) {
});
}

protected void setPaymentAccountsListHeight() {
int prefNumRows = Math.min(5, Math.max(2, getPaymentAccounts().size()));
double prefHeight = prefNumRows * (Layout.LIST_ROW_HEIGHT + 6);
paymentAccountsListView.setMinHeight(prefHeight);
paymentAccountsListView.setMaxHeight(prefHeight);
}

protected abstract void removeSelectAccountForm();

protected abstract boolean deleteAccountFromModel(PaymentAccount paymentAccount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ protected void buildForm() {

Tuple3<Label, ListView<PaymentAccount>, VBox> tuple = addTopLabelListView(root, gridRow, Res.get("account.crypto.yourCryptoAccounts"), Layout.FIRST_ROW_DISTANCE);
paymentAccountsListView = tuple.second;
int prefNumRows = Math.min(4, Math.max(2, model.dataModel.getNumPaymentAccounts()));
paymentAccountsListView.setMinHeight(prefNumRows * Layout.LIST_ROW_HEIGHT + 34);
paymentAccountsListView.setMaxHeight(prefNumRows * Layout.LIST_ROW_HEIGHT + 34);
setPaymentAccountsListHeight();
setPaymentAccountsCellFactory();

Tuple3<Button, Button, Button> tuple3 = add3ButtonsAfterGroup(root, ++gridRow, Res.get("shared.addNewAccount"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,7 @@ protected void buildForm() {

Tuple3<Label, ListView<PaymentAccount>, VBox> tuple = addTopLabelListView(root, gridRow, Res.get("account.traditional.yourTraditionalAccounts"), Layout.FIRST_ROW_DISTANCE);
paymentAccountsListView = tuple.second;
int prefNumRows = Math.min(4, Math.max(2, model.dataModel.getNumPaymentAccounts()));
paymentAccountsListView.setMinHeight(prefNumRows * Layout.LIST_ROW_HEIGHT + 34);
paymentAccountsListView.setMaxHeight(prefNumRows * Layout.LIST_ROW_HEIGHT + 34);
setPaymentAccountsListHeight();
setPaymentAccountsCellFactory();

Tuple3<Button, Button, Button> tuple3 = add3ButtonsAfterGroup(root, ++gridRow, Res.get("shared.addNewAccount"),
Expand Down
Loading