musicbox.gui
Class MusicBoxView

java.lang.Object
  extended by org.jdesktop.application.AbstractBean
      extended by org.jdesktop.application.View
          extended by org.jdesktop.application.FrameView
              extended by musicbox.gui.MusicBoxView
All Implemented Interfaces:
java.awt.event.ActionListener, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.HyperlinkListener

public class MusicBoxView
extends org.jdesktop.application.FrameView
implements java.awt.event.ActionListener, java.beans.PropertyChangeListener, javax.swing.event.HyperlinkListener

The application's main frame.

Author:
Isaac Hammon

Field Summary
 javax.swing.JList addressList
           
 javax.swing.JLabel albumArtLabel
           
 java.util.Vector<noTalent.MusicOutputDesign> allMusic
           
 Backend back
           
 javax.swing.Timer busyIconTimer
           
 int changed
           
 boolean clicked
           
 java.lang.String[] columnNames
           
protected  CustomTableListener ctl
           
 java.util.Vector<java.lang.String> currentlyPlaying2
           
 javax.swing.JTable currentlyPlayingTable
           
 javax.swing.JTable currentlyShowingTable
           
 javax.swing.JTextArea currentTrackInfoBox
           
 Database db
           
 boolean errorMessage
           
 double finalPercent
           
 javax.swing.ImageIcon fiveSmiles
           
 java.awt.Color fontColor
           
protected  boolean foundMixer
           
 javax.swing.ImageIcon fourSmiles
           
 int googleImageLocation
           
 java.lang.String googleSearch
           
 int imageResults
           
 java.util.Vector initial
           
 boolean internetConnection
           
 javax.swing.JButton jButton7
           
 javax.swing.JButton jButton8
           
 javax.swing.JEditorPane jEditorPane1
           
 javax.swing.JLabel jLabel1
           
 javax.swing.JLabel jLabel2
           
 javax.swing.JLabel jLabel5
           
 javax.swing.JList jList1
           
 javax.swing.JList jList2
           
 javax.swing.JList jList3
           
 javax.swing.JMenu jMenu2
           
 javax.swing.JMenu jMenu3
           
 javax.swing.JPopupMenu jPopupMenu3
           
 javax.swing.JProgressBar jProgressBar1
           
 javax.swing.JScrollPane jScrollPane12
           
 javax.swing.JScrollPane jScrollPane2
           
 javax.swing.JScrollPane jScrollPane5
           
 javax.swing.JScrollPane jScrollPane7
           
 javax.swing.JSlider jSlider1
           
 javax.swing.JTabbedPane jTabbedPane1
           
 javax.swing.JTabbedPane jTabbedPane2
           
 javax.swing.LookAndFeel laf
           
 javax.swing.JPanel mainPanel
           
 javax.swing.JMenuBar menuBar
           
 MiniPlayer mini
           
 javax.swing.ImageIcon musicBoxIcon16
           
 javax.swing.JButton nextTrackButton
           
 javax.swing.ImageIcon noImage
           
 javax.swing.ImageIcon oneSmile
           
 boolean originalCP
           
 boolean originalCS
           
 boolean originalPL
           
 MusicBoxView p
           
 javax.swing.JButton pauseButton
           
 javax.swing.JButton playButton
           
 boolean playing
           
 javax.swing.JPopupMenu PlayingPopupMenu
           
 java.util.Vector<java.lang.String> playList
           
 javax.swing.JPopupMenu PlaylistPopupMenu
           
 javax.swing.JTable playlistTable
           
 javax.swing.JFrame pref
           
 java.util.Comparator previousComparator
           
 javax.swing.JButton previousTrackButton
           
 java.awt.Color progressBarColor
           
 java.awt.Font projectFont
           
 javax.swing.JLabel ratingLabel
           
 java.lang.String serverAddress
           
 java.util.Vector<noTalent.MusicOutputDesign> sharedLibrary
           
 javax.swing.JPopupMenu SharedLibraryPopupMenu
           
 javax.swing.JTable sharedLibraryTable
           
 javax.swing.JList sharedPlayList
           
 javax.swing.JPopupMenu ShowingPopupMenu
           
 javax.swing.JButton shuffleButton
           
protected  SmallAlbumArt smallArt
           
 javax.swing.ImageIcon[] smileys
           
