MDateSelector

mseries.ui
Class MDateSpinnerModel

java.lang.Object
  extended by mseries.ui.DefaultSpinnerModel
      extended by mseries.ui.MDateSpinnerModel
All Implemented Interfaces:
SpinnerModel

public class MDateSpinnerModel
extends DefaultSpinnerModel

Spinner model to manage a range of dates. This one is a little special in that in allows each part (month, day, year etc) of a date to be spun independantly. In other words the step is variable .The value is always a Date but the step changes usually by the editor according to where the user places the cursor.


Constructor Summary
MDateSpinnerModel()
          Defualt constructor initialised to todays date and default maximum and minimum
MDateSpinnerModel(Date start)
          Constructor with default minimum and maximum values (1/1/1970 and 31/12/2037 respectively)
MDateSpinnerModel(Date start, Comparable max, Comparable min)
          Constructor.
 
Method Summary
 Comparable getMaximum()
          Returns the maximum value
 Comparable getMinimum()
          Returns the minimum value
 Object getNextValue()
          Advance and return the next value in the sequence according to the step value and maximum
 Object getPreviousValue()
          Advance and return the previous value in the sequence according to the step value and minimum
 Object getValue()
          Returns the current value of the field
 void setMaximum(Comparable max)
          Sets the maximum allowed value in the model
 void setMinimum(Comparable min)
          Sets the minimum allowed value in the model
 void setStep(int step)
          Sets the step which is a constant from java.text.DateFormat
 void setValue(Object newValue)
          Sets a new value in the model
 
Methods inherited from class mseries.ui.DefaultSpinnerModel
addChangeListener, notifyListeners, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MDateSpinnerModel

public MDateSpinnerModel(Date start,
                         Comparable max,
                         Comparable min)
Constructor.

Parameters:
start - the initial value
max - the maximum value allowed
min - the minimum value allowed

MDateSpinnerModel

public MDateSpinnerModel(Date start)
Constructor with default minimum and maximum values (1/1/1970 and 31/12/2037 respectively)

Parameters:
start - the initial value

MDateSpinnerModel

public MDateSpinnerModel()
Defualt constructor initialised to todays date and default maximum and minimum

Method Detail

setStep

public void setStep(int step)
Sets the step which is a constant from java.text.DateFormat

Specified by:
setStep in interface SpinnerModel
Overrides:
setStep in class DefaultSpinnerModel
Parameters:
step - the step value

getValue

public Object getValue()
Returns the current value of the field

Specified by:
getValue in interface SpinnerModel
Overrides:
getValue in class DefaultSpinnerModel
Returns:
the current value of the field

setValue

public void setValue(Object newValue)
Sets a new value in the model

Specified by:
setValue in interface SpinnerModel
Overrides:
setValue in class DefaultSpinnerModel
Parameters:
newValue - the new value

setMaximum

public void setMaximum(Comparable max)
Sets the maximum allowed value in the model

Parameters:
max - the maximum value

getMaximum

public Comparable getMaximum()
Returns the maximum value

Returns:
the maximum value

setMinimum

public void setMinimum(Comparable min)
Sets the minimum allowed value in the model

Parameters:
min - the minimum value

getMinimum

public Comparable getMinimum()
Returns the minimum value

Returns:
the minimum value

getNextValue

public Object getNextValue()
Advance and return the next value in the sequence according to the step value and maximum

Specified by:
getNextValue in interface SpinnerModel
Overrides:
getNextValue in class DefaultSpinnerModel
Returns:
the next value

getPreviousValue

public Object getPreviousValue()
Advance and return the previous value in the sequence according to the step value and minimum

Specified by:
getPreviousValue in interface SpinnerModel
Overrides:
getPreviousValue in class DefaultSpinnerModel
Returns:
the previous value

MDateSelector

Copyright © 2001-2007 M Newstead. All Rights Reserved.