com.melloware.jukes.file
Class Playlist

java.lang.Object
  extended by com.jgoodies.binding.beans.Model
      extended by com.melloware.jukes.file.Playlist
All Implemented Interfaces:
com.jgoodies.binding.beans.Observable, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

public final class Playlist
extends com.jgoodies.binding.beans.Model
implements java.beans.PropertyChangeListener

The playlist of the application. Stores history so you can go back and forth between previous and next tracks. The history and current list can also be saved as M3U playlists.

Copyright (c) 2006 Melloware, Inc.

Version:
4.0
Author:
Emil A. Lefkof III
See Also:
Serialized Form

Field Summary
static java.lang.String PROPERTYNAME_CURRENT_LIST
           
static java.lang.String PROPERTYNAME_HISTORY_LIST
           
 
Constructor Summary
Playlist()
          Default constructor constructs a list of 100 items.
 
Method Summary
 void add(java.lang.Object o)
          Adds an element to the history if it is not the previous element.
 void addNext(java.lang.Object o)
          Adds an element to the history if it is not the previous element.
 boolean contains(java.lang.Object o)
          Checks and answer if the object o is contained in the 'previous' list.
 boolean containsNext(java.lang.Object o)
          Checks and answer if the object o is contained in the 'next' list.
 boolean containsPrevious(java.lang.Object o)
          Checks and answer if the object o is contained in the 'previous' list.
 java.util.Iterator getBackIterator()
          Returns an Iterator for the available backward elements.
 java.lang.String getCurrentDuration()
          Gets the current running time.
 java.util.List getCurrentList()
          Gets the currentList.
 Track getCurrentTrack()
          Gets the currentTrack.
 java.lang.String getHistoryDuration()
          Gets the history running time.
 java.util.List getHistoryList()
          Gets the historyList.
 java.util.List getList()
          Gets the correct list.
 java.lang.Object getNext()
          Returns the next element.
 java.lang.Object getNextImmediate()
          Returns the next element no matter if shuffling.
 java.util.Iterator getNextIterator()
          Returns an Iterator for the available next elements.
 java.lang.Object getPrevious()
          Returns the previous element.
 boolean hasNext()
          Checks and answer if there's a next element.
 boolean hasPrevious()
          Checks and answers if there's a previous element.
 boolean isCurrent()
          Gets the current.
 boolean isShuffleCatalog()
          Gets the shuffleCatalog.
 boolean isShufflePlaylist()
          Gets the shufflePlaylist.
 void moveDown(int index)
          Move an item down on the list.
 void moveOver(int index)
          Move an item to the other list.
 void moveUp(int index)
          Move an item up on the list.
 void playImmediate(Track track)
          Plays this track immediately.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          The Catalog has changed.
 void remove(int index)
          Removes an item from the list.
 void save(java.io.File aFile)
          Saves a playlist to a file.
 void setCurrent(boolean aCurrent)
          Sets the current.
 void setShuffleCatalog(boolean aShuffleCatalog)
          Sets the shuffleCatalog.
 void setShufflePlaylist(boolean aShufflePlaylist)
          Sets the shufflePlaylist.
 int size()
          Returns the size of the correct list.
 int sizeNext()
          Returns the size of the next list.
 int sizePrevious()
          Returns the size of the previous list.
 java.lang.String toString()
           
 void updateState()
          Updates the state of the previous next buttons.
 
Methods inherited from class com.jgoodies.binding.beans.Model
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, equals, fireMulticastPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTYNAME_CURRENT_LIST

public static final java.lang.String PROPERTYNAME_CURRENT_LIST
See Also:
Constant Field Values

PROPERTYNAME_HISTORY_LIST

public static final java.lang.String PROPERTYNAME_HISTORY_LIST
See Also:
Constant Field Values
Constructor Detail

Playlist

public Playlist()
Default constructor constructs a list of 100 items.

Method Detail

getBackIterator

public java.util.Iterator getBackIterator()
Returns an Iterator for the available backward elements.

Returns:
an iterator that iterates over the available backward elements

getCurrentDuration

public java.lang.String getCurrentDuration()
Gets the current running time.

