com.spelunkcomputing.color
Interface PaletteSelectionModel


public interface PaletteSelectionModel

Interface for managing the selection of a palette of colors and a particular color within said palette.


Method Summary
 void addArmedListener(java.beans.PropertyChangeListener listener)
          Adds a listener that will be notified when the armed color index changes.
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Adds a listener that will be notified when the selected palette and/or selected color changes
 int getArmedColorIndex()
          Returns the index of the armed color within the current palette.
 int getSelectedColorIndex()
          Returns the index of the selected color within the selected palette
 ColorPalette getSelectedPalette()
          Returns the selected palette, which may be null.
 void removeArmedListener(java.beans.PropertyChangeListener listener)
          Removes an armed color listener
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Removes a listener
 void setArmed(int index)
          Arms a particular color index within the current palette.
 void setSelected(ColorPalette palette, int index)
          Sets the selected palette and color index within that palette.
 

Method Detail

getSelectedPalette

ColorPalette getSelectedPalette()
Returns the selected palette, which may be null.

Returns:
the selected ColorPalette

getSelectedColorIndex

int getSelectedColorIndex()
Returns the index of the selected color within the selected palette

Returns:
index of the selected color (-1 if no color is selected)

setSelected

void setSelected(ColorPalette palette,
                 int index)
Sets the selected palette and color index within that palette. The palette may be null, in which case the color index is ignored.

Parameters:
palette - the selected palette
index - the index, within the palette, of the selected color

getArmedColorIndex

int getArmedColorIndex()
Returns the index of the armed color within the current palette.

Returns:
the index of the armed color (negative if no color is armed).

setArmed

void setArmed(int index)
Arms a particular color index within the current palette. Arming does not necessarily bear any relation to selection, though it can be used to reflect a predisposition toward selection (for example arm on mouse over, select on press).

Parameters:
index - the index to be armed (negative to signify no color)

addChangeListener

void addChangeListener(javax.swing.event.ChangeListener listener)
Adds a listener that will be notified when the selected palette and/or selected color changes

Parameters:
listener - the listener to be added

removeChangeListener

void removeChangeListener(javax.swing.event.ChangeListener listener)
Removes a listener

Parameters:
listener - the listener to be removed

addArmedListener

void addArmedListener(java.beans.PropertyChangeListener listener)
Adds a listener that will be notified when the armed color index changes. The previous and new armed index values will be reported via the PropertyChangeListener interface. Note that armed index changes are not reported to the ChangeListeners added via addChangeListener. The latter are only informed of selection changes.

Parameters:
listener - the listener to be added

removeArmedListener

void removeArmedListener(java.beans.PropertyChangeListener listener)
Removes an armed color listener

Parameters:
listener - the listener to be removed