load offer book views off main thread #1518

This commit is contained in:
woodser 2025-01-05 18:23:21 -05:00
parent 3e0b694e13
commit e8d5366941

View file

@ -788,11 +788,13 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() {
@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty);
if (item != null && !empty)
setGraphic(new ColoredDecimalPlacesWithZerosText(model.getAmount(item), GUIUtil.AMOUNT_DECIMALS_WITH_ZEROS));
else
setGraphic(null);
});
}
};
}
@ -817,12 +819,13 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty);
if (item != null && !empty)
setText(CurrencyUtil.getCurrencyPair(item.getOffer().getCurrencyCode()));
else
setText("");
});
}
};
}
@ -852,6 +855,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() {
@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty);
if (item != null && !empty) {
@ -859,6 +863,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
} else {
setGraphic(null);
}
});
}
private HBox getPriceAndPercentage(OfferBookListItem item) {
@ -934,6 +939,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() {
@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty);
if (item != null && !empty) {
@ -949,6 +955,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
setText("");
setGraphic(null);
}
});
}
};
}
@ -974,6 +981,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty);
if (item != null && !empty) {
@ -998,6 +1006,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
if (field != null)
field.setOnAction(null);
}
});
}
};
}
@ -1026,7 +1035,9 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() {
@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty);
if (item != null && !empty) {
var isSellOffer = item.getOffer().getDirection() == OfferDirection.SELL;
var deposit = isSellOffer ? item.getOffer().getMaxBuyerSecurityDeposit() :
@ -1045,6 +1056,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
setText("");
setGraphic(null);
}
});
}
};
}
@ -1071,6 +1083,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty);
final ImageView iconView = new ImageView();
@ -1177,6 +1190,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
tableRow.setOnMousePressed(null);
}
}
});
}
};
}
@ -1204,6 +1218,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() {
@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
UserThread.execute(() -> {
super.updateItem(item, empty);
if (item != null && !empty) {
@ -1215,6 +1230,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
} else {
setGraphic(null);
}
});
}
};
}
@ -1240,6 +1256,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
return new TableCell<>() {
@Override
public void updateItem(final OfferBookListItem newItem, boolean empty) {
UserThread.execute(() -> {
super.updateItem(newItem, empty);
if (newItem != null && !empty) {
final Offer offer = newItem.getOffer();
@ -1258,6 +1275,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
} else {
setGraphic(null);
}
});
}
};
}