track view layout change, error printing comments

This commit is contained in:
aj 2018-03-29 15:36:12 -07:00
parent 8d731f284d
commit 9119e30335
5 changed files with 31 additions and 24 deletions

View File

@ -5,7 +5,6 @@ import java.awt.GridLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
import javax.swing.JButton; import javax.swing.JButton;
@ -14,8 +13,6 @@ import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import sarsoo.fmframework.music.Album; import sarsoo.fmframework.music.Album;
import sarsoo.fmframework.music.FMObj;
import sarsoo.fmframework.music.Track;
import sarsoo.fmframework.net.Network; import sarsoo.fmframework.net.Network;
public class AlbumView extends JFrame { public class AlbumView extends JFrame {
@ -48,14 +45,14 @@ public class AlbumView extends JFrame {
// if (album.getTrackList() != null) // if (album.getTrackList() != null)
// buttons2.setLayout(new GridLayout(album.getTrackList().size(), 1)); // buttons2.setLayout(new GridLayout(album.getTrackList().size(), 1));
buttons.add(open); buttons2.add(open);
buttons.add(viewArtist); buttons2.add(viewArtist);
if (album.getWiki() != null) if (album.getWiki() != null)
buttons2.add(viewWiki); buttons2.add(viewWiki);
if (album.getMbid() != null) if (album.getMbid() != null)
buttons2.add(musicBrainz); buttons.add(musicBrainz);
buttons2.add(rym); buttons.add(rym);
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US); NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);

View File

@ -16,6 +16,9 @@ import sarsoo.fmframework.music.Track;
import sarsoo.fmframework.net.Network; import sarsoo.fmframework.net.Network;
public class TrackView extends JFrame { public class TrackView extends JFrame {
JPanel info = new JPanel();
JPanel nameInfo = new JPanel();
JPanel scrobbleInfo = new JPanel();
JPanel buttons = new JPanel(); JPanel buttons = new JPanel();
JPanel buttons2 = new JPanel(); JPanel buttons2 = new JPanel();
@ -36,10 +39,13 @@ public class TrackView extends JFrame {
public TrackView(Track track) { public TrackView(Track track) {
super(track.getName()); super(track.getName());
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLayout(new GridLayout(8, 1)); setLayout(new GridLayout(3, 1));
// setSize(300, 300); // setSize(300, 300);
// setResizable(false); // setResizable(false);
info.setLayout(new GridLayout(1,2));
nameInfo.setLayout(new GridLayout(3,1));
scrobbleInfo.setLayout(new GridLayout(3,1));
buttons.setLayout(new FlowLayout()); buttons.setLayout(new FlowLayout());
buttons2.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) if(track.getAlbum() != null)
add(album); nameInfo.add(album);
add(artist); nameInfo.add(artist);
add(listeners); scrobbleInfo.add(listeners);
add(playCount); scrobbleInfo.add(playCount);
add(userPlayCount); scrobbleInfo.add(userPlayCount);
info.add(nameInfo);
info.add(scrobbleInfo);
add(info);
add(buttons); add(buttons);
add(buttons2); add(buttons2);
pack(); pack();

View File

@ -5,7 +5,7 @@ import java.util.ArrayList;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import sarsoo.fmframework.net.Network; import sarsoo.fmframework.net.Network;
import sarsoo.fmframework.net.TestCall; //import sarsoo.fmframework.net.TestCall;
import sarsoo.fmframework.parser.Parser; import sarsoo.fmframework.parser.Parser;
public class Artist extends FMObj{ public class Artist extends FMObj{

View File

@ -6,7 +6,7 @@ import org.w3c.dom.Document;
import sarsoo.fmframework.gui.TrackView; import sarsoo.fmframework.gui.TrackView;
import sarsoo.fmframework.net.Network; import sarsoo.fmframework.net.Network;
import sarsoo.fmframework.net.TestCall; //import sarsoo.fmframework.net.TestCall;
import sarsoo.fmframework.parser.Parser; import sarsoo.fmframework.parser.Parser;
public class Track extends FMObj{ public class Track extends FMObj{
@ -30,7 +30,7 @@ public class Track extends FMObj{
public static Track getTrack(String name, String artist, String username) { public static Track getTrack(String name, String artist, String username) {
String url = Network.getTrackInfoUrl(name, artist, username); String url = Network.getTrackInfoUrl(name, artist, username);
TestCall.test(url); // TestCall.test(url);
Document response = Network.getResponse(url); Document response = Network.getResponse(url);
Track track = Parser.parseTrack(response); Track track = Parser.parseTrack(response);
return track; return track;

View File

@ -12,7 +12,6 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
@ -126,21 +125,21 @@ public class Parser {
node = wikiContents.item(counter); node = wikiContents.item(counter);
if (node.getNodeName().equals("published")) { if (node.getNodeName().equals("published")) {
System.out.println(node.getNodeName() + node.getTextContent()); // System.out.println(node.getNodeName() + node.getTextContent());
date = node.getTextContent(); date = node.getTextContent();
} }
if (node.getNodeName().equals("summary")) { if (node.getNodeName().equals("summary")) {
System.out.println(node.getNodeName() + node.getTextContent()); // System.out.println(node.getNodeName() + node.getTextContent());
summary = node.getTextContent(); summary = node.getTextContent();
} }
if (node.getNodeName().equals("content")) { if (node.getNodeName().equals("content")) {
System.out.println(node.getNodeName() + node.getTextContent()); // System.out.println(node.getNodeName() + node.getTextContent());
content = node.getTextContent(); content = node.getTextContent();
} }
} }
if (date != null && content != null) if (date != null && content != null)
System.out.println("wiki init"); // System.out.println("wiki init");
wiki = new Wiki(date, summary, content); wiki = new Wiki(date, summary, content);
// if (wikiNodeList.item(0) != null) { // if (wikiNodeList.item(0) != null) {
// String date = wikiNodeList.item(0).getFirstChild().getTextContent(); // String date = wikiNodeList.item(0).getFirstChild().getTextContent();
@ -224,7 +223,7 @@ public class Parser {
node = wikiContents.item(counter); node = wikiContents.item(counter);
if (node.getNodeName().equals("published")) { if (node.getNodeName().equals("published")) {
System.out.println(node.getNodeName() + node.getTextContent()); // System.out.println(node.getNodeName() + node.getTextContent());
date = node.getTextContent(); date = node.getTextContent();
} }
// if (node.getNodeName().equals("summary")) { // if (node.getNodeName().equals("summary")) {
@ -232,7 +231,7 @@ public class Parser {
// summary = node.getTextContent(); // summary = node.getTextContent();
// } // }
if (node.getNodeName().equals("content")) { if (node.getNodeName().equals("content")) {
System.out.println(node.getNodeName() + node.getTextContent()); // System.out.println(node.getNodeName() + node.getTextContent());
content = node.getTextContent(); content = node.getTextContent();
} }
} }