protected  SongInfo songInfo
           
 SongSplash songSplash
           
 javax.swing.JButton stopButton
           
 musicbox.gui.MusicBoxView.Task task
          Used for calculating the progress of the progress bar
 javax.swing.ImageIcon threeSmiles
           
 java.util.Timer timer
           
 double timeSkipped
           
 double trackLength
           
 javax.swing.ImageIcon twoSmiles
           
 javax.swing.ImageIcon zeroSmiles
           
 
Constructor Summary
MusicBoxView(org.jdesktop.application.SingleFrameApplication app)
          Constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
           
 void addSongsToPlaylist(java.lang.String name, javax.swing.JTable jT, java.util.Vector<noTalent.MusicOutputDesign> v)
           
 void appendToPlayList(java.util.Vector<noTalent.MusicOutputDesign> v)
           
 void appendToPlayList(java.util.Vector<noTalent.MusicOutputDesign> v, javax.swing.JTable jT)
          Appends the currently selected songs from a table to the playlist.
 void appendToPlayList(java.util.Vector<java.lang.String> v, javax.swing.JTable jT, boolean flag)
           
 void connectToServer()
           
protected  void createAllLibraryAlbumPanels()
           
protected  void createAllLibraryArtistPanels()
           
 void executeTask()
           
 void fin()
          way of removing a property for task.
protected  javax.swing.ImageIcon getAlbumArt(noTalent.MusicOutputDesign m)
           
protected  java.util.Vector<noTalent.MusicOutputDesign> getAllInstancesOfArtist(java.lang.String s)
           
 void getAllMusic()
          Retrieves all the music from the db.
 java.util.Vector<java.lang.String> getAllPlayLists()
           
 void getCurrentlyPlaying()
           
 MusicBoxView getInstance()
           
 int getJList4PreviousSelection()
           
 SocketListener getSocketListener()
           
 void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e)
          Updates the page according to the link the user clicks on.
 boolean isPlaying()
           
 void next()
          Stops the currently playing song and starts playing the next song in the playlist.
 void nextGoogleImage()
           
 void pause()
          Pauses/resumes the current song being played.
 void play()
          Plays the currently selected music, or everything in the library if nothing is selected.
 CustomTableModel populateTableModel(CustomTableModel ctm)
           
 void populateTableModel(CustomTableModel ctm, noTalent.MusicOutputDesign m)
           
 void populateTableModel(CustomTableModel ctm, java.util.Vector<java.lang.Integer> v)
           
 void populateTableModel(CustomTableModel ctm, java.util.Vector<java.lang.String> v, int[] locations)
           
 void populateTableModel2(CustomTableModel ctm, java.util.Vector<java.lang.String> v)
           
 void previous()
          Stops the currently playing song and starts the previous song in the playlist.
 void previousGoogleImage()
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Invoked when task's progress property changes.
 javax.swing.RowFilter<CustomTableModel,java.lang.Object> regexSearch(java.lang.String filterText)
           
 javax.swing.RowFilter<CustomTableModel,java.lang.Object> regexSearch(java.lang.String filterText, int index)
           
 void removeFromCurrentlyPlaying()
           
 void removeSongsFromLibrary()
           
protected  void setAllLibraryAlbumImages(java.sql.Statement stmt)
           
protected  void setAllLibraryArtistImages(java.sql.Statement stmt)
           
 void setFont()
           
 void setFontColor()
           
 void setTickSpacings(javax.swing.JSlider slider)
           
 void showAboutBox()
          Displays the about box.
 void showDirChooser()
          Displays the Directory Chooser.
 void showErrorDialog(java.lang.Exception ex)
          Displays the ErrorDialog
 void showFileChooser()
          Displays the File Chooser
 noTalent.MusicOutputDesign showFileUnavailable(noTalent.MusicOutputDesign current)
           
 void showLargeAlbumArtwork()
          Displays AlbumArt dialog.
 void showMiniPlayer()
           
 void showPreferences()
           
 void showRating()
           
 void showSmallAlbumArt(javax.swing.ImageIcon i, java.lang.String s, java.awt.Point p, javax.swing.JLabel j)
           
 void showSongInfo(javax.swing.JTable jT)
           
 void showSongInfo(javax.swing.JTable jT, java.util.Vector<noTalent.MusicOutputDesign> v)
          Displays SongInfo Dialog
 void showSongSplash(noTalent.MusicOutputDesign m)
          Displays the SongSplash dialog.
 void shuffle()
          Shuffles the current playlist.
 javax.swing.DefaultListModel sortListModel(javax.swing.DefaultListModel dlm)
           
 void stop()
          Stops the current song being played.
 void updateTableAtLocation(noTalent.MusicOutputDesign m, int location, javax.swing.JTable jT)
          Updates a table at one specific location.
 void updateVector(java.util.Vector<noTalent.MusicOutputDesign> v1, noTalent.MusicOutputDesign m1, javax.swing.JTable jT)
          Updates an element in a vector with the latest information.
 void updateVectorAtLocation(java.util.Vector<java.lang.Integer> v1, int location, noTalent.MusicOutputDesign m1, javax.swing.JTable jT)
           
 void updateVectorAtLocation(java.util.Vector<java.lang.String> v1, int location, java.lang.String ID, noTalent.MusicOutputDesign m1, javax.swing.JTable jT)
           
 
