Package com.tagtraum.beatunes.action
Class BaseAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- com.tagtraum.core.app.ApplicationAction
-
- com.tagtraum.beatunes.action.BaseAction
-
- All Implemented Interfaces:
ApplicationComponent<BeaTunes>
,ActionListener
,Serializable
,Cloneable
,EventListener
,Action
- Direct Known Subclasses:
AddToCurrentPlayListAction
,AddToLibraryAction
,AddToPlayListAction
,AddToSongTablePlayListAction
,AirPlayAction
,AnalyzeAction
,AnalyzeAllAction
,AnalyzeNewAction
,BPMTapDialogAction
,CancelTaskAction
,ChartsFullscreenAction
,ClearAllTasksAction
,ClearAmazonFileCache
,ClearSearchAction
,ClearSolutionsAction
,CommitSolutionsAction
,ContextShopBackAction
,ContextShopClearSearchAction
,ContextShopForwardAction
,ContextShopNewAction
,ContextShopRecommendAction
,DeleteAllFingerprintsAction
,DeleteItemsAction
,DeletePlayListAction
,DownloadSongAction
,EditAction
,EjectCDAction
,EmailSupportAction
,ExportPlayListAction
,FindAction
,FindNextAction
,FindPreviousAction
,GetCurrentTrackAction
,GetCurrentTrackImageAction
,GetInfoAction
,GoToCurrentSongAction
,HideSongsFromPlaylistAction
,ImportPlayListAction
,InspectAction
,InspectLibraryAction
,IsPlayingAction
,ITunesPlayerAction
,LibraryBatchAction
,LikingAction
,ListActionIdsAction
,LoveCurrentTrackAction
,ManipulateBPMAction
,MatchTableClearFilterAction
,MinimizeAction
,MuteAction
,NewFileSystemLibraryAction
,NewITunesLibraryAction
,NewMatchListFromSelectionAction
,NewPlayListAction
,NextSegmentAction
,NextSimilarityAction
,NextSongAction
,OpenFilePropertiesAction
,OpenInAction
,OpenInExternalPlayerAction
,OpenInPreferredExternalPlayerAction
,OpenPlayListInPreferredExternalPlayerAction
,OpenStreamAction
,PauseAction
,PausePlayAction
,PauseResumeQueueAction
,PlayInITunesAction
,PlayInQuickTimeAction
,PlayNextAction
,PlaySelectedAction
,PreviousSegmentAction
,PreviousSimilarityAction
,PreviousSongAction
,RatingAction
,ReArrangePlayListAction
,RebuildDatabaseAction
,RebuildFullTextIndexAction
,RedoAction
,RefreshFromFileAction
,RegisterAction
,RenamePlayListAction
,RepairDatabaseAction
,RepeatModeAllAction
,RepeatModeNextAction
,RepeatModeOffAction
,RepeatModeOneAction
,ScanModeBeginningAction
,ScanModeNextAction
,ScanModeOffAction
,ScanModeProminentAction
,ScanModeThirdAction
,ShareAction
,ShowAboutAction
,ShowFAQAction
,ShowGeneralPreferencesAction
,ShowHelpAction
,ShowHideSideBar
,ShowHideStatusBarAction
,ShowInFinderAction
,ShowInPlayListAction
,ShowIssueAction
,ShowMainWindowAction
,ShowMasterViewAction
,ShowPreferencesAction
,ShowQueueMessagePanelAction
,ShowSongMatchingPreferencesAction
,ShutdownAction
,SingleItemInfoDialog.AutoInfoAction
,SongContextComponentShowHideAction
,StartRadioWithSelectedAction
,StopAction
,SynchronizeAction
,UndoAction
,UpdateMatchListAction
,UploadLogsAction
,VisibleColumnsAction
,VolumeDownAction
,VolumeUpAction
,ZoomAction
public abstract class BaseAction extends ApplicationAction implements ApplicationComponent<BeaTunes>
Abstract superclass for all Actions of any significance used throughout the application. Actions have to be declared as plugin inplugin.xml
.- Author:
- Hendrik Schreiber
- See Also:
ActionManager
,PluginManager
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BaseAction.EnabledView
static class
BaseAction.Location
static class
BaseAction.SelectionCount
-
Nested classes/interfaces inherited from class com.tagtraum.core.app.ApplicationAction
ApplicationAction.ApplicationActionFacade
-
-
Field Summary
Fields Modifier and Type Field Description static Predicate<JTable>
ITEMS_EDITABLE
-
Fields inherited from class com.tagtraum.core.app.ApplicationAction
BUTTON_MODEL, DISABLED_ICON, DISABLED_SELECTED_ICON, PRESSED_ICON, ROLLOVER_ICON, SELECTED_ICON, SHORT_NAME
-
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
-
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseAction()
BaseAction(BeaTunes application)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
bindListeners(Predicate<JTable> predicate, BaseAction.EnabledView... enabledViews)
Adds the appropriate UI triggers to this action.void
bindListeners(Predicate<JTable> predicate, Set<BaseAction.EnabledView> enabledViews)
Adds the appropriate UI triggers to this action.BeaTunes
getApplication()
Returns the main application component.PlayList
getFocusedPlayList()
Returns the playlist selected AND focused in the tree view.JComponent
getFocusOwner()
static JComponent
getMostRecentlyFocused(Class<? extends JComponent>... klass)
Search the recently focused component list for objects of the given types.protected DefaultMutableTreeNode
getPlayListTreeNode(PlayList beaTunesPlayList)
PlayList
getSelectedPlayList()
Returns the playlist selected in the tree view whether the tree view has the focus or notDefaultMutableTreeNode
getSelectedPlayListTreeNode()
AudioSong
getSelectedSong()
Returns the song currently selected in the focused table.int
getSelectedSongCount()
long[]
getSelectedSongIds()
Ids of currently selected songs (from any main table or playlist).Iterable<AudioSong>
getSelectedSongs()
Deprecated.prefergetSelectedSongIds()
Iterable<AudioSong>
getSelectedSongs(JComponent component)
Deprecated.prefergetSelectedSongIds()
void
init()
Initializes this action.boolean
isAnalysisQueueFocused()
boolean
isMatchTableFocused()
boolean
isPlayListTreeFocused()
boolean
isSimpleSongTableFocused()
boolean
isSongTableFocused()
protected void
loadResources()
Loads all resources that may change due to display resolution or theme change.BaseAction.SelectionCount
numberOfSelectedSongs()
static BaseAction.SelectionCount
numberOfSelectedSongs(JTable table)
Efficient way of determining how many songs are selected.void
setApplication(BeaTunes application)
Sets the main application component.void
shutdown()
Shuts down this component and its sub-components.-
Methods inherited from class com.tagtraum.core.app.ApplicationAction
getActionLocations, getButtonModel, getIconButtonFacade, getId, getMenuFacade, getToolbarButtonFacade, isVisible, register, setButtonModel, setVisible
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
-
Methods inherited from interface com.tagtraum.core.app.ApplicationComponent
getId
-
-
-
-
Constructor Detail
-
BaseAction
protected BaseAction()
-
BaseAction
public BaseAction(BeaTunes application)
- Parameters:
application
- beaTunes
-
-
Method Detail
-
getMostRecentlyFocused
public static JComponent getMostRecentlyFocused(Class<? extends JComponent>... klass)
Search the recently focused component list for objects of the given types.- Parameters:
klass
- classes- Returns:
- the most recently focused component of the given types.
-
loadResources
protected void loadResources()
Loads all resources that may change due to display resolution or theme change. The default implementation is empty.
-
getPlayListTreeNode
protected DefaultMutableTreeNode getPlayListTreeNode(PlayList beaTunesPlayList)
-
init
public void init()
Initializes this action. This method is called byActionManager.init()
, after all components are instantiated and set up. The default implementation is empty.- 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>
-
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 application)
Description copied from interface:ApplicationComponent
Sets the main application component.- Specified by:
setApplication
in interfaceApplicationComponent<BeaTunes>
- Parameters:
application
- main application component
-
bindListeners
public void bindListeners(Predicate<JTable> predicate, BaseAction.EnabledView... enabledViews)
Adds the appropriate UI triggers to this action.- Parameters:
predicate
- predicateenabledViews
- enabledViews
-
bindListeners
public void bindListeners(Predicate<JTable> predicate, Set<BaseAction.EnabledView> enabledViews)
Adds the appropriate UI triggers to this action.- Parameters:
predicate
- predicateenabledViews
- enabledViews
-
getFocusOwner
public JComponent getFocusOwner()
- Returns:
- JComponent with the focus after the latest focus change
-
getSelectedSong
public AudioSong getSelectedSong()
Returns the song currently selected in the focused table.- Returns:
- song or null
-
getSelectedSongs
public Iterable<AudioSong> getSelectedSongs()
Deprecated.prefergetSelectedSongIds()
Retrieves the currently selected songs (any main table or playlist).- Returns:
- currently selected songs
-
getSelectedSongs
public Iterable<AudioSong> getSelectedSongs(JComponent component)
Deprecated.prefergetSelectedSongIds()
Retrieves the currently selected songs from any main table or playlist.- Returns:
- currently selected songs
-
getSelectedSongCount
public int getSelectedSongCount()
- Returns:
- currently selected songs
-
getSelectedSongIds
public long[] getSelectedSongIds()
Ids of currently selected songs (from any main table or playlist).- Returns:
- currently selected song ids.
-
numberOfSelectedSongs
public BaseAction.SelectionCount numberOfSelectedSongs()
-
numberOfSelectedSongs
public static BaseAction.SelectionCount numberOfSelectedSongs(JTable table)
Efficient way of determining how many songs are selected.- Parameters:
table
- table- Returns:
BaseAction.SelectionCount.ZERO
,BaseAction.SelectionCount.ONE
orBaseAction.SelectionCount.MORE_THAN_ONE
-
getSelectedPlayList
public PlayList getSelectedPlayList()
Returns the playlist selected in the tree view whether the tree view has the focus or not- Returns:
- currently selected playlist
-
getFocusedPlayList
public PlayList getFocusedPlayList()
Returns the playlist selected AND focused in the tree view.- Returns:
- currently AND focused selected playlist - if the treeview is not focused, null is returned.
-
getSelectedPlayListTreeNode
public DefaultMutableTreeNode getSelectedPlayListTreeNode()
-
isSongTableFocused
public boolean isSongTableFocused()
- Returns:
- true if the song table has the focus.
-
isAnalysisQueueFocused
public boolean isAnalysisQueueFocused()
- Returns:
- true if the analsyis queue table has the focus.
-
isSimpleSongTableFocused
public boolean isSimpleSongTableFocused()
- Returns:
- true if a simple song table has the focus.
-
isMatchTableFocused
public boolean isMatchTableFocused()
- Returns:
- true if the match table has the focus.
-
isPlayListTreeFocused
public boolean isPlayListTreeFocused()
- Returns:
- true if the playlist tree view has the focus.
-
-