org.lyra.Interface
Class PlayerPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.lyra.Interface.PlayerPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class PlayerPanel
extends javax.swing.JPanel

This class serves as the primary interface for the PlayerOrganiserFrame class. While that class deals with finding and selecting songs for play this panel provides the missing functionality which will permit it to control play back.

Version:
1.0.5, %Revision, 174%, %LastChangedDate, 27/10/12 3:33PM%
Author:
Martin Foster
See Also:
PlayerOrganiserFrame, Serialized Form

Nested Class Summary
private  class PlayerPanel.Interact
          The code separation from the user interface.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.JButton buttonBack
           
private  javax.swing.JButton buttonCrossfade
           
private  javax.swing.JButton buttonNext
           
private  javax.swing.JButton buttonPlay
           
private  javax.swing.JButton buttonStop
           
private  javax.swing.JButton buttonVolume
           
private  Playback Control
           
private  CrossfadeMenu CrossfadeControl
           
private  javax.swing.JPopupMenu CrossfadePopup
           
private  java.util.Set<java.lang.String> Enabled
           
private  java.util.Map<java.lang.String,java.lang.String> Global
           
private  javax.swing.ImageIcon iconMute
           
private  javax.swing.ImageIcon iconPause
           
private  javax.swing.ImageIcon iconPlay
           
private  javax.swing.ImageIcon iconVolume
           
private  Status Information
           
private  PlayerPanel.Interact Interface
           
private  javax.swing.JLabel labelTime
           
private  javax.swing.JLabel labelTitle
           
private  java.util.Map<java.lang.String,java.lang.String> Lang
           
private  Ledger Logger
           
private  Comptroller Manager
           
private  Options Modes
           
private  javax.swing.JPanel panelControl
           
private  javax.swing.JPanel panelDisplay
           
private  javax.swing.JPanel panelInformation
           
private  javax.swing.JPanel panelTime
           
private  javax.swing.JPanel panelTitle
           
private  java.awt.Frame Parent
           
private static long serialVersionUID
           
private  javax.swing.JSlider sliderProgress
           
private static int TICKER_WIDTH
           
private  javax.swing.JToggleButton toggleRandom
           
private  javax.swing.JToggleButton toggleRepeat
           
private  javax.swing.JToggleButton toggleSingle
           
private  VolumeMenu VolumeControl
           
private  javax.swing.JPopupMenu VolumePopup
           
private  Updater Watcher
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PlayerPanel(Ledger logger, Comptroller manager, Status information, Playback control, Options modes, Updater watcher, Pendulum clock, java.util.Map<java.lang.String,java.lang.String> global, java.util.Map<java.lang.String,java.lang.String> lang, java.awt.Frame parent)
          Primary constructor class for this component.
 
Method Summary
private  javax.swing.JButton getButtonBack()
          This method initialises buttonBack.
private  javax.swing.JButton getButtonCrossfade()
          This method initialises buttonCrossfade.
private  javax.swing.JButton getButtonNext()
          This method initialises playerNext.
private  javax.swing.JButton getButtonPlay()
          This method initialises buttonPlay.
private  javax.swing.JButton getButtonStop()
          This method initialises buttonStop.
private  javax.swing.JButton getButtonVolume()
          This method initialises buttonVolume.
private  javax.swing.ImageIcon getIconMute()
          This method initialises iconMute.
private  javax.swing.ImageIcon getIconPause()
          This method initialises iconPause.
private  javax.swing.ImageIcon getIconPlay()
          This method initialises iconPlay.
private  javax.swing.ImageIcon getIconVolume()
          This method initialises iconVolume.
private  javax.swing.JLabel getLabelTime()
          This method initialises labelTime.
private  javax.swing.JLabel getLabelTitle()
          This method initialises labelTitle.
private  javax.swing.JPanel getPanelControl()
          This method initialises panelControl.
private  javax.swing.JPanel getPanelDisplay()
          Group container which will carry both the informational display and the album art display from the Last.fm service.
private  javax.swing.JPanel getPanelInformation()
          This method initialises panelInformation.
private  javax.swing.JPanel getPanelTime()
          This method initialises labelTime.
private  javax.swing.JPanel getPanelTitle()
          This method initialises labelTitle.
private  javax.swing.JSlider getSliderProgress()
          This method initialises sliderProgress
private  javax.swing.JToggleButton getToggleRandom()
          This method initialises toggleRandom.
private  javax.swing.JToggleButton getToggleRepeat()
          This method initialises toggleRepeat.
