org.lyra.Interface
Class PlayerOrganiserFrame.Interact

java.lang.Object
  extended by org.lyra.Interface.PlayerOrganiserFrame.Interact
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.WindowListener, java.util.EventListener, javax.swing.event.ListSelectionListener, UpdateListener
Enclosing class:
PlayerOrganiserFrame

public class PlayerOrganiserFrame.Interact
extends java.lang.Object
implements java.awt.event.ActionListener, java.awt.event.KeyListener, javax.swing.event.ListSelectionListener, java.awt.event.MouseListener, java.awt.event.WindowListener, UpdateListener

The code separation from the user interface. This Class handles all of the complexities of making the interface interactive.

Author:
Martin Foster

Field Summary
private static java.lang.String CLASS
           
private  java.lang.String[] Current
           
private  java.lang.String[] Current_Titles
           
private  java.lang.String CurrentPrecusor
           
private  java.util.Map<java.lang.String,java.lang.String> Filter
           
(package private)  boolean Initialise
           
private static java.lang.String LIST_DECADE
           
private static java.lang.String LIST_FAVORITE
           
private static java.lang.String LIST_LOCAL
           
private static java.lang.String LIST_REMOTE
           
private static java.lang.String LIST_SMART
           
private  javax.swing.tree.TreePath listLocal
           
private  javax.swing.tree.TreePath listRemote
           
private  javax.swing.tree.TreePath listSmart
           
private static java.lang.String POSITION
           
private static java.lang.String SIZE
           
private static java.lang.String SMART_ALBUM
           
private static java.lang.String SMART_ARTIST
           
private static java.lang.String SMART_GENRE
           
private static java.lang.String SMART_RATING
           
private static java.lang.String SMART_SONG
           
private  java.lang.String[] Songs
           
private  java.lang.String[] Songs_Titles
           
private static java.lang.String SongsPrecusor
           
 
Constructor Summary
PlayerOrganiserFrame.Interact()
          Base constructor for the class.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
           
 void getColumnState(javax.swing.JTable table, java.lang.String[] names, java.lang.String precursor)
          Fetches state information for specific columns in JTables which have adjustable columns.
 java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getColumnState(javax.swing.table.TableColumnModel model)
          Fetches state information for specific columns in JTables which have adjustable columns.
 java.lang.String[][] getOrganiserCurrent()
          This is a very specific implementation which is used to populate the playlist section.
 void getOrganiserState(javax.swing.JFrame source)
          State information gathering is a fairly large and complex entity.
 void hostUpdated(UpdateEvent update)
          Updates of host information as passed through this specific method.
 void initTables()
          Establishes the baseline for the two core tables.
 void keyPressed(java.awt.event.KeyEvent evt)
           
 void keyReleased(java.awt.event.KeyEvent evt)
           
 void keyTyped(java.awt.event.KeyEvent evt)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void setColumnState(javax.swing.JTable table, java.lang.String[] names, java.lang.String[] titles, java.lang.String precursor)
          Adjusts the column state for a specific table.
 void setColumnState(javax.swing.table.TableColumnModel model, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> prefs)
          Adjusts the column state for a specific table.
 void setSelection(javax.swing.JTable current, java.lang.String key)
          Adjusts the selection of the item to display what is currently being filtered.
 void updateCurrent()
          Triggers the generation of the baseline for the current playlist table.
private  void updateFilter(EnhancedListSelectionModel model, java.lang.String ident)
          Responsible for updating the main song selection filter.
 void updateLibrary()
          Triggers the generation of baseline information for the Songs listing table.
 void updateLibrary(java.lang.String ident)
          Triggers the generation of baseline information for the Songs listing table.
 void updateLibrary(java.lang.String fields, java.lang.String criteria)
          Triggers the generation of baseline information for the Songs listing table.
 void updatePlaylists()
          Triggers baseline information generation for the playlist listing.
 void updateRenderers()
          Adjusts the renderer to a specific value for highlighting a specific row when required.
private  void updateStatus()
          Responsible for updating the status information that is shown under the songs table.
 void valueChanged(javax.swing.event.ListSelectionEvent e)
           
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent evt)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Filter

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

Current

private final java.lang.String[] Current

Current_Titles

private final java.lang.String[] Current_Titles

CurrentPrecusor

private final java.lang.String CurrentPrecusor
See Also:
Constant Field Values

Songs

private final java.lang.String[] Songs

Songs_Titles

private java.lang.String[] Songs_Titles

Initialise

boolean Initialise

SIZE

private static final java.lang.String SIZE
See Also:
Constant Field Values

POSITION

private static final java.lang.String POSITION
See Also:
Constant Field Values

SongsPrecusor

private static final java.lang.String SongsPrecusor
See Also:
Constant Field Values

LIST_REMOTE

private static final java.lang.String LIST_REMOTE
See Also:
Constant Field Values

LIST_LOCAL

private static final java.lang.String LIST_LOCAL
See Also:
Constant Field Values

LIST_SMART

private static final java.lang.String LIST_SMART
See Also:
Constant Field Values

LIST_DECADE

