added scrobble viewing
This commit is contained in:
parent
c6cf7123bb
commit
2bc9aff667
@ -1,37 +1,61 @@
|
|||||||
package sarsoo.fmframework.fx.controller;
|
package sarsoo.fmframework.fx.controller;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.chart.AreaChart;
|
import javafx.scene.chart.AreaChart;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.SplitPane;
|
import javafx.scene.control.SplitPane;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import sarsoo.fmframework.music.FMObj;
|
import sarsoo.fmframework.music.FMObj;
|
||||||
import sarsoo.fmframework.music.Scrobble;
|
import sarsoo.fmframework.music.Scrobble;
|
||||||
|
|
||||||
public class ScrobblesViewPaneController {
|
public class ScrobblesViewPaneController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private SplitPane splitPane;
|
private SplitPane splitPane;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private GridPane gridPane;
|
private GridPane gridPane;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private AreaChart areaChart;
|
private AreaChart areaChart;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void populate(FMObj obj) {
|
public void populate(FMObj obj) {
|
||||||
|
|
||||||
ArrayList<Scrobble> scrobbles = obj.getScrobbles();
|
ArrayList<Scrobble> scrobbles = obj.getScrobbles();
|
||||||
|
|
||||||
|
if (scrobbles != null) {
|
||||||
|
if (scrobbles.size() > 0) {
|
||||||
|
|
||||||
|
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.UK);
|
||||||
|
|
||||||
|
int counter;
|
||||||
|
for (counter = 0; counter < scrobbles.size(); counter++) {
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user