private  javax.swing.JToggleButton getToggleSingle()
          This method initialises toggleSingle.
private  void initFrame()
          This method initialises the baseline structure.
 void setButtonPlayAsPause()
          Adjusts the icon for the play button setting it to a pause icon.
 void setButtonPlayAsPlay()
          Adjusts the icon for the play button setting it to a play icon.
 void setButtonVolumeAsMute()
          Adjusts the icon for the volume button setting it to a mute icon.
 void setButtonVolumeAsVolume()
          Adjusts the icon for the play button setting it to a play icon.
 void setLabelTime(int elapsed, int total)
          Sets the display label for the time field.
 void setLabelTitle(java.lang.String title)
          Sets the display label for the title field.
 void setSliderProgress(int elapsed, int total)
          Sets the slider of the position and capacity.
 void setToggleRandom(boolean state)
          Adjusts the state information for the toggle button.
 void setToggleRepeat(boolean state)
          Adjusts the state information for the toggle button.
 void setToggleSingle(boolean state)
          Adjusts the state information for the toggle button.
 void updateDisplay()
          Updates the elements that have been skipped over when the window is not currently being displayed.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

panelDisplay

private javax.swing.JPanel panelDisplay

panelInformation

private javax.swing.JPanel panelInformation

labelTitle

private javax.swing.JLabel labelTitle

panelTitle

private javax.swing.JPanel panelTitle

labelTime

private javax.swing.JLabel labelTime

panelTime

private javax.swing.JPanel panelTime

sliderProgress

private javax.swing.JSlider sliderProgress

panelControl

private javax.swing.JPanel panelControl

buttonBack

private javax.swing.JButton buttonBack

buttonPlay

private javax.swing.JButton buttonPlay

buttonNext

private javax.swing.JButton buttonNext

buttonStop

private javax.swing.JButton buttonStop

buttonVolume

private javax.swing.JButton buttonVolume

buttonCrossfade

private javax.swing.JButton buttonCrossfade

toggleRandom

private javax.swing.JToggleButton toggleRandom

toggleRepeat

private javax.swing.JToggleButton toggleRepeat

toggleSingle

private javax.swing.JToggleButton toggleSingle

iconPlay

private javax.swing.ImageIcon iconPlay

iconPause

private javax.swing.ImageIcon iconPause

iconVolume

private javax.swing.ImageIcon iconVolume

iconMute

private javax.swing.ImageIcon iconMute

Interface

private PlayerPanel.Interact Interface

Manager

private Comptroller Manager

Logger

private Ledger Logger

Information

private Status Information

Control

private Playback Control

Modes

private Options Modes

VolumeControl

private VolumeMenu VolumeControl

VolumePopup

private javax.swing.JPopupMenu VolumePopup

CrossfadeControl

private CrossfadeMenu CrossfadeControl

CrossfadePopup

private javax.swing.JPopupMenu CrossfadePopup

Lang

private java.util.Map<java.lang.String,java.lang.String> Lang

Global

private java.util.Map<java.lang.String,java.lang.String> Global

Enabled

private java.util.Set<java.lang.String> Enabled

Watcher

private Updater Watcher

Parent

private java.awt.Frame Parent

TICKER_WIDTH

private static final int TICKER_WIDTH
See Also:
Constant Field Values
Constructor Detail

PlayerPanel

public PlayerPanel(Ledger logger,
                   Comptroller manager,
                   Status information,
                   Playback control,
                   Options modes,
                   Updater watcher,
                   Pendulum clock,
                   java.util.Map<java.lang.String,java.lang.String> global,
                   java.util.Map<java.lang.String,java.lang.String> lang,
                   java.awt.Frame parent)
Primary constructor class for this component. Will pass on all of the necessary control elements to make it interactive.

Parameters:
logger - Ledger instance for logging of events.
manager - Database comptroller instance.
information - State and status information for playback and modes.
control - Playback control instance.
modes - Options handler for control host Options.
watcher - Updater instance to receive changes in player state.
clock - Timer to keep players up to date.
global - Global settings.
lang - Language elements.
parent - Parent holding window.
Method Detail

initFrame

private void initFrame()
This method initialises the baseline structure. Enabling the panel to be initialised and passed on.


getButtonBack

private javax.swing.JButton getButtonBack()
This method initialises buttonBack.

Returns:
javax.swing.JButton

getButtonPlay

private javax.swing.JButton getButtonPlay()
This method initialises buttonPlay. This button also includes the pause button, icon changes based on state.

