track scrobble viewing implemented
This commit is contained in:
parent
3f30e5e67e
commit
e3309746fd
@ -6,6 +6,7 @@ import java.util.Locale;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.chart.AreaChart;
|
||||
import javafx.scene.chart.XYChart;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
@ -29,13 +30,15 @@ public class ScrobblesViewPaneController {
|
||||
}
|
||||
|
||||
public void populate(FMObj obj) {
|
||||
|
||||
|
||||
ArrayList<Scrobble> scrobbles = obj.getScrobbles();
|
||||
|
||||
|
||||
if (scrobbles != null) {
|
||||
if (scrobbles.size() > 0) {
|
||||
|
||||
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.UK);
|
||||
|
||||
// gridPane.getChildren().clear();
|
||||
|
||||
int counter;
|
||||
for (counter = 0; counter < scrobbles.size(); counter++) {
|
||||
@ -43,14 +46,17 @@ public class ScrobblesViewPaneController {
|
||||
Scrobble scrobble = scrobbles.get(counter);
|
||||
|
||||
Label trackName = new Label(scrobble.getTrack().getName().toLowerCase());
|
||||
Label albumName = new Label(scrobble.getTrack().getAlbum().getName().toLowerCase());
|
||||
Label artistName = new Label(scrobble.getTrack().getArtist().getName().toLowerCase());
|
||||
Label date = new Label(scrobble.getDateTime().toString().toLowerCase());
|
||||
|
||||
gridPane.add(trackName, 0, counter);
|
||||
gridPane.add(albumName, 1, counter);
|
||||
gridPane.add(artistName, 2, counter);
|
||||
gridPane.add(date, 2, counter);
|
||||
gridPane.add(date, 3, counter);
|
||||
|
||||
if(scrobble.getAlbum() != null) {
|
||||
Label albumName = new Label(scrobble.getAlbum().getName().toLowerCase());
|
||||
gridPane.add(albumName, 1, counter);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class TrackBorderPaneController extends FMObjBorderPaneController {
|
||||
FmFramework.getController().addTab(new ArtistTab(track.getArtist()));
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}//
|
||||
}
|
||||
});
|
||||
}else {
|
||||
@ -132,13 +132,17 @@ public class TrackBorderPaneController extends FMObjBorderPaneController {
|
||||
@Override
|
||||
protected Void call() throws Exception {
|
||||
|
||||
track = new FmUserNetwork(Key.getKey(), Reference.getUserName()).refresh(track);
|
||||
FmUserNetwork net = new FmUserNetwork(Key.getKey(), Reference.getUserName());
|
||||
|
||||
track = net.refresh(track);
|
||||
track.setScrobbles(net.getTrackScrobbles(track));
|
||||
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
infoPaneController.refresh(track);
|
||||
scrobblePaneController.populate(track);
|
||||
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user