package vermilion;

/**
 * A change listener that is bound to a machine's parameter. This is just so
 * we can attach a listener with direct access to the actual parameter being
 * used for playback.
 */
public class JParameterListenerSlider implements javax.swing.event.ChangeListener
{
    /**
     * The parameter this listener is bound to.
     */
    private ParameterSlider param = null;

    /**
     * Constructs a new slider listener that is bound to the given parameter.
     */
    public JParameterListenerSlider(ParameterBase p)
    {
        param = (ParameterSlider) p;
    }

    /**
     * Listens for changes on the slider and changes the associated parameter.
     * @param e
     */
    @Override
    public void stateChanged(javax.swing.event.ChangeEvent e)
    {
        param.value = ((javax.swing.JSlider) e.getSource()).getValue();
        SystemRouter.secondarySavingNeeded = true;
    }
}