Skip to content

Commit

Permalink
Merge pull request #3092 from HenrikJannsen/various-improvements
Browse files Browse the repository at this point in the history
Various improvements
  • Loading branch information
HenrikJannsen authored Jan 11, 2025
2 parents 2fe25d2 + d7b508e commit b1001a5
Show file tree
Hide file tree
Showing 27 changed files with 270 additions and 380 deletions.
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

0 comments on commit b1001a5

Please sign in to comment.