Returns:
Returns the current running time.

getCurrentList

public java.util.List getCurrentList()
Gets the currentList.

Returns:
Returns the currentList.

getCurrentTrack

public Track getCurrentTrack()
Gets the currentTrack.

Returns:
Returns the currentTrack.

getHistoryDuration

public java.lang.String getHistoryDuration()
Gets the history running time.

Returns:
Returns the history running time.

getHistoryList

public java.util.List getHistoryList()
Gets the historyList.

Returns:
Returns the historyList.

getList

public java.util.List getList()
Gets the correct list.

Returns:
Returns the correct list

getNextImmediate

public java.lang.Object getNextImmediate()
Returns the next element no matter if shuffling.

Returns:
the next element

getNext

public java.lang.Object getNext()
Returns the next element.

Returns:
the next element

getNextIterator

public java.util.Iterator getNextIterator()
Returns an Iterator for the available next elements.

Returns:
an iterator that iterates over the available next elements

getPrevious

public java.lang.Object getPrevious()
Returns the previous element.

Returns:
the previous element

setCurrent

public void setCurrent(boolean aCurrent)
Sets the current.

Parameters:
aCurrent - The current to set.

setShuffleCatalog

public void setShuffleCatalog(boolean aShuffleCatalog)
Sets the shuffleCatalog.

Parameters:
aShuffleCatalog - The shuffleCatalog to set.

setShufflePlaylist

public void setShufflePlaylist(boolean aShufflePlaylist)
Sets the shufflePlaylist.

Parameters:
aShufflePlaylist - The shufflePlaylist to set.

isCurrent

public boolean isCurrent()
Gets the current.

Returns:
Returns the current.

isShuffleCatalog

public boolean isShuffleCatalog()
Gets the shuffleCatalog.

Returns:
Returns the shuffleCatalog.

isShufflePlaylist

public boolean isShufflePlaylist()
Gets the shufflePlaylist.

Returns:
Returns the shufflePlaylist.

add

public void add(java.lang.Object o)
Adds an element to the history if it is not the previous element. Returns whether the history changed.

Parameters:
o - the object to add

addNext

public void addNext(java.lang.Object o)
Adds an element to the history if it is not the previous element. Returns whether the history changed.

Parameters:
o - the object to add

contains

public boolean contains(java.lang.Object o)
Checks and answer if the object o is contained in the 'previous' list.

Returns:
true if this item is in the previous list

containsNext

public boolean containsNext(java.lang.Object o)
Checks and answer if the object o is contained in the 'next' list.

Returns:
true if this item is in the next list

containsPrevious

public boolean containsPrevious(java.lang.Object o)
Checks and answer if the object o is contained in the 'previous' list.

Returns:
true if this item is in the previous list

hasNext

public boolean hasNext()
Checks and answer if there's a next element.

Returns:
true if there's a next element

hasPrevious

public boolean hasPrevious()
Checks and answers if there's a previous element.

Returns:
true if there's a previous element

moveDown

public void moveDown(int index)
Move an item down on the list.

Parameters:
index - the index to move

moveOver

public void moveOver(int index)
Move an item to the other list.

Parameters:
index - the index to move

moveUp

public void moveUp(int index)
Move an item up on the list.

Parameters:
index - the index to move

playImmediate

public void playImmediate(Track track)
Plays this track immediately.

Parameters:
track - the track to play immediately

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
The Catalog has changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
evt - describes the property change

remove

public void remove(int index)
Removes an item from the list.

Parameters:
index - the index to remove from the list

save

public void save(java.io.File aFile)
          throws java.lang.Exception
Saves a playlist to a file.

Parameters:
aFile - the file to save.
Throws:
java.lang.Exception - if any error occurs

size

public int size()
Returns the size of the correct list.

Returns:
the size of the correct list

sizeNext

public int sizeNext()
Returns the size of the next list.

Returns:
the size of the next list

sizePrevious

public int sizePrevious()
Returns the size of the previous list.

Returns:
the size of the previous list

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

updateState

public void updateState()
Updates the state of the previous next buttons.



Copyright © 1999-2008 Melloware Inc. All Rights Reserved.