add recursive lookup for tab header

This commit is contained in:
Craig Raw 2020-11-11 14:48:10 +02:00
parent f826c2d423
commit bcd2c966a5

View file

@ -150,15 +150,7 @@ public class SendController extends WalletFormController implements Initializabl
addValidation();
addPaymentTab();
Platform.runLater(() -> {
StackPane stackPane = (StackPane)paymentTabs.lookup(".tab-header-area");
if(stackPane != null) {
tabHeader = stackPane;
tabHeader.managedProperty().bind(tabHeader.visibleProperty());
tabHeader.setVisible(false);
paymentTabs.getStyleClass().remove("initial");
}
});
initializeTabHeader(0);
paymentTabs.getTabs().addListener((ListChangeListener<Tab>) c -> {
if(tabHeader != null) {
@ -279,6 +271,21 @@ public class SendController extends WalletFormController implements Initializabl
});
}
private void initializeTabHeader(int count) {
final int lookupCount = count;
Platform.runLater(() -> {
StackPane stackPane = (StackPane)paymentTabs.lookup(".tab-header-area");
if(stackPane != null) {
tabHeader = stackPane;
tabHeader.managedProperty().bind(tabHeader.visibleProperty());
tabHeader.setVisible(false);
paymentTabs.getStyleClass().remove("initial");
} else if(lookupCount < 20) {
initializeTabHeader(lookupCount+1);
}
});
}
public BitcoinUnit getBitcoinUnit(BitcoinUnit bitcoinUnit) {
BitcoinUnit unit = bitcoinUnit;
if(unit == null || unit.equals(BitcoinUnit.AUTO)) {