Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various improvements #3092

Merged
merged 14 commits into from
Jan 11, 2025
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ protected void selectedChannelChanged(ChatChannel<? extends ChatMessage> chatCha
});
}

void onSelectItem(BisqEasyOpenTradesView.ListItem item) {
void onSelectItem(OpenTradeListItem item) {
if (item == null || !hasTradeForChannel(item.getChannel())) {
selectionService.selectChannel(null);
} else {
Expand Down Expand Up @@ -273,7 +273,7 @@ private void handleChannelRemoved(BisqEasyOpenTradeChannel channel) {
bisqEasyTradeService.findTrade(tradeId)
.ifPresentOrElse(this::handleTradeAndChannelRemoved,
() -> {
Optional<BisqEasyOpenTradesView.ListItem> listItem = findListItem(tradeId);
Optional<OpenTradeListItem> listItem = findListItem(tradeId);
if (listItem.isEmpty()) {
log.debug("Channel with tradeId {} was removed but associated trade and the listItem is not found. " +
"This is expected as we first remove the trade and then the channel.", tradeId);
Expand Down Expand Up @@ -303,7 +303,7 @@ private void handleTradeAndChannelAdded(BisqEasyTrade trade, BisqEasyOpenTradeCh
return;
}

model.getListItems().add(new BisqEasyOpenTradesView.ListItem(channel,
model.getListItems().add(new OpenTradeListItem(channel,
trade,
reputationService,
chatNotificationService,
Expand Down Expand Up @@ -334,7 +334,7 @@ private void handleTradeAndChannelRemoved(BisqEasyTrade trade) {
return;
}

BisqEasyOpenTradesView.ListItem item = findListItem(trade).get();
OpenTradeListItem item = findListItem(trade).get();
item.dispose();
model.getListItems().remove(item);

Expand All @@ -352,7 +352,7 @@ private void handleTradeAndChannelRemoved(BisqEasyTrade trade) {

private void handleClearTradesAndChannels() {
UIThread.run(() -> {
model.getListItems().forEach(BisqEasyOpenTradesView.ListItem::dispose);
model.getListItems().forEach(OpenTradeListItem::dispose);
model.getListItems().clear();

isInMediationPinMap.values().forEach(Pin::unbind);
Expand Down Expand Up @@ -395,11 +395,11 @@ private void updateIsAnyTradeInMediation() {
});
}

private Optional<BisqEasyOpenTradesView.ListItem> findListItem(BisqEasyTrade trade) {
private Optional<OpenTradeListItem> findListItem(BisqEasyTrade trade) {
return findListItem(trade.getId());
}

private Optional<BisqEasyOpenTradesView.ListItem> findListItem(String tradeId) {
private Optional<OpenTradeListItem> findListItem(String tradeId) {
return model.getListItems().stream()
.filter(item -> item.getTrade().getId().equals(tradeId))
.findAny();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public final class BisqEasyOpenTradesModel extends ChatModel {
private final BooleanProperty isAnyTradeInMediation = new SimpleBooleanProperty();
private final StringProperty chatWindowTitle = new SimpleStringProperty();
private final ObjectProperty<Stage> chatWindow = new SimpleObjectProperty<>();
private final ObjectProperty<BisqEasyOpenTradesView.ListItem> selectedItem = new SimpleObjectProperty<>();
private final ObservableList<BisqEasyOpenTradesView.ListItem> listItems = FXCollections.observableArrayList();
private final FilteredList<BisqEasyOpenTradesView.ListItem> filteredList = new FilteredList<>(listItems);
private final SortedList<BisqEasyOpenTradesView.ListItem> sortedList = new SortedList<>(filteredList);
private final ObjectProperty<OpenTradeListItem> selectedItem = new SimpleObjectProperty<>();
private final ObservableList<OpenTradeListItem> listItems = FXCollections.observableArrayList();
private final FilteredList<OpenTradeListItem> filteredList = new FilteredList<>(listItems);
private final SortedList<OpenTradeListItem> sortedList = new SortedList<>(filteredList);

public BisqEasyOpenTradesModel(ChatChannelDomain chatChannelDomain) {
super(chatChannelDomain);
Expand All @@ -58,7 +58,7 @@ void reset() {
chatWindowTitle.set(null);
chatWindow.set(null);
selectedItem.set(null);
listItems.forEach(BisqEasyOpenTradesView.ListItem::dispose);
listItems.forEach(OpenTradeListItem::dispose);
listItems.clear();
}
}
Loading
Loading