render offer view after main thread loaded

This commit is contained in:
woodser 2025-01-09 11:01:25 -05:00
parent d9f9c1e736
commit b0c1dceb56

View File

@ -424,7 +424,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
currencySelectionSubscriber = currencySelectionBinding.subscribe((observable, oldValue, newValue) -> { currencySelectionSubscriber = currencySelectionBinding.subscribe((observable, oldValue, newValue) -> {
}); });
tableView.setItems(model.getOfferList()); UserThread.execute(() -> tableView.setItems(model.getOfferList()));
model.getOfferList().addListener(offerListListener); model.getOfferList().addListener(offerListListener);
nrOfOffersLabel.setText(Res.get("offerbook.nrOffers", model.getOfferList().size())); nrOfOffersLabel.setText(Res.get("offerbook.nrOffers", model.getOfferList().size()));
@ -788,13 +788,11 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() { return new TableCell<>() {
@Override @Override
public void updateItem(final OfferBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty) if (item != null && !empty)
setGraphic(new ColoredDecimalPlacesWithZerosText(model.getAmount(item), GUIUtil.AMOUNT_DECIMALS_WITH_ZEROS)); setGraphic(new ColoredDecimalPlacesWithZerosText(model.getAmount(item), GUIUtil.AMOUNT_DECIMALS_WITH_ZEROS));
else else
setGraphic(null); setGraphic(null);
});
} }
}; };
} }
@ -819,13 +817,11 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
@Override @Override
public void updateItem(final OfferBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty) if (item != null && !empty)
setText(CurrencyUtil.getCurrencyPair(item.getOffer().getCurrencyCode())); setText(CurrencyUtil.getCurrencyPair(item.getOffer().getCurrencyCode()));
else else
setText(""); setText("");
});
} }
}; };
} }
@ -855,7 +851,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() { return new TableCell<>() {
@Override @Override
public void updateItem(final OfferBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty) { if (item != null && !empty) {
@ -863,7 +858,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
} else { } else {
setGraphic(null); setGraphic(null);
} }
});
} }
private HBox getPriceAndPercentage(OfferBookListItem item) { private HBox getPriceAndPercentage(OfferBookListItem item) {
@ -939,7 +933,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() { return new TableCell<>() {
@Override @Override
public void updateItem(final OfferBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty) { if (item != null && !empty) {
@ -955,7 +948,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
setText(""); setText("");
setGraphic(null); setGraphic(null);
} }
});
} }
}; };
} }
@ -981,7 +973,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
@Override @Override
public void updateItem(final OfferBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty) { if (item != null && !empty) {
@ -1006,7 +997,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
if (field != null) if (field != null)
field.setOnAction(null); field.setOnAction(null);
} }
});
} }
}; };
} }
@ -1035,7 +1025,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() { return new TableCell<>() {
@Override @Override
public void updateItem(final OfferBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty) { if (item != null && !empty) {
@ -1056,7 +1045,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
setText(""); setText("");
setGraphic(null); setGraphic(null);
} }
});
} }
}; };
} }
@ -1083,7 +1071,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
@Override @Override
public void updateItem(final OfferBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty); super.updateItem(item, empty);
final ImageView iconView = new ImageView(); final ImageView iconView = new ImageView();
@ -1190,7 +1177,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
tableRow.setOnMousePressed(null); tableRow.setOnMousePressed(null);
} }
} }
});
} }
}; };
} }
@ -1218,7 +1204,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() { return new TableCell<>() {
@Override @Override
public void updateItem(final OfferBookListItem item, boolean empty) { public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty); super.updateItem(item, empty);
if (item != null && !empty) { if (item != null && !empty) {
@ -1230,7 +1215,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
} else { } else {
setGraphic(null); setGraphic(null);
} }
});
} }
}; };
} }
@ -1256,7 +1240,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() { return new TableCell<>() {
@Override @Override
public void updateItem(final OfferBookListItem newItem, boolean empty) { public void updateItem(final OfferBookListItem newItem, boolean empty) {
UserThread.execute(() -> {
super.updateItem(newItem, empty); super.updateItem(newItem, empty);
if (newItem != null && !empty) { if (newItem != null && !empty) {
final Offer offer = newItem.getOffer(); final Offer offer = newItem.getOffer();
@ -1275,7 +1258,6 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
} else { } else {
setGraphic(null); setGraphic(null);
} }
});
} }
}; };
} }