public abstract class AbstractPlayer extends Object implements Player, Runnable
| Modifier and Type | Field and Description |
|---|---|
protected SequentialDispatcher |
dispatcher
The dispatcher.
|
protected EventListenerList |
listenerList
Listener support.
|
protected PropertyChangeSupport |
propertyChangeSupport
Support for property change listeners.
|
CLOSED, PREFETCHED, PREFETCHING, REALIZED, REALIZING, STARTED, UNREALIZED| Constructor and Description |
|---|
AbstractPlayer()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(ChangeListener listener)
Adds a listener that wants to be notified about
state changes of the player.
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener who is interested in changes of this object.
|
void |
addStateListener(StateListener l)
Adds a listener that wants to be notified about
state changes of the player.
|
void |
close()
Initiates the following asynchronous
state transitions:
any state -> closed
|
void |
deallocate()
Initiates the following asynchronous
state transitions:
realizing -> unrealized
prefetching -> realized
prefetched -> realized
realized
started -> throws IllegalStateException
closed -> throws IllegalStateException
|
protected abstract void |
doClosed()
Does the work for the closed state.
|
protected abstract void |
doPrefetched()
Does the work for the prefetched state.
|
protected abstract void |
doPrefetching()
Does the work for the prefetching state.
|
protected abstract void |
doRealized()
Does the work for the realized state.
|
protected abstract void |
doRealizing()
Does the work for the realizing state.
|
protected abstract void |
doStarted()
Does the work for the started state.
|
protected abstract void |
doUnrealized()
Does the work for the unrealized state.
|
protected void |
fireStateChanged()
Notifies all registered change listeners.
|
protected void |
fireStateChanged(int newState)
Notifies all registered state listeners and
all registered change listeners.
|
int |
getState()
Gets the current state of the player.
|
int |
getTargetState()
Gets the target state.
|
boolean |
isActive()
Returns true when the target state of the player is equal to STARTED.
|
void |
prefetch()
Initiates the following asynchronous
state transitions:
unrealized -> realizing -> realized -> prefetching -> prefetched
realizing -> realized -> prefetching -> prefetched
realized -> prefetching -> prefetched
prefetching -> prefetched
prefetched
started -> throws IllegalStateException
closed -> throws IllegalStateException
|
void |
realize()
Initiates the following asynchronous
state transitions:
unrealized -> realizing -> realized
realizing -> realized
realized
started -> throws IllegalStateException
closed -> throws IllegalStateException
|
void |
removeChangeListener(ChangeListener listener)
Removes a listener.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a previously registered listener.
|
void |
removeStateListener(StateListener l)
Removes a listener.
|
void |
run()
Most of the real work goes here.
|
void |
setTargetState(int state)
Sets the desired target state.
|
void |
start()
Initiates the following asynchronous
state transitions:
unrealized -> realizing -> realized -> prefetching -> prefetched -> started
realizing -> realized -> prefetching -> prefetched -> started
realized -> prefetching -> prefetched -> started
prefetching -> prefetched -> started
prefetched -> started
started
closed -> throws IllegalStateException
|
void |
stop()
Initiates the following asynchronous
state transitions:
started -> prefetched
unrealized
realizing
prefetching
prefetched
closed -> throws IllegalStateException
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCachingModel, getControlPanelComponent, getTimeModel, getTotalDuration, getVisualComponent, isAudioAvailable, isAudioEnabled, isCached, setAudioEnabledprotected EventListenerList listenerList
protected PropertyChangeSupport propertyChangeSupport
protected SequentialDispatcher dispatcher
public int getState()
getState in interface PlayergetState in interface StateModelpublic int getTargetState()
getTargetState in interface Playerpublic void setTargetState(int state)
setTargetState in interface Playerpublic void realize()
public void prefetch()
public void deallocate()
deallocate in interface Playerpublic void start()
public void stop()
public void close()
public void addStateListener(StateListener l)
addStateListener in interface PlayeraddStateListener in interface StateModelpublic void removeStateListener(StateListener l)
removeStateListener in interface PlayerremoveStateListener in interface StateModelpublic void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener in interface Playerpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener in interface Playerprotected void fireStateChanged(int newState)
protected void fireStateChanged()
public void run()
protected abstract void doClosed()
protected abstract void doUnrealized()
protected abstract void doRealizing()
protected abstract void doRealized()
protected abstract void doPrefetching()
protected abstract void doPrefetched()
protected abstract void doStarted()
public void addChangeListener(ChangeListener listener)
addChangeListener in interface Playerpublic void removeChangeListener(ChangeListener listener)
removeChangeListener in interface PlayerCopyright © 2014. All Rights Reserved.