Merge pull request #5145 from ripcurlx/improve-pending-trades-list

[v1.5.5] Improve pending trades list rendering
This commit is contained in:
sqrrm 2021-02-01 13:05:03 +01:00 committed by GitHub
commit 1a8aba8221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,16 +126,16 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
private Subscription selectedItemSubscription;
private Stage chatPopupStage;
private ListChangeListener<PendingTradesListItem> tradesListChangeListener;
private Map<String, Long> newChatMessagesByTradeMap = new HashMap<>();
private final Map<String, Long> newChatMessagesByTradeMap = new HashMap<>();
private String tradeIdOfOpenChat;
private double chatPopupStageXPosition = -1;
private double chatPopupStageYPosition = -1;
private ChangeListener<Number> xPositionListener;
private ChangeListener<Number> yPositionListener;
private Map<String, Button> buttonByTrade = new HashMap<>();
private Map<String, JFXBadge> badgeByTrade = new HashMap<>();
private Map<String, ListChangeListener<ChatMessage>> listenerByTrade = new HashMap<>();
private final Map<String, Button> buttonByTrade = new HashMap<>();
private final Map<String, JFXBadge> badgeByTrade = new HashMap<>();
private final Map<String, ListChangeListener<ChatMessage>> listenerByTrade = new HashMap<>();
private ChangeListener<Trade.State> tradeStateListener;
private ChangeListener<Trade.DisputeState> disputeStateListener;
private ChangeListener<MediationResultState> mediationResultStateListener;
@ -536,9 +536,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
if (selectedItemFromModel != null) {
// Select and focus selectedItem from model
int index = tableView.getItems().indexOf(selectedItemFromModel);
UserThread.execute(() -> {
tableView.getSelectionModel().select(index);
});
UserThread.execute(() -> tableView.getSelectionModel().select(index));
}
}
@ -578,12 +576,16 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
setGraphic(null);
if (trade != null && listener != null) {
trade.stateProperty().removeListener(listener);
trade = null;
listener = null;
}
}
}
private void update() {
HyperlinkWithIcon field;
if (trade == null) return;
if (isMaybeInvalidTrade(trade)) {
field = new HyperlinkWithIcon(trade.getShortId());
field.setIcon(FormBuilder.getMediumSizeIcon(MaterialDesignIcon.ALERT_CIRCLE_OUTLINE));
@ -864,7 +866,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
return chatColumn;
}
private TableColumn<PendingTradesListItem, PendingTradesListItem> setRemoveTradeColumnCellFactory() {
private void setRemoveTradeColumnCellFactory() {
moveTradeToFailedColumn.setCellValueFactory((trade) -> new ReadOnlyObjectWrapper<>(trade.getValue()));
moveTradeToFailedColumn.setCellFactory(
new Callback<>() {
@ -937,6 +939,5 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
};
}
});
return moveTradeToFailedColumn;
}
}