Package com.tagtraum.beatunes.songtable
Class SongTable
- java.lang.Object
-
- com.tagtraum.beatunes.songtable.SongTable
-
- All Implemented Interfaces:
DetailView
,DoubleClickListener
,TableView
,View
,ApplicationComponent<BeaTunes>
public class SongTable extends Object implements DetailView, TableView, DoubleClickListener, ApplicationComponent<BeaTunes>
Main song table in the UI.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description SongTable(MainWindow mainWindow)
Creates the main song table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JComponent
$$$getRootComponent$$$()
void
doubleClick(ActionEvent event)
Called when a double click occurs.BeaTunes
getApplication()
Returns the main application component.JComponent
getComponent()
The actual visual component for this view.SongTableModel
getFilterTableModel()
Return the song table model.JComponent
getFocusRoot()
The component that should be focused by default, when view is shown.String
getId()
Unique id for each instance of this object.MainWindow
getMainWindow()
Returns the owning window.AudioSong
getSelectedSong()
Returns the first selected song.JPanel
getSongContextButtonPanel()
The panel the buttons/action forSongContextComponent
s live in.JComponent
getSongContextComponent()
Returns currently selected song context component.List<SongContextComponent>
getSongContextComponents()
JPanel
getSongContextPanel()
Returns the actual song context panel.@NotNull String
getStatusLabel()
Status label to show in the status bar when this component becomes visible.PlayList.SubstringFilterProperty
getSubstringFilterProperty()
ButtonModel
getSyncButtonModel()
SpinnerModel
getSyncTempoModel()
JTable
getTable()
The actual table component showing songs.void
init()
Initializes this component and its sub-components.boolean
isIndeterminateProgress()
Indicates that the current status is an operation with indeterminate progress which should be reflected in the rendering of the status bar.void
registerDoubleClick(String actionId)
Registers the id of the action to execute upon a double click.void
resetSorting()
Clear all sorting flags and sort the current playlist by natural order.void
select(long id)
Select the given song in the current SongTable and scroll to it so that it becomes visible.void
select(AudioSong song)
Select the given song in the current SongTable and scroll to it so that it becomes visible.void
setApplication(BeaTunes beaTunes)
Sets the main application component.void
setSongContextComponent(JComponent component)
void
setSubstringFilterProperty(PlayList.SubstringFilterProperty substringFilterProperty)
void
shutdown()
Shuts down this component and its sub-components.void
startEditingPlaylistName()
Start editing of the playlist's name.
-
-
-
Constructor Detail
-
SongTable
public SongTable(MainWindow mainWindow)
Creates the main song table.- Parameters:
mainWindow
- main window
-
-
Method Detail
-
getSyncButtonModel
public ButtonModel getSyncButtonModel()
-
getSyncTempoModel
public SpinnerModel getSyncTempoModel()
-
getSubstringFilterProperty
public PlayList.SubstringFilterProperty getSubstringFilterProperty()
-
setSubstringFilterProperty
public void setSubstringFilterProperty(PlayList.SubstringFilterProperty substringFilterProperty)
-
startEditingPlaylistName
public void startEditingPlaylistName()
Start editing of the playlist's name.
-
$$$getRootComponent$$$
public JComponent $$$getRootComponent$$$()
-
getSongContextButtonPanel
public JPanel getSongContextButtonPanel()
The panel the buttons/action forSongContextComponent
s live in.- Returns:
- master button panel
- See Also:
SongContextComponentShowHideAction
,getSongContextPanel()
-
getSongContextComponents
public List<SongContextComponent> getSongContextComponents()
-
getApplication
public BeaTunes getApplication()
Description copied from interface:ApplicationComponent
Returns the main application component.- Specified by:
getApplication
in interfaceApplicationComponent<BeaTunes>
- Returns:
- application object
-
setApplication
public void setApplication(BeaTunes beaTunes)
Description copied from interface:ApplicationComponent
Sets the main application component.- Specified by:
setApplication
in interfaceApplicationComponent<BeaTunes>
- Parameters:
beaTunes
- main application component
-
getId
public String getId()
Description copied from interface:ApplicationComponent
Unique id for each instance of this object.- Specified by:
getId
in interfaceApplicationComponent<BeaTunes>
- Returns:
- id
-
isIndeterminateProgress
public boolean isIndeterminateProgress()
Description copied from interface:DetailView
Indicates that the current status is an operation with indeterminate progress which should be reflected in the rendering of the status bar.- Specified by:
isIndeterminateProgress
in interfaceDetailView
- Returns:
- true if an indeterminate progress indicator is supposed to be rendered
-
getStatusLabel
@NotNull public @NotNull String getStatusLabel()
Description copied from interface:DetailView
Status label to show in the status bar when this component becomes visible.- Specified by:
getStatusLabel
in interfaceDetailView
- Returns:
- label
- See Also:
MainWindow.getStatusLabel()
-
init
public void init()
Description copied from interface:ApplicationComponent
Initializes this component and its sub-components.- Specified by:
init
in interfaceApplicationComponent<BeaTunes>
-
shutdown
public void shutdown()
Description copied from interface:ApplicationComponent
Shuts down this component and its sub-components.- Specified by:
shutdown
in interfaceApplicationComponent<BeaTunes>
-
doubleClick
public void doubleClick(ActionEvent event)
Description copied from interface:DoubleClickListener
Called when a double click occurs.- Specified by:
doubleClick
in interfaceDoubleClickListener
- Parameters:
event
- event
-
registerDoubleClick
public void registerDoubleClick(String actionId)
Registers the id of the action to execute upon a double click.- Parameters:
actionId
- action id
-
getSongContextComponent
public JComponent getSongContextComponent()
Returns currently selected song context component.- Returns:
- song context component
-
setSongContextComponent
public void setSongContextComponent(JComponent component)
- Parameters:
component
- component
-
getSongContextPanel
public JPanel getSongContextPanel()
Returns the actual song context panel. To get the corresponding button panel, usegetSongContextButtonPanel()
.- Returns:
- song context panel
-
getTable
public JTable getTable()
The actual table component showing songs.
-
getMainWindow
public MainWindow getMainWindow()
Returns the owning window.- Returns:
- main window
-
getFilterTableModel
public SongTableModel getFilterTableModel()
Return the song table model.- Specified by:
getFilterTableModel
in interfaceTableView
- Returns:
- song tablemodel
-
getComponent
public JComponent getComponent()
Description copied from interface:View
The actual visual component for this view.- Specified by:
getComponent
in interfaceView
- Returns:
- detail component
-
getFocusRoot
public JComponent getFocusRoot()
Description copied from interface:View
The component that should be focused by default, when view is shown.- Specified by:
getFocusRoot
in interfaceView
- Returns:
- component
-
getSelectedSong
public AudioSong getSelectedSong()
Returns the first selected song. This call may be expensive when many songs are selected. You can check the number of songs selected withgetSongTable().getSelectedRowCount()
.- Returns:
- first selected song, or null if no songs are selected.
-
select
public void select(AudioSong song)
Select the given song in the current SongTable and scroll to it so that it becomes visible.- Parameters:
song
- song
-
select
public void select(long id)
Select the given song in the current SongTable and scroll to it so that it becomes visible.- Parameters:
id
- id
-
resetSorting
public void resetSorting()
Clear all sorting flags and sort the current playlist by natural order.
-
-