Moves some interface activities to the Swing thread.
We really should be doing this anyway.
This commit is contained in:
@@ -244,7 +244,7 @@ public class Interface extends JFrame implements SongDisplayListener, ComponentL
|
|||||||
.showMessageDialog(Interface.this,
|
.showMessageDialog(Interface.this,
|
||||||
command.getException(),
|
command.getException(),
|
||||||
command.getException()
|
command.getException()
|
||||||
.getMessage(),
|
.getMessage(),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -461,7 +461,7 @@ public class Interface extends JFrame implements SongDisplayListener, ComponentL
|
|||||||
this.setFocusCycleRoot(true);
|
this.setFocusCycleRoot(true);
|
||||||
|
|
||||||
this.getContentPane()
|
this.getContentPane()
|
||||||
.add(this.collectionTypes, BorderLayout.LINE_START);
|
.add(this.collectionTypes, BorderLayout.LINE_START);
|
||||||
this.collectionTypes.addFocusListener(this);
|
this.collectionTypes.addFocusListener(this);
|
||||||
this.collectionTypes.addSongDisplayListener(this);
|
this.collectionTypes.addSongDisplayListener(this);
|
||||||
|
|
||||||
@@ -562,18 +562,24 @@ public class Interface extends JFrame implements SongDisplayListener, ComponentL
|
|||||||
@Override
|
@Override
|
||||||
public void updateSongs(Collection<? extends Song> songs)
|
public void updateSongs(Collection<? extends Song> songs)
|
||||||
{
|
{
|
||||||
this.songList.listAlbums(songs);
|
SwingUtilities.invokeLater(() ->
|
||||||
this.centerView.setViewportView(this.songList);
|
{
|
||||||
this.centerView.revalidate();
|
this.songList.listAlbums(songs);
|
||||||
|
this.centerView.setViewportView(this.songList);
|
||||||
|
this.centerView.revalidate();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateCollections(CollectionType type, Collection<?> collections)
|
public void updateCollections(CollectionType type, Collection<?> collections)
|
||||||
{
|
{
|
||||||
this.collectionList.listCollection(type, collections);
|
SwingUtilities.invokeLater(() ->
|
||||||
this.centerView.setViewportView(this.collectionList);
|
{
|
||||||
this.collectionList.revalidate();
|
this.collectionList.listCollection(type, collections);
|
||||||
this.centerView.revalidate();
|
this.centerView.setViewportView(this.collectionList);
|
||||||
|
this.collectionList.revalidate();
|
||||||
|
this.centerView.revalidate();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -644,18 +650,21 @@ public class Interface extends JFrame implements SongDisplayListener, ComponentL
|
|||||||
public <T> void onUpdate(DataProvider<T> provider, int updated,
|
public <T> void onUpdate(DataProvider<T> provider, int updated,
|
||||||
int totalUpdate, String updating)
|
int totalUpdate, String updating)
|
||||||
{
|
{
|
||||||
this.controls.setUpdateProgress(updated, totalUpdate, updating);
|
SwingUtilities.invokeLater(() ->
|
||||||
if (updated == totalUpdate || totalUpdate == 0)
|
|
||||||
{
|
{
|
||||||
Collection<? extends Song> songs =
|
this.controls.setUpdateProgress(updated, totalUpdate, updating);
|
||||||
PlayerEnvironment.getSongs().getSongs();
|
if (updated == totalUpdate || totalUpdate == 0)
|
||||||
logger.debug("Resetting the song provider with {} songs.",
|
{
|
||||||
songs.size());
|
Collection<? extends Song> songs =
|
||||||
/*
|
PlayerEnvironment.getSongs().getSongs();
|
||||||
* TODO - Add some way to get back to the current view, just updated
|
logger.debug("Resetting the song provider with {} songs.",
|
||||||
*/
|
songs.size());
|
||||||
this.updateSongs(songs);
|
/*
|
||||||
}
|
* TODO - Add some way to get back to the current view, just updated
|
||||||
|
*/
|
||||||
|
this.updateSongs(songs);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user