added scrobble chart tab
This commit is contained in:
parent
f662d6d0ae
commit
c037d7414a
39
src/main/java/sarsoo/fmframework/fx/ScrobbleChartTab.java
Normal file
39
src/main/java/sarsoo/fmframework/fx/ScrobbleChartTab.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package sarsoo.fmframework.fx;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.*;
|
||||||
|
import sarsoo.fmframework.fx.controller.AlbumPaneController;
|
||||||
|
import sarsoo.fmframework.fx.controller.ScrobbleChartPaneController;
|
||||||
|
import sarsoo.fmframework.music.Album;
|
||||||
|
|
||||||
|
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
|
||||||
|
public class ScrobbleChartTab extends Tab {
|
||||||
|
|
||||||
|
public ScrobbleChartTab() throws IOException {
|
||||||
|
|
||||||
|
setText("scrobbles");
|
||||||
|
|
||||||
|
FXMLLoader loader = new FXMLLoader(getClass().getResource("ui/ScrobbleChartPane.fxml"));
|
||||||
|
|
||||||
|
AnchorPane pane = (AnchorPane) loader.load();
|
||||||
|
|
||||||
|
AnchorPane.setTopAnchor(pane, 0.0);
|
||||||
|
AnchorPane.setLeftAnchor(pane, 0.0);
|
||||||
|
AnchorPane.setRightAnchor(pane, 0.0);
|
||||||
|
AnchorPane.setBottomAnchor(pane, 0.0);
|
||||||
|
|
||||||
|
setContent(pane);
|
||||||
|
|
||||||
|
ScrobbleChartPaneController control = (ScrobbleChartPaneController) loader.getController();
|
||||||
|
|
||||||
|
//control.populate();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -27,6 +27,7 @@ import sarsoo.fmframework.fx.FMObjListTab;
|
|||||||
import sarsoo.fmframework.fx.FmFramework;
|
import sarsoo.fmframework.fx.FmFramework;
|
||||||
import sarsoo.fmframework.fx.GenrePieChartTitledPane;
|
import sarsoo.fmframework.fx.GenrePieChartTitledPane;
|
||||||
import sarsoo.fmframework.fx.PieChartTitledPane;
|
import sarsoo.fmframework.fx.PieChartTitledPane;
|
||||||
|
import sarsoo.fmframework.fx.ScrobbleChartTab;
|
||||||
import sarsoo.fmframework.fx.TrackTab;
|
import sarsoo.fmframework.fx.TrackTab;
|
||||||
import sarsoo.fmframework.music.Album;
|
import sarsoo.fmframework.music.Album;
|
||||||
import sarsoo.fmframework.music.Artist;
|
import sarsoo.fmframework.music.Artist;
|
||||||
@ -605,6 +606,17 @@ public class ControllerMain {
|
|||||||
protected void handleOpenConsole(ActionEvent event) {
|
protected void handleOpenConsole(ActionEvent event) {
|
||||||
addTab(new ConsoleTab());
|
addTab(new ConsoleTab());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void handleScrobbleChart(ActionEvent event) {
|
||||||
|
try {
|
||||||
|
addTab(new ScrobbleChartTab());
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
protected void handleListEdit(ActionEvent event) {
|
protected void handleListEdit(ActionEvent event) {
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
package sarsoo.fmframework.fx.controller;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import sarsoo.fmframework.fm.FmNetwork;
|
||||||
|
import sarsoo.fmframework.fx.ArtistTab;
|
||||||
|
import sarsoo.fmframework.fx.FmFramework;
|
||||||
|
import sarsoo.fmframework.music.Album;
|
||||||
|
import sarsoo.fmframework.music.Wiki;
|
||||||
|
import sarsoo.fmframework.net.Key;
|
||||||
|
import sarsoo.fmframework.net.Network;
|
||||||
|
import sarsoo.fmframework.util.Maths;
|
||||||
|
import sarsoo.fmframework.util.Reference;
|
||||||
|
import javafx.scene.chart.LineChart;
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
|
||||||
|
public class ScrobbleChartPaneController {
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ToolBar toolBar;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Button buttonRefresh;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ChoiceBox dropDownTimeRange;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private LineChart lineChartScrobbles;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private BorderPane chartBorderPane;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void initialize() {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void handleRefresh(ActionEvent event) {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void populate(Album album) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void refresh() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.chart.*?>
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.util.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.paint.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
|
|
||||||
|
<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sarsoo.fmframework.fx.controller.ScrobbleChartPaneController">
|
||||||
|
<children>
|
||||||
|
<BorderPane fx:id="chartBorderPane" prefHeight="327.0" prefWidth="600.0" stylesheets="@../styles/ObjPane.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<bottom>
|
||||||
|
<ToolBar fx:id="toolBar" prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||||
|
<items>
|
||||||
|
<ChoiceBox fx:id="dropDownTimeRange" prefHeight="25.0" prefWidth="208.0" />
|
||||||
|
<Button fx:id="buttonRefresh" mnemonicParsing="false" onAction="#handleRefresh" text="refresh" />
|
||||||
|
</items>
|
||||||
|
</ToolBar>
|
||||||
|
</bottom>
|
||||||
|
<center>
|
||||||
|
<LineChart fx:id="lineChartScrobbles" BorderPane.alignment="CENTER">
|
||||||
|
<xAxis>
|
||||||
|
<CategoryAxis side="BOTTOM" />
|
||||||
|
</xAxis>
|
||||||
|
<yAxis>
|
||||||
|
<NumberAxis side="LEFT" />
|
||||||
|
</yAxis>
|
||||||
|
</LineChart>
|
||||||
|
</center>
|
||||||
|
</BorderPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
@ -29,6 +29,7 @@
|
|||||||
<items>
|
<items>
|
||||||
<MenuItem fx:id="menuItemScrobble" mnemonicParsing="false" onAction="#handleScrobble" text="scrobble" />
|
<MenuItem fx:id="menuItemScrobble" mnemonicParsing="false" onAction="#handleScrobble" text="scrobble" />
|
||||||
<MenuItem fx:id="menuItemCurrentTrack" mnemonicParsing="false" onAction="#handleCurrentTrack" text="current track" />
|
<MenuItem fx:id="menuItemCurrentTrack" mnemonicParsing="false" onAction="#handleCurrentTrack" text="current track" />
|
||||||
|
<MenuItem fx:id="menuItemScrobbleChart" mnemonicParsing="false" onAction="#handleScrobbleChart" text="scrobble chart" />
|
||||||
<MenuItem fx:id="menuItemOpenConsole" mnemonicParsing="false" onAction="#handleOpenConsole" text="open console" />
|
<MenuItem fx:id="menuItemOpenConsole" mnemonicParsing="false" onAction="#handleOpenConsole" text="open console" />
|
||||||
<MenuItem mnemonicParsing="false" onAction="#handleChangeUsername" text="set username" />
|
<MenuItem mnemonicParsing="false" onAction="#handleChangeUsername" text="set username" />
|
||||||
</items>
|
</items>
|
||||||
|
Loading…
Reference in New Issue
Block a user