Methods inherited from class org.jdesktop.application.FrameView
getFrame, getRootPane, setFrame
 
Methods inherited from class org.jdesktop.application.View
getApplication, getComponent, getContext, getMenuBar, getResourceMap, getStatusBar, getToolBar, getToolBars, setComponent, setMenuBar, setStatusBar, setToolBar, setToolBars
 
Methods inherited from class org.jdesktop.application.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PlayingPopupMenu

public javax.swing.JPopupMenu PlayingPopupMenu

PlaylistPopupMenu

public javax.swing.JPopupMenu PlaylistPopupMenu

SharedLibraryPopupMenu

public javax.swing.JPopupMenu SharedLibraryPopupMenu

ShowingPopupMenu

public javax.swing.JPopupMenu ShowingPopupMenu

addressList

public javax.swing.JList addressList

albumArtLabel

public javax.swing.JLabel albumArtLabel

currentTrackInfoBox

public javax.swing.JTextArea currentTrackInfoBox

currentlyPlayingTable

public javax.swing.JTable currentlyPlayingTable

currentlyShowingTable

public javax.swing.JTable currentlyShowingTable

jButton7

public javax.swing.JButton jButton7

jButton8

public javax.swing.JButton jButton8

jEditorPane1

public javax.swing.JEditorPane jEditorPane1

jLabel1

public javax.swing.JLabel jLabel1

jLabel2

public javax.swing.JLabel jLabel2

jLabel5

public javax.swing.JLabel jLabel5

jList1

public javax.swing.JList jList1

jList2

public javax.swing.JList jList2

jList3

public javax.swing.JList jList3

jPopupMenu3

public javax.swing.JPopupMenu jPopupMenu3

jProgressBar1

public javax.swing.JProgressBar jProgressBar1

jScrollPane12

public javax.swing.JScrollPane jScrollPane12

jScrollPane2

public javax.swing.JScrollPane jScrollPane2

jScrollPane5

public javax.swing.JScrollPane jScrollPane5

jScrollPane7

public javax.swing.JScrollPane jScrollPane7

jSlider1

public javax.swing.JSlider jSlider1

jTabbedPane1

public javax.swing.JTabbedPane jTabbedPane1

jTabbedPane2

public javax.swing.JTabbedPane jTabbedPane2

mainPanel

public javax.swing.JPanel mainPanel

menuBar

public javax.swing.JMenuBar menuBar

nextTrackButton

public javax.swing.JButton nextTrackButton

pauseButton

public javax.swing.JButton pauseButton

playButton

public javax.swing.JButton playButton

playlistTable

public javax.swing.JTable playlistTable

previousTrackButton

public javax.swing.JButton previousTrackButton

ratingLabel

public javax.swing.JLabel ratingLabel

sharedLibraryTable

public javax.swing.JTable sharedLibraryTable

sharedPlayList

public javax.swing.JList sharedPlayList

shuffleButton

public javax.swing.JButton shuffleButton

stopButton

public javax.swing.JButton stopButton

jMenu2

public javax.swing.JMenu jMenu2

jMenu3

public javax.swing.JMenu jMenu3

back

public Backend back

initial

public java.util.Vector initial

allMusic

public java.util.Vector<noTalent.MusicOutputDesign> allMusic

trackLength

public double trackLength

timer

public java.util.Timer timer

currentlyPlaying2

public java.util.Vector<java.lang.String> currentlyPlaying2

originalCP

public boolean originalCP

originalCS

public boolean originalCS

playList

public java.util.Vector<java.lang.String> playList

originalPL

public boolean originalPL

busyIconTimer

public javax.swing.Timer busyIconTimer

songInfo

protected SongInfo songInfo

songSplash

public SongSplash songSplash

playing

public boolean playing

columnNames

public java.lang.String[] columnNames

