added artist tab getting
This commit is contained in:
parent
7a0337ea19
commit
a00199fbd3
38
fmframework/src/sarsoo/fmframework/fx/AlbumTab.java
Normal file
38
fmframework/src/sarsoo/fmframework/fx/AlbumTab.java
Normal file
@ -0,0 +1,38 @@
|
||||
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.music.Album;
|
||||
|
||||
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
||||
public class AlbumTab extends Tab {
|
||||
|
||||
public AlbumTab(Album album) throws IOException {
|
||||
|
||||
setText(album.getName());
|
||||
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("ui/AlbumPane.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);
|
||||
|
||||
AlbumPaneController control = (AlbumPaneController) loader.getController();
|
||||
|
||||
control.populate(album);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
38
fmframework/src/sarsoo/fmframework/fx/ArtistTab.java
Normal file
38
fmframework/src/sarsoo/fmframework/fx/ArtistTab.java
Normal file
@ -0,0 +1,38 @@
|
||||
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.ArtistPaneController;
|
||||
import sarsoo.fmframework.music.Album;
|
||||
import sarsoo.fmframework.music.Artist;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
||||
public class ArtistTab extends Tab {
|
||||
|
||||
public ArtistTab(Artist artist) throws IOException {
|
||||
|
||||
setText(artist.getName());
|
||||
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("ui/ArtistPane.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);
|
||||
|
||||
ArtistPaneController control = (ArtistPaneController) loader.getController();
|
||||
|
||||
control.populate(artist);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -7,6 +7,7 @@ import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import sarsoo.fmframework.fx.controller.ControllerMain;
|
||||
import sarsoo.fmframework.util.Reference;
|
||||
|
||||
public class FmFramework extends Application {
|
||||
@ -14,18 +15,25 @@ public class FmFramework extends Application {
|
||||
private Stage stage;
|
||||
private Scene rootScene;
|
||||
|
||||
private static ControllerMain control;
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws Exception {
|
||||
this.stage = stage;
|
||||
|
||||
Parent root = FXMLLoader.load(getClass().getResource("ui/main.fxml"));
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("ui/main.fxml"));
|
||||
|
||||
// Parent root = FXMLLoader.load(getClass().getResource("ui/main.fxml"));
|
||||
Parent root = (Parent)loader.load();
|
||||
|
||||
Scene scene = new Scene(root, 800, 400);
|
||||
|
||||
rootScene = scene;
|
||||
// scene.getStylesheets().add("styles/style.css");
|
||||
|
||||
stage.setTitle("FM Framework");
|
||||
control = (ControllerMain)loader.getController();
|
||||
|
||||
stage.setTitle("fm framework");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
|
||||
@ -38,8 +46,10 @@ public class FmFramework extends Application {
|
||||
public void changeScene() throws IOException {
|
||||
Parent root = FXMLLoader.load(getClass().getResource("ui/changed.fxml"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static ControllerMain getController() {
|
||||
return control;
|
||||
}
|
||||
|
||||
}
|
||||
|
5
fmframework/src/sarsoo/fmframework/fx/TrackTab.java
Normal file
5
fmframework/src/sarsoo/fmframework/fx/TrackTab.java
Normal file
@ -0,0 +1,5 @@
|
||||
package sarsoo.fmframework.fx;
|
||||
|
||||
public class TrackTab {
|
||||
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
package sarsoo.fmframework.fx.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.text.Text;
|
||||
import sarsoo.fmframework.fx.ArtistTab;
|
||||
import sarsoo.fmframework.fx.FmFramework;
|
||||
import sarsoo.fmframework.music.Album;
|
||||
import sarsoo.fmframework.music.Wiki;
|
||||
import sarsoo.fmframework.net.Network;
|
||||
import sarsoo.fmframework.util.FMObjList;
|
||||
import sarsoo.fmframework.util.Getter;
|
||||
import sarsoo.fmframework.util.Maths;
|
||||
import sarsoo.fmframework.util.Reference;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.chart.*;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
public class AlbumPaneController {
|
||||
|
||||
@FXML
|
||||
private Label labelAlbumName;
|
||||
|
||||
@FXML
|
||||
private Label labelArtistName;
|
||||
|
||||
@FXML
|
||||
private Label labelUserScrobbles;
|
||||
|
||||
@FXML
|
||||
private Label labelRatio;
|
||||
|
||||
@FXML
|
||||
private Label labelTotalListeners;
|
||||
|
||||
@FXML
|
||||
private Label labelTotalScrobbles;
|
||||
|
||||
@FXML
|
||||
private TextArea textAreaWiki;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
|
||||
labelAlbumName.setText("Hello World");
|
||||
|
||||
}
|
||||
|
||||
Album album;
|
||||
|
||||
public void populate(Album album) {
|
||||
|
||||
this.album = album;
|
||||
|
||||
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
|
||||
|
||||
labelAlbumName.setText(album.getName());
|
||||
labelArtistName.setText(album.getArtist().getName());
|
||||
labelUserScrobbles.setText(numberFormat.format(album.getUserPlayCount())
|
||||
+ String.format(" Scrobbles (%.2f%%)", Maths.getPercentListening(album, Reference.getUserName())));
|
||||
|
||||
labelTotalListeners.setText(numberFormat.format(album.getListeners()) + " Listeners");
|
||||
labelTotalScrobbles.setText(numberFormat.format(album.getPlayCount()) + " Total Scrobbles");
|
||||
|
||||
double ratio = album.getTimeListenRatio();
|
||||
|
||||
|
||||
if (ratio > 1) {
|
||||
labelRatio.setText(String.format("listen every %.2f days", ratio));
|
||||
} else if (ratio == 1) {
|
||||
labelRatio.setText("listen every day");
|
||||
} else {
|
||||
labelRatio.setText(String.format("%.2f times a day", 1 / ratio));
|
||||
}
|
||||
|
||||
Wiki wiki = album.getWiki();
|
||||
|
||||
if(wiki != null) {
|
||||
|
||||
textAreaWiki.setText(wiki.getContent()+ "\n\n" + wiki.getDate());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void handleRefresh(ActionEvent event) {
|
||||
refresh();
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void viewOnline(ActionEvent event) {
|
||||
Network.openURL(album.getUrl());
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void viewArtist(ActionEvent event) throws IOException {
|
||||
FmFramework.getController().addTab(new ArtistTab(album.getArtist()));
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void viewRYM(ActionEvent event) {
|
||||
Network.openURL(album.getRymURL());
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
album.refresh();
|
||||
|
||||
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
|
||||
|
||||
labelUserScrobbles.setText(numberFormat.format(album.getUserPlayCount())
|
||||
+ String.format(" Scrobbles (%.2f%%)", Maths.getPercentListening(album, Reference.getUserName())));
|
||||
|
||||
labelTotalListeners.setText(numberFormat.format(album.getListeners()) + " Listeners");
|
||||
labelTotalScrobbles.setText(numberFormat.format(album.getPlayCount()) + " Total Scrobbles");
|
||||
|
||||
double ratio = album.getTimeListenRatio();
|
||||
|
||||
|
||||
if (ratio > 1) {
|
||||
labelRatio.setText(String.format("listen every %.2f days", ratio));
|
||||
} else if (ratio == 1) {
|
||||
labelRatio.setText("listen every day");
|
||||
} else {
|
||||
labelRatio.setText(String.format("%.2f times a day", 1 / ratio));
|
||||
}
|
||||
|
||||
Wiki wiki = album.getWiki();
|
||||
|
||||
if(wiki != null) {
|
||||
|
||||
textAreaWiki.setText(wiki.getContent()+ "\n\n" + wiki.getDate());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
package sarsoo.fmframework.fx.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.text.Text;
|
||||
import sarsoo.fmframework.music.Album;
|
||||
import sarsoo.fmframework.util.FMObjList;
|
||||
import sarsoo.fmframework.util.Getter;
|
||||
import sarsoo.fmframework.util.Maths;
|
||||
import sarsoo.fmframework.util.Reference;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.chart.*;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
public class AlbumTabController {
|
||||
|
||||
@FXML
|
||||
private Label labelAlbumName;
|
||||
|
||||
@FXML
|
||||
private Label labelArtistName;
|
||||
|
||||
@FXML
|
||||
private Label labelUserScrobbles;
|
||||
|
||||
@FXML
|
||||
private Label labelRatio;
|
||||
|
||||
@FXML
|
||||
private Label labelTotalListeners;
|
||||
|
||||
@FXML
|
||||
private Label labelTotalScrobbles;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
|
||||
labelAlbumName.setText("Hello World");
|
||||
|
||||
}
|
||||
|
||||
public void populateTab(Album album) {
|
||||
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
|
||||
|
||||
labelAlbumName.setText(album.getName());
|
||||
labelArtistName.setText(album.getArtist().getName());
|
||||
labelUserScrobbles.setText(numberFormat.format(album.getUserPlayCount())
|
||||
+ String.format(" Scrobbles (%.2f%%)", Maths.getPercentListening(album, Reference.getUserName())));
|
||||
|
||||
labelTotalListeners.setText(numberFormat.format(album.getListeners()) + " Listeners");
|
||||
labelTotalScrobbles.setText(numberFormat.format(album.getPlayCount()) + " Total Scrobbles");
|
||||
|
||||
double ratio = album.getTimeListenRatio();
|
||||
|
||||
|
||||
if (ratio > 1) {
|
||||
labelRatio.setText(String.format("listen every %.2f days", ratio));
|
||||
} else if (ratio == 1) {
|
||||
labelRatio.setText("listen every day");
|
||||
} else {
|
||||
labelRatio.setText(String.format("%.2f times a day", 1 / ratio));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
package sarsoo.fmframework.fx.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.text.Text;
|
||||
import sarsoo.fmframework.fx.FmFramework;
|
||||
import sarsoo.fmframework.music.Album;
|
||||
import sarsoo.fmframework.music.Artist;
|
||||
import sarsoo.fmframework.music.Wiki;
|
||||
import sarsoo.fmframework.net.Network;
|
||||
import sarsoo.fmframework.util.FMObjList;
|
||||
import sarsoo.fmframework.util.Getter;
|
||||
import sarsoo.fmframework.util.Maths;
|
||||
import sarsoo.fmframework.util.Reference;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.chart.*;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
public class ArtistPaneController {
|
||||
|
||||
@FXML
|
||||
private Label labelArtistName;
|
||||
|
||||
@FXML
|
||||
private Label labelUserScrobbles;
|
||||
|
||||
@FXML
|
||||
private Label labelRatio;
|
||||
|
||||
@FXML
|
||||
private Label labelTotalListeners;
|
||||
|
||||
@FXML
|
||||
private Label labelTotalScrobbles;
|
||||
|
||||
@FXML
|
||||
private TextArea textAreaWiki;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Artist artist;
|
||||
|
||||
public void populate(Artist artist) {
|
||||
|
||||
this.artist = artist;
|
||||
|
||||
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
|
||||
|
||||
labelArtistName.setText(artist.getName());
|
||||
labelUserScrobbles.setText(numberFormat.format(artist.getUserPlayCount())
|
||||
+ String.format(" Scrobbles (%.2f%%)", Maths.getPercentListening(artist, Reference.getUserName())));
|
||||
|
||||
labelTotalListeners.setText(numberFormat.format(artist.getListeners()) + " Listeners");
|
||||
labelTotalScrobbles.setText(numberFormat.format(artist.getPlayCount()) + " Total Scrobbles");
|
||||
|
||||
double ratio = artist.getTimeListenRatio();
|
||||
|
||||
|
||||
if (ratio > 1) {
|
||||
labelRatio.setText(String.format("listen every %.2f days", ratio));
|
||||
} else if (ratio == 1) {
|
||||
labelRatio.setText("listen every day");
|
||||
} else {
|
||||
labelRatio.setText(String.format("%.2f times a day", 1 / ratio));
|
||||
}
|
||||
|
||||
Wiki wiki = artist.getWiki();
|
||||
|
||||
if(wiki != null) {
|
||||
|
||||
textAreaWiki.setText(wiki.getContent()+ "\n\n" + wiki.getDate());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void handleRefresh(ActionEvent event) {
|
||||
refresh();
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void viewOnline(ActionEvent event) {
|
||||
Network.openURL(artist.getUrl());
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
protected void viewRYM(ActionEvent event) {
|
||||
Network.openURL(artist.getRymURL());
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
artist.refresh();
|
||||
|
||||
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
|
||||
|
||||
labelUserScrobbles.setText(numberFormat.format(artist.getUserPlayCount())
|
||||
+ String.format(" Scrobbles (%.2f%%)", Maths.getPercentListening(artist, Reference.getUserName())));
|
||||
|
||||
labelTotalListeners.setText(numberFormat.format(artist.getListeners()) + " Listeners");
|
||||
labelTotalScrobbles.setText(numberFormat.format(artist.getPlayCount()) + " Total Scrobbles");
|
||||
|
||||
double ratio = artist.getTimeListenRatio();
|
||||
|
||||
|
||||
if (ratio > 1) {
|
||||
labelRatio.setText(String.format("listen every %.2f days", ratio));
|
||||
} else if (ratio == 1) {
|
||||
labelRatio.setText("listen every day");
|
||||
} else {
|
||||
labelRatio.setText(String.format("%.2f times a day", 1 / ratio));
|
||||
}
|
||||
|
||||
Wiki wiki = artist.getWiki();
|
||||
|
||||
if(wiki != null) {
|
||||
|
||||
textAreaWiki.setText(wiki.getContent()+ "\n\n" + wiki.getDate());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -12,6 +12,8 @@ import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.text.Text;
|
||||
import sarsoo.fmframework.fx.AlbumTab;
|
||||
import sarsoo.fmframework.fx.ArtistTab;
|
||||
import sarsoo.fmframework.fx.FMObjListTab;
|
||||
import sarsoo.fmframework.music.Album;
|
||||
import sarsoo.fmframework.music.Tag;
|
||||
@ -139,6 +141,14 @@ public class ControllerMain {
|
||||
// "rock")));
|
||||
// tabPane.getTabs().add(tab);
|
||||
//
|
||||
|
||||
tabPane.getTabs().add(new AlbumTab(Getter.getAlbum()));
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void handleLookupArtist(ActionEvent event) throws IOException {
|
||||
|
||||
tabPane.getTabs().add(new ArtistTab(Getter.getArtist()));
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -230,4 +240,7 @@ public class ControllerMain {
|
||||
}
|
||||
}
|
||||
|
||||
public void addTab(Tab tab) {
|
||||
tabPane.getTabs().add(tab);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class FMObjListPaneController {
|
||||
|
||||
FMObj obj = list.get(counter);
|
||||
|
||||
Label name = new Label(obj.getName());
|
||||
Label name = new Label(obj.getName().toLowerCase());
|
||||
Label userScrobbles = new Label(numberFormat.format(obj.getUserPlayCount()));
|
||||
Label totalScrobbles = new Label(numberFormat.format(obj.getPlayCount()));
|
||||
|
||||
|
85
fmframework/src/sarsoo/fmframework/fx/ui/AlbumPane.fxml
Normal file
85
fmframework/src/sarsoo/fmframework/fx/ui/AlbumPane.fxml
Normal file
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?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.AlbumPaneController">
|
||||
<children>
|
||||
<BorderPane fx:id="albumBorderPane" prefHeight="327.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<center>
|
||||
<SplitPane dividerPositions="0.5" prefHeight="327.0" prefWidth="600.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<GridPane prefHeight="325.0" prefWidth="296.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="115.0" minHeight="10.0" prefHeight="94.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="181.0" minHeight="10.0" prefHeight="57.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="49.0" minHeight="10.0" prefHeight="33.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="43.0" minHeight="10.0" prefHeight="34.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="39.0" minHeight="10.0" prefHeight="34.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="37.0" minHeight="10.0" prefHeight="35.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label fx:id="labelAlbumName" alignment="CENTER" text="Album Name" wrapText="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
|
||||
<font>
|
||||
<Font name="System Bold" size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelArtistName" alignment="CENTER" text="Artist Name" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelUserScrobbles" alignment="CENTER" text="User Scrobbles" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelRatio" alignment="CENTER" text="Ratio" GridPane.halignment="CENTER" GridPane.rowIndex="3">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelTotalListeners" alignment="CENTER" text="Total Listeners" GridPane.halignment="CENTER" GridPane.rowIndex="4">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelTotalScrobbles" alignment="CENTER" text="Total Scrobbles" GridPane.halignment="CENTER" GridPane.rowIndex="5">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<TextArea fx:id="textAreaWiki" editable="false" layoutX="37.0" layoutY="34.0" prefHeight="285.0" prefWidth="296.0" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</center>
|
||||
<bottom>
|
||||
<ToolBar fx:id="toolBar" prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<Button fx:id="buttonRefresh" mnemonicParsing="false" onAction="#handleRefresh" text="refresh" />
|
||||
<Button fx:id="buttonViewArtist" mnemonicParsing="false" onAction="#viewArtist" text="view artist" />
|
||||
<Button fx:id="buttonViewOnline" mnemonicParsing="false" onAction="#viewOnline" text="view online" />
|
||||
<Button fx:id="buttonViewRYM" mnemonicParsing="false" onAction="#viewRYM" text="view rym" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
</bottom>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</AnchorPane>
|
78
fmframework/src/sarsoo/fmframework/fx/ui/ArtistPane.fxml
Normal file
78
fmframework/src/sarsoo/fmframework/fx/ui/ArtistPane.fxml
Normal file
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?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.ArtistPaneController">
|
||||
<children>
|
||||
<BorderPane fx:id="albumBorderPane" prefHeight="327.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<center>
|
||||
<SplitPane dividerPositions="0.5" prefHeight="327.0" prefWidth="600.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<GridPane prefHeight="325.0" prefWidth="296.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="115.0" minHeight="10.0" prefHeight="94.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="49.0" minHeight="10.0" prefHeight="33.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="43.0" minHeight="10.0" prefHeight="34.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="39.0" minHeight="10.0" prefHeight="34.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="37.0" minHeight="10.0" prefHeight="35.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label fx:id="labelArtistName" alignment="CENTER" text="Artist Name" wrapText="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
|
||||
<font>
|
||||
<Font name="System Bold" size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelUserScrobbles" alignment="CENTER" text="User Scrobbles" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelRatio" alignment="CENTER" text="Ratio" GridPane.halignment="CENTER" GridPane.rowIndex="2">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelTotalListeners" alignment="CENTER" text="Total Listeners" GridPane.halignment="CENTER" GridPane.rowIndex="3">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelTotalScrobbles" alignment="CENTER" text="Total Scrobbles" GridPane.halignment="CENTER" GridPane.rowIndex="4">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<TextArea fx:id="textAreaWiki" editable="false" layoutX="37.0" layoutY="34.0" prefHeight="285.0" prefWidth="296.0" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</center>
|
||||
<bottom>
|
||||
<ToolBar fx:id="toolBar" prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<Button fx:id="buttonRefresh" mnemonicParsing="false" onAction="#handleRefresh" text="refresh" />
|
||||
<Button fx:id="buttonViewOnline" mnemonicParsing="false" onAction="#viewOnline" text="view online" />
|
||||
<Button fx:id="buttonViewRYM" mnemonicParsing="false" onAction="#viewRYM" text="view rym" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
</bottom>
|
||||
</BorderPane>
|
||||
</children>
|
||||
</AnchorPane>
|
@ -1,76 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?import java.lang.*?>
|
||||
<?import java.util.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.paint.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
<BorderPane prefHeight="327.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sarsoo.fmframework.fx.controller.AlbumTabController">
|
||||
<center>
|
||||
<SplitPane dividerPositions="0.5" prefHeight="327.0" prefWidth="600.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<GridPane prefHeight="325.0" prefWidth="296.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="115.0" minHeight="10.0" prefHeight="94.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="181.0" minHeight="10.0" prefHeight="57.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="49.0" minHeight="10.0" prefHeight="33.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="43.0" minHeight="10.0" prefHeight="34.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="39.0" minHeight="10.0" prefHeight="34.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="37.0" minHeight="10.0" prefHeight="35.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label fx:id="labelAlbumName" alignment="CENTER" text="Album Name" wrapText="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
|
||||
<font>
|
||||
<Font name="System Bold" size="18.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelArtistName" alignment="CENTER" text="Artist Name" GridPane.halignment="CENTER" GridPane.rowIndex="1" GridPane.valignment="CENTER">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelUserScrobbles" alignment="CENTER" text="User Scrobbles" GridPane.halignment="CENTER" GridPane.rowIndex="2" GridPane.valignment="CENTER">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelRatio" alignment="CENTER" text="Ratio" GridPane.halignment="CENTER" GridPane.rowIndex="3">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelTotalListeners" alignment="CENTER" text="Total Listeners" GridPane.halignment="CENTER" GridPane.rowIndex="4">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
<Label fx:id="labelTotalScrobbles" alignment="CENTER" text="Total Scrobbles" GridPane.halignment="CENTER" GridPane.rowIndex="5">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
</Label>
|
||||
</children>
|
||||
</GridPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<children>
|
||||
<TextArea fx:id="textAreaWiki" layoutX="37.0" layoutY="34.0" prefHeight="285.0" prefWidth="296.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</center>
|
||||
<bottom>
|
||||
<ToolBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||
<items>
|
||||
<Button mnemonicParsing="false" text="Button" />
|
||||
</items>
|
||||
</ToolBar>
|
||||
</bottom>
|
||||
</BorderPane>
|
@ -10,14 +10,14 @@
|
||||
<top>
|
||||
<MenuBar fx:id="menuBar" BorderPane.alignment="CENTER">
|
||||
<menus>
|
||||
<Menu fx:id="menuLookup" mnemonicParsing="false" text="Lookup">
|
||||
<Menu fx:id="menuLookup" mnemonicParsing="false" text="lookup">
|
||||
<items>
|
||||
<MenuItem fx:id="menuItemTrack" mnemonicParsing="false" text="Track" />
|
||||
<MenuItem fx:id="menuItemAlbum" mnemonicParsing="false" onAction="#handleLookupAlbum" text="Album" />
|
||||
<MenuItem fx:id="menuItemArtist" mnemonicParsing="false" text="Artist" />
|
||||
<MenuItem fx:id="menuItemTrack" mnemonicParsing="false" text="track" />
|
||||
<MenuItem fx:id="menuItemAlbum" mnemonicParsing="false" onAction="#handleLookupAlbum" text="album" />
|
||||
<MenuItem fx:id="menuItemArtist" mnemonicParsing="false" onAction="#handleLookupArtist" text="artist" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu fx:id="menuTag" mnemonicParsing="false" text="Tags" />
|
||||
<Menu fx:id="menuTag" mnemonicParsing="false" text="tags" />
|
||||
</menus>
|
||||
</MenuBar>
|
||||
</top>
|
||||
|
@ -90,4 +90,16 @@ public class Album extends FMObj {
|
||||
return name + " - " + artist.getName();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
Album album = Album.getAlbum(name, artist.getName(), Reference.getUserName());
|
||||
|
||||
this.listeners = album.listeners;
|
||||
this.userPlayCount = album.userPlayCount;
|
||||
this.playCount = album.playCount;
|
||||
this.wiki = album.wiki;
|
||||
this.mbid = album.mbid;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import sarsoo.fmframework.net.TestCall;
|
||||
import sarsoo.fmframework.net.URLBuilder;
|
||||
//import sarsoo.fmframework.net.TestCall;
|
||||
import sarsoo.fmframework.parser.Parser;
|
||||
import sarsoo.fmframework.util.Reference;
|
||||
|
||||
public class Artist extends FMObj {
|
||||
// protected boolean streamable;
|
||||
@ -80,4 +81,17 @@ public class Artist extends FMObj {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
Artist artist = Artist.getArtist(name, Reference.getUserName());
|
||||
|
||||
this.listeners = artist.listeners;
|
||||
this.userPlayCount = artist.userPlayCount;
|
||||
this.playCount = artist.playCount;
|
||||
this.wiki = artist.wiki;
|
||||
this.mbid = artist.mbid;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ public abstract class FMObj implements Comparable<FMObj>{
|
||||
this.wiki = wiki;
|
||||
}
|
||||
|
||||
public abstract void refresh();
|
||||
|
||||
public void view() {
|
||||
FMObjView view = new FMObjView(this);
|
||||
view.setVisible(true);
|
||||
|
@ -9,6 +9,7 @@ import sarsoo.fmframework.net.Network;
|
||||
import sarsoo.fmframework.net.URLBuilder;
|
||||
//import sarsoo.fmframework.net.TestCall;
|
||||
import sarsoo.fmframework.parser.Parser;
|
||||
import sarsoo.fmframework.util.Reference;
|
||||
|
||||
public class Track extends FMObj {
|
||||
protected Album album;
|
||||
@ -89,4 +90,17 @@ public class Track extends FMObj {
|
||||
return name + " - " + artist.getName();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
Track track = Track.getTrack(name, artist.getName(), Reference.getUserName());
|
||||
|
||||
this.listeners = track.listeners;
|
||||
this.userPlayCount = track.userPlayCount;
|
||||
this.playCount = track.playCount;
|
||||
this.wiki = track.wiki;
|
||||
this.mbid = track.mbid;
|
||||
this.isLoved = track.isLoved;
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user