Class AnalysisQueue
- java.lang.Object
-
- com.tagtraum.beatunes.analysisqueue.AnalysisQueue
-
- All Implemented Interfaces:
DetailView
,TableView
,View
,ApplicationComponent<BeaTunes>
public class AnalysisQueue extends Object implements DetailView, TableView, ApplicationComponent<BeaTunes>
Analysis queue.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description AnalysisQueue(BeaTunes application)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JComponent
$$$getRootComponent$$$()
void
addPropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)
void
addSongFilter(SongFilter songFilter)
void
cancel(Task task)
Cancel a task.void
cancel(Task[] tasks)
Cancel multiple tasks.void
clear()
Clear the queue.void
fireAnalysisDone(Task task)
void
fireAnalysisStarted(Task task)
void
fireSongSuccessfullyAnalyzed(Task task)
Icon
getAnimatedIcon()
BeaTunes
getApplication()
Returns the main application component.JPanel
getButtonPanel()
Panel for buttons vertically aligned on the right edge of the view.JComponent
getComponent()
The actual visual component for this view.ConfigurableComponent
getConfiguration()
List<Task>
getCurrentlyAnalyzedTasks()
AnalysisQueueTableModel
getFilterTableModel()
JComponent
getFocusRoot()
The component that should be focused by default, when view is shown.Icon
getIcon()
String
getId()
Unique id for each instance of this object.String
getLabel()
MessagePanel
getMessagePanel()
PropertyChangeListener[]
getPropertyChangeListeners()
PropertyChangeListener[]
getPropertyChangeListeners(String propertyName)
TaskQueue
getQueue()
BoundedBufferMap<Long,ReferenceSong>
getReferenceSongLookupBuffer()
int
getSize()
Set<SongFilter>
getSongFilters()
List<Long>
getSongIdsForTasksUsingOnlineResources()
String
getStatusLabel()
Status label to show in the status bar when this component becomes visible.JTable
getTable()
void
init()
Initializes this component and its sub-components.void
initializeTask(Task task)
boolean
isEmpty()
boolean
isIndeterminateProgress()
Indicates that the current status is an operation with indeterminate progress which should be reflected in the rendering of the status bar.boolean
isPaused()
void
offer(long[] songIds, TaskFactory taskFactory, Runnable... runAfterOfferComplete)
Offer song ids to the queue (asynchronously).void
offer(PlayList playlist, TaskFactory taskFactory, boolean filterTasks, Runnable... runAfterOfferComplete)
Offer a playlist to the queue.void
offer(Iterable<AudioSong> songs, TaskFactory taskFactory, boolean filterTasks, Runnable... runAfterOfferComplete)
Offer an Iterable of songs to the queue (asynchronously).Task
poll()
void
removeEndedReferenceSongLookupJobs()
void
removePropertyChangeListener(String name, PropertyChangeListener analysisQueueLabelListener)
void
removeSongFilter(SongFilter songFilter)
void
setAnimatedIcon(Icon animatedIcon)
void
setApplication(BeaTunes beaTunes)
Sets the main application component.void
setPaused(boolean paused)
Toggles pausing the processing of this queue.void
shutdown()
Shuts down this component and its sub-components.void
startReferenceSongLookupJob(List<Long> ids)
boolean
waitWhileSending()
boolean
willOrHasBeenBeLookedUp(long id)
-
-
-
Constructor Detail
-
AnalysisQueue
public AnalysisQueue(BeaTunes application)
- Parameters:
application
- beatunes
-
-
Method Detail
-
getReferenceSongLookupBuffer
public BoundedBufferMap<Long,ReferenceSong> getReferenceSongLookupBuffer()
-
getMessagePanel
public MessagePanel getMessagePanel()
-
getConfiguration
public ConfigurableComponent getConfiguration()
-
addSongFilter
public void addSongFilter(SongFilter songFilter)
- Parameters:
songFilter
- songfilter
-
removeSongFilter
public void removeSongFilter(SongFilter songFilter)
- Parameters:
songFilter
- songfilter
-
getSongFilters
public Set<SongFilter> getSongFilters()
-
getIcon
public Icon getIcon()
-
getAnimatedIcon
public Icon getAnimatedIcon()
-
setAnimatedIcon
public void setAnimatedIcon(Icon animatedIcon)
-
isEmpty
public boolean isEmpty()
- Returns:
- true if the queue is empty
-
getSize
public int getSize()
- Returns:
- size/length of the queue
-
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
-
getQueue
public TaskQueue getQueue()
-
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>
-
addPropertyChangeListener
public void addPropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)
-
getPropertyChangeListeners
public PropertyChangeListener[] getPropertyChangeListeners()
-
getPropertyChangeListeners
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
-
getFilterTableModel
public AnalysisQueueTableModel getFilterTableModel()
- Specified by:
getFilterTableModel
in interfaceTableView
-
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
-
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
public 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()
-
offer
public void offer(PlayList playlist, TaskFactory taskFactory, boolean filterTasks, Runnable... runAfterOfferComplete)
Offer a playlist to the queue. Tasks that are already in the queue will not be added a second time.- Parameters:
playlist
- the playlist to add.taskFactory
- factory for creating tasks for each songfilterTasks
- filter the songs before adding corresponding tasks to the queue.
-
offer
public void offer(Iterable<AudioSong> songs, TaskFactory taskFactory, boolean filterTasks, Runnable... runAfterOfferComplete)
Offer an Iterable of songs to the queue (asynchronously). Tasks that are already in the queue will not be added a second time.- Parameters:
songs
- the songs to add.taskFactory
- factory for creating tasks for each songfilterTasks
- filter tasks with this queue's filtersrunAfterOfferComplete
- code to run after the offering is completed.
-
offer
public void offer(long[] songIds, TaskFactory taskFactory, Runnable... runAfterOfferComplete)
Offer song ids to the queue (asynchronously). Tasks that are already in the queue will not be added a second time. The songs are not filtered like it is possible inoffer(Iterable, TaskFactory, boolean, Runnable...)
.- Parameters:
songIds
- the songs to add.taskFactory
- factory for creating tasks for each song
-
clear
public void clear()
Clear the queue.
-
cancel
public void cancel(Task[] tasks)
Cancel multiple tasks.- Parameters:
tasks
- tasks
-
cancel
public void cancel(Task task)
Cancel a task. Usecancel(Task[])
for multiple tasks.- Parameters:
task
- task to cancel
-
isPaused
public boolean isPaused()
-
setPaused
public void setPaused(boolean paused)
Toggles pausing the processing of this queue.- Parameters:
paused
- true or false
-
poll
public Task poll() throws InterruptedException
- Throws:
InterruptedException
-
initializeTask
public void initializeTask(Task task)
-
removeEndedReferenceSongLookupJobs
public void removeEndedReferenceSongLookupJobs()
-
waitWhileSending
public boolean waitWhileSending() throws InterruptedException
- Throws:
InterruptedException
-
willOrHasBeenBeLookedUp
public boolean willOrHasBeenBeLookedUp(long id)
-
fireAnalysisDone
public void fireAnalysisDone(Task task)
-
fireAnalysisStarted
public void fireAnalysisStarted(Task task)
-
fireSongSuccessfullyAnalyzed
public void fireSongSuccessfullyAnalyzed(Task task)
-
getLabel
public String getLabel()
-
getButtonPanel
public JPanel getButtonPanel()
Panel for buttons vertically aligned on the right edge of the view.- Returns:
- panel
- See Also:
BeaTunesUIRegion.ANALYSIS_QUEUE_BUTTON_PANEL
-
removePropertyChangeListener
public void removePropertyChangeListener(String name, PropertyChangeListener analysisQueueLabelListener)
-
$$$getRootComponent$$$
public JComponent $$$getRootComponent$$$()
-
-