001/**
002 * 
003 */
004package icy.gui.component.model;
005
006import javax.swing.SpinnerNumberModel;
007
008/**
009 * @author Stephane
010 */
011public class SpecialValueSpinnerModel extends SpinnerNumberModel
012{
013    /**
014     * 
015     */
016    private static final long serialVersionUID = -8088583643848930402L;
017
018    private Number special;
019    private String specialText;
020
021    public SpecialValueSpinnerModel()
022    {
023        this(Integer.valueOf(0), null, null, Integer.valueOf(1), Integer.valueOf(0), null);
024    }
025
026    public SpecialValueSpinnerModel(int special, String specialText)
027    {
028        this(Integer.valueOf(0), null, null, Integer.valueOf(1), Integer.valueOf(special), specialText);
029    }
030
031    public SpecialValueSpinnerModel(double value, double minimum, double maximum, double stepSize, double special,
032            String specialText)
033    {
034        this(new Double(value), new Double(minimum), new Double(maximum), new Double(stepSize), new Double(special),
035                specialText);
036    }
037
038    public SpecialValueSpinnerModel(int value, int minimum, int maximum, int stepSize, int special, String specialText)
039    {
040        this(Integer.valueOf(value), Integer.valueOf(minimum), Integer.valueOf(maximum), Integer.valueOf(stepSize),
041                Integer.valueOf(special), specialText);
042    }
043
044    public SpecialValueSpinnerModel(Number value, Comparable minimum, Comparable maximum, Number stepSize,
045            Number special, String specialText)
046    {
047        super(value, minimum, maximum, stepSize);
048
049        this.special = special;
050        this.specialText = specialText;
051    }
052
053    /**
054     * Returns the special value which is used to display special text.
055     * 
056     * @see #getSpecialText()
057     */
058    public Number getSpecialValue()
059    {
060        return special;
061    }
062
063    /**
064     * Returns the special text which is display when special value is selected.
065     * 
066     * @see #getSpecialValue()
067     */
068    public String getSpecialText()
069    {
070        return specialText;
071    }
072}