previousComparator

public java.util.Comparator previousComparator

zeroSmiles

public javax.swing.ImageIcon zeroSmiles

oneSmile

public javax.swing.ImageIcon oneSmile

twoSmiles

public javax.swing.ImageIcon twoSmiles

threeSmiles

public javax.swing.ImageIcon threeSmiles

fourSmiles

public javax.swing.ImageIcon fourSmiles

fiveSmiles

public javax.swing.ImageIcon fiveSmiles

noImage

public javax.swing.ImageIcon noImage

smileys

public javax.swing.ImageIcon[] smileys

musicBoxIcon16

public javax.swing.ImageIcon musicBoxIcon16

db

public Database db

clicked

public boolean clicked

timeSkipped

public double timeSkipped

finalPercent

public double finalPercent

changed

public int changed

task

public musicbox.gui.MusicBoxView.Task task
Used for calculating the progress of the progress bar


p

public MusicBoxView p

googleImageLocation

public int googleImageLocation

imageResults

public int imageResults

googleSearch

public java.lang.String googleSearch

projectFont

public java.awt.Font projectFont

fontColor

public java.awt.Color fontColor

internetConnection

public boolean internetConnection

errorMessage

public boolean errorMessage

progressBarColor

public java.awt.Color progressBarColor

laf

public javax.swing.LookAndFeel laf

mini

public MiniPlayer mini

pref

public javax.swing.JFrame pref

foundMixer

protected boolean foundMixer

smallArt

protected SmallAlbumArt smallArt

ctl

protected CustomTableListener ctl

sharedLibrary

public java.util.Vector<noTalent.MusicOutputDesign> sharedLibrary

serverAddress

public java.lang.String serverAddress
Constructor Detail

MusicBoxView

public MusicBoxView(org.jdesktop.application.SingleFrameApplication app)
Constructor

Parameters:
app -
Method Detail

executeTask

public void executeTask()

getInstance

public MusicBoxView getInstance()

connectToServer

public void connectToServer()

getAlbumArt

protected javax.swing.ImageIcon getAlbumArt(noTalent.MusicOutputDesign m)
Parameters:
m -
Returns:
r

setAllLibraryArtistImages

protected void setAllLibraryArtistImages(java.sql.Statement stmt)
Parameters:
stmt -

setAllLibraryAlbumImages

protected void setAllLibraryAlbumImages(java.sql.Statement stmt)
Parameters:
stmt -

createAllLibraryArtistPanels

protected void createAllLibraryArtistPanels()

createAllLibraryAlbumPanels

protected void createAllLibraryAlbumPanels()

setFont

public void setFont()

setFontColor

public void setFontColor()

showRating

public void showRating()

showAboutBox

@Action
public void showAboutBox()
Displays the about box.


showMiniPlayer

public void showMiniPlayer()

showDirChooser

@Action
public void showDirChooser()
Displays the Directory Chooser.


showFileChooser

@Action
public void showFileChooser()
Displays the File Chooser


showFileUnavailable

public noTalent.MusicOutputDesign showFileUnavailable(noTalent.MusicOutputDesign current)
Parameters:
current -

showLargeAlbumArtwork

@Action
public void showLargeAlbumArtwork()
Displays AlbumArt dialog.


showSmallAlbumArt

@Action
public void showSmallAlbumArt(javax.swing.ImageIcon i,
                                     java.lang.String s,
                                     java.awt.Point p,
                                     javax.swing.JLabel j)
Parameters:
i -
s -
p -
j -

showPreferences

public void showPreferences()

showSongSplash

@Action
public void showSongSplash(noTalent.MusicOutputDesign m)
Displays the SongSplash dialog.

Parameters:
m - information used to display in the dialog.

showSongInfo

@Action
public void showSongInfo(javax.swing.JTable jT,
                                java.util.Vector<noTalent.MusicOutputDesign> v)
Displays SongInfo Dialog

Parameters:
jT - The JTable that is selected
v - The vector that corresponds with the JTable

showSongInfo

@Action
public void showSongInfo(javax.swing.JTable jT)

showErrorDialog

@Action
public void showErrorDialog(java.lang.Exception ex)
Displays the ErrorDialog

Parameters:
ex - Exception to be displayed.

updateVector

public void updateVector(java.util.Vector<noTalent.MusicOutputDesign> v1,
                         noTalent.MusicOutputDesign m1,
                         javax.swing.JTable jT)
Updates an element in a vector with the latest information.

