Package com.tagtraum.beatunes.songtable
Class SongContextComponent
- java.lang.Object
-
- com.tagtraum.beatunes.songtable.SongContextComponent
-
- All Implemented Interfaces:
View,ApplicationComponent<BeaTunes>
- Direct Known Subclasses:
ContextShop,DelegatingSongContextComponent,DummySongContextComponent,MatchTable,WikiInfo
public abstract class SongContextComponent extends Object implements ApplicationComponent<BeaTunes>, View
Baseclass for a component that is displayed in the lower half of the mainSongTable. Examples areMatchTableandContextShop. Extend this class, if you would like to write a component that offers additional functionality for a song that has been selected in the mainSongTable. Note that you will have to supply aSongContextComponentShowHideActionto show and hide this component. Both theSongContextComponentand theSongContextComponentShowHideActionhave to be registered in theplugin.xmlfile.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSongContextComponent()protectedSongContextComponent(BeaTunes beaTunes)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidadjustToTheme(Theme theme)React to theme changes.voidfireDelayedUpdate()Starts a timer and callsupdate(com.tagtraum.audiokern.AudioSong)when the timer fires.BeaTunesgetApplication()Returns the main application component.abstract StringgetId()Component id.SongContextComponentShowHideActiongetShowHideAction()Returns the action that shows/hides this component.StringgetShowHideActionId()Id for the action that is responsible for showing/hiding this SongContextComponent.SongTablegetSongTable()Easy access to theSongTableobject.voidinit()Initializes this component.voidinitVisibility()Is called bySongTableto make sure this component is shown (if it was shown last time beaTunes ran).voidsetApplication(BeaTunes beaTunes)Sets the main application component.voidsetShowHideActionId(String showHideActionId)Sets the id for the show/hide action.voidshutdown()Shuts this component down.abstract voidupdate(AudioSong selectedSong)Is called when the component is expected to update its view.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tagtraum.beatunes.View
getComponent, getFocusRoot
-
-
-
-
Constructor Detail
-
SongContextComponent
protected SongContextComponent()
-
SongContextComponent
protected SongContextComponent(BeaTunes beaTunes)
-
-
Method Detail
-
getId
public abstract String getId()
Component id. Useful forPluginManager.getPlugin(Object).- Specified by:
getIdin interfaceApplicationComponent<BeaTunes>- Returns:
- component id
-
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
-
adjustToTheme
protected void adjustToTheme(Theme theme)
React to theme changes. Default implementation is empty.- Parameters:
theme- theme
-
getSongTable
public SongTable getSongTable()
Easy access to theSongTableobject. UseSongTable.getSelectedSong()to find out, which song is selected.- Returns:
- the song table object
-
initVisibility
public void initVisibility()
Is called bySongTableto make sure this component is shown (if it was shown last time beaTunes ran).
-
init
public void init()
Initializes this component. This is a non-empty implementation. Make sure to call super.init() when you override this.- Specified by:
initin interfaceApplicationComponent<BeaTunes>
-
shutdown
public void shutdown()
Shuts this component down. This is a non-empty implementation. Make sure to call super.shutdown() when you override this.- Specified by:
shutdownin interfaceApplicationComponent<BeaTunes>
-
update
public abstract void update(AudioSong selectedSong)
Is called when the component is expected to update its view. This can have programmatic reasons or happen as a result offireDelayedUpdate(). Typically you are notified when the selection in the mainSongTablechanges and stays stable for at least 250ms (UPDATE_DELAY).- Parameters:
selectedSong- (first) song that was selected or null, if no songs are selected- See Also:
getSongTable(),SongTable.getSelectedSong()
-
fireDelayedUpdate
public void fireDelayedUpdate()
Starts a timer and callsupdate(com.tagtraum.audiokern.AudioSong)when the timer fires. Timer events are coalesced.
-
getShowHideAction
public SongContextComponentShowHideAction getShowHideAction()
Returns the action that shows/hides this component. By default the action is obtained from theActionManagervia the id set withsetShowHideActionId(String).- Returns:
- actionManager.getAction(getShowHideActionId())
- See Also:
getShowHideActionId()
-
getShowHideActionId
public String getShowHideActionId()
Id for the action that is responsible for showing/hiding this SongContextComponent. This id has to be set by subclasses usingsetShowHideActionId(String).- Returns:
- action id
-
setShowHideActionId
public void setShowHideActionId(String showHideActionId)
Sets the id for the show/hide action. The action id has to reference aSongContextComponentShowHideAction.- Parameters:
showHideActionId- id for the action that makes this SongContextComponent appear and disappear.- See Also:
getShowHideAction()
-
-