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 classBaseAction.EnabledViewstatic classBaseAction.Locationstatic classBaseAction.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 protectedBaseAction()BaseAction(BeaTunes application)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbindListeners(Predicate<JTable> predicate, BaseAction.EnabledView... enabledViews)Adds the appropriate UI triggers to this action.voidbindListeners(Predicate<JTable> predicate, Set<BaseAction.EnabledView> enabledViews)Adds the appropriate UI triggers to this action.BeaTunesgetApplication()Returns the main application component.PlayListgetFocusedPlayList()Returns the playlist selected AND focused in the tree view.JComponentgetFocusOwner()static JComponentgetMostRecentlyFocused(Class<? extends JComponent>... klass)Search the recently focused component list for objects of the given types.protected DefaultMutableTreeNodegetPlayListTreeNode(PlayList beaTunesPlayList)PlayListgetSelectedPlayList()Returns the playlist selected in the tree view whether the tree view has the focus or notDefaultMutableTreeNodegetSelectedPlayListTreeNode()AudioSonggetSelectedSong()Returns the song currently selected in the focused table.intgetSelectedSongCount()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()voidinit()Initializes this action.booleanisAnalysisQueueFocused()booleanisMatchTableFocused()booleanisPlayListTreeFocused()booleanisSimpleSongTableFocused()booleanisSongTableFocused()protected voidloadResources()Loads all resources that may change due to display resolution or theme change.BaseAction.SelectionCountnumberOfSelectedSongs()static BaseAction.SelectionCountnumberOfSelectedSongs(JTable table)Efficient way of determining how many songs are selected.voidsetApplication(BeaTunes application)Sets the main application component.voidshutdown()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:
initin interfaceApplicationComponent<BeaTunes>
-
shutdown
public void shutdown()
Description copied from interface:ApplicationComponentShuts down this component and its sub-components.- Specified by:
shutdownin interfaceApplicationComponent<BeaTunes>
-
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 application)
Description copied from interface:ApplicationComponentSets the main application component.- Specified by:
setApplicationin 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.ONEorBaseAction.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.
-
-