2008-07-13 13:59:05 -04:00
|
|
|
|
2008-10-12 11:46:45 -04:00
|
|
|
package net.sourceforge.filebot.ui.panel.episodelist;
|
2008-07-13 13:59:05 -04:00
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.SpinnerNumberModel;
|
|
|
|
|
|
|
|
|
|
|
|
public class SeasonSpinnerModel extends SpinnerNumberModel {
|
|
|
|
|
|
|
|
public static final int ALL_SEASONS = 0;
|
|
|
|
|
|
|
|
|
|
|
|
public SeasonSpinnerModel() {
|
|
|
|
super(ALL_SEASONS, ALL_SEASONS, Integer.MAX_VALUE, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-01 17:27:53 -05:00
|
|
|
public Integer getSeason() {
|
2008-07-13 13:59:05 -04:00
|
|
|
return getNumber().intValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-01 17:27:53 -05:00
|
|
|
public void spin(int steps) {
|
|
|
|
int next = getSeason() + steps;
|
|
|
|
|
|
|
|
if (next < ALL_SEASONS)
|
|
|
|
next = ALL_SEASONS;
|
|
|
|
|
|
|
|
setValue(next);
|
2008-07-13 13:59:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-01 17:27:53 -05:00
|
|
|
public void lock(boolean lock) {
|
|
|
|
if (lock) {
|
|
|
|
setValue(ALL_SEASONS);
|
|
|
|
setMaximum(ALL_SEASONS);
|
|
|
|
} else {
|
|
|
|
setMaximum(Integer.MAX_VALUE);
|
|
|
|
}
|
2008-07-13 13:59:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|