com.groovemanager.sampled.waveform
Interface SelectableListener


public interface SelectableListener

A SelectableListener can be added to a Selectable instance to be notified about changes to its Selection or position. There are two different types of changes: Those that are happening in a situation of continuing changes, so that they are likely to be followed by another change soon and those that are happening at the end of such a situation and are likely to be the last change for a while.
A listener should always decide whether it has to be notified about each single change even if it is only a temporary one if it only has to know if a permanent change is made to the Selectable.
For Selection changes there are the two methods selectionChanged and selectionPermanentChanged. The first will be called whenever a change to the selection is made and the second one only when this change seems to be permanent for the next while.
Because it is likely that a Selectable´s position may change very often in some situations, another approach is taken for position changes: When the Selectable comes into a situation, where it is likely that the position will change continuously, positionWillChange() is called, so that the listener can decide, whether it wants to start a separate Thread for continuous observation of the Selectable´s position or not. When this situation is over and no continuous changes are expected any more, positionWontChange() is called. This informs the listener that it can the continuous observation. positionChanged() will only be called when a change seems to be permanent for a while.

Author:
Manu Robledo

Method Summary
 void positionChanged(Selectable s, int pos)
          Notification about a change of the Selectable´s position that is likely to be permanent for a while.
 void positionWillChange(Selectable s)
          Notification that the Selectable is going into a state where continuous change of its position is expected.
 void positionWontChange(Selectable s)
          Notification that the Selectable is leaving a state where continuous change of its position was expected.
 void selectionChanged(Selectable s, Selection sel)
          Notification about a change of the Selectable´s selection that is likely be followed by more changes soon.
 void selectionPermanentChanged(Selectable s, Selection sel)
          Notification about a change of the Selectable´s selection that is likely to be permanent for a while.
 

Method Detail

positionChanged

void positionChanged(Selectable s,
                     int pos)
Notification about a change of the Selectable´s position that is likely to be permanent for a while.

Parameters:
s - The Selectable that sends this notification
pos - The new position

positionWillChange

void positionWillChange(Selectable s)
Notification that the Selectable is going into a state where continuous change of its position is expected.

Parameters:
s - The Selectable that sends this notification

positionWontChange

void positionWontChange(Selectable s)
Notification that the Selectable is leaving a state where continuous change of its position was expected.

Parameters:
s - The Selectable that sends this notification

selectionChanged

void selectionChanged(Selectable s,
                      Selection sel)
Notification about a change of the Selectable´s selection that is likely be followed by more changes soon.

Parameters:
s - The Selectable that sends this notification
sel - The new Selection

selectionPermanentChanged

void selectionPermanentChanged(Selectable s,
                               Selection sel)
Notification about a change of the Selectable´s selection that is likely to be permanent for a while.

Parameters:
s - The Selectable that sends this notification
sel - The new Selection