Moves some interface activities to the Swing thread.

We really should be doing this anyway.
This commit is contained in:
Markil3
2021-10-31 16:01:07 -06:00
parent 8022104373
commit afce1a8628

View File

@@ -561,19 +561,25 @@ public class Interface extends JFrame implements SongDisplayListener, ComponentL
@Override
public void updateSongs(Collection<? extends Song> songs)
{
SwingUtilities.invokeLater(() ->
{
this.songList.listAlbums(songs);
this.centerView.setViewportView(this.songList);
this.centerView.revalidate();
});
}
@Override
public void updateCollections(CollectionType type, Collection<?> collections)
{
SwingUtilities.invokeLater(() ->
{
this.collectionList.listCollection(type, collections);
this.centerView.setViewportView(this.collectionList);
this.collectionList.revalidate();
this.centerView.revalidate();
});
}
@Override
@@ -643,6 +649,8 @@ public class Interface extends JFrame implements SongDisplayListener, ComponentL
@Override
public <T> void onUpdate(DataProvider<T> provider, int updated,
int totalUpdate, String updating)
{
SwingUtilities.invokeLater(() ->
{
this.controls.setUpdateProgress(updated, totalUpdate, updating);
if (updated == totalUpdate || totalUpdate == 0)
@@ -656,6 +664,7 @@ public class Interface extends JFrame implements SongDisplayListener, ComponentL
*/
this.updateSongs(songs);
}
});
}
@Override