mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 21:36:45 +00:00
avoid unnecessary computation during entry cell sizing on table scrolls
This commit is contained in:
parent
2d42ebff13
commit
4217de15a3
1 changed files with 8 additions and 0 deletions
|
@ -36,6 +36,8 @@ public class EntryCell extends TreeTableCell<Entry, Entry> {
|
|||
public static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
private static final Pattern REPLACED_BY_FEE_SUFFIX = Pattern.compile("(.*)\\(Replaced By Fee( #)?(\\d+)?\\).*");
|
||||
|
||||
private static EntryCell lastCell;
|
||||
|
||||
public EntryCell() {
|
||||
super();
|
||||
setAlignment(Pos.CENTER_LEFT);
|
||||
|
@ -47,6 +49,12 @@ public class EntryCell extends TreeTableCell<Entry, Entry> {
|
|||
protected void updateItem(Entry entry, boolean empty) {
|
||||
super.updateItem(entry, empty);
|
||||
|
||||
//Return immediately to avoid CPU usage when updating the same invisible cell to determine tableview size (see https://bugs.openjdk.org/browse/JDK-8280442)
|
||||
if(this == lastCell && !getTableRow().isVisible()) {
|
||||
return;
|
||||
}
|
||||
lastCell = this;
|
||||
|
||||
applyRowStyles(this, entry);
|
||||
|
||||
if(empty) {
|
||||
|
|
Loading…
Reference in a new issue