Skip to content

Commit

Permalink
Fixed sorting in views with TableView instances with no implemented
Browse files Browse the repository at this point in the history
sort.
  • Loading branch information
niyid committed Sep 24, 2019
1 parent 4274a8e commit c1a9cce
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ public void updateItem(final BondListItem item, boolean empty) {
};
}
});

column.setComparator(Comparator.comparing(BondListItem::getAmount));
column.setSortType(TableColumn.SortType.ASCENDING);
tableView.getColumns().add(column);
tableView.getSortOrder().add(column);

column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.lockTime"));
column.setMinWidth(40);
column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ public void updateItem(final MyReputationListItem item, boolean empty) {
};
}
});
column.setComparator(Comparator.comparing(MyReputationListItem::getAmount));
column.setSortType(TableColumn.SortType.ASCENDING);
tableView.getColumns().add(column);
tableView.getSortOrder().add(column);

column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.lockTime"));
column.setMinWidth(60);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public void updateItem(final RolesListItem item, boolean empty) {
};
}
});
column.setComparator(Comparator.comparing(RolesListItem::getLockupDate).reversed());
column.setSortType(TableColumn.SortType.ASCENDING);
tableView.getSortOrder().add(column);
tableView.getColumns().add(column);

column = new AutoTooltipTableColumn<>(Res.get("dao.bond.table.column.link"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@ public void updateItem(final OfferListItem newItem, boolean empty) {
});

tableView.getColumns().add(volumeColumn);
volumeColumn.setComparator(Comparator.comparing(item -> item.offer.getPrice()));
volumeColumn.setSortType(TableColumn.SortType.ASCENDING);
tableView.getColumns().add(volumeColumn);

tableView.getColumns().add(amountColumn);
tableView.getColumns().add(priceColumn);
tableView.getColumns().add(avatarColumn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@

import static bisq.desktop.util.FormBuilder.addButtonAfterGroup;

import java.util.Comparator;

@Slf4j
public class ProposalResultsWindow extends TabbedOverlay<ProposalResultsWindow> {

Expand Down Expand Up @@ -249,6 +251,9 @@ public void updateItem(final VoteListItem item, boolean empty) {
};
}
});
column.setComparator(Comparator.comparing(VoteListItem::getBlindVoteDate));
column.setSortType(TableColumn.SortType.DESCENDING);
votesTableView.getSortOrder().add(column);
votesTableView.getColumns().add(column);

column = new AutoTooltipTableColumn<>(Res.get("shared.blindVoteTxId"));
Expand Down

1 comment on commit c1a9cce

@niyid
Copy link
Contributor Author

@niyid niyid commented on c1a9cce Nov 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #3231

Please sign in to comment.