Parameters:
v1 - Vector to be updated.
m1 - New information.
jT - JTable that is associated with the vector.

updateVectorAtLocation

public void updateVectorAtLocation(java.util.Vector<java.lang.Integer> v1,
                                   int location,
                                   noTalent.MusicOutputDesign m1,
                                   javax.swing.JTable jT)

updateVectorAtLocation

public void updateVectorAtLocation(java.util.Vector<java.lang.String> v1,
                                   int location,
                                   java.lang.String ID,
                                   noTalent.MusicOutputDesign m1,
                                   javax.swing.JTable jT)

regexSearch

public javax.swing.RowFilter<CustomTableModel,java.lang.Object> regexSearch(java.lang.String filterText,
                                                                            int index)

regexSearch

public javax.swing.RowFilter<CustomTableModel,java.lang.Object> regexSearch(java.lang.String filterText)

updateTableAtLocation

public void updateTableAtLocation(noTalent.MusicOutputDesign m,
                                  int location,
                                  javax.swing.JTable jT)
Updates a table at one specific location.

Parameters:
m - New information
location - Location in the table to be updated
jT - JTable to be updated.

play

public void play()
Plays the currently selected music, or everything in the library if nothing is selected.


pause

public void pause()
           throws java.lang.InterruptedException
Pauses/resumes the current song being played.

Throws:
java.lang.InterruptedException

stop

public void stop()
Stops the current song being played.


shuffle

public void shuffle()
Shuffles the current playlist.


nextGoogleImage

public void nextGoogleImage()

previousGoogleImage

public void previousGoogleImage()

next

public void next()
Stops the currently playing song and starts playing the next song in the playlist.


previous

public void previous()
Stops the currently playing song and starts the previous song in the playlist.


fin

public void fin()
way of removing a property for task. (Used to finish the progress bar task.)


sortListModel

public javax.swing.DefaultListModel sortListModel(javax.swing.DefaultListModel dlm)
Parameters:
dlm -
Returns:
dlm Returns a sorted list model.

getAllPlayLists

public java.util.Vector<java.lang.String> getAllPlayLists()
Returns:
temp

getAllInstancesOfArtist

protected java.util.Vector<noTalent.MusicOutputDesign> getAllInstancesOfArtist(java.lang.String s)
Parameters:
s -
Returns:
m

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

isPlaying

public boolean isPlaying()

hyperlinkUpdate

public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e)
Updates the page according to the link the user clicks on.

Specified by:
hyperlinkUpdate in interface javax.swing.event.HyperlinkListener
Parameters:
e -

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Invoked when task's progress property changes.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

removeFromCurrentlyPlaying

public void removeFromCurrentlyPlaying()

getCurrentlyPlaying

public void getCurrentlyPlaying()

getAllMusic

public void getAllMusic()
Retrieves all the music from the db.


populateTableModel

public void populateTableModel(CustomTableModel ctm,
                               noTalent.MusicOutputDesign m)

populateTableModel

public CustomTableModel populateTableModel(CustomTableModel ctm)

populateTableModel2

public void populateTableModel2(CustomTableModel ctm,
                                java.util.Vector<java.lang.String> v)

populateTableModel

public void populateTableModel(CustomTableModel ctm,
                               java.util.Vector<java.lang.Integer> v)

populateTableModel

public void populateTableModel(CustomTableModel ctm,
                               java.util.Vector<java.lang.String> v,
                               int[] locations)

appendToPlayList

public void appendToPlayList(java.util.Vector<noTalent.MusicOutputDesign> v,
                             javax.swing.JTable jT)
Appends the currently selected songs from a table to the playlist.

Parameters:
v - Vector associated with the table.
jT - Table that is currently selected.

appendToPlayList

public void appendToPlayList(java.util.Vector<java.lang.String> v,
                             javax.swing.JTable jT,
                             boolean flag)

appendToPlayList

public void appendToPlayList(java.util.Vector<noTalent.MusicOutputDesign> v)
Parameters:
v -

setTickSpacings

public void setTickSpacings(javax.swing.JSlider slider)
Parameters:
slider -

addSongsToPlaylist

public void addSongsToPlaylist(java.lang.String name,
                               javax.swing.JTable jT,
                               java.util.Vector<noTalent.MusicOutputDesign> v)
Parameters:
name -
jT -
v -

getSocketListener

public SocketListener getSocketListener()

getJList4PreviousSelection

public int getJList4PreviousSelection()

removeSongsFromLibrary

public void removeSongsFromLibrary()