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$$$()voidaddPropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)voidaddSongFilter(SongFilter songFilter)voidcancel(Task task)Cancel a task.voidcancel(Task[] tasks)Cancel multiple tasks.voidclear()Clear the queue.voidfireAnalysisDone(Task task)voidfireAnalysisStarted(Task task)voidfireSongSuccessfullyAnalyzed(Task task)IcongetAnimatedIcon()BeaTunesgetApplication()Returns the main application component.JPanelgetButtonPanel()Panel for buttons vertically aligned on the right edge of the view.JComponentgetComponent()The actual visual component for this view.ConfigurableComponentgetConfiguration()List<Task>getCurrentlyAnalyzedTasks()AnalysisQueueTableModelgetFilterTableModel()JComponentgetFocusRoot()The component that should be focused by default, when view is shown.IcongetIcon()StringgetId()Unique id for each instance of this object.StringgetLabel()MessagePanelgetMessagePanel()PropertyChangeListener[]getPropertyChangeListeners()PropertyChangeListener[]getPropertyChangeListeners(String propertyName)TaskQueuegetQueue()BoundedBufferMap<Long,ReferenceSong>getReferenceSongLookupBuffer()intgetSize()Set<SongFilter>getSongFilters()List<Long>getSongIdsForTasksUsingOnlineResources()StringgetStatusLabel()Status label to show in the status bar when this component becomes visible.JTablegetTable()voidinit()Initializes this component and its sub-components.voidinitializeTask(Task task)booleanisEmpty()booleanisIndeterminateProgress()Indicates that the current status is an operation with indeterminate progress which should be reflected in the rendering of the status bar.booleanisPaused()voidoffer(long[] songIds, TaskFactory taskFactory, Runnable... runAfterOfferComplete)Offer song ids to the queue (asynchronously).voidoffer(PlayList playlist, TaskFactory taskFactory, boolean filterTasks, Runnable... runAfterOfferComplete)Offer a playlist to the queue.voidoffer(Iterable<AudioSong> songs, TaskFactory taskFactory, boolean filterTasks, Runnable... runAfterOfferComplete)Offer an Iterable of songs to the queue (asynchronously).Taskpoll()voidremoveEndedReferenceSongLookupJobs()voidremovePropertyChangeListener(String name, PropertyChangeListener analysisQueueLabelListener)voidremoveSongFilter(SongFilter songFilter)voidsetAnimatedIcon(Icon animatedIcon)voidsetApplication(BeaTunes beaTunes)Sets the main application component.voidsetPaused(boolean paused)Toggles pausing the processing of this queue.voidshutdown()Shuts down this component and its sub-components.voidstartReferenceSongLookupJob(List<Long> ids)booleanwaitWhileSending()booleanwillOrHasBeenBeLookedUp(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:ApplicationComponentReturns the main application component.- Specified by:
getApplicationin interfaceApplicationComponent<BeaTunes>- Returns:
- application object
-
setApplication
public void setApplication(BeaTunes beaTunes)
Description copied from interface:ApplicationComponentSets the main application component.- Specified by:
setApplicationin interfaceApplicationComponent<BeaTunes>- Parameters:
beaTunes- main application component
-
getId
public String getId()
Description copied from interface:ApplicationComponentUnique id for each instance of this object.- Specified by:
getIdin interfaceApplicationComponent<BeaTunes>- Returns:
- id
-
getQueue
public TaskQueue getQueue()
-
init
public void init()
Description copied from interface:ApplicationComponentInitializes this component and its sub-components.- Specified by:
initin interfaceApplicationComponent<BeaTunes>
-
shutdown
public void shutdown()
Description copied from interface:ApplicationComponentShuts down this component and its sub-components.- Specified by:
shutdownin 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:
getFilterTableModelin interfaceTableView
-
getComponent
public JComponent getComponent()
Description copied from interface:ViewThe actual visual component for this view.- Specified by:
getComponentin interfaceView- Returns:
- detail component
-
getFocusRoot
public JComponent getFocusRoot()
Description copied from interface:ViewThe component that should be focused by default, when view is shown.- Specified by:
getFocusRootin interfaceView- Returns:
- component
-
isIndeterminateProgress
public boolean isIndeterminateProgress()
Description copied from interface:DetailViewIndicates that the current status is an operation with indeterminate progress which should be reflected in the rendering of the status bar.- Specified by:
isIndeterminateProgressin interfaceDetailView- Returns:
- true if an indeterminate progress indicator is supposed to be rendered
-
getStatusLabel
public String getStatusLabel()
Description copied from interface:DetailViewStatus label to show in the status bar when this component becomes visible.- Specified by:
getStatusLabelin 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$$$()
-
-