put header string update on jfx thread

This commit is contained in:
jmillman 2014-09-04 10:11:09 -04:00
parent 91ea4f40ac
commit 885c43a182

View File

@ -308,7 +308,9 @@ public class GroupPane extends BorderPane implements GroupView {
*/ */
protected void resetHeaderString() { protected void resetHeaderString() {
if (grouping.get() == null) { if (grouping.get() == null) {
groupLabel.setText(""); Platform.runLater(() -> {
groupLabel.setText("");
});
} else { } else {
int size = grouping.get().getSize(); int size = grouping.get().getSize();
int hashHitCount = grouping.get().getFilesWithHashSetHitsCount(); int hashHitCount = grouping.get().getFilesWithHashSetHitsCount();
@ -318,7 +320,10 @@ public class GroupPane extends BorderPane implements GroupView {
} else { } else {
groupName = grouping.get().groupKey.getValue().toString(); groupName = grouping.get().groupKey.getValue().toString();
} }
groupLabel.setText(StringUtils.defaultIfBlank(groupName, Grouping.UNKNOWN) + " -- " + hashHitCount + " hash set hits / " + size + " files"); final String headerString = StringUtils.defaultIfBlank(groupName, Grouping.UNKNOWN) + " -- " + hashHitCount + " hash set hits / " + size + " files";
Platform.runLater(() -> {
groupLabel.setText(headerString);
});
} }
} }
@ -356,12 +361,12 @@ public class GroupPane extends BorderPane implements GroupView {
//and assign fileIDs to gridView //and assign fileIDs to gridView
if (grouping.get() == null) { if (grouping.get() == null) {
Platform.runLater(gridView.getItems()::clear); Platform.runLater(gridView.getItems()::clear);
} else { } else {
Platform.runLater(() -> { Platform.runLater(() -> {
gridView.setItems(grouping.get().fileIds()); gridView.setItems(grouping.get().fileIds());
}); });
grouping.get().fileIds().addListener((Observable p) -> { grouping.get().fileIds().addListener((Observable p) -> {
resetHeaderString(); resetHeaderString();
}); });
} }