Returns:
javax.swing.JButton

getButtonNext

private javax.swing.JButton getButtonNext()
This method initialises playerNext.

Returns:
javax.swing.JButton

getButtonStop

private javax.swing.JButton getButtonStop()
This method initialises buttonStop.

Returns:
javax.swing.JButton

getPanelInformation

private javax.swing.JPanel getPanelInformation()
This method initialises panelInformation.

Returns:
javax.swing.JPanel

getPanelDisplay

private javax.swing.JPanel getPanelDisplay()
Group container which will carry both the informational display and the album art display from the Last.fm service.

Returns:
javax.swing.JPanel

getLabelTime

private javax.swing.JLabel getLabelTime()
This method initialises labelTime.

Returns:
javax.swing.JLabel

getLabelTitle

private javax.swing.JLabel getLabelTitle()
This method initialises labelTitle.

Returns:
javax.swing.JLabel

getPanelTitle

private javax.swing.JPanel getPanelTitle()
This method initialises labelTitle.

Returns:
javax.swing.JTextField

getPanelTime

private javax.swing.JPanel getPanelTime()
This method initialises labelTime.

Returns:
javax.swing.JTextField

getSliderProgress

private javax.swing.JSlider getSliderProgress()
This method initialises sliderProgress

Returns:
javax.swing.JSlider

getButtonVolume

private javax.swing.JButton getButtonVolume()
This method initialises buttonVolume.

Returns:
javax.swing.JButton

getButtonCrossfade

private javax.swing.JButton getButtonCrossfade()
This method initialises buttonCrossfade.

Returns:
javax.swing.JButton

getToggleRandom

private javax.swing.JToggleButton getToggleRandom()
This method initialises toggleRandom.

Returns:
javax.swing.JToggleButton

getToggleRepeat

private javax.swing.JToggleButton getToggleRepeat()
This method initialises toggleRepeat.

Returns:
javax.swing.JToggleButton

getToggleSingle

private javax.swing.JToggleButton getToggleSingle()
This method initialises toggleSingle.

Returns:
javax.swing.JToggleButton

getPanelControl

private javax.swing.JPanel getPanelControl()
This method initialises panelControl. This panel defines all of the control buttons for play back.

Returns:
javax.swing.JPanel

getIconPlay

private javax.swing.ImageIcon getIconPlay()
This method initialises iconPlay.

Returns:
javax.swing.ImageIcon

getIconPause

private javax.swing.ImageIcon getIconPause()
This method initialises iconPause.

Returns:
javax.swing.ImageIcon

getIconVolume

private javax.swing.ImageIcon getIconVolume()
This method initialises iconVolume.

Returns:
javax.swing.ImageIcon

getIconMute

private javax.swing.ImageIcon getIconMute()
This method initialises iconMute.

Returns:
javax.swing.ImageIcon

setButtonPlayAsPause

public void setButtonPlayAsPause()
Adjusts the icon for the play button setting it to a pause icon.


setButtonPlayAsPlay

public void setButtonPlayAsPlay()
Adjusts the icon for the play button setting it to a play icon.


setButtonVolumeAsMute

public void setButtonVolumeAsMute()
Adjusts the icon for the volume button setting it to a mute icon.


setButtonVolumeAsVolume

public void setButtonVolumeAsVolume()
Adjusts the icon for the play button setting it to a play icon.


setToggleRandom

public void setToggleRandom(boolean state)
Adjusts the state information for the toggle button.

Parameters:
state - Boolean containing state information.

setToggleRepeat

public void setToggleRepeat(boolean state)
Adjusts the state information for the toggle button.

Parameters:
state - Boolean containing state information.

setToggleSingle

public void setToggleSingle(boolean state)
Adjusts the state information for the toggle button.

Parameters:
state - Boolean containing state information.

setLabelTitle

public void setLabelTitle(java.lang.String title)
Sets the display label for the title field.

Parameters:
title - String carrying title name.

setSliderProgress

public void setSliderProgress(int elapsed,
                              int total)
Sets the slider of the position and capacity.

Parameters:
elapsed - Integer carrying current runtime.
total - Integer representing total play time.

setLabelTime

public void setLabelTime(int elapsed,
                         int total)
Sets the display label for the time field.

Parameters:
elapsed - Integer carrying current runtime.
total - Integer representing total play time.

updateDisplay

public void updateDisplay()
Updates the elements that have been skipped over when the window is not currently being displayed.