private static final java.lang.String LIST_DECADE
See Also:
Constant Field Values

LIST_FAVORITE

private static final java.lang.String LIST_FAVORITE
See Also:
Constant Field Values

SMART_ARTIST

private static final java.lang.String SMART_ARTIST
See Also:
Constant Field Values

SMART_ALBUM

private static final java.lang.String SMART_ALBUM
See Also:
Constant Field Values

SMART_GENRE

private static final java.lang.String SMART_GENRE
See Also:
Constant Field Values

SMART_SONG

private static final java.lang.String SMART_SONG
See Also:
Constant Field Values

SMART_RATING

private static final java.lang.String SMART_RATING
See Also:
Constant Field Values

listRemote

private javax.swing.tree.TreePath listRemote

listLocal

private javax.swing.tree.TreePath listLocal

listSmart

private javax.swing.tree.TreePath listSmart

CLASS

private static final java.lang.String CLASS
See Also:
Constant Field Values
Constructor Detail

PlayerOrganiserFrame.Interact

public PlayerOrganiserFrame.Interact()
Base constructor for the class.

Method Detail

initTables

public void initTables()
Establishes the baseline for the two core tables. Library songs and the current playlist.


updateCurrent

public void updateCurrent()
Triggers the generation of the baseline for the current playlist table.


updateLibrary

public void updateLibrary()
Triggers the generation of baseline information for the Songs listing table.


updateLibrary

public void updateLibrary(java.lang.String ident)
Triggers the generation of baseline information for the Songs listing table.

Parameters:
ident - Identity of the element managing.

updateLibrary

public void updateLibrary(java.lang.String fields,
                          java.lang.String criteria)
Triggers the generation of baseline information for the Songs listing table.

Parameters:
fields - String containing fields to search from.
criteria - String containing search criteria.

updatePlaylists

public void updatePlaylists()
Triggers baseline information generation for the playlist listing.


updateRenderers

public void updateRenderers()
Adjusts the renderer to a specific value for highlighting a specific row when required.


getOrganiserCurrent

public java.lang.String[][] getOrganiserCurrent()
This is a very specific implementation which is used to populate the playlist section. This method is not a database element but one which translates from the host directly.

Returns:
Multilevel array containing the contents of the Current Playlist.

getOrganiserState

public void getOrganiserState(javax.swing.JFrame source)
State information gathering is a fairly large and complex entity. So what we do is separate it out to make the listeners a bit cleaner to review. In other words, a proverbial rug to sweep this code under.

Parameters:
source - JFrame Instance that we will extract state from.

getColumnState

public void getColumnState(javax.swing.JTable table,
                           java.lang.String[] names,
                           java.lang.String precursor)
Fetches state information for specific columns in JTables which have adjustable columns. This variant will store it to a Map which will be recorded to the database at shutdown.

Parameters:
table - JTable containing all rows and columns.
names - Column names and titles.
precursor - String containing tag precursor.

getColumnState

public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getColumnState(javax.swing.table.TableColumnModel model)
Fetches state information for specific columns in JTables which have adjustable columns. This variant will return it as an array.

Parameters:
model - ColumnModel containing all information.
Returns:
Array of integers containing width

setColumnState

public void setColumnState(javax.swing.JTable table,
                           java.lang.String[] names,
                           java.lang.String[] titles,
                           java.lang.String precursor)
Adjusts the column state for a specific table. Allowing the users options to be reflected.

Parameters:
table - JTable element containing all the rows and columns.
names - Column names.
titles - Column titles.
precursor - String containing tag precursor.

setColumnState

public void setColumnState(javax.swing.table.TableColumnModel model,
                           java.util.List<java.util.Map<java.lang.String,java.lang.Object>> prefs)
Adjusts the column state for a specific table. Allowing the users options to be reflected, uses an array to copy and pass on.

Parameters:
model - ColumnModel containing all information.
prefs - List containing all necessary attributes for cloning.

setSelection

public void setSelection(javax.swing.JTable current,
                         java.lang.String key)
Adjusts the selection of the item to display what is currently being filtered. That way the user understands what is taking place when filtering occurs.

Parameters:
current - JTable that will be adjusted based on selection.
key - String identifier tied to the Filter Map.

actionPerformed

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

hostUpdated

public void hostUpdated(UpdateEvent update)
Description copied from interface: UpdateListener
Updates of host information as passed through this specific method. Multiple updates can be triggered from this, so it becomes important to check for a specific update if necessary in order to avoid undue

Specified by:
hostUpdated in interface UpdateListener
Parameters:
update - Update notification method.
See Also:
UpdateEvent

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent e)
Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener

updateStatus

private void updateStatus()
Responsible for updating the status information that is shown under the songs table. Since only one table makes use of this calculations are easy to make.


updateFilter

private void updateFilter(EnhancedListSelectionModel model,
                          java.lang.String ident)
Responsible for updating the main song selection filter. This filter is key to actually cutting down the amount of songs shown on the organiser.

Parameters:
model - Instance of the captured model.
ident - String identifier of the table.

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent evt)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Specified by:
keyTyped in interface java.awt.event.KeyListener