mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-02-11 20:28:46 -05:00
load offer book views off main thread #1518
This commit is contained in:
parent
3e0b694e13
commit
e8d5366941
@ -788,11 +788,13 @@ 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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -817,12 +819,13 @@ 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("");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -852,6 +855,7 @@ 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) {
|
||||||
@ -859,6 +863,7 @@ 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) {
|
||||||
@ -934,6 +939,7 @@ 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) {
|
||||||
@ -949,6 +955,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
|||||||
setText("");
|
setText("");
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -974,6 +981,7 @@ 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) {
|
||||||
@ -998,6 +1006,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
|||||||
if (field != null)
|
if (field != null)
|
||||||
field.setOnAction(null);
|
field.setOnAction(null);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1026,7 +1035,9 @@ 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) {
|
||||||
var isSellOffer = item.getOffer().getDirection() == OfferDirection.SELL;
|
var isSellOffer = item.getOffer().getDirection() == OfferDirection.SELL;
|
||||||
var deposit = isSellOffer ? item.getOffer().getMaxBuyerSecurityDeposit() :
|
var deposit = isSellOffer ? item.getOffer().getMaxBuyerSecurityDeposit() :
|
||||||
@ -1045,6 +1056,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
|||||||
setText("");
|
setText("");
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1071,6 +1083,7 @@ 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();
|
||||||
@ -1177,6 +1190,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
|||||||
tableRow.setOnMousePressed(null);
|
tableRow.setOnMousePressed(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1204,6 +1218,7 @@ 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) {
|
||||||
@ -1215,6 +1230,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
|||||||
} else {
|
} else {
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1240,6 +1256,7 @@ 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();
|
||||||
@ -1258,6 +1275,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
|
|||||||
} else {
|
} else {
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user