tag menu disabled until loaded, console uneditable, scrobble scrollpane

This commit is contained in:
aj 2019-05-10 18:58:59 +01:00
parent e3309746fd
commit 3bc0cdcc63
6 changed files with 30 additions and 16 deletions

View File

@ -12,6 +12,7 @@ public class TextAreaConsole implements Console{
private TextAreaConsole() { private TextAreaConsole() {
output = new TextArea(); output = new TextArea();
output.setEditable(false);
} }
public static TextAreaConsole getInstance(){ public static TextAreaConsole getInstance(){

View File

@ -141,6 +141,7 @@ public class RootController {
@Override @Override
public void run() { public void run() {
menuTag.getItems().setAll((ArrayList<MenuItem>) t.getSource().getValue()); menuTag.getItems().setAll((ArrayList<MenuItem>) t.getSource().getValue());
menuTag.setDisable(false);
} }
}); });

View File

@ -38,7 +38,7 @@ public class ScrobblesViewPaneController {
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.UK); NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.UK);
// gridPane.getChildren().clear(); gridPane.getChildren().clear();
int counter; int counter;
for (counter = 0; counter < scrobbles.size(); counter++) { for (counter = 0; counter < scrobbles.size(); counter++) {

View File

@ -10,11 +10,11 @@
<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sarsoo.fmframework.fx.controller.ScrobblesViewPaneController"> <AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sarsoo.fmframework.fx.controller.ScrobblesViewPaneController">
<children> <children>
<SplitPane fx:id="splitPane" dividerPositions="0.4909819639278557" prefHeight="160.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <SplitPane fx:id="splitPane" dividerPositions="0.4909819639278557" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items> <items>
<AnchorPane> <ScrollPane fitToHeight="true" fitToWidth="true" prefViewportHeight="158.0" prefViewportWidth="93.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children> <content>
<GridPane fx:id="gridPane" prefHeight="798.0" prefWidth="486.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <GridPane fx:id="gridPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
@ -22,8 +22,8 @@
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>
</children> </content>
</AnchorPane> </ScrollPane>
<AnchorPane fx:id="areaChartAnchorPane" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"> <AnchorPane fx:id="areaChartAnchorPane" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children> <children>
<AreaChart fx:id="areaChart" layoutX="-93.0" layoutY="69.0" prefHeight="798.0" prefWidth="504.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <AreaChart fx:id="areaChart" layoutX="-93.0" layoutY="69.0" prefHeight="798.0" prefWidth="504.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">

View File

@ -30,7 +30,7 @@
<MenuItem fx:id="menuItemGenrePieChartTab" mnemonicParsing="false" onAction="#handleGenrePieTab" text="genre pie chart" /> <MenuItem fx:id="menuItemGenrePieChartTab" mnemonicParsing="false" onAction="#handleGenrePieTab" text="genre pie chart" />
</items> </items>
</Menu> </Menu>
<Menu fx:id="menuTag" mnemonicParsing="false" text="tags" /> <Menu fx:id="menuTag" disable="true" mnemonicParsing="false" text="tags" />
<Menu fx:id="menuUtil" mnemonicParsing="false" text="util"> <Menu fx:id="menuUtil" mnemonicParsing="false" text="util">
<items> <items>
<MenuItem fx:id="menuItemScrobble" mnemonicParsing="false" onAction="#handleScrobble" text="scrobble" /> <MenuItem fx:id="menuItemScrobble" mnemonicParsing="false" onAction="#handleScrobble" text="scrobble" />

View File

@ -28,34 +28,46 @@ public class FmUserNetworkTest {
@Test @Test
public void testGetRecentTracks() { public void testGetRecentTracks() {
FmUserNetwork net = new FmUserNetwork(Key.getKey(), "sarsoo"); FmUserNetwork net = new FmUserNetwork(Key.getKey(), "sarsoo");
ArrayList<Scrobble> scrobbles = net.getRecentScrobbles(50);
int limit = 50;
ArrayList<Scrobble> scrobbles = net.getRecentScrobbles(limit);
// scrobbles.stream().forEach(System.out::println); // scrobbles.stream().forEach(System.out::println);
System.out.println(scrobbles.size()); System.out.println(scrobbles.size());
assertNotNull(1); assertEquals(limit, scrobbles.size());
} }
@Test @Test
public void testGetTopAlbums() { public void testGetTopAlbums() {
FmUserNetwork net = new FmUserNetwork(Key.getKey(), "sarsoo"); FmUserNetwork net = new FmUserNetwork(Key.getKey(), "sarsoo");
FMObjList list = net.getTopAlbums("7day", 15);
int limit = 50;
FMObjList list = net.getTopAlbums("7day", limit);
// list.stream().forEach(System.out::println); // list.stream().forEach(System.out::println);
assertEquals(15, list.size()); assertEquals(limit, list.size());
} }
@Test @Test
public void testGetTopArtists() { public void testGetTopArtists() {
FmUserNetwork net = new FmUserNetwork(Key.getKey(), "sarsoo"); FmUserNetwork net = new FmUserNetwork(Key.getKey(), "sarsoo");
FMObjList list = net.getTopArtists("7day", 15);
int limit = 50;
FMObjList list = net.getTopArtists("7day", limit);
// list.stream().forEach(System.out::println); // list.stream().forEach(System.out::println);
assertEquals(15, list.size()); assertEquals(limit, list.size());
} }
@Test @Test
public void testGetTopTracks() { public void testGetTopTracks() {
FmUserNetwork net = new FmUserNetwork(Key.getKey(), "sarsoo"); FmUserNetwork net = new FmUserNetwork(Key.getKey(), "sarsoo");
FMObjList list = net.getTopTracks("7day", 15);
int limit = 50;
FMObjList list = net.getTopTracks("7day", limit);
// list.stream().forEach(System.out::println); // list.stream().forEach(System.out::println);
assertEquals(15, list.size()); assertEquals(limit, list.size());
} }
@Test @Test