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 areMatchTable
andContextShop
. 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 aSongContextComponentShowHideAction
to show and hide this component. Both theSongContextComponent
and theSongContextComponentShowHideAction
have to be registered in theplugin.xml
file.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SongContextComponent()
protected
SongContextComponent(BeaTunes beaTunes)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
adjustToTheme(Theme theme)
React to theme changes.void
fireDelayedUpdate()
Starts a timer and callsupdate(com.tagtraum.audiokern.AudioSong)
when the timer fires.BeaTunes
getApplication()
Returns the main application component.abstract String
getId()
Component id.SongContextComponentShowHideAction
getShowHideAction()
Returns the action that shows/hides this component.String
getShowHideActionId()
Id for the action that is responsible for showing/hiding this SongContextComponent.SongTable
getSongTable()
Easy access to theSongTable
object.void
init()
Initializes this component.void
initVisibility()
Is called bySongTable
to make sure this component is shown (if it was shown last time beaTunes ran).void
setApplication(BeaTunes beaTunes)
Sets the main application component.void
setShowHideActionId(String showHideActionId)
Sets the id for the show/hide action.void
shutdown()
Shuts this component down.abstract void
update(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:
getId
in interfaceApplicationComponent<BeaTunes>
- Returns:
- component id
-
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
-
adjustToTheme
protected void adjustToTheme(Theme theme)
React to theme changes. Default implementation is empty.- Parameters:
theme
- theme
-
getSongTable
public SongTable getSongTable()
Easy access to theSongTable
object. UseSongTable.getSelectedSong()
to find out, which song is selected.- Returns:
- the song table object
-
initVisibility
public void initVisibility()
Is called bySongTable
to 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:
init
in 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:
shutdown
in 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 mainSongTable
changes 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 theActionManager
via 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()
-
-