Cleaned things up, split primary UI so that we can add better playlist
management. git-svn-id: https://samskivert.googlecode.com/svn/trunk@170 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
//
|
||||||
|
// $Id: BrowsePanel.java,v 1.1 2001/07/12 23:06:55 mdb Exp $
|
||||||
|
|
||||||
|
package robodj.chooser;
|
||||||
|
|
||||||
|
// import java.awt.*;
|
||||||
|
// import java.awt.event.ActionEvent;
|
||||||
|
// import java.awt.event.ActionListener;
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
// import com.samskivert.swing.*;
|
||||||
|
import robodj.repository.*;
|
||||||
|
|
||||||
|
public class BrowsePanel extends JTabbedPane
|
||||||
|
{
|
||||||
|
public BrowsePanel ()
|
||||||
|
{
|
||||||
|
EntryList elist;
|
||||||
|
Category[] cats = Chooser.model.getCategories();
|
||||||
|
|
||||||
|
// create a tab for each category
|
||||||
|
for (int i = 0; i < cats.length; i++) {
|
||||||
|
elist = new EntryList(cats[i].categoryid);
|
||||||
|
String tip = "Browse entries in '" + cats[i].name + "' category.";
|
||||||
|
addTab(cats[i].name, null, elist, tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
// and add one for uncategorized entries
|
||||||
|
elist = new EntryList(-1);
|
||||||
|
addTab("Uncategorized", null, elist,
|
||||||
|
"Browse uncategorized entries.");
|
||||||
|
|
||||||
|
setSelectedIndex(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ChooserFrame.java,v 1.3 2001/07/12 22:31:04 mdb Exp $
|
// $Id: ChooserFrame.java,v 1.4 2001/07/12 23:06:55 mdb Exp $
|
||||||
|
|
||||||
package robodj.chooser;
|
package robodj.chooser;
|
||||||
|
|
||||||
@@ -31,24 +31,15 @@ public class ChooserFrame
|
|||||||
// give ourselves a wee bit of a border
|
// give ourselves a wee bit of a border
|
||||||
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||||
|
|
||||||
// the top of the UI is the playlist manager section
|
// the top of the UI is the browser and the playlist manager
|
||||||
JTabbedPane tpane = new JTabbedPane();
|
JTabbedPane tpane = new JTabbedPane();
|
||||||
EntryList elist;
|
BrowsePanel bpanel = new BrowsePanel();
|
||||||
Category[] cats = Chooser.model.getCategories();
|
String tip = "Browse and select tunes to play.";
|
||||||
|
tpane.addTab("Browse", null, bpanel, tip);
|
||||||
|
|
||||||
// create a tab for each category
|
PlaylistPanel ppanel = new PlaylistPanel();
|
||||||
for (int i = 0; i < cats.length; i++) {
|
tip = "View and manipulate the playlist.";
|
||||||
elist = new EntryList(cats[i].categoryid);
|
tpane.addTab("Playlist", null, ppanel, tip);
|
||||||
String tip = "Browse entries in '" + cats[i].name + "' category.";
|
|
||||||
tpane.addTab(cats[i].name, null, elist, tip);
|
|
||||||
}
|
|
||||||
|
|
||||||
// and add one for uncategorized entries
|
|
||||||
elist = new EntryList(-1);
|
|
||||||
tpane.addTab("Uncategorized", null, elist,
|
|
||||||
"Browse uncategorized entries.");
|
|
||||||
|
|
||||||
tpane.setSelectedIndex(0);
|
|
||||||
top.add(tpane);
|
top.add(tpane);
|
||||||
|
|
||||||
// the bottom is the control bar
|
// the bottom is the control bar
|
||||||
@@ -57,8 +48,7 @@ public class ChooserFrame
|
|||||||
JPanel cbar = new JPanel(bgl);
|
JPanel cbar = new JPanel(bgl);
|
||||||
|
|
||||||
// add some fake control buttons for now
|
// add some fake control buttons for now
|
||||||
cbar.add(createControlButton("Play", "play"));
|
cbar.add(_pause = createControlButton("Pause", "pause"));
|
||||||
cbar.add(createControlButton("Pause", "pause"));
|
|
||||||
cbar.add(createControlButton("Stop", "stop"));
|
cbar.add(createControlButton("Stop", "stop"));
|
||||||
cbar.add(createControlButton("Skip", "skip"));
|
cbar.add(createControlButton("Skip", "skip"));
|
||||||
cbar.add(createControlButton("Clear", "clear"));
|
cbar.add(createControlButton("Clear", "clear"));
|
||||||
@@ -88,9 +78,13 @@ public class ChooserFrame
|
|||||||
|
|
||||||
} else if (cmd.equals("pause")) {
|
} else if (cmd.equals("pause")) {
|
||||||
Chooser.scontrol.pause();
|
Chooser.scontrol.pause();
|
||||||
|
_pause.setLabel("Play");
|
||||||
|
_pause.setActionCommand("play");
|
||||||
|
|
||||||
} else if (cmd.equals("play")) {
|
} else if (cmd.equals("play")) {
|
||||||
Chooser.scontrol.play();
|
Chooser.scontrol.play();
|
||||||
|
_pause.setLabel("Pause");
|
||||||
|
_pause.setActionCommand("Pause");
|
||||||
|
|
||||||
} else if (cmd.equals("clear")) {
|
} else if (cmd.equals("clear")) {
|
||||||
Chooser.scontrol.clear();
|
Chooser.scontrol.clear();
|
||||||
@@ -106,13 +100,5 @@ public class ChooserFrame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Component makeTextPanel (String text)
|
protected JButton _pause;
|
||||||
{
|
|
||||||
JPanel panel = new JPanel(false);
|
|
||||||
JLabel filler = new JLabel(text);
|
|
||||||
filler.setHorizontalAlignment(JLabel.CENTER);
|
|
||||||
panel.setLayout(new GridLayout(1, 1));
|
|
||||||
panel.add(filler);
|
|
||||||
return panel;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: EntryList.java,v 1.2 2001/06/07 08:37:47 mdb Exp $
|
// $Id: EntryList.java,v 1.3 2001/07/12 23:06:55 mdb Exp $
|
||||||
|
|
||||||
package robodj.chooser;
|
package robodj.chooser;
|
||||||
|
|
||||||
@@ -66,7 +66,9 @@ public class EntryList
|
|||||||
|
|
||||||
} else if (name.equals("readAndPlay")) {
|
} else if (name.equals("readAndPlay")) {
|
||||||
for (int i = 0; i < _entry.songs.length; i++) {
|
for (int i = 0; i < _entry.songs.length; i++) {
|
||||||
Chooser.scontrol.append(_entry.songs[i].location);
|
Chooser.scontrol.append(_entry.songs[i].entryid,
|
||||||
|
_entry.songs[i].songid,
|
||||||
|
_entry.songs[i].location);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (name.equals("readSongs")) {
|
} else if (name.equals("readSongs")) {
|
||||||
@@ -259,7 +261,7 @@ public class EntryList
|
|||||||
} else if (cmd.equals("play")) {
|
} else if (cmd.equals("play")) {
|
||||||
JButton src = (JButton)e.getSource();
|
JButton src = (JButton)e.getSource();
|
||||||
Song song = (Song)src.getClientProperty("song");
|
Song song = (Song)src.getClientProperty("song");
|
||||||
Chooser.scontrol.append(song.location);
|
Chooser.scontrol.append(song.entryid, song.songid, song.location);
|
||||||
|
|
||||||
} else if (cmd.equals("up")) {
|
} else if (cmd.equals("up")) {
|
||||||
// re-read the category beacuse this entry may have been
|
// re-read the category beacuse this entry may have been
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
//
|
||||||
|
// $Id: PlaylistPanel.java,v 1.1 2001/07/12 23:06:55 mdb Exp $
|
||||||
|
|
||||||
|
package robodj.chooser;
|
||||||
|
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import com.samskivert.swing.*;
|
||||||
|
|
||||||
|
public class PlaylistPanel
|
||||||
|
extends JPanel
|
||||||
|
implements ActionListener
|
||||||
|
{
|
||||||
|
public PlaylistPanel ()
|
||||||
|
{
|
||||||
|
GroupLayout gl = new VGroupLayout(GroupLayout.STRETCH);
|
||||||
|
gl.setOffAxisPolicy(GroupLayout.STRETCH);
|
||||||
|
setLayout(gl);
|
||||||
|
|
||||||
|
// create the pane that will hold the buttons
|
||||||
|
gl = new VGroupLayout(GroupLayout.NONE);
|
||||||
|
gl.setJustification(GroupLayout.TOP);
|
||||||
|
_bpanel = new JPanel(gl);
|
||||||
|
|
||||||
|
// give ourselves a wee bit of a border
|
||||||
|
_bpanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||||
|
|
||||||
|
// put it into a scrolling pane
|
||||||
|
JScrollPane bscroll = new JScrollPane(_bpanel);
|
||||||
|
add(bscroll);
|
||||||
|
|
||||||
|
// add our navigation button
|
||||||
|
_clearbut = new JButton("Clear");
|
||||||
|
_clearbut.setActionCommand("clear");
|
||||||
|
_clearbut.addActionListener(this);
|
||||||
|
add(_clearbut, GroupLayout.FIXED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed (ActionEvent e)
|
||||||
|
{
|
||||||
|
String cmd = e.getActionCommand();
|
||||||
|
if (cmd.equals("...")) {
|
||||||
|
|
||||||
|
} else if (cmd.equals("clear")) {
|
||||||
|
Chooser.scontrol.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected JPanel _bpanel;
|
||||||
|
protected JButton _clearbut;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ServerControl.java,v 1.1 2001/06/05 16:42:17 mdb Exp $
|
// $Id: ServerControl.java,v 1.2 2001/07/12 23:06:55 mdb Exp $
|
||||||
|
|
||||||
package robodj.util;
|
package robodj.util;
|
||||||
|
|
||||||
@@ -52,9 +52,14 @@ public class ServerControl
|
|||||||
sendCommand("SKIP");
|
sendCommand("SKIP");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void append (String trackPath)
|
public void append (int eid, int sid, String trackPath)
|
||||||
{
|
{
|
||||||
sendCommand("APPEND " + trackPath);
|
sendCommand("APPEND " + eid + " " + sid + " " + trackPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove (int sid)
|
||||||
|
{
|
||||||
|
sendCommand("REMOVE " + sid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getPlaylist ()
|
public String[] getPlaylist ()
|
||||||
|
|||||||
Reference in New Issue
Block a user