PlayListPanel is a class for opening, parsing and presenting M3U style play lists.
It is put in a GUI that implements a trackHandler method to deal with the tracks
selected in the JTable of tracks.
This component offers a text filter for the tracks, a 'random' check box to determine
'next track' behaviour, and keeps a history of tracks already provided to the
trackHandler method.
Name stop unfltr loop
Filter TRUE TRUE TRUE
All TRUE FALSE TRUE
Versions:
2009-10-20
- Changed isRandom() to return a meaningful value
- Moved the history from DukeBoxPanel to PlayListPanel
- Version:
- 2009-10-20
- Author:
- Andrew Thompson
- See Also:
- Serialized Form
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
PlayListPanel
public PlayListPanel(TrackHandler trackHandler)
PlayListPanel
public PlayListPanel(URL url,
TrackHandler trackHandler)
PlayListPanel
public PlayListPanel(File f,
TrackHandler trackHandler)
PlayListPanel
public PlayListPanel(Vector<Track> tracks,
TrackHandler trackHandler)
addDudTrack
public void addDudTrack(Track track)
getDudTracks
public ArrayList<Track> getDudTracks()
constructGUI
public void constructGUI()
isRandom
public boolean isRandom()
getTable
public void getTable()
act
public void act()
- Make an attempt to reselect any row that is already
selected, after a filter is applied or removed.
loadTracks
public void loadTracks(File file)
loadTracks
public void loadTracks(URL url)
loadTracks
public void loadTracks(InputStream is)
setTable
public void setTable(Vector<Track> tableTracks)
popNoTracksMessage
public void popNoTracksMessage()
getNextUnplayedFromIndex
public Track getNextUnplayedFromIndex(Vector<Track> all,
Vector<Track> unplayed,
int index)
next
public URL next()
getDisplayedTracks
public Vector<Track> getDisplayedTracks()
promptClearHistory
public void promptClearHistory()
showHistoryList
public void showHistoryList()
playTrack
public void playTrack(Track track)
getUnplayedTracks
public Vector<Track> getUnplayedTracks()
isFiltered
public boolean isFiltered()
clearTextFilter
public void clearTextFilter()
getHistory
public ArrayList getHistory()
getArtistCount
public int getArtistCount()
- Provides a count of the artists listed in this playlist.This
method ignores pre/suffix of 'the' and is case insensitive.
- Returns:
- The total count of artists in this playlist.
getAverageTrackLength
public int getAverageTrackLength()
- Calculates the average track length of this playlist.
- Returns:
- The average duration of the tracks, in seconds.
secondsToTime
public static String secondsToTime(int seconds)
- Convert a raw count in seconds to the more conventional,
hours/minutes/seconds
- Parameters:
seconds -
- Returns:
- Formatted time as NhNNmNNs
getTotalLength
public int getTotalLength()
- Calculates the total track duration of this playlist.
- Returns:
- The total duration of the tracks, in seconds.
showPlayListInfo
public void showPlayListInfo()
- Show general information on this play list, and a button to open it.
getCurrentTrack
public Track getCurrentTrack()
setSelectedIndex
public void setSelectedIndex(int select)
getDelim
public String getDelim(ArrayList<String> trackStrings)
- An attempt to determine the delimiter used to separate the
band from the track title.
It splits the first records on " " and stores the count of
the different parts.
When it reaches a point that only one part occurs exactly as many times
as the record count, that part is returned as the delimiter.
- Parameters:
trackStrings -
- Returns:
- The delimiter used to separate track from title.