From 9119e30335ec5cc74a0a8a91626eb7d03e57b89e Mon Sep 17 00:00:00 2001 From: aj Date: Thu, 29 Mar 2018 15:36:12 -0700 Subject: [PATCH] track view layout change, error printing comments --- .../src/sarsoo/fmframework/gui/AlbumView.java | 11 +++----- .../src/sarsoo/fmframework/gui/TrackView.java | 25 +++++++++++++------ .../src/sarsoo/fmframework/music/Artist.java | 2 +- .../src/sarsoo/fmframework/music/Track.java | 4 +-- .../src/sarsoo/fmframework/parser/Parser.java | 13 +++++----- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/fmframework/src/sarsoo/fmframework/gui/AlbumView.java b/fmframework/src/sarsoo/fmframework/gui/AlbumView.java index 96d6a8d..2a9f297 100644 --- a/fmframework/src/sarsoo/fmframework/gui/AlbumView.java +++ b/fmframework/src/sarsoo/fmframework/gui/AlbumView.java @@ -5,7 +5,6 @@ import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.NumberFormat; -import java.util.ArrayList; import java.util.Locale; import javax.swing.JButton; @@ -14,8 +13,6 @@ import javax.swing.JLabel; import javax.swing.JPanel; import sarsoo.fmframework.music.Album; -import sarsoo.fmframework.music.FMObj; -import sarsoo.fmframework.music.Track; import sarsoo.fmframework.net.Network; public class AlbumView extends JFrame { @@ -48,14 +45,14 @@ public class AlbumView extends JFrame { // if (album.getTrackList() != null) // buttons2.setLayout(new GridLayout(album.getTrackList().size(), 1)); - buttons.add(open); - buttons.add(viewArtist); + buttons2.add(open); + buttons2.add(viewArtist); if (album.getWiki() != null) buttons2.add(viewWiki); if (album.getMbid() != null) - buttons2.add(musicBrainz); - buttons2.add(rym); + buttons.add(musicBrainz); + buttons.add(rym); NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US); diff --git a/fmframework/src/sarsoo/fmframework/gui/TrackView.java b/fmframework/src/sarsoo/fmframework/gui/TrackView.java index a3fdc15..52084e1 100644 --- a/fmframework/src/sarsoo/fmframework/gui/TrackView.java +++ b/fmframework/src/sarsoo/fmframework/gui/TrackView.java @@ -16,6 +16,9 @@ import sarsoo.fmframework.music.Track; import sarsoo.fmframework.net.Network; public class TrackView extends JFrame { + JPanel info = new JPanel(); + JPanel nameInfo = new JPanel(); + JPanel scrobbleInfo = new JPanel(); JPanel buttons = new JPanel(); JPanel buttons2 = new JPanel(); @@ -36,10 +39,13 @@ public class TrackView extends JFrame { public TrackView(Track track) { super(track.getName()); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - setLayout(new GridLayout(8, 1)); + setLayout(new GridLayout(3, 1)); // setSize(300, 300); // setResizable(false); + info.setLayout(new GridLayout(1,2)); + nameInfo.setLayout(new GridLayout(3,1)); + scrobbleInfo.setLayout(new GridLayout(3,1)); buttons.setLayout(new FlowLayout()); buttons2.setLayout(new FlowLayout()); @@ -96,13 +102,18 @@ public class TrackView extends JFrame { } }); - add(name); + nameInfo.add(name); if(track.getAlbum() != null) - add(album); - add(artist); - add(listeners); - add(playCount); - add(userPlayCount); + nameInfo.add(album); + nameInfo.add(artist); + scrobbleInfo.add(listeners); + scrobbleInfo.add(playCount); + scrobbleInfo.add(userPlayCount); + + info.add(nameInfo); + info.add(scrobbleInfo); + + add(info); add(buttons); add(buttons2); pack(); diff --git a/fmframework/src/sarsoo/fmframework/music/Artist.java b/fmframework/src/sarsoo/fmframework/music/Artist.java index 694714e..2ad963d 100644 --- a/fmframework/src/sarsoo/fmframework/music/Artist.java +++ b/fmframework/src/sarsoo/fmframework/music/Artist.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import org.w3c.dom.Document; import sarsoo.fmframework.net.Network; -import sarsoo.fmframework.net.TestCall; +//import sarsoo.fmframework.net.TestCall; import sarsoo.fmframework.parser.Parser; public class Artist extends FMObj{ diff --git a/fmframework/src/sarsoo/fmframework/music/Track.java b/fmframework/src/sarsoo/fmframework/music/Track.java index 6410a7a..8566c35 100644 --- a/fmframework/src/sarsoo/fmframework/music/Track.java +++ b/fmframework/src/sarsoo/fmframework/music/Track.java @@ -6,7 +6,7 @@ import org.w3c.dom.Document; import sarsoo.fmframework.gui.TrackView; import sarsoo.fmframework.net.Network; -import sarsoo.fmframework.net.TestCall; +//import sarsoo.fmframework.net.TestCall; import sarsoo.fmframework.parser.Parser; public class Track extends FMObj{ @@ -30,7 +30,7 @@ public class Track extends FMObj{ public static Track getTrack(String name, String artist, String username) { String url = Network.getTrackInfoUrl(name, artist, username); - TestCall.test(url); +// TestCall.test(url); Document response = Network.getResponse(url); Track track = Parser.parseTrack(response); return track; diff --git a/fmframework/src/sarsoo/fmframework/parser/Parser.java b/fmframework/src/sarsoo/fmframework/parser/Parser.java index ffc7993..52289c3 100644 --- a/fmframework/src/sarsoo/fmframework/parser/Parser.java +++ b/fmframework/src/sarsoo/fmframework/parser/Parser.java @@ -12,7 +12,6 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; -import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -126,21 +125,21 @@ public class Parser { node = wikiContents.item(counter); if (node.getNodeName().equals("published")) { - System.out.println(node.getNodeName() + node.getTextContent()); +// System.out.println(node.getNodeName() + node.getTextContent()); date = node.getTextContent(); } if (node.getNodeName().equals("summary")) { - System.out.println(node.getNodeName() + node.getTextContent()); +// System.out.println(node.getNodeName() + node.getTextContent()); summary = node.getTextContent(); } if (node.getNodeName().equals("content")) { - System.out.println(node.getNodeName() + node.getTextContent()); +// System.out.println(node.getNodeName() + node.getTextContent()); content = node.getTextContent(); } } if (date != null && content != null) - System.out.println("wiki init"); +// System.out.println("wiki init"); wiki = new Wiki(date, summary, content); // if (wikiNodeList.item(0) != null) { // String date = wikiNodeList.item(0).getFirstChild().getTextContent(); @@ -224,7 +223,7 @@ public class Parser { node = wikiContents.item(counter); if (node.getNodeName().equals("published")) { - System.out.println(node.getNodeName() + node.getTextContent()); +// System.out.println(node.getNodeName() + node.getTextContent()); date = node.getTextContent(); } // if (node.getNodeName().equals("summary")) { @@ -232,7 +231,7 @@ public class Parser { // summary = node.getTextContent(); // } if (node.getNodeName().equals("content")) { - System.out.println(node.getNodeName() + node.getTextContent()); +// System.out.println(node.getNodeName() + node.getTextContent()); content = node.getTextContent(); } }